From 424490c892c559e6e7ffabd9a0d28dc8ba040189 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Thu, 21 Nov 2019 01:40:54 -0800 Subject: [PATCH 01/34] PagedFluxCore as an abstraction for generic paging (not tied to protocol e.g. http) --- .../com/azure/core/http/rest/PagedFlux.java | 10 +- .../azure/core/http/rest/PagedFluxBase.java | 79 +++------------- .../core/http/rest/PagedIterableBase.java | 50 +--------- .../com/azure/core/paging/PagedFluxCore.java | 91 +++++++++++++++++++ .../azure/core/paging/PagedIterableCore.java | 75 +++++++++++++++ 5 files changed, 189 insertions(+), 116 deletions(-) create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index d6ceb8b81025..eca6ee187c09 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -37,6 +37,8 @@ * @see Flux */ public class PagedFlux extends PagedFluxBase> { + private final Supplier>> firstPageRetriever; + private final Function>> nextPageRetriever; /** * Creates an instance of {@link PagedFlux} that consists of only a single page of results. The only argument to @@ -49,6 +51,8 @@ public class PagedFlux extends PagedFluxBase> { */ public PagedFlux(Supplier>> firstPageRetriever) { super(firstPageRetriever); + this.firstPageRetriever = firstPageRetriever; + this.nextPageRetriever = continuationToken -> Mono.empty(); } /** @@ -65,6 +69,8 @@ public PagedFlux(Supplier>> firstPageRetriever) { public PagedFlux(Supplier>> firstPageRetriever, Function>> nextPageRetriever) { super(firstPageRetriever, nextPageRetriever); + this.firstPageRetriever = firstPageRetriever; + this.nextPageRetriever = nextPageRetriever; } /** @@ -75,9 +81,9 @@ public PagedFlux(Supplier>> firstPageRetriever, * @return A PagedFlux of type S. */ public PagedFlux mapPage(Function mapper) { - return new PagedFlux(() -> getFirstPageRetriever().get() + return new PagedFlux(() -> this.firstPageRetriever.get() .map(mapPagedResponse(mapper)), - continuationToken -> getNextPageRetriever().apply(continuationToken) + continuationToken -> this.nextPageRetriever.apply(continuationToken) .map(mapPagedResponse(mapper))); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index 84d30c776feb..5d926579203e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -3,12 +3,12 @@ package com.azure.core.http.rest; -import org.reactivestreams.Publisher; +import com.azure.core.paging.PagedFluxCore; import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.util.Objects; +import java.util.HashMap; import java.util.function.Function; import java.util.function.Supplier; @@ -38,15 +38,11 @@ * @see Page * @see Flux */ -public class PagedFluxBase> extends Flux { - - private final Supplier> firstPageRetriever; - - private final Function> nextPageRetriever; - +public class PagedFluxBase> extends PagedFluxCore { /** - * Creates an instance of {@link PagedFluxBase} that consists of only a single page of results. The only - * argument to this constructor therefore is a supplier that fetches the first (and known-only) page from {@code P}. + * Creates an instance of {@link PagedFluxBase} that consists of only a single page of results. + * The only argument to this constructor therefore is a supplier that fetches the first + * (and known-only) page from {@code P}. * *

Code sample

* {@codesnippet com.azure.core.http.rest.pagedfluxbase.singlepage.instantiation} @@ -70,18 +66,10 @@ public PagedFluxBase(Supplier> firstPageRetriever) { */ public PagedFluxBase(Supplier> firstPageRetriever, Function> nextPageRetriever) { - Objects.requireNonNull(firstPageRetriever, "'firstPageRetriever' cannot be null."); - Objects.requireNonNull(nextPageRetriever, "'nextPageRetriever' function cannot be null."); - this.firstPageRetriever = firstPageRetriever; - this.nextPageRetriever = nextPageRetriever; - } - - Supplier> getFirstPageRetriever() { - return firstPageRetriever; - } - - Function> getNextPageRetriever() { - return nextPageRetriever; + super(new HashMap<>(), + (state, continuationToken) -> continuationToken == null + ? firstPageRetriever.get().flux() + : nextPageRetriever.apply(continuationToken).flux()); } /** @@ -93,7 +81,7 @@ Function> getNextPageRetriever() { * @return A {@link PagedFluxBase} starting from the first page */ public Flux

byPage() { - return firstPageRetriever.get().flatMapMany(this::extractAndFetchPage); + return super.byPage(); } /** @@ -107,7 +95,7 @@ public Flux

byPage() { * @return A {@link PagedFluxBase} starting from the page associated with the continuation token */ public Flux

byPage(String continuationToken) { - return nextPageRetriever.apply(continuationToken).flatMapMany(this::extractAndFetchPage); + return super.byPage(continuationToken); } /** @@ -122,47 +110,6 @@ public Flux

byPage(String continuationToken) { */ @Override public void subscribe(CoreSubscriber coreSubscriber) { - byT(null).subscribe(coreSubscriber); - } - - /** - * Helper method to return the flux of items starting from the page associated with the {@code continuationToken} - * - * @param continuationToken The continuation token that is used to fetch the next page - * @return A {@link Flux} of items in this page - */ - private Flux byT(String continuationToken) { - if (continuationToken == null) { - return firstPageRetriever.get().flatMapMany(this::extractAndFetchT); - } - return nextPageRetriever.apply(continuationToken).flatMapMany(this::extractAndFetchT); - } - - /** - * Helper method to string together a flux of items transparently extracting items from - * next pages, if available. - * @param page Starting page - * @return A {@link Flux} of items - */ - private Publisher extractAndFetchT(PagedResponse page) { - String nextPageLink = page.getContinuationToken(); - if (nextPageLink == null) { - return Flux.fromIterable(page.getItems()); - } - return Flux.fromIterable(page.getItems()).concatWith(byT(nextPageLink)); - } - - /** - * Helper method to string together a flux of {@link PagedResponse} transparently - * fetching next pages, if available - * @param page Starting page - * @return A {@link Flux} of {@link PagedResponse} - */ - private Publisher extractAndFetchPage(P page) { - String nextPageLink = page.getContinuationToken(); - if (nextPageLink == null) { - return Flux.just(page); - } - return Flux.just(page).concatWith(byPage(page.getContinuationToken())); + super.subscribe(coreSubscriber); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java index c9eaaeba30f5..8b9a08f7c01a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java @@ -3,6 +3,7 @@ package com.azure.core.http.rest; +import com.azure.core.paging.PagedIterableCore; import com.azure.core.util.IterableStream; import java.util.stream.Stream; @@ -27,59 +28,12 @@ * @see PagedResponse * @see IterableStream */ -public class PagedIterableBase> extends IterableStream { - private final PagedFluxBase pagedFluxBase; - +public class PagedIterableBase> extends PagedIterableCore { /** * Creates instance given {@link PagedFluxBase}. * @param pagedFluxBase to use as iterable */ public PagedIterableBase(PagedFluxBase pagedFluxBase) { super(pagedFluxBase); - this.pagedFluxBase = pagedFluxBase; - } - - /** - * Retrieve the {@link Stream}, one page at a time. - * It will provide same {@link Stream} of T values from starting if called multiple times. - * - * @return {@link Stream} of a Response that extends {@link PagedResponse} - */ - public Stream

streamByPage() { - return pagedFluxBase.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 a Response that extends {@link PagedResponse}, starting from the page associated - * with the continuation token - */ - public Stream

streamByPage(String continuationToken) { - return pagedFluxBase.byPage(continuationToken).toStream(); - } - - /** - * Provides {@link Iterable} API for{ @link PagedResponse} - * It will provide same collection of {@code T} values from starting if called multiple times. - * - * @return {@link Iterable} interface - */ - public Iterable

iterableByPage() { - return pagedFluxBase.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 pagedFluxBase.byPage(continuationToken).toIterable(); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java new file mode 100644 index 000000000000..9550807e6a06 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.paging; + +import com.azure.core.http.rest.Page; +import com.azure.core.http.rest.PagedFluxBase; +import reactor.core.CoreSubscriber; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.BiFunction; + +/** + * This class is a Flux that can operate on any type that extends {@link Page} and + * also provides the ability to operate on individual items. + * + * @param The type of items in a {@link Page} + * @param

The {@link Page} holding items of type {@code T}. + * + * @see Page + * @see Flux + */ +public class PagedFluxCore> extends Flux { + private final BiFunction, String, Flux

> pageRetriever; + private final Map initialState; + + /** + * Creates an instance of {@link PagedFluxCore}. + * + * @param state the initial state, a copy of this state will be created per subscription, + * it will be shared across multiple {@code pageRetriever} calls during the + * life time of the subscription. + * @param pageRetriever Function that returns Flux of pages. The pageRetriever can get + * called multiple times. The continuation-token from the last Page + * emitted by the pageRetriever returned Flux will be provided to + * the next pageRetriever invocation. If the last Page emitted by + * the pageRetriever returned Flux has null continuation-token then + * final completion signal will be send to the downstream subscriber. + */ + public PagedFluxCore(Map state, + BiFunction, String, Flux

> pageRetriever) { + Objects.requireNonNull(state, "'state' cannot be null."); + this.initialState = new HashMap<>(state); + this.pageRetriever = Objects.requireNonNull(pageRetriever, + "'pageRetriever' function cannot be null."); + } + + /** + * Creates a flux of {@link Page} starting from the first page. + * + * @return A flux of {@link Page} starting from the first page + */ + public Flux

byPage() { + return byPage(null); + } + + /** + * Creates a flux of {@link Page} starting from the next page associated with the given + * continuation token. To start from first page, use {@link #byPage()} instead. + * + * @param continuationToken The continuation token used to fetch the next page + * @return A flux of {@link Page} starting from the page associated with the continuation token + */ + public Flux

byPage(String continuationToken) { + final String [] lastPageContinuationToken = { continuationToken }; + final Map state = new HashMap<>(this.initialState); + return Mono.just(true) + .repeat() + .concatMap(b -> pageRetriever.apply(state, lastPageContinuationToken[0]) + .doOnNext(page -> lastPageContinuationToken[0] = page.getContinuationToken())) + .takeUntil(page -> page.getContinuationToken() == null); + } + + /** + * Subscribe to consume all items of type {@code T} in the sequence respectively. + * This is recommended for most common scenarios. This will seamlessly fetch next + * page when required and provide with a {@link Flux} of items. + * + * @param coreSubscriber The subscriber for this {@link PagedFluxBase} + */ + @Override + public void subscribe(CoreSubscriber coreSubscriber) { + byPage(null) + .flatMap(page -> Flux.fromIterable(page.getItems())) + .subscribe(coreSubscriber); + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java new file mode 100644 index 000000000000..e92278e00844 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.paging; + +import com.azure.core.http.rest.Page; +import com.azure.core.util.IterableStream; + +import java.util.stream.Stream; + +/** + * This class provides utility to iterate over pages that extend {@link Page} using {@link Stream} and + * {@link Iterable} interfaces. + * + * @param The type of value contained in this {@link IterableStream}. + * @param

The page extending from {@link Page} + * @see Page + * @see IterableStream + */ +public class PagedIterableCore> extends IterableStream { + private final PagedFluxCore pagedFluxCore; + + /** + * Creates instance given {@link PagedIterableCore}. + * @param pagedFlux to use as iterable + */ + public PagedIterableCore(PagedFluxCore pagedFlux) { + super(pagedFlux); + this.pagedFluxCore = pagedFlux; + } + + /** + * Retrieve the {@link Stream}, one page at a time. + * It will provide same {@link Stream} of T values from starting if called multiple times. + * + * @return {@link Stream} of a page that extends {@link Page} + */ + public Stream

streamByPage() { + return pagedFluxCore.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 a Response that extends {@link Page}, starting from the page associated + * with the continuation token + */ + public Stream

streamByPage(String continuationToken) { + return pagedFluxCore.byPage(continuationToken).toStream(); + } + + /** + * Provides {@link Iterable} API for{ @link PagedResponse} + * It will provide same collection of {@code T} values from starting if called multiple times. + * + * @return {@link Iterable} interface + */ + public Iterable

iterableByPage() { + return pagedFluxCore.byPage().toIterable(); + } + + /** + * Provides {@link Iterable} API for {@link Page}, 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 pagedFluxCore.byPage(continuationToken).toIterable(); + } +} From 35f8814a82f23c5a5ef9d0324320fbe3241219d9 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Thu, 21 Nov 2019 12:42:52 -0800 Subject: [PATCH 02/34] Making PagedFluxCore abstract, letting user to define state type --- .../azure/core/http/rest/PagedFluxBase.java | 13 ++++++--- .../core/http/rest/PagedIterableBase.java | 2 +- .../com/azure/core/paging/PagedFluxCore.java | 28 +++++++++---------- .../azure/core/paging/PagedIterableCore.java | 7 +++-- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index 5d926579203e..59ea7b558ef3 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -8,7 +8,6 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.util.HashMap; import java.util.function.Function; import java.util.function.Supplier; @@ -38,7 +37,7 @@ * @see Page * @see Flux */ -public class PagedFluxBase> extends PagedFluxCore { +public class PagedFluxBase> extends PagedFluxCore { /** * Creates an instance of {@link PagedFluxBase} that consists of only a single page of results. * The only argument to this constructor therefore is a supplier that fetches the first @@ -66,8 +65,7 @@ public PagedFluxBase(Supplier> firstPageRetriever) { */ public PagedFluxBase(Supplier> firstPageRetriever, Function> nextPageRetriever) { - super(new HashMap<>(), - (state, continuationToken) -> continuationToken == null + super((state, continuationToken) -> continuationToken == null ? firstPageRetriever.get().flux() : nextPageRetriever.apply(continuationToken).flux()); } @@ -112,4 +110,11 @@ public Flux

byPage(String continuationToken) { public void subscribe(CoreSubscriber coreSubscriber) { super.subscribe(coreSubscriber); } + + @Override + protected Void getState() { + // PagedFluxBase has no state to be pass around across + // multiple invocations of page retrieval calls + return null; + } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java index 8b9a08f7c01a..934a2f9a2ade 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java @@ -28,7 +28,7 @@ * @see PagedResponse * @see IterableStream */ -public class PagedIterableBase> extends PagedIterableCore { +public class PagedIterableBase> extends PagedIterableCore { /** * Creates instance given {@link PagedFluxBase}. * @param pagedFluxBase to use as iterable diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java index 9550807e6a06..57e615e2c544 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java @@ -9,8 +9,6 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.util.HashMap; -import java.util.Map; import java.util.Objects; import java.util.function.BiFunction; @@ -18,22 +16,19 @@ * This class is a Flux that can operate on any type that extends {@link Page} and * also provides the ability to operate on individual items. * + * @param The type of state * @param The type of items in a {@link Page} * @param

The {@link Page} holding items of type {@code T}. * * @see Page * @see Flux */ -public class PagedFluxCore> extends Flux { - private final BiFunction, String, Flux

> pageRetriever; - private final Map initialState; +public abstract class PagedFluxCore> extends Flux { + private final BiFunction> pageRetriever; /** * Creates an instance of {@link PagedFluxCore}. * - * @param state the initial state, a copy of this state will be created per subscription, - * it will be shared across multiple {@code pageRetriever} calls during the - * life time of the subscription. * @param pageRetriever Function that returns Flux of pages. The pageRetriever can get * called multiple times. The continuation-token from the last Page * emitted by the pageRetriever returned Flux will be provided to @@ -41,10 +36,7 @@ public class PagedFluxCore> extends Flux { * the pageRetriever returned Flux has null continuation-token then * final completion signal will be send to the downstream subscriber. */ - public PagedFluxCore(Map state, - BiFunction, String, Flux

> pageRetriever) { - Objects.requireNonNull(state, "'state' cannot be null."); - this.initialState = new HashMap<>(state); + public PagedFluxCore(BiFunction> pageRetriever) { this.pageRetriever = Objects.requireNonNull(pageRetriever, "'pageRetriever' function cannot be null."); } @@ -67,10 +59,9 @@ public Flux

byPage() { */ public Flux

byPage(String continuationToken) { final String [] lastPageContinuationToken = { continuationToken }; - final Map state = new HashMap<>(this.initialState); return Mono.just(true) .repeat() - .concatMap(b -> pageRetriever.apply(state, lastPageContinuationToken[0]) + .concatMap(b -> pageRetriever.apply(getState(), lastPageContinuationToken[0]) .doOnNext(page -> lastPageContinuationToken[0] = page.getContinuationToken())) .takeUntil(page -> page.getContinuationToken() == null); } @@ -88,4 +79,13 @@ public void subscribe(CoreSubscriber coreSubscriber) { .flatMap(page -> Flux.fromIterable(page.getItems())) .subscribe(coreSubscriber); } + + /** + * Get a state for a subscription to this flux. For each subscription, this method will + * be called for the state instance to be associated with it, such a state instance will + * be shared across multiple pageRetriever calls during the life time of that subscription. + * + * @return get state object + */ + protected abstract S getState(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java index e92278e00844..0e5df1840643 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java @@ -12,19 +12,20 @@ * This class provides utility to iterate over pages that extend {@link Page} using {@link Stream} and * {@link Iterable} interfaces. * + * @param The type of state. * @param The type of value contained in this {@link IterableStream}. * @param

The page extending from {@link Page} * @see Page * @see IterableStream */ -public class PagedIterableCore> extends IterableStream { - private final PagedFluxCore pagedFluxCore; +public class PagedIterableCore> extends IterableStream { + private final PagedFluxCore pagedFluxCore; /** * Creates instance given {@link PagedIterableCore}. * @param pagedFlux to use as iterable */ - public PagedIterableCore(PagedFluxCore pagedFlux) { + public PagedIterableCore(PagedFluxCore pagedFlux) { super(pagedFlux); this.pagedFluxCore = pagedFlux; } From 1eb73811627c5ca4ac663df174fc83c8917b802f Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sun, 24 Nov 2019 01:50:44 -0800 Subject: [PATCH 03/34] Making the Paged Flux type more flexiable --- .../java/com/azure/core/http/rest/Page.java | 12 +- .../azure/core/http/rest/PagedFluxBase.java | 13 +- .../core/http/rest/PagedIterableBase.java | 50 ++++++- .../azure/core/paging/ContinuablePage.java | 17 +++ .../core/paging/ContinuablePagedFlux.java | 119 +++++++++++++++ .../azure/core/paging/ContinuationState.java | 28 ++++ .../azure/core/paging/ContinuationToken.java | 13 ++ .../java/com/azure/core/paging/PageCore.java | 18 +++ .../com/azure/core/paging/PagedFluxCore.java | 138 ++++++++++++------ .../azure/core/paging/PagedIterableCore.java | 76 ---------- .../azure/core/paging/SimplePagedFlux.java | 67 +++++++++ 11 files changed, 409 insertions(+), 142 deletions(-) create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationToken.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java index 27533bf2217f..db69bc400c43 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java @@ -3,22 +3,14 @@ package com.azure.core.http.rest; -import java.util.List; +import com.azure.core.paging.PageCore; /** * Represents a paginated REST response from the service. * * @param Type of the listed objects in that response. */ -public interface Page { - - /** - * Gets a list of items returned from the service. - * - * @return A list of items from the service. - */ - List getItems(); - +public interface Page extends PageCore { /** * Gets a link to the next page, or {@code null} if there are no more results. * diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index 59ea7b558ef3..5adcff8d0534 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -3,7 +3,7 @@ package com.azure.core.http.rest; -import com.azure.core.paging.PagedFluxCore; +import com.azure.core.paging.SimplePagedFlux; import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -37,7 +37,7 @@ * @see Page * @see Flux */ -public class PagedFluxBase> extends PagedFluxCore { +public class PagedFluxBase> extends SimplePagedFlux { /** * Creates an instance of {@link PagedFluxBase} that consists of only a single page of results. * The only argument to this constructor therefore is a supplier that fetches the first @@ -65,7 +65,7 @@ public PagedFluxBase(Supplier> firstPageRetriever) { */ public PagedFluxBase(Supplier> firstPageRetriever, Function> nextPageRetriever) { - super((state, continuationToken) -> continuationToken == null + super((continuationToken) -> continuationToken == null ? firstPageRetriever.get().flux() : nextPageRetriever.apply(continuationToken).flux()); } @@ -110,11 +110,4 @@ public Flux

byPage(String continuationToken) { public void subscribe(CoreSubscriber coreSubscriber) { super.subscribe(coreSubscriber); } - - @Override - protected Void getState() { - // PagedFluxBase has no state to be pass around across - // multiple invocations of page retrieval calls - return null; - } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java index 934a2f9a2ade..c9eaaeba30f5 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterableBase.java @@ -3,7 +3,6 @@ package com.azure.core.http.rest; -import com.azure.core.paging.PagedIterableCore; import com.azure.core.util.IterableStream; import java.util.stream.Stream; @@ -28,12 +27,59 @@ * @see PagedResponse * @see IterableStream */ -public class PagedIterableBase> extends PagedIterableCore { +public class PagedIterableBase> extends IterableStream { + private final PagedFluxBase pagedFluxBase; + /** * Creates instance given {@link PagedFluxBase}. * @param pagedFluxBase to use as iterable */ public PagedIterableBase(PagedFluxBase pagedFluxBase) { super(pagedFluxBase); + this.pagedFluxBase = pagedFluxBase; + } + + /** + * Retrieve the {@link Stream}, one page at a time. + * It will provide same {@link Stream} of T values from starting if called multiple times. + * + * @return {@link Stream} of a Response that extends {@link PagedResponse} + */ + public Stream

streamByPage() { + return pagedFluxBase.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 a Response that extends {@link PagedResponse}, starting from the page associated + * with the continuation token + */ + public Stream

streamByPage(String continuationToken) { + return pagedFluxBase.byPage(continuationToken).toStream(); + } + + /** + * Provides {@link Iterable} API for{ @link PagedResponse} + * It will provide same collection of {@code T} values from starting if called multiple times. + * + * @return {@link Iterable} interface + */ + public Iterable

iterableByPage() { + return pagedFluxBase.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 pagedFluxBase.byPage(continuationToken).toIterable(); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java new file mode 100644 index 000000000000..47ed505e254f --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.paging; + +/** + * Type represents a Page from the service and expose continuation token. + * + * @param Type of continuation token + * @param Type of items in the page + */ +public interface ContinuablePage extends PageCore { + /** + * @return the continuation token to retrieve one or more next pages. + */ + C getContinuationToken(); +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java new file mode 100644 index 000000000000..14540cfc5660 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.paging; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * This class is a Flux that can operate on a type that extends {@link ContinuablePage} and also + * provides the ability to operate on individual items. This type support user providing continuation + * token and retrieve pages using such token. + * + * The constructor of this type takes a provider method, that when called should provides Page Retriever + * Function which accepts continuation token. The provider is called for each Subscription to the + * ContinuablePagedFlux instance. The Page Retriever Function can get called multiple times in serial + * fashion, first time with {@code null} as continuation token and then each time with the non-null + * continuation token of the {@link ContinuablePage} emitted from the Flux returned by the last Page + * Retriever invocation. Completion signal will be send to the subscriber when the last {@link ContinuablePage} + * emitted from the Flux has {@code null} continuation token. + * + * Note that similar to PagedFluxCore, if needed the provider implementation can create state and associate + * it with Page Retriever Function instance, most of the cases such state is not needed as continuation + * token is sufficient to identify next set of pages. + * + * Example: + * ---------------------------------------------------------------------------------- + * // FilesPage is list of files. This type has concept of continuation token that can be exposed + * // to the user, hence extends from ContinuablePage and exposes getContinuationToken method. + * + * // The continuation token type FilesContinuationToken is used to retrieve one or more FilesPage. + * // + * public class FilesPage implements ContinuablePage { + * @Override + * public List getItems() {..} + * + * @Override + * public FilesContinuationToken getContinuationToken() {..} + * } + * + * // The user facing Continuation Token type to retrieve Flux of FilesPage. + * // + * public class FilesContinuationToken implements ContinuationToken { + * public int getNextLinkId(); + * } + * + * // The provider impl that when called provides Page Retrieval Function that returns Flux of FilesPage. + * // Provider method is called for each Subscription to ContinuablePagedFlux. + * // + * private final Supplier>> pageRetrieverProvider + * = new Supplier>>() { + * @Override + * public Function> get() { + * // optional: create any state if needed + * return new Function>() { + * @Override + * public Flux

apply(FilesContinuationToken token) { + * // optional: use any state if needed + * return shareClient.getFilePages(token); + * } + * }; + * } + * }; + * ---------------------------------------------------------------------------------- + * + * @param The continuation token type + * @param The type of items in a {@link ContinuablePage} + * @param

The {@link ContinuablePage} holding items of type {@code T}. + * + * @see ContinuablePage + * @see PageCore + * @see Flux + */ +public abstract class ContinuablePagedFlux> + extends PagedFluxCore { + + private final Supplier>> pageRetrieverProvider; + + /** + * Creates an instance of {@link ContinuablePagedFlux}. + * + * @param pageRetrieverProvider a provider that returns Page Retriever Function. + */ + public ContinuablePagedFlux(Supplier>> pageRetrieverProvider) { + super(new Supplier<>() { + final ContinuationState state = new ContinuationState<>(null); + final Function> pageRetriever = pageRetrieverProvider.get(); + @Override + public Supplier> get() { + return () -> { + if (state.isDone()) { + // PagedFluxCore contract to send completion signal to subscriber. + return null; + } else { + return pageRetriever.apply(state.getLastContinuationToken()) + .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken())); + } + }; + } + }); + this.pageRetrieverProvider = pageRetrieverProvider; + } + + /** + * @return a flux of {@link ContinuablePage} starting from the Page identified + * by the given token. + */ + public Flux

byPage(C continuationToken) { + final ContinuationState state = new ContinuationState<>(continuationToken); + final Function> pageRetriever = this.pageRetrieverProvider.get(); + return Mono.just(true) + .repeat(() -> !state.isDone()) + .concatMap(b -> pageRetriever.apply(state.getLastContinuationToken()) + .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken()))); + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java new file mode 100644 index 000000000000..f261c080a328 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java @@ -0,0 +1,28 @@ +package com.azure.core.paging; + +/** + * Internal type to store continuation state. + * + * @param the Continuation Token type + */ +class ContinuationState { + private C lastContinuationToken; + private boolean isDone; + + ContinuationState(C token) { + this.lastContinuationToken = token; + } + + void setLastContinuationToken(C token) { + this.isDone = token == null ? true : false; + this.lastContinuationToken = token; + } + + C getLastContinuationToken() { + return this.lastContinuationToken; + } + + boolean isDone() { + return this.isDone; + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationToken.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationToken.java new file mode 100644 index 000000000000..965a7d165af5 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationToken.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.paging; + +/** + * Type to reference next set of one or more Pages. + * + * @see ContinuablePage + * @see ContinuablePagedFlux + */ +public interface ContinuationToken { +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java new file mode 100644 index 000000000000..b045dd122ebb --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.paging; + +import java.util.List; + +/** + * Type represents a Page from the service. + * + * @param Type of items in the page + */ +public interface PageCore { + /** + * @return list of items in the page returned by the service. + */ + List getItems(); +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java index 57e615e2c544..95d872bce478 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java @@ -4,66 +4,110 @@ package com.azure.core.paging; import com.azure.core.http.rest.Page; -import com.azure.core.http.rest.PagedFluxBase; import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.util.Objects; -import java.util.function.BiFunction; +import java.util.function.Supplier; /** - * This class is a Flux that can operate on any type that extends {@link Page} and - * also provides the ability to operate on individual items. + * This class is a Flux that can operate on a type that extends {@link PageCore} and also provides + * the ability to operate on individual items. This type does not impose the need of a user facing + * continuation token, hence it does not expose a public method to retrieve pages using such token. * - * @param The type of state - * @param The type of items in a {@link Page} - * @param

The {@link Page} holding items of type {@code T}. + * The constructor of this type takes a provider method, that when called should provides Page Retriever + * Function which accepts no arguments. The provider is called for each Subscription to the PagedFluxCore + * instance. Given provider is called per Subscription, the provider implementation can create one or more + * objects to store any state and Page Retriever Function can capture and use those objects. This indirectly + * associate the state objects to the Subscription. The Page Retriever Function can get called multiple + * times in serial fashion, each time after the completion of the Flux returned by the previous invocation. + * The final completion signal will be send to the downstream subscriber when Page Retriever returns {@code null}. * - * @see Page + * Example: + * ---------------------------------------------------------------------------------- + * // BlobsPage is list of blobs. This type does not have the concept of continuation token that can be + * // exposed to the user, hence extends from PageCore. The Page Retrieval Function uses internal state + * // to prepare/retrieve Flux of BlobsPage. + * // + * public class BlobsPage implements PageCore { + * @Override + * List getItems() {..} + * } + * + * // The provider impl that when called provides Page Retrieval Function that returns Flux of BlobsPage. + * // Provider method is called for each Subscription to PagedFluxCore, For each call it create a state and + * // associate it with instance of Page Retrieval Function. + * // + * Supplier>> pageRetrieverProvider = new Supplier>>() { + * @Override + * public Supplier> get() { + * // create state for each call to Provider. + * State state = new State(); + * + * // Provide the Page Retrieval Function. + * return new Supplier> get() { + * // 'state' object is captured here. + * if (state.hasMorePage) { + * // Pass current state to service method that make API call. + * // state contains necessary data that service method needed + * // to prepare next set of pages. Before returning, the service + * // method updates the state for the next call. + * // + * Flux pages = containerClient.getBlobsPages(state); + * return pages; + * } else { + * // Null indicates no more Pages, upon receiving this, PagedFluxCore + * // send completion signal to the subscriber. + * // + * return null; + * } + * } + * } + * }; + * }; + * + * class State { + * public int foo; + * public String bar; + * public boolean hasMorePage; + * } + * ---------------------------------------------------------------------------------- + * + * @param The type of items in a {@link PageCore} + * @param

The {@link PageCore} holding items of type {@code T}. + * + * @see PageCore * @see Flux */ -public abstract class PagedFluxCore> extends Flux { - private final BiFunction> pageRetriever; +public abstract class PagedFluxCore> extends Flux { + + private final Supplier>> pageRetrieverProvider; /** * Creates an instance of {@link PagedFluxCore}. * - * @param pageRetriever Function that returns Flux of pages. The pageRetriever can get - * called multiple times. The continuation-token from the last Page - * emitted by the pageRetriever returned Flux will be provided to - * the next pageRetriever invocation. If the last Page emitted by - * the pageRetriever returned Flux has null continuation-token then - * final completion signal will be send to the downstream subscriber. + * @param pageRetrieverProvider a provider that returns Page Retriever Function. */ - public PagedFluxCore(BiFunction> pageRetriever) { - this.pageRetriever = Objects.requireNonNull(pageRetriever, + public PagedFluxCore(Supplier>> pageRetrieverProvider) { + this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, "'pageRetriever' function cannot be null."); } /** - * Creates a flux of {@link Page} starting from the first page. - * - * @return A flux of {@link Page} starting from the first page + * @return a flux of {@link Page} starting from the first page */ public Flux

byPage() { - return byPage(null); - } - - /** - * Creates a flux of {@link Page} starting from the next page associated with the given - * continuation token. To start from first page, use {@link #byPage()} instead. - * - * @param continuationToken The continuation token used to fetch the next page - * @return A flux of {@link Page} starting from the page associated with the continuation token - */ - public Flux

byPage(String continuationToken) { - final String [] lastPageContinuationToken = { continuationToken }; + FluxHolder

holder = new FluxHolder<>(); + Supplier> pageRetriever = this.pageRetrieverProvider.get(); return Mono.just(true) .repeat() - .concatMap(b -> pageRetriever.apply(getState(), lastPageContinuationToken[0]) - .doOnNext(page -> lastPageContinuationToken[0] = page.getContinuationToken())) - .takeUntil(page -> page.getContinuationToken() == null); + .map(b -> { + holder.setFlux(pageRetriever.get()); + return b; + }) + .takeWhile(b -> holder.getFlux() != null) + .concatMap(b -> holder.getFlux()); } /** @@ -71,21 +115,27 @@ public Flux

byPage(String continuationToken) { * This is recommended for most common scenarios. This will seamlessly fetch next * page when required and provide with a {@link Flux} of items. * - * @param coreSubscriber The subscriber for this {@link PagedFluxBase} + * @param coreSubscriber The subscriber for this {@link PagedFluxCore} */ @Override public void subscribe(CoreSubscriber coreSubscriber) { - byPage(null) + byPage() .flatMap(page -> Flux.fromIterable(page.getItems())) .subscribe(coreSubscriber); } /** - * Get a state for a subscription to this flux. For each subscription, this method will - * be called for the state instance to be associated with it, such a state instance will - * be shared across multiple pageRetriever calls during the life time of that subscription. - * - * @return get state object + *Type to hold Flux

. */ - protected abstract S getState(); + private static class FluxHolder

{ + private Flux

value; + + Flux

getFlux() { + return this.value; + } + + void setFlux(Flux

value) { + this.value = value; + } + } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java deleted file mode 100644 index 0e5df1840643..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedIterableCore.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.paging; - -import com.azure.core.http.rest.Page; -import com.azure.core.util.IterableStream; - -import java.util.stream.Stream; - -/** - * This class provides utility to iterate over pages that extend {@link Page} using {@link Stream} and - * {@link Iterable} interfaces. - * - * @param The type of state. - * @param The type of value contained in this {@link IterableStream}. - * @param

The page extending from {@link Page} - * @see Page - * @see IterableStream - */ -public class PagedIterableCore> extends IterableStream { - private final PagedFluxCore pagedFluxCore; - - /** - * Creates instance given {@link PagedIterableCore}. - * @param pagedFlux to use as iterable - */ - public PagedIterableCore(PagedFluxCore pagedFlux) { - super(pagedFlux); - this.pagedFluxCore = pagedFlux; - } - - /** - * Retrieve the {@link Stream}, one page at a time. - * It will provide same {@link Stream} of T values from starting if called multiple times. - * - * @return {@link Stream} of a page that extends {@link Page} - */ - public Stream

streamByPage() { - return pagedFluxCore.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 a Response that extends {@link Page}, starting from the page associated - * with the continuation token - */ - public Stream

streamByPage(String continuationToken) { - return pagedFluxCore.byPage(continuationToken).toStream(); - } - - /** - * Provides {@link Iterable} API for{ @link PagedResponse} - * It will provide same collection of {@code T} values from starting if called multiple times. - * - * @return {@link Iterable} interface - */ - public Iterable

iterableByPage() { - return pagedFluxCore.byPage().toIterable(); - } - - /** - * Provides {@link Iterable} API for {@link Page}, 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 pagedFluxCore.byPage(continuationToken).toIterable(); - } -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java new file mode 100644 index 000000000000..efb8011a80c2 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.paging; + +import com.azure.core.http.rest.Page; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * This class is a Flux that can operate on a type that extends {@link Page} and also provides + * the ability to operate on individual items. This type support user providing string based + * continuation token (next link) and retrieve pages using it. + * + * The constructor of this type takes a Page Retriever Function which accepts string continuation + * token. The Page Retriever Function can get called multiple times in serial fashion, first time + * with {@code null} as continuation token and then each time with the non-null continuation token + * of the {@link Page} emitted from the Flux returned by the last Page Retriever invocation. + * Completion signal will be send to the subscriber when the last {@link Page} emitted from the Flux + * has {@code null} continuation token. Note that unlike {@link PagedFluxCore} and {@link ContinuablePagedFlux} + * this type does not support capture based state management. + * + * @param Type of items in the page + * @param

The of the page + */ +public abstract class SimplePagedFlux> extends PagedFluxCore { + + private final Function> pageRetriever; + + /** + * Creates an instance of {@link SimplePagedFlux}. + * + * @param pageRetriever the Page Retriever Function. + */ + public SimplePagedFlux(Function> pageRetriever) { + super(new Supplier<>() { + final ContinuationState state = new ContinuationState(null); + @Override + public Supplier> get() { + return () -> { + if (state.isDone()) { + // PagedFluxCore contract to send completion signal to subscriber. + return null; + } else { + return pageRetriever.apply(state.getLastContinuationToken()) + .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken())); + } + }; + } + }); + this.pageRetriever = pageRetriever; + } + + /** + * @return a flux of {@link Page} starting from the Page identified by the given token. + */ + public Flux

byPage(String continuationToken) { + final ContinuationState state = new ContinuationState(continuationToken); + return Mono.just(true) + .repeat(() -> !state.isDone()) + .concatMap(b -> pageRetriever.apply(state.getLastContinuationToken()) + .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken()))); + } +} From d3a5d424e011cafb0cd922a68384c4c271727fba Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Mon, 25 Nov 2019 10:53:52 -0800 Subject: [PATCH 04/34] Adding byItem(token) and some cleanup. --- .../azure/core/paging/ContinuablePage.java | 3 ++- .../core/paging/ContinuablePagedFlux.java | 11 ++++++++++- .../azure/core/paging/ContinuationState.java | 19 +++++++++++++++++++ .../java/com/azure/core/paging/PageCore.java | 4 ++-- .../com/azure/core/paging/PagedFluxCore.java | 10 +++++++++- .../azure/core/paging/SimplePagedFlux.java | 9 +++++++++ 6 files changed, 51 insertions(+), 5 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java index 47ed505e254f..acb8eee3caa0 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java @@ -4,7 +4,8 @@ package com.azure.core.paging; /** - * Type represents a Page from the service and expose continuation token. + * Type represents a Page and continuation token for the next set of + * one or more page. * * @param Type of continuation token * @param Type of items in the page diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java index 14540cfc5660..46c4c0c278a7 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java @@ -105,7 +105,7 @@ public Supplier> get() { } /** - * @return a flux of {@link ContinuablePage} starting from the Page identified + * @return a Flux of {@link ContinuablePage} starting from the Page identified * by the given token. */ public Flux

byPage(C continuationToken) { @@ -116,4 +116,13 @@ public Flux

byPage(C continuationToken) { .concatMap(b -> pageRetriever.apply(state.getLastContinuationToken()) .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken()))); } + + /** + * @return a Flux of Page items starting from the items in the Page identified + * by the given token. + */ + public Flux byItem(C continuationToken) { + return byPage(continuationToken) + .flatMapIterable(page -> page.getItems()); + } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java index f261c080a328..f7dea8316048 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java @@ -6,22 +6,41 @@ * @param the Continuation Token type */ class ContinuationState { + // The last seen continuation token private C lastContinuationToken; + // Indicate whether to call the PageRetrieval Function private boolean isDone; + /** + * Creates ContinuationState. + * + * @param token the token to start with + */ ContinuationState(C token) { this.lastContinuationToken = token; } + /** + * Store the last seen continuation token. + * + * @param token the token + */ void setLastContinuationToken(C token) { this.isDone = token == null ? true : false; this.lastContinuationToken = token; } + /** + * @return the last seen token + */ C getLastContinuationToken() { return this.lastContinuationToken; } + /** + * @return true if the PageRetrieval Function needs to be invoked + * for next set of pages. + */ boolean isDone() { return this.isDone; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java index b045dd122ebb..0d3f2d995190 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java @@ -6,13 +6,13 @@ import java.util.List; /** - * Type represents a Page from the service. + * Type represents a Page. * * @param Type of items in the page */ public interface PageCore { /** - * @return list of items in the page returned by the service. + * @return list of items in the page. */ List getItems(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java index 95d872bce478..d855aa082c37 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java @@ -125,15 +125,23 @@ public void subscribe(CoreSubscriber coreSubscriber) { } /** - *Type to hold Flux

. + *Internal type to hold a reference to Flux

. */ private static class FluxHolder

{ private Flux

value; + /** + * @return the Flux in hold + */ Flux

getFlux() { return this.value; } + /** + * Hold the given Flux. + * + * @param value the Flux + */ void setFlux(Flux

value) { this.value = value; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java index efb8011a80c2..5efc03a1ea18 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java @@ -64,4 +64,13 @@ public Flux

byPage(String continuationToken) { .concatMap(b -> pageRetriever.apply(state.getLastContinuationToken()) .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken()))); } + + /** + * @return a Flux of Page items starting from the items in the Page identified + * by the given token. + */ + public Flux byItem(String continuationToken) { + return byPage(continuationToken) + .flatMapIterable(page -> page.getItems()); + } } From 1dee7f52d9a6a8cb63b5d658b1bbc196518818ae Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Tue, 26 Nov 2019 10:34:03 -0800 Subject: [PATCH 05/34] Code cleanup and adding javadoc code-snippets for PagedFluxCore --- .../java/com/azure/core/http/rest/Page.java | 10 +- .../azure/core/paging/ContinuablePage.java | 18 -- .../core/paging/ContinuablePagedFlux.java | 128 --------- .../azure/core/paging/ContinuationState.java | 3 + .../azure/core/paging/ContinuationToken.java | 13 - .../com/azure/core/paging/PagedFluxCore.java | 55 +--- .../com/azure/core/paging/SimplePage.java | 16 ++ .../azure/core/paging/SimplePagedFlux.java | 33 ++- .../com/azure/core/paging/package-info.java | 7 + .../PagedFluxCoreJavaDocCodeSnippets.java | 246 ++++++++++++++++++ 10 files changed, 295 insertions(+), 234 deletions(-) delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationToken.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePage.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/paging/package-info.java create mode 100644 sdk/core/azure-core/src/samples/java/com/azure/core/paging/PagedFluxCoreJavaDocCodeSnippets.java diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java index db69bc400c43..31a3b77140e6 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java @@ -3,18 +3,12 @@ package com.azure.core.http.rest; -import com.azure.core.paging.PageCore; +import com.azure.core.paging.SimplePage; /** * Represents a paginated REST response from the service. * * @param Type of the listed objects in that response. */ -public interface Page extends PageCore { - /** - * Gets a link to the next page, or {@code null} if there are no more results. - * - * @return A link to the next page, or {@code null} if there are no more results. - */ - String getContinuationToken(); +public interface Page extends SimplePage { } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java deleted file mode 100644 index acb8eee3caa0..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePage.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.paging; - -/** - * Type represents a Page and continuation token for the next set of - * one or more page. - * - * @param Type of continuation token - * @param Type of items in the page - */ -public interface ContinuablePage extends PageCore { - /** - * @return the continuation token to retrieve one or more next pages. - */ - C getContinuationToken(); -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java deleted file mode 100644 index 46c4c0c278a7..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuablePagedFlux.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.paging; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.util.function.Function; -import java.util.function.Supplier; - -/** - * This class is a Flux that can operate on a type that extends {@link ContinuablePage} and also - * provides the ability to operate on individual items. This type support user providing continuation - * token and retrieve pages using such token. - * - * The constructor of this type takes a provider method, that when called should provides Page Retriever - * Function which accepts continuation token. The provider is called for each Subscription to the - * ContinuablePagedFlux instance. The Page Retriever Function can get called multiple times in serial - * fashion, first time with {@code null} as continuation token and then each time with the non-null - * continuation token of the {@link ContinuablePage} emitted from the Flux returned by the last Page - * Retriever invocation. Completion signal will be send to the subscriber when the last {@link ContinuablePage} - * emitted from the Flux has {@code null} continuation token. - * - * Note that similar to PagedFluxCore, if needed the provider implementation can create state and associate - * it with Page Retriever Function instance, most of the cases such state is not needed as continuation - * token is sufficient to identify next set of pages. - * - * Example: - * ---------------------------------------------------------------------------------- - * // FilesPage is list of files. This type has concept of continuation token that can be exposed - * // to the user, hence extends from ContinuablePage and exposes getContinuationToken method. - * - * // The continuation token type FilesContinuationToken is used to retrieve one or more FilesPage. - * // - * public class FilesPage implements ContinuablePage { - * @Override - * public List getItems() {..} - * - * @Override - * public FilesContinuationToken getContinuationToken() {..} - * } - * - * // The user facing Continuation Token type to retrieve Flux of FilesPage. - * // - * public class FilesContinuationToken implements ContinuationToken { - * public int getNextLinkId(); - * } - * - * // The provider impl that when called provides Page Retrieval Function that returns Flux of FilesPage. - * // Provider method is called for each Subscription to ContinuablePagedFlux. - * // - * private final Supplier>> pageRetrieverProvider - * = new Supplier>>() { - * @Override - * public Function> get() { - * // optional: create any state if needed - * return new Function>() { - * @Override - * public Flux

apply(FilesContinuationToken token) { - * // optional: use any state if needed - * return shareClient.getFilePages(token); - * } - * }; - * } - * }; - * ---------------------------------------------------------------------------------- - * - * @param The continuation token type - * @param The type of items in a {@link ContinuablePage} - * @param

The {@link ContinuablePage} holding items of type {@code T}. - * - * @see ContinuablePage - * @see PageCore - * @see Flux - */ -public abstract class ContinuablePagedFlux> - extends PagedFluxCore { - - private final Supplier>> pageRetrieverProvider; - - /** - * Creates an instance of {@link ContinuablePagedFlux}. - * - * @param pageRetrieverProvider a provider that returns Page Retriever Function. - */ - public ContinuablePagedFlux(Supplier>> pageRetrieverProvider) { - super(new Supplier<>() { - final ContinuationState state = new ContinuationState<>(null); - final Function> pageRetriever = pageRetrieverProvider.get(); - @Override - public Supplier> get() { - return () -> { - if (state.isDone()) { - // PagedFluxCore contract to send completion signal to subscriber. - return null; - } else { - return pageRetriever.apply(state.getLastContinuationToken()) - .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken())); - } - }; - } - }); - this.pageRetrieverProvider = pageRetrieverProvider; - } - - /** - * @return a Flux of {@link ContinuablePage} starting from the Page identified - * by the given token. - */ - public Flux

byPage(C continuationToken) { - final ContinuationState state = new ContinuationState<>(continuationToken); - final Function> pageRetriever = this.pageRetrieverProvider.get(); - return Mono.just(true) - .repeat(() -> !state.isDone()) - .concatMap(b -> pageRetriever.apply(state.getLastContinuationToken()) - .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken()))); - } - - /** - * @return a Flux of Page items starting from the items in the Page identified - * by the given token. - */ - public Flux byItem(C continuationToken) { - return byPage(continuationToken) - .flatMapIterable(page -> page.getItems()); - } -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java index f7dea8316048..0c1150f84325 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.core.paging; /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationToken.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationToken.java deleted file mode 100644 index 965a7d165af5..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationToken.java +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.paging; - -/** - * Type to reference next set of one or more Pages. - * - * @see ContinuablePage - * @see ContinuablePagedFlux - */ -public interface ContinuationToken { -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java index d855aa082c37..e1884791269d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java @@ -22,57 +22,14 @@ * objects to store any state and Page Retriever Function can capture and use those objects. This indirectly * associate the state objects to the Subscription. The Page Retriever Function can get called multiple * times in serial fashion, each time after the completion of the Flux returned by the previous invocation. - * The final completion signal will be send to the downstream subscriber when Page Retriever returns {@code null}. + * The final completion signal will be send to the downstream subscriber when Page Retriever returns + * {@code null}. * - * Example: - * ---------------------------------------------------------------------------------- - * // BlobsPage is list of blobs. This type does not have the concept of continuation token that can be - * // exposed to the user, hence extends from PageCore. The Page Retrieval Function uses internal state - * // to prepare/retrieve Flux of BlobsPage. - * // - * public class BlobsPage implements PageCore { - * @Override - * List getItems() {..} - * } + *

Extending PagedFluxCore with Page Retrieval Function Provider

+ * {@codesnippet com.azure.core.paging.pagedfluxcore.provider} * - * // The provider impl that when called provides Page Retrieval Function that returns Flux of BlobsPage. - * // Provider method is called for each Subscription to PagedFluxCore, For each call it create a state and - * // associate it with instance of Page Retrieval Function. - * // - * Supplier>> pageRetrieverProvider = new Supplier>>() { - * @Override - * public Supplier> get() { - * // create state for each call to Provider. - * State state = new State(); - * - * // Provide the Page Retrieval Function. - * return new Supplier> get() { - * // 'state' object is captured here. - * if (state.hasMorePage) { - * // Pass current state to service method that make API call. - * // state contains necessary data that service method needed - * // to prepare next set of pages. Before returning, the service - * // method updates the state for the next call. - * // - * Flux pages = containerClient.getBlobsPages(state); - * return pages; - * } else { - * // Null indicates no more Pages, upon receiving this, PagedFluxCore - * // send completion signal to the subscriber. - * // - * return null; - * } - * } - * } - * }; - * }; - * - * class State { - * public int foo; - * public String bar; - * public boolean hasMorePage; - * } - * ---------------------------------------------------------------------------------- + *

Extending PagedFluxCore for Custom Continuation Token support

+ * {@codesnippet com.azure.core.paging.pagedfluxcore.continuationtoken} * * @param The type of items in a {@link PageCore} * @param

The {@link PageCore} holding items of type {@code T}. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePage.java new file mode 100644 index 000000000000..06a1dfad6957 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePage.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.paging; + +/** + * Represents Page from service that has reference to next set of one or more pages. + * + * @param Type of the items in the page. + */ +public interface SimplePage extends PageCore { + /** + * @return A reference to the next page, or {@code null} if there are no more pages. + */ + String getContinuationToken(); +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java index 5efc03a1ea18..39dd182c6b79 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java @@ -11,7 +11,7 @@ import java.util.function.Supplier; /** - * This class is a Flux that can operate on a type that extends {@link Page} and also provides + * This class is a Flux that can operate on a type that extends {@link SimplePage} and also provides * the ability to operate on individual items. This type support user providing string based * continuation token (next link) and retrieve pages using it. * @@ -19,14 +19,14 @@ * token. The Page Retriever Function can get called multiple times in serial fashion, first time * with {@code null} as continuation token and then each time with the non-null continuation token * of the {@link Page} emitted from the Flux returned by the last Page Retriever invocation. - * Completion signal will be send to the subscriber when the last {@link Page} emitted from the Flux - * has {@code null} continuation token. Note that unlike {@link PagedFluxCore} and {@link ContinuablePagedFlux} - * this type does not support capture based state management. + * Completion signal will be send to the subscriber when the last {@link SimplePage} emitted from + * the Flux has {@code null} continuation token. Note that unlike {@link PagedFluxCore} and + * {@link ContinuablePagedFlux} this type does not support capture based state management. * * @param Type of items in the page * @param

The of the page */ -public abstract class SimplePagedFlux> extends PagedFluxCore { +public abstract class SimplePagedFlux> extends PagedFluxCore { private final Function> pageRetriever; @@ -36,8 +36,8 @@ public abstract class SimplePagedFlux> extends PagedFluxCor * @param pageRetriever the Page Retriever Function. */ public SimplePagedFlux(Function> pageRetriever) { - super(new Supplier<>() { - final ContinuationState state = new ContinuationState(null); + super(new Supplier>>() { + final ContinuationState state = new ContinuationState<>(null); @Override public Supplier> get() { return () -> { @@ -55,22 +55,19 @@ public Supplier> get() { } /** - * @return a flux of {@link Page} starting from the Page identified by the given token. + * Get Flux of {@link SimplePage} starting from the Page identified by the given token. + * + * @param continuationToken the continuation token + * @return a Flux that emits one or pages */ public Flux

byPage(String continuationToken) { - final ContinuationState state = new ContinuationState(continuationToken); + if (continuationToken == null) { + return Flux.empty(); + } + final ContinuationState state = new ContinuationState<>(continuationToken); return Mono.just(true) .repeat(() -> !state.isDone()) .concatMap(b -> pageRetriever.apply(state.getLastContinuationToken()) .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken()))); } - - /** - * @return a Flux of Page items starting from the items in the Page identified - * by the given token. - */ - public Flux byItem(String continuationToken) { - return byPage(continuationToken) - .flatMapIterable(page -> page.getItems()); - } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/package-info.java b/sdk/core/azure-core/src/main/java/com/azure/core/paging/package-info.java new file mode 100644 index 000000000000..580b9bffce6c --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/paging/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing paging abstraction. + */ +package com.azure.core.paging; diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/paging/PagedFluxCoreJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/paging/PagedFluxCoreJavaDocCodeSnippets.java new file mode 100644 index 000000000000..a3c74184588a --- /dev/null +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/paging/PagedFluxCoreJavaDocCodeSnippets.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.paging; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * Code snippets for {@link PagedFluxCore} + */ +public class PagedFluxCoreJavaDocCodeSnippets { + /** + * Code snippets for showing usage of {@link PagedFluxCore} in class docs + */ + public void classDocSnippet() { + // BEGIN: com.azure.core.paging.pagedfluxcore.provider + + /** + * BlobPage that does not have user facing continuation token. + */ + class BlobPage implements PageCore { + @Override + public List getItems() { + // The Blob items in the page + return null; + } + } + + /** + * Service client to make API calls. + */ + class ContainerServiceClient { + /** + * Retrieve next set of pages using the given state. + * + * @param state the current state + * @return the Flux of BlobPage + */ + Flux getBlobsPages(State state) { + return null; + } + } + ContainerServiceClient client = null; // Initialize client + + /** + * A provider, upon invocation returns Page Retrieval Function. + * Provider is called for each Subscription to PagedFluxCore, For each call + * it create a state and associate it with instance of Page Retrieval Function. + */ + Supplier>> pageRetrieverProvider = new Supplier>>() { + @Override + public Supplier> get() { + State state = new State(); + return new Supplier>() { + @Override + public Flux get() { + if (state.hasMorePage()) { + // Pass current state to service method that make API call. + // state contains necessary data that service method needed + // to prepare next set of pages. Before returning, the service + // method updates the state for the next call. + // + Flux pages = client.getBlobsPages(state); + return pages; + } else { + // Null indicates no more Pages, upon receiving this + // the PagedFluxCore send completion signal to the subscriber. + return null; + } + } + }; + } + }; + + /** + * A Paged Flux specialized to for BlobPage. + */ + class BlobPagedFlux extends PagedFluxCore { + /** + * Creates an instance of {@link PagedFluxCore}. + * + * @param pageRetrieverProvider a provider that returns Page Retriever Function. + */ + BlobPagedFlux(Supplier>> pageRetrieverProvider) { + super(pageRetrieverProvider); + } + } + + BlobPagedFlux blobPagedFlux = new BlobPagedFlux(pageRetrieverProvider); + // END: com.azure.core.paging.pagedfluxcore.provider + } + + /** + * Code snippets for extending from {@link PagedFluxCore} and enabling custom continuation token. + */ + public void customContinuationTokenSnippet() { + // BEGIN: com.azure.core.paging.pagedfluxcore.continuationtoken + + abstract class ContinuablePage implements PageCore { + abstract C getContinuationToken(); + } + + class ContinuationState { + private C lastContinuationToken; + private boolean isDone; + + ContinuationState(C token) { + this.lastContinuationToken = token; + } + + void setLastContinuationToken(C token) { + this.isDone = token == null ? true : false; + this.lastContinuationToken = token; + } + + C getLastContinuationToken() { + return this.lastContinuationToken; + } + + boolean isDone() { + return this.isDone; + } + } + + class ContinuablePagedFlux> + extends PagedFluxCore { + + private final Supplier>> pageRetrieverProvider; + + ContinuablePagedFlux(Supplier>> pageRetrieverProvider) { + super(new Supplier>>() { + final ContinuationState state = new ContinuationState<>(null); + final Function> pageRetriever = pageRetrieverProvider.get(); + @Override + public Supplier> get() { + return () -> { + if (state.isDone()) { + // PagedFluxCore contract to send completion signal to subscriber. + return null; + } else { + return pageRetriever + .apply(state.getLastContinuationToken()) + .doOnNext(p -> state + .setLastContinuationToken(p.getContinuationToken())); + } + }; + } + }); + this.pageRetrieverProvider = pageRetrieverProvider; + } + + public Flux

byPage(C continuationToken) { + final ContinuationState state = new ContinuationState<>(continuationToken); + final Function> pageRetriever = this.pageRetrieverProvider.get(); + return Mono.just(true) + .repeat(() -> !state.isDone()) + .concatMap(b -> pageRetriever + .apply(state.getLastContinuationToken()) + .doOnNext(p -> state + .setLastContinuationToken(p.getContinuationToken()))); + } + } + + class FileContinuationToken { + public int getNextLinkId() { + return 0; + } + } + + class FilePage extends ContinuablePage { + @Override + public List getItems() { + return null; + } + + @Override + FileContinuationToken getContinuationToken() { + return null; + } + } + + class FileShareServiceClient { + Flux getFilePages(FileContinuationToken token) { + return null; + } + } + FileShareServiceClient client = null; // Initialize client + + Supplier>> pageRetrieverProvider + = new Supplier>>() { + @Override + public Function> get() { + return new Function>() { + @Override + public Flux apply(FileContinuationToken token) { + return client.getFilePages(token); + } + }; + } + }; + + class FilePagedFlux extends ContinuablePagedFlux { + FilePagedFlux(Supplier>> + pageRetrieverProvider) { + super(pageRetrieverProvider); + } + } + + FilePagedFlux filePagedFlux = new FilePagedFlux(pageRetrieverProvider); + + // END: com.azure.core.paging.pagedfluxcore.continuationtoken + } + + /** + * Implementation not provided. + * + * Type of items in a BlobPage + */ + private static class Blob { + } + + /** + * Implementation not provided. + * + * Type to store state specific to one subscription + */ + private static class State { + Boolean hasMorePage() { + return null; + } + // Other state variables + } + + /** + * Implementation not provided. + * + * Type of items in a FilePage + */ + private static class File { + } +} From 92029bd11a855cdf7ea882accd8beb950f75555e Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Tue, 26 Nov 2019 11:49:57 -0800 Subject: [PATCH 06/34] Moving paging base types to util package, adding exclusions for paging code-snippets --- .../resources/spotbugs/spotbugs-exclude.xml | 10 ++++ .../java/com/azure/core/http/rest/Page.java | 2 +- .../azure/core/http/rest/PagedFluxBase.java | 2 +- .../{ => util}/paging/ContinuationState.java | 2 +- .../core/{ => util}/paging/PageCore.java | 2 +- .../core/{ => util}/paging/PagedFluxCore.java | 6 +- .../core/{ => util}/paging/SimplePage.java | 2 +- .../{ => util}/paging/SimplePagedFlux.java | 6 +- .../core/{ => util}/paging/package-info.java | 2 +- .../PagedFluxCoreJavaDocCodeSnippets.java | 57 ++++++++----------- 10 files changed, 46 insertions(+), 45 deletions(-) rename sdk/core/azure-core/src/main/java/com/azure/core/{ => util}/paging/ContinuationState.java (96%) rename sdk/core/azure-core/src/main/java/com/azure/core/{ => util}/paging/PageCore.java (89%) rename sdk/core/azure-core/src/main/java/com/azure/core/{ => util}/paging/PagedFluxCore.java (95%) rename sdk/core/azure-core/src/main/java/com/azure/core/{ => util}/paging/SimplePage.java (92%) rename sdk/core/azure-core/src/main/java/com/azure/core/{ => util}/paging/SimplePagedFlux.java (95%) rename sdk/core/azure-core/src/main/java/com/azure/core/{ => util}/paging/package-info.java (80%) rename sdk/core/azure-core/src/samples/java/com/azure/core/{ => util}/paging/PagedFluxCoreJavaDocCodeSnippets.java (90%) 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 50174f2d01b2..7be5e43b7e57 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 @@ -702,4 +702,14 @@ + + + + + + + diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java index 31a3b77140e6..1be856e26e4e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java @@ -3,7 +3,7 @@ package com.azure.core.http.rest; -import com.azure.core.paging.SimplePage; +import com.azure.core.util.paging.SimplePage; /** * Represents a paginated REST response from the service. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index 5adcff8d0534..ce88d61d3ab5 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -3,7 +3,7 @@ package com.azure.core.http.rest; -import com.azure.core.paging.SimplePagedFlux; +import com.azure.core.util.paging.SimplePagedFlux; import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java similarity index 96% rename from sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java rename to sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java index 0c1150f84325..9be0b071185a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/ContinuationState.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.paging; +package com.azure.core.util.paging; /** * Internal type to store continuation state. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageCore.java similarity index 89% rename from sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java rename to sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageCore.java index 0d3f2d995190..75d1edb9be7a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PageCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageCore.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.paging; +package com.azure.core.util.paging; import java.util.List; diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PagedFluxCore.java similarity index 95% rename from sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java rename to sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PagedFluxCore.java index e1884791269d..9392c8989331 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/PagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PagedFluxCore.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.paging; +package com.azure.core.util.paging; import com.azure.core.http.rest.Page; import reactor.core.CoreSubscriber; @@ -26,10 +26,10 @@ * {@code null}. * *

Extending PagedFluxCore with Page Retrieval Function Provider

- * {@codesnippet com.azure.core.paging.pagedfluxcore.provider} + * {@codesnippet com.azure.core.util.paging.pagedfluxcore.provider} * *

Extending PagedFluxCore for Custom Continuation Token support

- * {@codesnippet com.azure.core.paging.pagedfluxcore.continuationtoken} + * {@codesnippet com.azure.core.util.paging.pagedfluxcore.continuationtoken} * * @param The type of items in a {@link PageCore} * @param

The {@link PageCore} holding items of type {@code T}. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePage.java similarity index 92% rename from sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePage.java rename to sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePage.java index 06a1dfad6957..c915f98f642d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePage.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.paging; +package com.azure.core.util.paging; /** * Represents Page from service that has reference to next set of one or more pages. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePagedFlux.java similarity index 95% rename from sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java rename to sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePagedFlux.java index 39dd182c6b79..c12127e3887c 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/SimplePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePagedFlux.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.paging; +package com.azure.core.util.paging; import com.azure.core.http.rest.Page; import reactor.core.publisher.Flux; @@ -20,8 +20,8 @@ * with {@code null} as continuation token and then each time with the non-null continuation token * of the {@link Page} emitted from the Flux returned by the last Page Retriever invocation. * Completion signal will be send to the subscriber when the last {@link SimplePage} emitted from - * the Flux has {@code null} continuation token. Note that unlike {@link PagedFluxCore} and - * {@link ContinuablePagedFlux} this type does not support capture based state management. + * the Flux has {@code null} continuation token. Note that unlike {@link PagedFluxCore} this type + * does not support capture based state management. * * @param Type of items in the page * @param

The of the page diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/paging/package-info.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/package-info.java similarity index 80% rename from sdk/core/azure-core/src/main/java/com/azure/core/paging/package-info.java rename to sdk/core/azure-core/src/main/java/com/azure/core/util/paging/package-info.java index 580b9bffce6c..36a2862bb781 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/paging/package-info.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/package-info.java @@ -4,4 +4,4 @@ /** * Package containing paging abstraction. */ -package com.azure.core.paging; +package com.azure.core.util.paging; diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/paging/PagedFluxCoreJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java similarity index 90% rename from sdk/core/azure-core/src/samples/java/com/azure/core/paging/PagedFluxCoreJavaDocCodeSnippets.java rename to sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java index a3c74184588a..a7df4b55691f 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/paging/PagedFluxCoreJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.paging; +package com.azure.core.util.paging; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -18,7 +18,13 @@ public class PagedFluxCoreJavaDocCodeSnippets { * Code snippets for showing usage of {@link PagedFluxCore} in class docs */ public void classDocSnippet() { - // BEGIN: com.azure.core.paging.pagedfluxcore.provider + // BEGIN: com.azure.core.util.paging.pagedfluxcore.provider + + /** + * Blob entry in a BlobPage. + */ + class Blob { + } /** * BlobPage that does not have user facing continuation token. @@ -31,6 +37,16 @@ public List getItems() { } } + /** + * Type to store state specific to one subscription + */ + class State { + boolean hasMorePage() { + return true; + } + // Other state variables + } + /** * Service client to make API calls. */ @@ -92,14 +108,14 @@ class BlobPagedFlux extends PagedFluxCore { } BlobPagedFlux blobPagedFlux = new BlobPagedFlux(pageRetrieverProvider); - // END: com.azure.core.paging.pagedfluxcore.provider + // END: com.azure.core.util.paging.pagedfluxcore.provider } /** * Code snippets for extending from {@link PagedFluxCore} and enabling custom continuation token. */ public void customContinuationTokenSnippet() { - // BEGIN: com.azure.core.paging.pagedfluxcore.continuationtoken + // BEGIN: com.azure.core.util.paging.pagedfluxcore.continuationtoken abstract class ContinuablePage implements PageCore { abstract C getContinuationToken(); @@ -172,6 +188,9 @@ public int getNextLinkId() { } } + class File { + } + class FilePage extends ContinuablePage { @Override public List getItems() { @@ -213,34 +232,6 @@ class FilePagedFlux extends ContinuablePagedFlux Date: Sun, 1 Dec 2019 12:57:25 -0800 Subject: [PATCH 07/34] Making the base Paged Flux completely abstract, exposing prefetch for the default implementation of paged flux --- .../java/com/azure/core/http/rest/Page.java | 4 +- .../azure/core/http/rest/PagedFluxBase.java | 17 +- .../core/util/paging/ContinuablePage.java | 20 +++ .../util/paging/ContinuablePagedFlux.java | 25 +++ .../util/paging/ContinuablePagedFluxCore.java | 156 ++++++++++++++++++ .../com/azure/core/util/paging/PageCore.java | 18 -- .../azure/core/util/paging/PagedFluxCore.java | 106 ------------ .../azure/core/util/paging/SimplePage.java | 16 -- .../core/util/paging/SimplePagedFlux.java | 73 -------- .../PagedFluxCoreJavaDocCodeSnippets.java | 152 +---------------- 10 files changed, 220 insertions(+), 367 deletions(-) create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageCore.java delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PagedFluxCore.java delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePage.java delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePagedFlux.java diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java index 1be856e26e4e..32515d733dca 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java @@ -3,12 +3,12 @@ package com.azure.core.http.rest; -import com.azure.core.util.paging.SimplePage; +import com.azure.core.util.paging.ContinuablePage; /** * Represents a paginated REST response from the service. * * @param Type of the listed objects in that response. */ -public interface Page extends SimplePage { +public interface Page extends ContinuablePage { } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index ce88d61d3ab5..c896ec478232 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -3,7 +3,7 @@ package com.azure.core.http.rest; -import com.azure.core.util.paging.SimplePagedFlux; +import com.azure.core.util.paging.ContinuablePagedFluxCore; import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -37,7 +37,7 @@ * @see Page * @see Flux */ -public class PagedFluxBase> extends SimplePagedFlux { +public class PagedFluxBase> extends ContinuablePagedFluxCore { /** * Creates an instance of {@link PagedFluxBase} that consists of only a single page of results. * The only argument to this constructor therefore is a supplier that fetches the first @@ -65,9 +65,16 @@ public PagedFluxBase(Supplier> firstPageRetriever) { */ public PagedFluxBase(Supplier> firstPageRetriever, Function> nextPageRetriever) { - super((continuationToken) -> continuationToken == null - ? firstPageRetriever.get().flux() - : nextPageRetriever.apply(continuationToken).flux()); + super(new Supplier>>() { + @Override + public Function> get() { + return continuationToken -> { + return continuationToken == null + ? firstPageRetriever.get().flux() + : nextPageRetriever.apply(continuationToken).flux(); + }; + } + }); } /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java new file mode 100644 index 000000000000..efd8ca2ba196 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java @@ -0,0 +1,20 @@ +package com.azure.core.util.paging; + +import java.util.List; + +/** + * Represents Page from service that has reference to next set of one or more pages. + * + * @param Type of the continuation token + * @param Type of the items in the page + */ +public interface ContinuablePage { + /** + * @return list of items in the page. + */ + List getItems(); + /** + * @return A reference to the next page, or {@code null} if there are no more pages. + */ + C getContinuationToken(); +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java new file mode 100644 index 000000000000..94331db5b67f --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.util.paging; + +import reactor.core.publisher.Flux; + +/** + * A contract that represents a Flux which provides the ability to operate on individual items in pages + * of type {@link ContinuablePage}, also also provide ability to operate on individual pages. + * + * @param the type of continuation token + * @param the type of items in the page + * @param

the type of page + */ +public abstract class ContinuablePagedFlux> extends Flux { + /** + * @return a Flux of {@link ContinuablePage} that this Paged Flux represents. + */ + public abstract Flux

byPage(); + /** + * @return a Flux of {@link ContinuablePage} identified by the given continuation token. + */ + public abstract Flux

byPage(C continuationToken); +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java new file mode 100644 index 000000000000..d6c35834aba1 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.util.paging; + +import reactor.core.CoreSubscriber; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.Objects; +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * The default implementation of {@link ContinuablePagedFlux}. + * + * The Flux that provides the ability to operate on individual items in pages of type {@link ContinuablePage}, + * it also provide ability to operate on individual pages. + * + * The constructor of this type takes a provider method, that when called should provides Page Retriever + * Function which accepts continuation token. The provider is called for each Subscription to the + * ContinuablePagedFluxCore instance. Given provider is called per Subscription, the provider implementation + * can create one or more objects to store any state and Page Retriever Function can capture and use those objects. + * This indirectly associate the state objects to the Subscription. The Page Retriever Function can get called + * multiple times in serial fashion, each time after the completion of the Flux returned by the previous invocation. + * The final completion signal will be send to the downstream subscriber when the last Page emitted by the Flux + * returned by Page Continuation Function has {@code null} continuation token. + * + *

Extending PagedFluxCore for Custom Continuation Token support

+ * {@codesnippet com.azure.core.util.paging.pagedfluxcore.continuationtoken} + * + * @param The type of items in a {@link ContinuablePage} + * @param

The {@link ContinuablePage} holding items of type {@code T}. + * + * @see ContinuablePage + * @see Flux + */ +public abstract class ContinuablePagedFluxCore> + extends ContinuablePagedFlux { + + private final Supplier>> pageRetrieverProvider; + private final int defaultPrefetch; + + /** + * Creates an instance of {@link ContinuablePagedFluxCore}. + * + * @param pageRetrieverProvider a provider that returns Page Retriever Function. + */ + protected ContinuablePagedFluxCore(Supplier>> pageRetrieverProvider) { + this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, + "'pageRetrieverProvider' function cannot be null."); + this.defaultPrefetch = -1; + } + + /** + * Creates an instance of {@link ContinuablePagedFluxCore}. + * + * @param pageRetrieverProvider a provider that returns Page Retriever Function. + * @param prefetch the number of Pages to be pre-fetched from the Page Retriever Function upon + * subscription. + */ + protected ContinuablePagedFluxCore(Supplier>> pageRetrieverProvider, int prefetch) { + this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, + "'pageRetrieverProvider' function cannot be null."); + if (prefetch <= 0) { + throw new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch); + } + this.defaultPrefetch = prefetch; + } + + @Override + public Flux

byPage() { + return byPageIntern(this.pageRetrieverProvider, null, this.defaultPrefetch); + } + + @Override + public Flux

byPage(C continuationToken) { + if (continuationToken == null) { + return Flux.empty(); + } + return byPageIntern(this.pageRetrieverProvider, continuationToken, this.defaultPrefetch); + } + + /** + * Flux of {@link ContinuablePage} that this Paged Flux represents. + * + * @param prefetch the number of Pages to be pre-fetched from the Page Retriever Function upon + * subscription + * @return a Flux of {@link ContinuablePage} that this Paged Flux represents. + */ + public Flux

byPage(int prefetch) { + if (prefetch <= 0) { + throw new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch); + } + return byPageIntern(this.pageRetrieverProvider, null, prefetch); + } + + /** + * Flux of {@link ContinuablePage} identified by a continuation token. + * + * @param continuationToken the token to identify the pages to be retrieved + * @param prefetch the number of Pages to be pre-fetched from the Page Retriever Function upon + * subscription + * @return a Flux of {@link ContinuablePage} identified by the given continuation token + */ + public Flux

byPage(C continuationToken, int prefetch) { + if (continuationToken == null) { + return Flux.empty(); + } + if (prefetch <= 0) { + throw new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch); + } + return byPageIntern(this.pageRetrieverProvider, continuationToken, prefetch); + } + + private static > + Flux

byPageIntern(Supplier>> pageRetrieverProvider, + C continuationToken, + int prefetch) { + return Flux.defer(() -> { + Function> pageRetriever = pageRetrieverProvider.get(); + final ContinuationState state = new ContinuationState<>(continuationToken); + // + Flux repeatUntilDone = Mono.just(true) + .repeat(() -> !state.isDone()); + // + if (prefetch == -1) { + return repeatUntilDone + .concatMap(b -> { + return pageRetriever.apply(state.getLastContinuationToken()) + .doOnNext(page -> state.setLastContinuationToken(page.getContinuationToken())); + }); + } else { + return repeatUntilDone + .concatMap(b -> { + return pageRetriever.apply(state.getLastContinuationToken()) + .doOnNext(page -> state.setLastContinuationToken(page.getContinuationToken())); + }, prefetch); + } + }); + } + + /** + * Subscribe to consume all items of type {@code T} in the sequence respectively. + * This is recommended for most common scenarios. This will seamlessly fetch next + * page when required and provide with a {@link Flux} of items. + * + * @param coreSubscriber The subscriber for this {@link ContinuablePagedFluxCore} + */ + @Override + public void subscribe(CoreSubscriber coreSubscriber) { + byPage() + .flatMap(page -> Flux.fromIterable(page.getItems())) + .subscribe(coreSubscriber); + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageCore.java deleted file mode 100644 index 75d1edb9be7a..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageCore.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.util.paging; - -import java.util.List; - -/** - * Type represents a Page. - * - * @param Type of items in the page - */ -public interface PageCore { - /** - * @return list of items in the page. - */ - List getItems(); -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PagedFluxCore.java deleted file mode 100644 index 9392c8989331..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PagedFluxCore.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.util.paging; - -import com.azure.core.http.rest.Page; -import reactor.core.CoreSubscriber; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.util.Objects; -import java.util.function.Supplier; - -/** - * This class is a Flux that can operate on a type that extends {@link PageCore} and also provides - * the ability to operate on individual items. This type does not impose the need of a user facing - * continuation token, hence it does not expose a public method to retrieve pages using such token. - * - * The constructor of this type takes a provider method, that when called should provides Page Retriever - * Function which accepts no arguments. The provider is called for each Subscription to the PagedFluxCore - * instance. Given provider is called per Subscription, the provider implementation can create one or more - * objects to store any state and Page Retriever Function can capture and use those objects. This indirectly - * associate the state objects to the Subscription. The Page Retriever Function can get called multiple - * times in serial fashion, each time after the completion of the Flux returned by the previous invocation. - * The final completion signal will be send to the downstream subscriber when Page Retriever returns - * {@code null}. - * - *

Extending PagedFluxCore with Page Retrieval Function Provider

- * {@codesnippet com.azure.core.util.paging.pagedfluxcore.provider} - * - *

Extending PagedFluxCore for Custom Continuation Token support

- * {@codesnippet com.azure.core.util.paging.pagedfluxcore.continuationtoken} - * - * @param The type of items in a {@link PageCore} - * @param

The {@link PageCore} holding items of type {@code T}. - * - * @see PageCore - * @see Flux - */ -public abstract class PagedFluxCore> extends Flux { - - private final Supplier>> pageRetrieverProvider; - - /** - * Creates an instance of {@link PagedFluxCore}. - * - * @param pageRetrieverProvider a provider that returns Page Retriever Function. - */ - public PagedFluxCore(Supplier>> pageRetrieverProvider) { - this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, - "'pageRetriever' function cannot be null."); - } - - /** - * @return a flux of {@link Page} starting from the first page - */ - public Flux

byPage() { - FluxHolder

holder = new FluxHolder<>(); - Supplier> pageRetriever = this.pageRetrieverProvider.get(); - return Mono.just(true) - .repeat() - .map(b -> { - holder.setFlux(pageRetriever.get()); - return b; - }) - .takeWhile(b -> holder.getFlux() != null) - .concatMap(b -> holder.getFlux()); - } - - /** - * Subscribe to consume all items of type {@code T} in the sequence respectively. - * This is recommended for most common scenarios. This will seamlessly fetch next - * page when required and provide with a {@link Flux} of items. - * - * @param coreSubscriber The subscriber for this {@link PagedFluxCore} - */ - @Override - public void subscribe(CoreSubscriber coreSubscriber) { - byPage() - .flatMap(page -> Flux.fromIterable(page.getItems())) - .subscribe(coreSubscriber); - } - - /** - *Internal type to hold a reference to Flux

. - */ - private static class FluxHolder

{ - private Flux

value; - - /** - * @return the Flux in hold - */ - Flux

getFlux() { - return this.value; - } - - /** - * Hold the given Flux. - * - * @param value the Flux - */ - void setFlux(Flux

value) { - this.value = value; - } - } -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePage.java deleted file mode 100644 index c915f98f642d..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePage.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.util.paging; - -/** - * Represents Page from service that has reference to next set of one or more pages. - * - * @param Type of the items in the page. - */ -public interface SimplePage extends PageCore { - /** - * @return A reference to the next page, or {@code null} if there are no more pages. - */ - String getContinuationToken(); -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePagedFlux.java deleted file mode 100644 index c12127e3887c..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/SimplePagedFlux.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.util.paging; - -import com.azure.core.http.rest.Page; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.util.function.Function; -import java.util.function.Supplier; - -/** - * This class is a Flux that can operate on a type that extends {@link SimplePage} and also provides - * the ability to operate on individual items. This type support user providing string based - * continuation token (next link) and retrieve pages using it. - * - * The constructor of this type takes a Page Retriever Function which accepts string continuation - * token. The Page Retriever Function can get called multiple times in serial fashion, first time - * with {@code null} as continuation token and then each time with the non-null continuation token - * of the {@link Page} emitted from the Flux returned by the last Page Retriever invocation. - * Completion signal will be send to the subscriber when the last {@link SimplePage} emitted from - * the Flux has {@code null} continuation token. Note that unlike {@link PagedFluxCore} this type - * does not support capture based state management. - * - * @param Type of items in the page - * @param

The of the page - */ -public abstract class SimplePagedFlux> extends PagedFluxCore { - - private final Function> pageRetriever; - - /** - * Creates an instance of {@link SimplePagedFlux}. - * - * @param pageRetriever the Page Retriever Function. - */ - public SimplePagedFlux(Function> pageRetriever) { - super(new Supplier>>() { - final ContinuationState state = new ContinuationState<>(null); - @Override - public Supplier> get() { - return () -> { - if (state.isDone()) { - // PagedFluxCore contract to send completion signal to subscriber. - return null; - } else { - return pageRetriever.apply(state.getLastContinuationToken()) - .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken())); - } - }; - } - }); - this.pageRetriever = pageRetriever; - } - - /** - * Get Flux of {@link SimplePage} starting from the Page identified by the given token. - * - * @param continuationToken the continuation token - * @return a Flux that emits one or pages - */ - public Flux

byPage(String continuationToken) { - if (continuationToken == null) { - return Flux.empty(); - } - final ContinuationState state = new ContinuationState<>(continuationToken); - return Mono.just(true) - .repeat(() -> !state.isDone()) - .concatMap(b -> pageRetriever.apply(state.getLastContinuationToken()) - .doOnNext(p -> state.setLastContinuationToken(p.getContinuationToken()))); - } -} diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java index a7df4b55691f..8b57b52d1df6 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java @@ -4,123 +4,20 @@ package com.azure.core.util.paging; import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; import java.util.List; import java.util.function.Function; import java.util.function.Supplier; /** - * Code snippets for {@link PagedFluxCore} + * Code snippets for {@link ContinuablePagedFluxCore} */ public class PagedFluxCoreJavaDocCodeSnippets { /** - * Code snippets for showing usage of {@link PagedFluxCore} in class docs - */ - public void classDocSnippet() { - // BEGIN: com.azure.core.util.paging.pagedfluxcore.provider - - /** - * Blob entry in a BlobPage. - */ - class Blob { - } - - /** - * BlobPage that does not have user facing continuation token. - */ - class BlobPage implements PageCore { - @Override - public List getItems() { - // The Blob items in the page - return null; - } - } - - /** - * Type to store state specific to one subscription - */ - class State { - boolean hasMorePage() { - return true; - } - // Other state variables - } - - /** - * Service client to make API calls. - */ - class ContainerServiceClient { - /** - * Retrieve next set of pages using the given state. - * - * @param state the current state - * @return the Flux of BlobPage - */ - Flux getBlobsPages(State state) { - return null; - } - } - ContainerServiceClient client = null; // Initialize client - - /** - * A provider, upon invocation returns Page Retrieval Function. - * Provider is called for each Subscription to PagedFluxCore, For each call - * it create a state and associate it with instance of Page Retrieval Function. - */ - Supplier>> pageRetrieverProvider = new Supplier>>() { - @Override - public Supplier> get() { - State state = new State(); - return new Supplier>() { - @Override - public Flux get() { - if (state.hasMorePage()) { - // Pass current state to service method that make API call. - // state contains necessary data that service method needed - // to prepare next set of pages. Before returning, the service - // method updates the state for the next call. - // - Flux pages = client.getBlobsPages(state); - return pages; - } else { - // Null indicates no more Pages, upon receiving this - // the PagedFluxCore send completion signal to the subscriber. - return null; - } - } - }; - } - }; - - /** - * A Paged Flux specialized to for BlobPage. - */ - class BlobPagedFlux extends PagedFluxCore { - /** - * Creates an instance of {@link PagedFluxCore}. - * - * @param pageRetrieverProvider a provider that returns Page Retriever Function. - */ - BlobPagedFlux(Supplier>> pageRetrieverProvider) { - super(pageRetrieverProvider); - } - } - - BlobPagedFlux blobPagedFlux = new BlobPagedFlux(pageRetrieverProvider); - // END: com.azure.core.util.paging.pagedfluxcore.provider - } - - /** - * Code snippets for extending from {@link PagedFluxCore} and enabling custom continuation token. + * Code snippets for extending from {@link ContinuablePagedFluxCore} and enabling custom continuation token. */ public void customContinuationTokenSnippet() { // BEGIN: com.azure.core.util.paging.pagedfluxcore.continuationtoken - - abstract class ContinuablePage implements PageCore { - abstract C getContinuationToken(); - } - class ContinuationState { private C lastContinuationToken; private boolean isDone; @@ -143,45 +40,6 @@ boolean isDone() { } } - class ContinuablePagedFlux> - extends PagedFluxCore { - - private final Supplier>> pageRetrieverProvider; - - ContinuablePagedFlux(Supplier>> pageRetrieverProvider) { - super(new Supplier>>() { - final ContinuationState state = new ContinuationState<>(null); - final Function> pageRetriever = pageRetrieverProvider.get(); - @Override - public Supplier> get() { - return () -> { - if (state.isDone()) { - // PagedFluxCore contract to send completion signal to subscriber. - return null; - } else { - return pageRetriever - .apply(state.getLastContinuationToken()) - .doOnNext(p -> state - .setLastContinuationToken(p.getContinuationToken())); - } - }; - } - }); - this.pageRetrieverProvider = pageRetrieverProvider; - } - - public Flux

byPage(C continuationToken) { - final ContinuationState state = new ContinuationState<>(continuationToken); - final Function> pageRetriever = this.pageRetrieverProvider.get(); - return Mono.just(true) - .repeat(() -> !state.isDone()) - .concatMap(b -> pageRetriever - .apply(state.getLastContinuationToken()) - .doOnNext(p -> state - .setLastContinuationToken(p.getContinuationToken()))); - } - } - class FileContinuationToken { public int getNextLinkId() { return 0; @@ -191,14 +49,14 @@ public int getNextLinkId() { class File { } - class FilePage extends ContinuablePage { + class FilePage implements ContinuablePage { @Override public List getItems() { return null; } @Override - FileContinuationToken getContinuationToken() { + public FileContinuationToken getContinuationToken() { return null; } } @@ -223,7 +81,7 @@ public Flux apply(FileContinuationToken token) { } }; - class FilePagedFlux extends ContinuablePagedFlux { + class FilePagedFlux extends ContinuablePagedFluxCore { FilePagedFlux(Supplier>> pageRetrieverProvider) { super(pageRetrieverProvider); From 8c69889c54dc705543693fcdfe0dc3238a64bd7f Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Wed, 11 Dec 2019 12:40:41 -0800 Subject: [PATCH 08/34] Enabling a way to decorate a PagedFlux and have that decoreated type as PagedFlux, this will help us from not exposing more-more flux operator on PagedFlux, enable Continuation-option in base abstract type --- .../core/http/rest/PageRetrieverProvider.java | 15 ++++++++++ .../com/azure/core/http/rest/PagedFlux.java | 28 +++++++++++-------- .../azure/core/http/rest/PagedFluxBase.java | 11 ++++++++ .../util/paging/ContinuablePagedFlux.java | 7 +++-- .../util/paging/ContinuablePagedFluxCore.java | 18 +++++++++++- 5 files changed, 64 insertions(+), 15 deletions(-) create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java new file mode 100644 index 000000000000..d5398900f13a --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java @@ -0,0 +1,15 @@ +package com.azure.core.http.rest; + +import reactor.core.publisher.Flux; + +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * Type represents a provider that when called return a Function to retrieve pages. + * + * @param

the Page type. + */ +@FunctionalInterface +public interface PageRetrieverProvider

extends Supplier>> { +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index eca6ee187c09..c357a537ba17 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -37,9 +37,6 @@ * @see Flux */ public class PagedFlux extends PagedFluxBase> { - private final Supplier>> firstPageRetriever; - private final Function>> nextPageRetriever; - /** * Creates an instance of {@link PagedFlux} that consists of only a single page of results. The only argument to * this constructor therefore is a supplier that fetches the first (and known-only) page of {@code T}. @@ -51,8 +48,6 @@ public class PagedFlux extends PagedFluxBase> { */ public PagedFlux(Supplier>> firstPageRetriever) { super(firstPageRetriever); - this.firstPageRetriever = firstPageRetriever; - this.nextPageRetriever = continuationToken -> Mono.empty(); } /** @@ -69,8 +64,20 @@ public PagedFlux(Supplier>> firstPageRetriever) { public PagedFlux(Supplier>> firstPageRetriever, Function>> nextPageRetriever) { super(firstPageRetriever, nextPageRetriever); - this.firstPageRetriever = firstPageRetriever; - this.nextPageRetriever = nextPageRetriever; + } + + /** + * Creates an instance of {@link PagedFlux}. The constructor takes a provider, that when called should + * provides Page Retriever Function which accepts continuation token. The provider will be called for + * each Subscription to the PagedFlux instance. The Page Retriever Function can get called multiple times + * in serial fashion, each time after the completion of the Flux returned by the previous invocation. + * The final completion signal will be send to the downstream subscriber when the last Page emitted by + * the Flux returned by Page Continuation Function has {@code null} continuation token. + * + * @param pageRetrieverProvider the Page Retrieval Provider + */ + public PagedFlux(PageRetrieverProvider> pageRetrieverProvider) { + super(pageRetrieverProvider); } /** @@ -80,11 +87,10 @@ public PagedFlux(Supplier>> firstPageRetriever, * @param The mapped type. * @return A PagedFlux of type S. */ + @Deprecated public PagedFlux mapPage(Function mapper) { - return new PagedFlux(() -> this.firstPageRetriever.get() - .map(mapPagedResponse(mapper)), - continuationToken -> this.nextPageRetriever.apply(continuationToken) - .map(mapPagedResponse(mapper))); + return new PagedFlux((PageRetrieverProvider>) () -> c -> byPage() + .map(mapPagedResponse(mapper))); } private Function, PagedResponse> mapPagedResponse(Function mapper) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index c896ec478232..72116a8ef8a0 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -77,6 +77,17 @@ public Function> get() { }); } + /** + * Creates an instance of {@link PagedFluxBase}. The constructor takes in two arguments. + * The first argument is the provider that returns page retrieval Function. The second + * argument is the default prefetch. + * + * @param pageRetrieverProvider the Page Retrieval Provider + */ + public PagedFluxBase(PageRetrieverProvider

pageRetrieverProvider) { + super(pageRetrieverProvider); + } + /** * Creates a flux of {@link PagedResponse} starting from the first page. * diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java index 94331db5b67f..5b657cb20482 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java @@ -9,17 +9,18 @@ * A contract that represents a Flux which provides the ability to operate on individual items in pages * of type {@link ContinuablePage}, also also provide ability to operate on individual pages. * + * @param the type of continuation option for byPage * @param the type of continuation token * @param the type of items in the page * @param

the type of page */ -public abstract class ContinuablePagedFlux> extends Flux { +public abstract class ContinuablePagedFlux> extends Flux { /** * @return a Flux of {@link ContinuablePage} that this Paged Flux represents. */ public abstract Flux

byPage(); /** - * @return a Flux of {@link ContinuablePage} identified by the given continuation token. + * @return a Flux of {@link ContinuablePage} identified by the given continuation option. */ - public abstract Flux

byPage(C continuationToken); + public abstract Flux

byPage(O continuationOption); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index d6c35834aba1..8dbedc14b851 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -36,7 +36,7 @@ * @see Flux */ public abstract class ContinuablePagedFluxCore> - extends ContinuablePagedFlux { + extends ContinuablePagedFlux { private final Supplier>> pageRetrieverProvider; private final int defaultPrefetch; @@ -68,6 +68,22 @@ protected ContinuablePagedFluxCore(Supplier>> pageRetrieverP this.defaultPrefetch = prefetch; } + /** + * Creates an instance of {@link ContinuablePagedFluxCore}. + * + * @param pageRetrieverProvider a provider that returns Page Retriever Function. + * @param prefetch the number of Pages to be pre-fetched from the Page Retriever Function upon + * subscription. + */ + ContinuablePagedFluxCore(Supplier>> pageRetrieverProvider, Integer prefetch) { + this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, + "'pageRetrieverProvider' function cannot be null."); + if (prefetch <= 0) { + throw new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch); + } + this.defaultPrefetch = prefetch; + } + @Override public Flux

byPage() { return byPageIntern(this.pageRetrieverProvider, null, this.defaultPrefetch); From 1540c6cae3652abb64d23df24a4f95e330c67cd8 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Wed, 11 Dec 2019 12:45:48 -0800 Subject: [PATCH 09/34] Removed unused internal ctr --- .../util/paging/ContinuablePagedFluxCore.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index 8dbedc14b851..7a778820f818 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -68,22 +68,6 @@ protected ContinuablePagedFluxCore(Supplier>> pageRetrieverP this.defaultPrefetch = prefetch; } - /** - * Creates an instance of {@link ContinuablePagedFluxCore}. - * - * @param pageRetrieverProvider a provider that returns Page Retriever Function. - * @param prefetch the number of Pages to be pre-fetched from the Page Retriever Function upon - * subscription. - */ - ContinuablePagedFluxCore(Supplier>> pageRetrieverProvider, Integer prefetch) { - this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, - "'pageRetrieverProvider' function cannot be null."); - if (prefetch <= 0) { - throw new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch); - } - this.defaultPrefetch = prefetch; - } - @Override public Flux

byPage() { return byPageIntern(this.pageRetrieverProvider, null, this.defaultPrefetch); From dfa1f40fe5a86b296cb5d8db7f7a8011865f9162 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Wed, 11 Dec 2019 15:59:10 -0800 Subject: [PATCH 10/34] Update sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java Co-Authored-By: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> --- .../main/java/com/azure/core/util/paging/ContinuationState.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java index 9be0b071185a..9b2e8bd68a31 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java @@ -29,7 +29,7 @@ class ContinuationState { * @param token the token */ void setLastContinuationToken(C token) { - this.isDone = token == null ? true : false; + this.isDone = (token == null); this.lastContinuationToken = token; } From b9fe5e9d1a5cc3ad020fae2cf56260b59702c72f Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Wed, 11 Dec 2019 19:02:37 -0800 Subject: [PATCH 11/34] cleaning up comments and simplifying the code --- .../core/http/rest/PageRetrieverProvider.java | 5 ++- .../com/azure/core/http/rest/PagedFlux.java | 44 +++++++++++------- .../azure/core/http/rest/PagedFluxBase.java | 18 +++++--- .../util/paging/ContinuablePagedFlux.java | 5 ++- .../util/paging/ContinuablePagedFluxCore.java | 45 ++++++++++++------- 5 files changed, 75 insertions(+), 42 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java index d5398900f13a..a103b471794d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.core.http.rest; import reactor.core.publisher.Flux; @@ -6,7 +9,7 @@ import java.util.function.Supplier; /** - * Type represents a provider that when called return a Function to retrieve pages. + * Type represents a Provider that when called return a Function to retrieve pages. * * @param

the Page type. */ diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index c357a537ba17..77eadd9d9c5b 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -6,6 +6,7 @@ import com.azure.core.http.HttpRequest; import java.util.stream.Collectors; + import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -14,8 +15,8 @@ /** * This class is a flux that can operate on a {@link PagedResponse} and also provides the ability to operate on - * individual items. When processing the response by page, each response will contain the items in the page as well as - * the request details like status code and headers. + * individual items. When processing the response by page, each response will contain the items in the page as + * well as the request details like status code and headers. * *

To process one item at a time, simply subscribe to this flux as shown below

*

Code sample

@@ -38,8 +39,9 @@ */ public class PagedFlux extends PagedFluxBase> { /** - * Creates an instance of {@link PagedFlux} that consists of only a single page of results. The only argument to - * this constructor therefore is a supplier that fetches the first (and known-only) page of {@code T}. + * Creates an instance of {@link PagedFlux} that consists of only a single page of results. The only + * argument to this constructor therefore is a supplier that fetches the first (and known-only) page + * of {@code T}. * *

Code sample

* {@codesnippet com.azure.core.http.rest.pagedflux.singlepage.instantiation} @@ -47,13 +49,13 @@ public class PagedFlux extends PagedFluxBase> { * @param firstPageRetriever Supplier that retrieves the first page. */ public PagedFlux(Supplier>> firstPageRetriever) { - super(firstPageRetriever); + this(firstPageRetriever, token -> Mono.empty()); } /** - * Creates an instance of {@link PagedFlux}. The constructor takes in two arguments. The first argument is a - * supplier that fetches the first page of {@code T}. The second argument is a function that fetches subsequent - * pages of {@code T} + * Creates an instance of {@link PagedFlux}. The constructor takes in two arguments. The first argument + * is a supplier that fetches the first page of {@code T}. The second argument is a function that fetches + * subsequent pages of {@code T} * *

Code sample

* {@codesnippet com.azure.core.http.rest.pagedflux.instantiation} @@ -63,21 +65,30 @@ public PagedFlux(Supplier>> firstPageRetriever) { */ public PagedFlux(Supplier>> firstPageRetriever, Function>> nextPageRetriever) { - super(firstPageRetriever, nextPageRetriever); + this(new PageRetrieverProvider>() { + @Override + public Function>> get() { + return continuationToken -> { + return continuationToken == null + ? firstPageRetriever.get().flux() + : nextPageRetriever.apply(continuationToken).flux(); + }; + } + }); } /** * Creates an instance of {@link PagedFlux}. The constructor takes a provider, that when called should * provides Page Retriever Function which accepts continuation token. The provider will be called for - * each Subscription to the PagedFlux instance. The Page Retriever Function can get called multiple times - * in serial fashion, each time after the completion of the Flux returned by the previous invocation. - * The final completion signal will be send to the downstream subscriber when the last Page emitted by - * the Flux returned by Page Continuation Function has {@code null} continuation token. + * each Subscription to the PagedFlux instance. The Page Retriever Function can get called multiple + * times in serial fashion, each time after the completion of the Flux returned from the previous + * invocation. The final completion signal will be send to the downstream subscriber when the last + * Page emitted by the Flux returned by Page Continuation Function has {@code null} continuation token. * - * @param pageRetrieverProvider the Page Retrieval Provider + * @param provider the Page Retrieval Provider */ - public PagedFlux(PageRetrieverProvider> pageRetrieverProvider) { - super(pageRetrieverProvider); + public PagedFlux(PageRetrieverProvider> provider) { + super(provider); } /** @@ -86,6 +97,7 @@ public PagedFlux(PageRetrieverProvider> pageRetrieverProvider) * @param mapper The mapper function to convert from type T to type S. * @param The mapped type. * @return A PagedFlux of type S. + * @Deprecated */ @Deprecated public PagedFlux mapPage(Function mapper) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index 72116a8ef8a0..ebc5cf18717c 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -65,7 +65,7 @@ public PagedFluxBase(Supplier> firstPageRetriever) { */ public PagedFluxBase(Supplier> firstPageRetriever, Function> nextPageRetriever) { - super(new Supplier>>() { + this(new PageRetrieverProvider

() { @Override public Function> get() { return continuationToken -> { @@ -78,14 +78,18 @@ public Function> get() { } /** - * Creates an instance of {@link PagedFluxBase}. The constructor takes in two arguments. - * The first argument is the provider that returns page retrieval Function. The second - * argument is the default prefetch. + * Creates an instance of {@link PagedFlux}. The constructor takes a provider, that when called should + * provides Page Retriever Function which accepts continuation token. The provider will be called for + * each Subscription to the PagedFlux instance. The Page Retriever Function can get called multiple + * times in serial fashion, each time after the completion of the Flux returned from the previous + * invocation. The final completion signal will be send to the downstream subscriber when the last + * Page emitted by the Flux returned by Page Continuation Function has {@code null} continuation token. * - * @param pageRetrieverProvider the Page Retrieval Provider + * + * @param provider the Page Retrieval Provider */ - public PagedFluxBase(PageRetrieverProvider

pageRetrieverProvider) { - super(pageRetrieverProvider); + public PagedFluxBase(PageRetrieverProvider

provider) { + super(provider); } /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java index 5b657cb20482..3f3674a96f71 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java @@ -6,8 +6,9 @@ import reactor.core.publisher.Flux; /** - * A contract that represents a Flux which provides the ability to operate on individual items in pages - * of type {@link ContinuablePage}, also also provide ability to operate on individual pages. + * A contract that represents a Flux that provides the ability to operate on individual items + * in pages of type {@link ContinuablePage}, also provide ability to operate on individual + * pages. * * @param the type of continuation option for byPage * @param the type of continuation token diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index 7a778820f818..da6231a474f2 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -14,17 +14,18 @@ /** * The default implementation of {@link ContinuablePagedFlux}. * - * The Flux that provides the ability to operate on individual items in pages of type {@link ContinuablePage}, - * it also provide ability to operate on individual pages. + * The Flux that provides the ability to operate on individual items in pages of type + * {@link ContinuablePage}, also provide ability to operate on individual pages. * - * The constructor of this type takes a provider method, that when called should provides Page Retriever + * The constructor of this type takes a provider, that when called should provides Page Retriever * Function which accepts continuation token. The provider is called for each Subscription to the - * ContinuablePagedFluxCore instance. Given provider is called per Subscription, the provider implementation - * can create one or more objects to store any state and Page Retriever Function can capture and use those objects. - * This indirectly associate the state objects to the Subscription. The Page Retriever Function can get called - * multiple times in serial fashion, each time after the completion of the Flux returned by the previous invocation. - * The final completion signal will be send to the downstream subscriber when the last Page emitted by the Flux - * returned by Page Continuation Function has {@code null} continuation token. + * ContinuablePagedFluxCore instance. Given provider is called per Subscription, the provider + * implementation can create one or more objects to store any state and Page Retriever Function can + * capture and use those objects. This indirectly associate the state objects to the Subscription. + * The Page Retriever Function can get called multiple times in serial fashion, each time after the + * completion of the Flux returned by the previous invocation. The final completion signal will be + * send to the downstream subscriber when the last Page emitted by the Flux returned by + * the Page Retrieval Function has {@code null} continuation token. * *

Extending PagedFluxCore for Custom Continuation Token support

* {@codesnippet com.azure.core.util.paging.pagedfluxcore.continuationtoken} @@ -55,13 +56,12 @@ protected ContinuablePagedFluxCore(Supplier>> pageRetrieverP /** * Creates an instance of {@link ContinuablePagedFluxCore}. * - * @param pageRetrieverProvider a provider that returns Page Retriever Function. + * @param provider a provider that returns Page Retriever Function. * @param prefetch the number of Pages to be pre-fetched from the Page Retriever Function upon * subscription. */ - protected ContinuablePagedFluxCore(Supplier>> pageRetrieverProvider, int prefetch) { - this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, - "'pageRetrieverProvider' function cannot be null."); + protected ContinuablePagedFluxCore(Supplier>> provider, int prefetch) { + this.pageRetrieverProvider = Objects.requireNonNull(provider, "'provider' function cannot be null."); if (prefetch <= 0) { throw new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch); } @@ -96,7 +96,7 @@ public Flux

byPage(int prefetch) { } /** - * Flux of {@link ContinuablePage} identified by a continuation token. + * Flux of {@link ContinuablePage} starting from the Page identified by a continuation token. * * @param continuationToken the token to identify the pages to be retrieved * @param prefetch the number of Pages to be pre-fetched from the Page Retriever Function upon @@ -113,12 +113,25 @@ public Flux

byPage(C continuationToken, int prefetch) { return byPageIntern(this.pageRetrieverProvider, continuationToken, prefetch); } + /** + * Get a Flux of {@link ContinuablePage} created by concat-ing Flux instances returned + * Page Retriever Function calls. + * + * @param provider the provider that when called returns Page Retriever Function + * @param continuationToken the token to identify the pages to be retrieved + * @param prefetch the prefetch, a value -1 will result in using Reactor defined default prefetch + * + * @param the type of Continuation token + * @param The type of items in a {@link ContinuablePage} + * @param

The {@link ContinuablePage} holding items of type {@code T} + * @return a Flux of {@link ContinuablePage} identified by the given continuation token + */ private static > - Flux

byPageIntern(Supplier>> pageRetrieverProvider, + Flux

byPageIntern(Supplier>> provider, C continuationToken, int prefetch) { return Flux.defer(() -> { - Function> pageRetriever = pageRetrieverProvider.get(); + Function> pageRetriever = provider.get(); final ContinuationState state = new ContinuationState<>(continuationToken); // Flux repeatUntilDone = Mono.just(true) From 6b82642f8035a7071472eba47f12c9c88831dcbf Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Wed, 11 Dec 2019 19:04:20 -0800 Subject: [PATCH 12/34] Update sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java Co-Authored-By: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> --- .../src/main/java/com/azure/core/http/rest/PagedFlux.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index 77eadd9d9c5b..8272b87c9998 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -79,7 +79,7 @@ public Function>> get() { /** * Creates an instance of {@link PagedFlux}. The constructor takes a provider, that when called should - * provides Page Retriever Function which accepts continuation token. The provider will be called for + * provide Page Retriever Function which accepts continuation token. The provider will be called for * each Subscription to the PagedFlux instance. The Page Retriever Function can get called multiple * times in serial fashion, each time after the completion of the Flux returned from the previous * invocation. The final completion signal will be send to the downstream subscriber when the last From 3175061f297f241aa40bcd5ca56e934829e03d61 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Thu, 12 Dec 2019 15:30:04 -0800 Subject: [PATCH 13/34] Removing generic arg for contination option, adding sample for PagedFlux decoration --- .../java/com/azure/core/http/rest/Page.java | 2 +- .../com/azure/core/http/rest/PagedFlux.java | 33 +++++--- .../azure/core/http/rest/PagedFluxBase.java | 24 +++--- .../core/util/paging/ContinuablePage.java | 5 +- .../util/paging/ContinuablePagedFlux.java | 18 +++-- .../util/paging/ContinuablePagedFluxCore.java | 79 +++++++++++++++---- .../core/util/paging/ContinuationState.java | 50 ------------ .../rest/PagedFluxJavaDocCodeSnippets.java | 45 ++++++++++- 8 files changed, 153 insertions(+), 103 deletions(-) delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java index 32515d733dca..2ca95cd33ac5 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java @@ -8,7 +8,7 @@ /** * Represents a paginated REST response from the service. * - * @param Type of the listed objects in that response. + * @param Type of items in the page response. */ public interface Page extends ContinuablePage { } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index 77eadd9d9c5b..6deadea8fa5f 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -14,9 +14,9 @@ import java.util.function.Supplier; /** - * This class is a flux that can operate on a {@link PagedResponse} and also provides the ability to operate on - * individual items. When processing the response by page, each response will contain the items in the page as - * well as the request details like status code and headers. + * This type is a Flux provides the ability to operate on paginated REST response of type {@link PagedResponse} + * and individual items in such pages. When processing the response by page, each response will contain the items + * in the page as well as the REST response details like status code and headers. * *

To process one item at a time, simply subscribe to this flux as shown below

*

Code sample

@@ -39,9 +39,8 @@ */ public class PagedFlux extends PagedFluxBase> { /** - * Creates an instance of {@link PagedFlux} that consists of only a single page of results. The only - * argument to this constructor therefore is a supplier that fetches the first (and known-only) page - * of {@code T}. + * Creates an instance of {@link PagedFlux} that consists of only a single page. + * This constructor takes a {@code Supplier} that return the single page of {@code T}. * *

Code sample

* {@codesnippet com.azure.core.http.rest.pagedflux.singlepage.instantiation} @@ -53,9 +52,9 @@ public PagedFlux(Supplier>> firstPageRetriever) { } /** - * Creates an instance of {@link PagedFlux}. The constructor takes in two arguments. The first argument - * is a supplier that fetches the first page of {@code T}. The second argument is a function that fetches - * subsequent pages of {@code T} + * Creates an instance of {@link PagedFlux}. The constructor takes a {@code Supplier} and + * {@code Function}. The {@code Supplier} returns the first page of {@code T}, + * the {@code Function} retrieves subsequent pages of {@code T}. * *

Code sample

* {@codesnippet com.azure.core.http.rest.pagedflux.instantiation} @@ -82,8 +81,15 @@ public Function>> get() { * provides Page Retriever Function which accepts continuation token. The provider will be called for * each Subscription to the PagedFlux instance. The Page Retriever Function can get called multiple * times in serial fashion, each time after the completion of the Flux returned from the previous - * invocation. The final completion signal will be send to the downstream subscriber when the last - * Page emitted by the Flux returned by Page Continuation Function has {@code null} continuation token. + * invocation. The final completion signal will be send to the Subscriber when the last Page emitted + * by the Flux returned by Page Continuation Function has {@code null} continuation token. + * + * The provider is useful mainly in two scenarios: + * 1. To manage state across multiple call to Page Retrieval Function within the same Subscription + * 2. To decorate a PagedFlux to produce new PagedFlux + * + *

Decoration sample

+ * {@codesnippet com.azure.core.http.rest.pagedflux.ctr.decoration} * * @param provider the Page Retrieval Provider */ @@ -92,12 +98,13 @@ public PagedFlux(PageRetrieverProvider> provider) { } /** - * Maps this PagedFlux instance of T to a PagedFlux instance of type S as per the provided mapper function. + * Maps this PagedFlux instance of T to a PagedFlux instance of type S as per the provided mapper + * function. * * @param mapper The mapper function to convert from type T to type S. * @param The mapped type. * @return A PagedFlux of type S. - * @Deprecated + * @Deprecated refer the decoration samples for PagedFlux constructor that takes provider */ @Deprecated public PagedFlux mapPage(Function mapper) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index ebc5cf18717c..bd4ed93efec7 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -39,23 +39,22 @@ */ public class PagedFluxBase> extends ContinuablePagedFluxCore { /** - * Creates an instance of {@link PagedFluxBase} that consists of only a single page of results. - * The only argument to this constructor therefore is a supplier that fetches the first - * (and known-only) page from {@code P}. + * Creates an instance of {@link PagedFluxBase} that consists of only a single page. + * This constructor takes a {@code Supplier} that return the single page of {@code T}. * *

Code sample

* {@codesnippet com.azure.core.http.rest.pagedfluxbase.singlepage.instantiation} * - * @param firstPageRetriever Supplier that retrieves the first page + * @param firstPageRetriever Supplier that retrieves the first page. */ public PagedFluxBase(Supplier> firstPageRetriever) { this(firstPageRetriever, token -> Mono.empty()); } /** - * Creates an instance of {@link PagedFluxBase}. The constructor takes in two arguments. The first - * argument is a supplier that fetches the first page from {@code P}. The second argument is a - * function that fetches subsequent pages from {@code P}. + * Creates an instance of {@link PagedFluxBase}. The constructor takes a {@code Supplier} and + * {@code Function}. The {@code Supplier} returns the first page of {@code T}, + * the {@code Function} retrieves subsequent pages of {@code T}. * *

Code sample

* {@codesnippet com.azure.core.http.rest.pagedfluxbase.instantiation} @@ -78,13 +77,12 @@ public Function> get() { } /** - * Creates an instance of {@link PagedFlux}. The constructor takes a provider, that when called should + * Creates an instance of {@link PagedFluxBase}. The constructor takes a provider, that when called should * provides Page Retriever Function which accepts continuation token. The provider will be called for * each Subscription to the PagedFlux instance. The Page Retriever Function can get called multiple * times in serial fashion, each time after the completion of the Flux returned from the previous - * invocation. The final completion signal will be send to the downstream subscriber when the last - * Page emitted by the Flux returned by Page Continuation Function has {@code null} continuation token. - * + * invocation. The final completion signal will be send to the Subscriber when the last Page emitted + * by the Flux returned by Page Continuation Function has {@code null} continuation token. * * @param provider the Page Retrieval Provider */ @@ -93,7 +91,7 @@ public PagedFluxBase(PageRetrieverProvider

provider) { } /** - * Creates a flux of {@link PagedResponse} starting from the first page. + * Creates a Flux of {@link PagedResponse} starting from the first page. * *

Code sample

* {@codesnippet com.azure.core.http.rest.pagedfluxbase.bypage} @@ -105,7 +103,7 @@ public Flux

byPage() { } /** - * Creates a flux of {@link PagedResponse} starting from the next page associated with the given + * Creates a Flux of {@link PagedResponse} starting from the next page associated with the given * continuation token. To start from first page, use {@link #byPage()} instead. * *

Code sample

diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java index efd8ca2ba196..d9f90587c5ba 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java @@ -3,10 +3,13 @@ import java.util.List; /** - * Represents Page from service that has reference to next set of one or more pages. + * Represents Page from service that has reference (a.k.a continuation token) to next set + * of one or more pages. * * @param Type of the continuation token * @param Type of the items in the page + * + * @see ContinuablePagedFlux */ public interface ContinuablePage { /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java index 3f3674a96f71..2c891eed55f0 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java @@ -6,22 +6,24 @@ import reactor.core.publisher.Flux; /** - * A contract that represents a Flux that provides the ability to operate on individual items - * in pages of type {@link ContinuablePage}, also provide ability to operate on individual - * pages. + * A contract that represents a Flux that provides the ability to operate on pages of type + * {@link ContinuablePage} and individual items in such pages. This type supports user-provided + * continuation tokens, allowing for restarting from a previously-retrieved continuation token. * - * @param the type of continuation option for byPage * @param the type of continuation token * @param the type of items in the page * @param

the type of page + * + * @see Flux + * @see ContinuablePage */ -public abstract class ContinuablePagedFlux> extends Flux { +public abstract class ContinuablePagedFlux> extends Flux { /** - * @return a Flux of {@link ContinuablePage} that this Paged Flux represents. + * @return a Flux of {@link ContinuablePage} that this Paged Flux. */ public abstract Flux

byPage(); /** - * @return a Flux of {@link ContinuablePage} identified by the given continuation option. + * @return a Flux of {@link ContinuablePage} identified by the given continuation token. */ - public abstract Flux

byPage(O continuationOption); + public abstract Flux

byPage(C continuationToken); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index da6231a474f2..cd6ae263204a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -14,18 +14,19 @@ /** * The default implementation of {@link ContinuablePagedFlux}. * - * The Flux that provides the ability to operate on individual items in pages of type - * {@link ContinuablePage}, also provide ability to operate on individual pages. + * This type is a Flux provides the ability to operate on pages of type {@link ContinuablePage} + * and individual items in such pages. This type supports user-provided continuation tokens, + * allowing for restarting from a previously-retrieved continuation token. * - * The constructor of this type takes a provider, that when called should provides Page Retriever - * Function which accepts continuation token. The provider is called for each Subscription to the - * ContinuablePagedFluxCore instance. Given provider is called per Subscription, the provider - * implementation can create one or more objects to store any state and Page Retriever Function can - * capture and use those objects. This indirectly associate the state objects to the Subscription. - * The Page Retriever Function can get called multiple times in serial fashion, each time after the - * completion of the Flux returned by the previous invocation. The final completion signal will be - * send to the downstream subscriber when the last Page emitted by the Flux returned by - * the Page Retrieval Function has {@code null} continuation token. + * The constructor takes a provider, that when called should return Page Retriever Function which + * accepts continuation token. The provider is called for each Subscription to this Flux. + * Given provider is called per Subscription, the provider implementation can create one or more + * objects to store any state and Page Retriever Function can capture and use those objects. + * This indirectly associate the state objects to the Subscription. The Page Retriever Function + * can get called multiple times in serial fashion, each time after the completion of the Flux + * returned by the previous invocation. The final completion signal will be send to the Subscriber + * when the last Page emitted by the Flux returned by the Page Retrieval Function has {@code null} + * continuation token. * *

Extending PagedFluxCore for Custom Continuation Token support

* {@codesnippet com.azure.core.util.paging.pagedfluxcore.continuationtoken} @@ -33,11 +34,11 @@ * @param The type of items in a {@link ContinuablePage} * @param

The {@link ContinuablePage} holding items of type {@code T}. * + * @see ContinuablePagedFlux * @see ContinuablePage - * @see Flux */ public abstract class ContinuablePagedFluxCore> - extends ContinuablePagedFlux { + extends ContinuablePagedFlux { private final Supplier>> pageRetrieverProvider; private final int defaultPrefetch; @@ -90,7 +91,7 @@ public Flux

byPage(C continuationToken) { */ public Flux

byPage(int prefetch) { if (prefetch <= 0) { - throw new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch); + return Flux.error(new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch)); } return byPageIntern(this.pageRetrieverProvider, null, prefetch); } @@ -108,7 +109,7 @@ public Flux

byPage(C continuationToken, int prefetch) { return Flux.empty(); } if (prefetch <= 0) { - throw new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch); + return Flux.error(new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch)); } return byPageIntern(this.pageRetrieverProvider, continuationToken, prefetch); } @@ -131,7 +132,7 @@ Flux

byPageIntern(Supplier>> provider, C continuationToken, int prefetch) { return Flux.defer(() -> { - Function> pageRetriever = provider.get(); + final Function> pageRetriever = provider.get(); final ContinuationState state = new ContinuationState<>(continuationToken); // Flux repeatUntilDone = Mono.just(true) @@ -166,4 +167,50 @@ public void subscribe(CoreSubscriber coreSubscriber) { .flatMap(page -> Flux.fromIterable(page.getItems())) .subscribe(coreSubscriber); } + + /** + * Internal type to store Continuation State. + * + * @param the Continuation Token type + */ + private static class ContinuationState { + // The last seen continuation token + private C lastContinuationToken; + // Indicate whether to call the PageRetrieval Function + private boolean isDone; + + /** + * Creates ContinuationState. + * + * @param token the token to start with + */ + ContinuationState(C token) { + this.lastContinuationToken = token; + } + + /** + * Store the last seen continuation token. + * + * @param token the token + */ + void setLastContinuationToken(C token) { + this.isDone = (token == null); + this.lastContinuationToken = token; + } + + /** + * @return the last seen token + */ + C getLastContinuationToken() { + return this.lastContinuationToken; + } + + /** + * @return true if the PageRetrieval Function needs to be invoked + * for next set of pages. + */ + boolean isDone() { + return this.isDone; + } + } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java deleted file mode 100644 index 9b2e8bd68a31..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuationState.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.util.paging; - -/** - * Internal type to store continuation state. - * - * @param the Continuation Token type - */ -class ContinuationState { - // The last seen continuation token - private C lastContinuationToken; - // Indicate whether to call the PageRetrieval Function - private boolean isDone; - - /** - * Creates ContinuationState. - * - * @param token the token to start with - */ - ContinuationState(C token) { - this.lastContinuationToken = token; - } - - /** - * Store the last seen continuation token. - * - * @param token the token - */ - void setLastContinuationToken(C token) { - this.isDone = (token == null); - this.lastContinuationToken = token; - } - - /** - * @return the last seen token - */ - C getLastContinuationToken() { - return this.lastContinuationToken; - } - - /** - * @return true if the PageRetrieval Function needs to be invoked - * for next set of pages. - */ - boolean isDone() { - return this.isDone; - } -} diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java index c590e4b63361..64ca026fc8b5 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java @@ -6,16 +6,18 @@ import org.reactivestreams.Subscription; import reactor.core.CoreSubscriber; import reactor.core.publisher.BaseSubscriber; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.util.function.Function; import java.util.function.Supplier; +import java.util.stream.Collectors; /** * Code snippets for {@link PagedFlux} */ public final class PagedFluxJavaDocCodeSnippets { - + /** * Code snippets for showing usage of {@link PagedFlux} in class docs */ @@ -140,6 +142,41 @@ protected void hookOnComplete() { // END: com.azure.core.http.rest.pagedflux.subscribe } + /** + * Code snippets for using {@link PagedFlux#PagedFlux(PageRetrieverProvider)} + * to create a PagedFlux by applying decoration on another PagedFlux. + */ + public void pagedFluxFromPagedFlux() { + // BEGIN: com.azure.core.http.rest.pagedflux.ctr.decoration + + // Transform a PagedFlux with Integer items to PagedFlux of String items. + final PagedFlux intPagedFlux = createAnInstance(); + + Function, PagedResponse> responseMapper + = intResponse -> new PagedResponseBase(intResponse.getRequest(), + intResponse.getStatusCode(), + intResponse.getHeaders(), + intResponse.getValue() + .stream() + .map(intValue -> Integer.toString(intValue)).collect(Collectors.toList()), + intResponse.getContinuationToken(), + null); + + PagedFlux strPagedFlux = new PagedFlux<>(() -> + (Function>>) ct -> intPagedFlux + .byPage() + .map(responseMapper)); + + // Create a PagedFlux from a PagedFlux with all exceptions mapped to a specific exception. + final PagedFlux pagedFlux = createAnInstance(); + final PagedFlux pagedFluxWithExceptionMapped = new PagedFlux<>(() -> + (Function>>) ct -> pagedFlux + .byPage() + .onErrorMap(t -> new PaginationException(t))); + + // END: com.azure.core.http.rest.pagedflux..ctr.decoration + } + /** * Implementation not provided * @@ -167,4 +204,10 @@ private Mono> getNextPage(String continuationToken) { private Mono> getFirstPage() { return null; } + + class PaginationException extends RuntimeException { + PaginationException(Throwable ex) { + super(ex); + } + } } From b1df28063b4fa1c83199ac5ec08f53c0dfa15f9c Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Fri, 13 Dec 2019 01:42:32 -0800 Subject: [PATCH 14/34] Simplifying ContinuablePagedFluxCore concat logic and updating the PagedIterableTests to assert for the correct behavior we're looking for. --- .../com/azure/core/http/rest/PagedFlux.java | 10 +- .../azure/core/http/rest/PagedFluxBase.java | 8 +- .../core/util/paging/ContinuablePage.java | 3 + .../util/paging/ContinuablePagedFlux.java | 8 +- .../util/paging/ContinuablePagedFluxCore.java | 107 ++++++------------ .../core/http/rest/PagedIterableTest.java | 24 +--- 6 files changed, 53 insertions(+), 107 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index a373b2776816..82fe29e62053 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -67,11 +67,9 @@ public PagedFlux(Supplier>> firstPageRetriever, this(new PageRetrieverProvider>() { @Override public Function>> get() { - return continuationToken -> { - return continuationToken == null - ? firstPageRetriever.get().flux() - : nextPageRetriever.apply(continuationToken).flux(); - }; + return continuationToken -> continuationToken == null + ? firstPageRetriever.get().flux() + : nextPageRetriever.apply(continuationToken).flux(); } }); } @@ -104,7 +102,7 @@ public PagedFlux(PageRetrieverProvider> provider) { * @param mapper The mapper function to convert from type T to type S. * @param The mapped type. * @return A PagedFlux of type S. - * @Deprecated refer the decoration samples for PagedFlux constructor that takes provider + * @deprecated refer the decoration samples for PagedFlux constructor that takes provider */ @Deprecated public PagedFlux mapPage(Function mapper) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index bd4ed93efec7..8ad7cf47c8de 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -67,11 +67,9 @@ public PagedFluxBase(Supplier> firstPageRetriever, this(new PageRetrieverProvider

() { @Override public Function> get() { - return continuationToken -> { - return continuationToken == null - ? firstPageRetriever.get().flux() - : nextPageRetriever.apply(continuationToken).flux(); - }; + return continuationToken -> continuationToken == null + ? firstPageRetriever.get().flux() + : nextPageRetriever.apply(continuationToken).flux(); } }); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java index d9f90587c5ba..cea5be3af4eb 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.core.util.paging; import java.util.List; diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java index 2c891eed55f0..9ded283df987 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java @@ -19,11 +19,15 @@ */ public abstract class ContinuablePagedFlux> extends Flux { /** - * @return a Flux of {@link ContinuablePage} that this Paged Flux. + * @return a Flux that emits stream of {@link ContinuablePage} in this Paged Flux. */ public abstract Flux

byPage(); /** - * @return a Flux of {@link ContinuablePage} identified by the given continuation token. + * Get a Flux that emits stream of {@link ContinuablePage} identified by the given + * continuation token. + * + * @param continuationToken the continuation token + * @return a Flux of {@link ContinuablePage} */ public abstract Flux

byPage(C continuationToken); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index cd6ae263204a..1223f711acdf 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -39,9 +39,7 @@ */ public abstract class ContinuablePagedFluxCore> extends ContinuablePagedFlux { - private final Supplier>> pageRetrieverProvider; - private final int defaultPrefetch; /** * Creates an instance of {@link ContinuablePagedFluxCore}. @@ -51,27 +49,11 @@ public abstract class ContinuablePagedFluxCore>> pageRetrieverProvider) { this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, "'pageRetrieverProvider' function cannot be null."); - this.defaultPrefetch = -1; - } - - /** - * Creates an instance of {@link ContinuablePagedFluxCore}. - * - * @param provider a provider that returns Page Retriever Function. - * @param prefetch the number of Pages to be pre-fetched from the Page Retriever Function upon - * subscription. - */ - protected ContinuablePagedFluxCore(Supplier>> provider, int prefetch) { - this.pageRetrieverProvider = Objects.requireNonNull(provider, "'provider' function cannot be null."); - if (prefetch <= 0) { - throw new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch); - } - this.defaultPrefetch = prefetch; } @Override public Flux

byPage() { - return byPageIntern(this.pageRetrieverProvider, null, this.defaultPrefetch); + return byPage(this.pageRetrieverProvider, null); } @Override @@ -79,39 +61,7 @@ public Flux

byPage(C continuationToken) { if (continuationToken == null) { return Flux.empty(); } - return byPageIntern(this.pageRetrieverProvider, continuationToken, this.defaultPrefetch); - } - - /** - * Flux of {@link ContinuablePage} that this Paged Flux represents. - * - * @param prefetch the number of Pages to be pre-fetched from the Page Retriever Function upon - * subscription - * @return a Flux of {@link ContinuablePage} that this Paged Flux represents. - */ - public Flux

byPage(int prefetch) { - if (prefetch <= 0) { - return Flux.error(new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch)); - } - return byPageIntern(this.pageRetrieverProvider, null, prefetch); - } - - /** - * Flux of {@link ContinuablePage} starting from the Page identified by a continuation token. - * - * @param continuationToken the token to identify the pages to be retrieved - * @param prefetch the number of Pages to be pre-fetched from the Page Retriever Function upon - * subscription - * @return a Flux of {@link ContinuablePage} identified by the given continuation token - */ - public Flux

byPage(C continuationToken, int prefetch) { - if (continuationToken == null) { - return Flux.empty(); - } - if (prefetch <= 0) { - return Flux.error(new IllegalArgumentException("prefetch > 0 required but provided: " + prefetch)); - } - return byPageIntern(this.pageRetrieverProvider, continuationToken, prefetch); + return byPage(this.pageRetrieverProvider, continuationToken); } /** @@ -119,8 +69,7 @@ public Flux

byPage(C continuationToken, int prefetch) { * Page Retriever Function calls. * * @param provider the provider that when called returns Page Retriever Function - * @param continuationToken the token to identify the pages to be retrieved - * @param prefetch the prefetch, a value -1 will result in using Reactor defined default prefetch + * @param continuationToken the token to identify the pages to be retrieved * * @param the type of Continuation token * @param The type of items in a {@link ContinuablePage} @@ -128,32 +77,42 @@ public Flux

byPage(C continuationToken, int prefetch) { * @return a Flux of {@link ContinuablePage} identified by the given continuation token */ private static > - Flux

byPageIntern(Supplier>> provider, - C continuationToken, - int prefetch) { + Flux

byPage(Supplier>> provider, + C continuationToken) { return Flux.defer(() -> { final Function> pageRetriever = provider.get(); final ContinuationState state = new ContinuationState<>(continuationToken); - // - Flux repeatUntilDone = Mono.just(true) - .repeat(() -> !state.isDone()); - // - if (prefetch == -1) { - return repeatUntilDone - .concatMap(b -> { - return pageRetriever.apply(state.getLastContinuationToken()) - .doOnNext(page -> state.setLastContinuationToken(page.getContinuationToken())); - }); - } else { - return repeatUntilDone - .concatMap(b -> { - return pageRetriever.apply(state.getLastContinuationToken()) - .doOnNext(page -> state.setLastContinuationToken(page.getContinuationToken())); - }, prefetch); - } + return concatPagedFlux(state, pageRetriever); }); } + /** + * Get a Flux of {@link ContinuablePage} created by concat-ing Flux instances returned + * Page Retriever Function calls. The first Flux of {@link ContinuablePage} is identified + * by the continuation-token in the state. + * + * @param state the state to be used across multiple Page Retriever Function calls + * @param pageRetriever the Page Retriever Function + * @param the type of Continuation token + * @param The type of items in a {@link ContinuablePage} + * @param

The {@link ContinuablePage} holding items of type {@code T} + * @return a Flux of {@link ContinuablePage} + */ + private static > Flux

concatPagedFlux(ContinuationState state, + Function> pageRetriever) { + if (state.isDone()) { + return Flux.empty(); + } else { + return pageRetriever.apply(state.getLastContinuationToken()) + .switchIfEmpty(Flux.defer(() -> { + state.setLastContinuationToken(null); + return Mono.empty(); + })) + .doOnNext(page -> state.setLastContinuationToken(page.getContinuationToken())) + .concatWith(Flux.defer(() -> concatPagedFlux(state, pageRetriever))); + } + } + /** * Subscribe to consume all items of type {@code T} in the sequence respectively. * This is recommended for most common scenarios. This will seamlessly fetch next diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedIterableTest.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedIterableTest.java index 136abaad61a8..6bb89a81e8bb 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedIterableTest.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedIterableTest.java @@ -139,16 +139,8 @@ public void streamFirstPage() { assertEquals(pagedResponses.get(0), pagedIterable.streamByPage().limit(1).collect(Collectors.toList()).get(0)); - /* - * The goal for this test would be that 0 next page retrieval calls are made but due to how Flux.concatWith - * works it needs to begin the next publisher to determine whether onNext or onComplete should trigger. This - * results in 2 next page retrieval calls for the following reason: - * - * - Makes the initial get first page call, then needs to validate that get next page emits. 1 call made. - * - Retrieving the first page in verification moves the stream iterator to the initial next page, Reactor then - * needs to verify that the page after it emits. 2 calls made. - */ - assertEquals(2, pagedFlux.getNextPageRetrievals()); + // The goal for this test is that 0 next page retrieval calls are made. + assertEquals(0, pagedFlux.getNextPageRetrievals()); } @Test @@ -158,16 +150,8 @@ public void iterateFirstPage() { assertEquals(pagedResponses.get(0), pagedIterable.iterableByPage().iterator().next()); - /* - * The goal for this test would be that 0 next page retrieval calls are made but due to how Flux.concatWith - * works it needs to begin the next publisher to determine whether onNext or onComplete should trigger. This - * results in 2 next page retrieval calls for the following reason: - * - * - Makes the initial get first page call, then needs to validate that get next page emits. 1 call made. - * - Retrieving the first page in verification moves the stream iterator to the initial next page, Reactor then - * needs to verify that the page after it emits. 2 calls made. - */ - assertEquals(2, pagedFlux.getNextPageRetrievals()); + // The goal for this test is that 0 next page retrieval calls are made. + assertEquals(0, pagedFlux.getNextPageRetrievals()); } @Test From 4670ab7d835d1d3b7cf9f22862b37494bf3afd44 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Fri, 13 Dec 2019 13:36:54 -0800 Subject: [PATCH 15/34] Adding getElements() to Page that return elements as iterable-stream, deprecating getItems() that return list. --- .../ConfigurationSettingPage.java | 11 +++++++---- .../implementation/RestProxyWithMockTests.java | 9 +++++---- .../azure/core/http/rest/PagedResponse.java | 3 ++- .../core/http/rest/PagedResponseBase.java | 5 +++-- .../implementation/serializer/ItemPage.java | 5 +++-- .../core/util/paging/ContinuablePage.java | 18 ++++++++++++++++-- .../PagedFluxCoreJavaDocCodeSnippets.java | 6 ++++++ ...onseConstructorsCacheBenchMarkTestData.java | 5 +++-- .../CertificatePropertiesPage.java | 9 +++++---- .../implementation/ContactPage.java | 9 +++++---- .../implementation/DeletedCertificatePage.java | 9 +++++---- .../implementation/IssuerPropertiesPage.java | 9 +++++---- .../keys/implementation/DeletedKeyPage.java | 9 +++++---- .../keys/implementation/KeyPropertiesPage.java | 9 +++++---- .../implementation/DeletedSecretPage.java | 9 +++++---- .../implementation/SecretPropertiesPage.java | 9 +++++---- .../blob/batch/BlobBatchAsyncClient.java | 5 +++-- 17 files changed, 88 insertions(+), 51 deletions(-) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java index 8b8e9213a9a3..23c39ca7021b 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java @@ -2,6 +2,7 @@ // Licensed under the MIT License. package com.azure.data.appconfiguration.implementation; +import com.azure.core.util.IterableStream; import com.azure.data.appconfiguration.models.ConfigurationSetting; import com.azure.core.http.rest.Page; import com.fasterxml.jackson.annotation.JsonProperty; @@ -30,12 +31,14 @@ public String getContinuationToken() { } /** - * Gets the list of {@link ConfigurationSetting ConfigurationSettings} on this page. + * Gets the iterable stream of {@link ConfigurationSetting ConfigurationSettings} on this page. * - * @return The list of {@link ConfigurationSetting ConfigurationSettings}. + * @return The iterable stream of {@link ConfigurationSetting ConfigurationSettings}. */ @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream<>(items); } + + } diff --git a/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java b/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java index e37bf5091e7a..934cda0ff137 100644 --- a/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java +++ b/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java @@ -36,6 +36,7 @@ import com.azure.core.test.http.MockHttpResponse; import com.azure.core.test.http.NoOpHttpClient; import com.azure.core.util.Base64Url; +import com.azure.core.util.IterableStream; import com.fasterxml.jackson.annotation.JsonGetter; import com.fasterxml.jackson.annotation.JsonProperty; import java.nio.charset.StandardCharsets; @@ -468,8 +469,8 @@ static class KeyValuePage implements Page { } @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream(items); } @Override @@ -488,8 +489,8 @@ static class ConformingPage implements Page { } @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream<>(items); } @Override diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java index 3b7bc564e8f9..4c73455e6a66 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java @@ -4,6 +4,7 @@ import java.io.Closeable; import java.util.List; +import java.util.stream.Collectors; /** * Response of a REST API that returns page. @@ -21,6 +22,6 @@ public interface PagedResponse extends Page, Response>, Closeable * @return The items in the page. */ default List getValue() { - return getItems(); + return this.getElements().stream().collect(Collectors.toList()); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java index ea678d8d9d32..88f20e61540a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java @@ -5,6 +5,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; +import com.azure.core.util.IterableStream; import java.util.List; @@ -62,8 +63,8 @@ public PagedResponseBase(HttpRequest request, int statusCode, HttpHeaders header * {@inheritDoc} */ @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream(items); } /** 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 510375e3db01..e1fc3bfd7642 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 @@ -4,6 +4,7 @@ package com.azure.core.implementation.serializer; import com.azure.core.http.rest.Page; +import com.azure.core.util.IterableStream; import com.fasterxml.jackson.annotation.JsonAlias; import java.util.List; @@ -30,8 +31,8 @@ class ItemPage implements Page { private String continuationToken; @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream(items); } @Override diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java index cea5be3af4eb..ba55ab5ec3ae 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java @@ -3,7 +3,10 @@ package com.azure.core.util.paging; +import com.azure.core.util.IterableStream; + import java.util.List; +import java.util.stream.Collectors; /** * Represents Page from service that has reference (a.k.a continuation token) to next set @@ -16,9 +19,20 @@ */ public interface ContinuablePage { /** - * @return list of items in the page. + * @return a iterable stream of elements in the page. */ - List getItems(); + IterableStream getElements(); + + /** + * @return list of elements in the page. + * + * @deprecated use {@link this#getElements()}. + */ + @Deprecated + default List getItems() { + return this.getElements().stream().collect(Collectors.toList()); + } + /** * @return A reference to the next page, or {@code null} if there are no more pages. */ diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java index 8b57b52d1df6..e446eac0d3e6 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java @@ -3,6 +3,7 @@ package com.azure.core.util.paging; +import com.azure.core.util.IterableStream; import reactor.core.publisher.Flux; import java.util.List; @@ -50,6 +51,11 @@ class File { } class FilePage implements ContinuablePage { + @Override + public IterableStream getElements() { + return null; + } + @Override public List getItems() { return null; diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/ResponseConstructorsCacheBenchMarkTestData.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/ResponseConstructorsCacheBenchMarkTestData.java index ddac597b3510..19041f45fcd6 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/ResponseConstructorsCacheBenchMarkTestData.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/ResponseConstructorsCacheBenchMarkTestData.java @@ -8,6 +8,7 @@ import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; import com.azure.core.implementation.serializer.HttpResponseDecoder; +import com.azure.core.util.IterableStream; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.core.util.serializer.JacksonAdapter; @@ -174,10 +175,10 @@ public Mono getBodyAsString(Charset charset) { private static final byte[] STREAM_BYTE_ARRAY = new byte[1]; private static final Page PAGE_FOO = new Page() { @Override - public List getItems() { + public IterableStream getElements() { List items = new ArrayList<>(); items.add(FOO); - return items; + return new IterableStream(items); } @Override diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java index 2d9da743580e..10ed16c1faf1 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.certificates.implementation; import com.azure.core.http.rest.Page; +import com.azure.core.util.IterableStream; import com.azure.security.keyvault.certificates.models.CertificateProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -38,13 +39,13 @@ public String getContinuationToken() { } /** - * Gets the list of {@link CertificateProperties CertificateProperties} on this page. + * Gets the iterable stream of {@link CertificateProperties CertificateProperties} on this page. * - * @return The list of items in {@link List}. + * @return The iterable stream of items in {@link List}. */ @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream<>(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java index 9197f3289bf6..fa8ec4b93980 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.certificates.implementation; import com.azure.core.http.rest.Page; +import com.azure.core.util.IterableStream; import com.azure.security.keyvault.certificates.models.CertificateContact; import com.fasterxml.jackson.annotation.JsonProperty; @@ -22,13 +23,13 @@ public final class ContactPage implements Page { private List items; /** - * Gets the list of {@link CertificateContact contacts} on this page. + * Gets the iterable stream of {@link CertificateContact contacts} on this page. * - * @return The list of items in {@link List}. + * @return The iterable stream of items in {@link List}. */ @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream<>(items); } @Override diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java index 54454924a429..92cd553e911a 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.certificates.implementation; import com.azure.core.http.rest.Page; +import com.azure.core.util.IterableStream; import com.azure.security.keyvault.certificates.models.DeletedCertificate; import com.fasterxml.jackson.annotation.JsonProperty; @@ -38,12 +39,12 @@ public String getContinuationToken() { } /** - * Gets the list of {@link DeletedCertificate deletedSecrets} on this page. + * Gets the iterable stream of {@link DeletedCertificate deletedSecrets} on this page. * - * @return The list of items in {@link List}. + * @return The iterable stream of items in {@link List}. */ @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream<>(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java index 203754cb85c9..03cac2e701bb 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.certificates.implementation; import com.azure.core.http.rest.Page; +import com.azure.core.util.IterableStream; import com.azure.security.keyvault.certificates.models.IssuerProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -38,12 +39,12 @@ public String getContinuationToken() { } /** - * Gets the list of {@link IssuerProperties issuers} on this page. + * Gets the iterable stream of {@link IssuerProperties issuers} on this page. * - * @return The list of items in {@link List}. + * @return The iterable stream of items in {@link List}. */ @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream<>(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java index b25b7795124a..f762e9c100b9 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.keys.implementation; import com.azure.core.http.rest.Page; +import com.azure.core.util.IterableStream; import com.azure.security.keyvault.keys.models.DeletedKey; import com.fasterxml.jackson.annotation.JsonProperty; @@ -38,12 +39,12 @@ public String getContinuationToken() { } /** - * Gets the list of {@link DeletedKey deletedSecrets} on this page. + * Gets the iterable stream of {@link DeletedKey deletedSecrets} on this page. * - * @return The list of items in {@link List}. + * @return The iterable stream of items in {@link List}. */ @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream<>(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java index 77d15a657223..c5c1197bb12a 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.keys.implementation; import com.azure.core.http.rest.Page; +import com.azure.core.util.IterableStream; import com.azure.security.keyvault.keys.models.KeyProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -38,13 +39,13 @@ public String getContinuationToken() { } /** - * Gets the list of {@link KeyProperties KeyProperties} on this page. + * Gets the iterable stream of {@link KeyProperties KeyProperties} on this page. * - * @return The list of items in {@link List}. + * @return The iterable stream of items in {@link List}. */ @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java index d7b0cc9a09d6..e501fe33cd32 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.secrets.implementation; import com.azure.core.http.rest.Page; +import com.azure.core.util.IterableStream; import com.azure.security.keyvault.secrets.models.DeletedSecret; import com.fasterxml.jackson.annotation.JsonProperty; @@ -38,12 +39,12 @@ public String getContinuationToken() { } /** - * Gets the list of {@link DeletedSecret deletedSecrets} on this page. + * Gets the iterable stream of {@link DeletedSecret deletedSecrets} on this page. * - * @return The list of items in {@link List}. + * @return The iterable stream of items in {@link List}. */ @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java index 8e23a697ea25..2b928a6698e0 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.secrets.implementation; import com.azure.core.http.rest.Page; +import com.azure.core.util.IterableStream; import com.azure.security.keyvault.secrets.models.SecretProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -38,12 +39,12 @@ public String getContinuationToken() { } /** - * Gets the list of {@link SecretProperties SecretProperties} on this page. + * Gets the iterable stream of {@link SecretProperties SecretProperties} on this page. * - * @return The list of items in {@link List}. + * @return The iterable stream of items in {@link List}. */ @Override - public List getItems() { - return items; + public IterableStream getElements() { + return new IterableStream(items); } } diff --git a/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchAsyncClient.java b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchAsyncClient.java index 5834e825e762..3a004d73aca9 100644 --- a/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchAsyncClient.java +++ b/sdk/storage/azure-storage-blob-batch/src/main/java/com/azure/storage/blob/batch/BlobBatchAsyncClient.java @@ -14,6 +14,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.IterableStream; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobServiceVersion; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; @@ -209,8 +210,8 @@ private Mono>> submitBatchHelper(List blob private PagedResponse> initPagedResponse(List> values, Response response) { return new PagedResponse>() { @Override - public List> getItems() { - return values; + public IterableStream> getElements() { + return new IterableStream<>(values); } @Override From 0e48a1181252b931b1d9862bf1aaf5a8e8794e73 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Fri, 13 Dec 2019 13:46:47 -0800 Subject: [PATCH 16/34] Moving deprecated getItems() to REST Page --- .../main/java/com/azure/core/http/rest/Page.java | 12 ++++++++++++ .../com/azure/core/util/paging/ContinuablePage.java | 13 ------------- .../core/util/paging/ContinuablePagedFluxCore.java | 2 +- .../paging/PagedFluxCoreJavaDocCodeSnippets.java | 5 ----- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java index 2ca95cd33ac5..c9b641d4a328 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java @@ -5,10 +5,22 @@ import com.azure.core.util.paging.ContinuablePage; +import java.util.List; +import java.util.stream.Collectors; + /** * Represents a paginated REST response from the service. * * @param Type of items in the page response. */ public interface Page extends ContinuablePage { + /** + * @return list of elements in the page. + * + * @deprecated use {@link this#getElements()}. + */ + @Deprecated + default List getItems() { + return this.getElements().stream().collect(Collectors.toList()); + } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java index ba55ab5ec3ae..5fa0a5416e28 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java @@ -5,9 +5,6 @@ import com.azure.core.util.IterableStream; -import java.util.List; -import java.util.stream.Collectors; - /** * Represents Page from service that has reference (a.k.a continuation token) to next set * of one or more pages. @@ -23,16 +20,6 @@ public interface ContinuablePage { */ IterableStream getElements(); - /** - * @return list of elements in the page. - * - * @deprecated use {@link this#getElements()}. - */ - @Deprecated - default List getItems() { - return this.getElements().stream().collect(Collectors.toList()); - } - /** * @return A reference to the next page, or {@code null} if there are no more pages. */ diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index 1223f711acdf..e99855a982cb 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -123,7 +123,7 @@ private static > Flux

concatPagedFlux(C @Override public void subscribe(CoreSubscriber coreSubscriber) { byPage() - .flatMap(page -> Flux.fromIterable(page.getItems())) + .flatMap(page -> Flux.fromIterable(page.getElements())) .subscribe(coreSubscriber); } diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java index e446eac0d3e6..a20c35aefa2e 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java @@ -56,11 +56,6 @@ public IterableStream getElements() { return null; } - @Override - public List getItems() { - return null; - } - @Override public FileContinuationToken getContinuationToken() { return null; From 4a67f98cebeaa421933a0e9d3815891b8629acfa Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Fri, 13 Dec 2019 16:45:00 -0800 Subject: [PATCH 17/34] Checking for null page items before creating IterableStream, Fixing the bug of not sending token in provider based mapPage impl --- .../src/main/java/com/azure/core/http/rest/Page.java | 6 +++++- .../src/main/java/com/azure/core/http/rest/PagedFlux.java | 2 +- .../main/java/com/azure/core/http/rest/PagedResponse.java | 7 ++++++- .../java/com/azure/core/http/rest/PagedResponseBase.java | 4 +++- .../azure/core/implementation/serializer/ItemPage.java | 4 +++- .../azure/core/util/paging/ContinuablePagedFluxCore.java | 8 +++++++- .../util/paging/PagedFluxCoreJavaDocCodeSnippets.java | 1 - 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java index c9b641d4a328..dcd5b6a32b13 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java @@ -3,6 +3,7 @@ package com.azure.core.http.rest; +import com.azure.core.util.IterableStream; import com.azure.core.util.paging.ContinuablePage; import java.util.List; @@ -21,6 +22,9 @@ public interface Page extends ContinuablePage { */ @Deprecated default List getItems() { - return this.getElements().stream().collect(Collectors.toList()); + IterableStream iterableStream = this.getElements(); + return iterableStream == null + ? null + : this.getElements().stream().collect(Collectors.toList()); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index 82fe29e62053..f5e0719bb7f5 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -106,7 +106,7 @@ public PagedFlux(PageRetrieverProvider> provider) { */ @Deprecated public PagedFlux mapPage(Function mapper) { - return new PagedFlux((PageRetrieverProvider>) () -> c -> byPage() + return new PagedFlux((PageRetrieverProvider>) () -> c -> byPage(c) .map(mapPagedResponse(mapper))); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java index 4c73455e6a66..afba800cf1a7 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java @@ -2,6 +2,8 @@ // Licensed under the MIT License. package com.azure.core.http.rest; +import com.azure.core.util.IterableStream; + import java.io.Closeable; import java.util.List; import java.util.stream.Collectors; @@ -22,6 +24,9 @@ public interface PagedResponse extends Page, Response>, Closeable * @return The items in the page. */ default List getValue() { - return this.getElements().stream().collect(Collectors.toList()); + IterableStream iterableStream = this.getElements(); + return iterableStream == null + ? null + : iterableStream.stream().collect(Collectors.toList()); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java index 88f20e61540a..5a99069e26cc 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java @@ -64,7 +64,9 @@ public PagedResponseBase(HttpRequest request, int statusCode, HttpHeaders header */ @Override public IterableStream getElements() { - return new IterableStream(items); + return items == null + ? null + : new IterableStream(items); } /** 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 e1fc3bfd7642..d03de25fe709 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 @@ -32,7 +32,9 @@ class ItemPage implements Page { @Override public IterableStream getElements() { - return new IterableStream(items); + return items == null + ? null + : new IterableStream(items); } @Override diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index e99855a982cb..8973b0712b37 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -3,6 +3,7 @@ package com.azure.core.util.paging; +import com.azure.core.util.IterableStream; import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -123,7 +124,12 @@ private static > Flux

concatPagedFlux(C @Override public void subscribe(CoreSubscriber coreSubscriber) { byPage() - .flatMap(page -> Flux.fromIterable(page.getElements())) + .flatMap(page -> { + IterableStream iterableStream = page.getElements(); + return iterableStream == null + ? Flux.empty() + : Flux.fromIterable(page.getElements()); + }) .subscribe(coreSubscriber); } diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java index a20c35aefa2e..d22f89f8d3d1 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java @@ -6,7 +6,6 @@ import com.azure.core.util.IterableStream; import reactor.core.publisher.Flux; -import java.util.List; import java.util.function.Function; import java.util.function.Supplier; From 9f77c8073adc14f2047f5e560cd979fb26581806 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Fri, 13 Dec 2019 16:45:47 -0800 Subject: [PATCH 18/34] Re-recording data lake test as we no longer make extra network call --- .../ServiceAPITestlistfilesystemserror.json | 132 ++++++------------ 1 file changed, 46 insertions(+), 86 deletions(-) diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemserror.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemserror.json index 8288be4745fa..c2ac8e099e8a 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemserror.json +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemserror.json @@ -1,87 +1,47 @@ { - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemserror019690f1314b4d43e349c2?restype=container", - "Headers" : { - "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "1c3276e9-e90a-4d13-b489-9230a9b07d69" - }, - "Response" : { - "x-ms-version" : "2019-02-02", - "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA63F0308", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:40 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dc6fd643-e01e-007c-5cd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "1c3276e9-e90a-4d13-b489-9230a9b07d69" - }, - "Exception" : null - }, { - "Method" : "GET", - "Uri" : "https://gaprahns.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 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "80bf437e-2e52-48ca-99c3-83f42288e626" - }, - "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" : "3a65698c-a01e-0034-13d3-90e1d2000000", - "Body" : "OutOfRangeInputOne of the request inputs is out of range.\nRequestId:3a65698c-a01e-0034-13d3-90e1d2000000\nTime:2019-11-01T16:43:40.1298162Z", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "80bf437e-2e52-48ca-99c3-83f42288e626", - "Content-Type" : "application/xml" - }, - "Exception" : null - }, { - "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfslistfilesystemserror&comp=list", - "Headers" : { - "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "84b9e90e-e727-428b-be15-517086fb46f9" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2019-02-02", - "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "dc6fd669-e01e-007c-7fd3-90d34f000000", - "Body" : "jtfslistfilesystemserrorjtfslistfilesystemserror019690f1314b4d43e349c2Fri, 01 Nov 2019 16:43:40 GMT\"0x8D75EEAA63F0308\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "84b9e90e-e727-428b-be15-517086fb46f9", - "Content-Type" : "application/xml" - }, - "Exception" : null - }, { - "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemserror019690f1314b4d43e349c2?restype=container", - "Headers" : { - "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "80b1bc84-a76a-49af-b64a-edb76939b404" - }, - "Response" : { - "x-ms-version" : "2019-02-02", - "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "3a6569c1-a01e-0034-42d3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "80b1bc84-a76a-49af-b64a-edb76939b404" - }, - "Exception" : null - } ], - "variables" : [ "jtfslistfilesystemserror019690f1314b4d43e349c2" ] -} \ No newline at end of file + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemserror094204812b3a48abea475c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "4f9b17d9-8c14-4694-9120-9c78c171fd02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7802DB5DD7CC2", + "Last-Modified" : "Sat, 14 Dec 2019 00:36:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "f283edee-201e-00e6-3e16-b22186000000", + "Date" : "Sat, 14 Dec 2019 00:36:50 GMT", + "x-ms-client-request-id" : "4f9b17d9-8c14-4694-9120-9c78c171fd02" + }, + "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.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "41dc6201-e074-4658-ac33-ef08ac413452" + }, + "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" : "f283ee29-201e-00e6-7116-b22186000000", + "Body" : "OutOfRangeInputOne of the request inputs is out of range.\nRequestId:f283ee29-201e-00e6-7116-b22186000000\nTime:2019-12-14T00:36:51.2002287Z", + "Date" : "Sat, 14 Dec 2019 00:36:51 GMT", + "x-ms-client-request-id" : "41dc6201-e074-4658-ac33-ef08ac413452", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtfslistfilesystemserror094204812b3a48abea475c" ] +} From daff6076cf4a31f63bd1434472f4248d6e161c4b Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sat, 14 Dec 2019 12:40:59 -0800 Subject: [PATCH 19/34] Handle the case where byPage(ct) can be invoked on a PagedFlux created by mapPage() API --- .../com/azure/core/http/rest/PagedFlux.java | 12 ++++++--- .../rest/PagedFluxJavaDocCodeSnippets.java | 27 ++++++++++--------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index f5e0719bb7f5..154a132fa5e3 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -22,7 +22,7 @@ *

Code sample

* {@codesnippet com.azure.core.http.rest.pagedflux.items} * - *

To process one page at a time, use {@link #byPage} method as shown below

+ *

To process one page at a time, use {@link #byPage()} method as shown below

*

Code sample

* {@codesnippet com.azure.core.http.rest.pagedflux.pages} * @@ -106,8 +106,14 @@ public PagedFlux(PageRetrieverProvider> provider) { */ @Deprecated public PagedFlux mapPage(Function mapper) { - return new PagedFlux((PageRetrieverProvider>) () -> c -> byPage(c) - .map(mapPagedResponse(mapper))); + PageRetrieverProvider> provider = () -> continuationToken -> { + Flux> flux = (continuationToken == null) + ? byPage() + : byPage(continuationToken); + return flux + .map(mapPagedResponse(mapper)); + }; + return new PagedFlux<>(provider); } private Function, PagedResponse> mapPagedResponse(Function mapper) { diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java index 64ca026fc8b5..d2595a5ec0b9 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java @@ -151,8 +151,7 @@ public void pagedFluxFromPagedFlux() { // Transform a PagedFlux with Integer items to PagedFlux of String items. final PagedFlux intPagedFlux = createAnInstance(); - - Function, PagedResponse> responseMapper + final Function, PagedResponse> responseMapper = intResponse -> new PagedResponseBase(intResponse.getRequest(), intResponse.getStatusCode(), intResponse.getHeaders(), @@ -161,19 +160,23 @@ public void pagedFluxFromPagedFlux() { .map(intValue -> Integer.toString(intValue)).collect(Collectors.toList()), intResponse.getContinuationToken(), null); - - PagedFlux strPagedFlux = new PagedFlux<>(() -> - (Function>>) ct -> intPagedFlux - .byPage() - .map(responseMapper)); + final PageRetrieverProvider> provider = () -> continuationToken -> { + Flux> flux = (continuationToken == null) + ? intPagedFlux.byPage() + : intPagedFlux.byPage(continuationToken); + return flux.map(responseMapper); + }; + PagedFlux strPagedFlux = new PagedFlux<>(provider); // Create a PagedFlux from a PagedFlux with all exceptions mapped to a specific exception. final PagedFlux pagedFlux = createAnInstance(); - final PagedFlux pagedFluxWithExceptionMapped = new PagedFlux<>(() -> - (Function>>) ct -> pagedFlux - .byPage() - .onErrorMap(t -> new PaginationException(t))); - + final PageRetrieverProvider> eprovider = () -> continuationToken -> { + Flux> flux = (continuationToken == null) + ? pagedFlux.byPage() + : pagedFlux.byPage(continuationToken); + return flux.onErrorMap(t -> new PaginationException(t)); + }; + final PagedFlux exceptionMappedPagedFlux = new PagedFlux<>(eprovider); // END: com.azure.core.http.rest.pagedflux..ctr.decoration } From 1607889fe1e8b8cd4bbd28d649a1162930659b0b Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sat, 14 Dec 2019 12:42:24 -0800 Subject: [PATCH 20/34] re-record datalake tests using PagedFlux/PagedIterable --- .../ServiceAPITestlistfilesystems.json | 58 +-- .../ServiceAPITestlistfilesystemsdetails.json | 86 ++--- .../ServiceAPITestlistfilesystemserror.json | 132 ++++--- .../ServiceAPITestlistfilesystemsmarker.json | 338 +++++++++--------- ...rviceAPITestlistfilesystemsmaxresults.json | 212 +++++------ .../ServiceAPITestlistfilesystemsmin.json | 58 +-- ...temswithtimeoutstillbackedbypagedflux.json | 247 +++++++------ 7 files changed, 596 insertions(+), 535 deletions(-) diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystems.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystems.json index 3635b27b99d9..987cd55ff90d 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystems.json +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystems.json @@ -1,32 +1,32 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystems0serviceapitestlistfilesystemsae737054209?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystems0serviceapitestlistfilesystems19c650541ba?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "597512c9-2228-4446-9039-257dfadda2ab" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "af78b290-7a25-4931-ab94-d4ca9976e881" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA453A35E", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:36 GMT", + "ETag" : "0x8D7807B59CD1C80", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:37 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd10d-e01e-007c-1cd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:36 GMT", - "x-ms-client-request-id" : "597512c9-2228-4446-9039-257dfadda2ab" + "x-ms-request-id" : "23a46533-001e-001f-2864-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:36 GMT", + "x-ms-client-request-id" : "af78b290-7a25-4931-ab94-d4ca9976e881" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfslistfilesystems&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtfslistfilesystems&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "664bb54c-91a6-4c30-b475-0e6abeba1362" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "6c2d8cbe-1706-45fc-b0d2-cc52d41331b2" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -34,20 +34,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd12c-e01e-007c-3ad3-90d34f000000", - "Body" : "jtfslistfilesystemsjtfslistfilesystems0serviceapitestlistfilesystemsae737054209Fri, 01 Nov 2019 16:43:36 GMT\"0x8D75EEAA453A35E\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:36 GMT", - "x-ms-client-request-id" : "664bb54c-91a6-4c30-b475-0e6abeba1362", + "x-ms-request-id" : "23a4655d-001e-001f-4c64-b2eb66000000", + "Body" : "jtfslistfilesystemsjtfslistfilesystems0serviceapitestlistfilesystems19c650541baSat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B59CD1C80\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:36 GMT", + "x-ms-client-request-id" : "6c2d8cbe-1706-45fc-b0d2-cc52d41331b2", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfslistfilesystems&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtfslistfilesystems&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "54ccdcbf-217d-469e-a061-c57f9d44f17b" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "43092665-57f5-497c-8c09-7fc01168d26e" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -55,20 +55,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd134-e01e-007c-41d3-90d34f000000", - "Body" : "jtfslistfilesystemsjtfslistfilesystems0serviceapitestlistfilesystemsae737054209Fri, 01 Nov 2019 16:43:36 GMT\"0x8D75EEAA453A35E\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:36 GMT", - "x-ms-client-request-id" : "54ccdcbf-217d-469e-a061-c57f9d44f17b", + "x-ms-request-id" : "23a4657e-001e-001f-6964-b2eb66000000", + "Body" : "jtfslistfilesystemsjtfslistfilesystems0serviceapitestlistfilesystems19c650541baSat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B59CD1C80\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:36 GMT", + "x-ms-client-request-id" : "43092665-57f5-497c-8c09-7fc01168d26e", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystems0serviceapitestlistfilesystemsae737054209?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystems0serviceapitestlistfilesystems19c650541ba?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "ede3f689-cf54-4893-981d-f4625df875a7" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "76b3fc62-176d-4720-9372-62e42dd93782" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -76,11 +76,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd142-e01e-007c-4ed3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:36 GMT", - "x-ms-client-request-id" : "ede3f689-cf54-4893-981d-f4625df875a7" + "x-ms-request-id" : "23a46589-001e-001f-7364-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:36 GMT", + "x-ms-client-request-id" : "76b3fc62-176d-4720-9372-62e42dd93782" }, "Exception" : null } ], - "variables" : [ "jtfslistfilesystems0serviceapitestlistfilesystemsae737054209" ] + "variables" : [ "jtfslistfilesystems0serviceapitestlistfilesystems19c650541ba" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsdetails.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsdetails.json index d5ebfe71cc30..f2f42183abdf 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsdetails.json +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsdetails.json @@ -1,53 +1,53 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsdetails025381f8d96fac343347f?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsdetails04977540c0d2b72c8d4d5?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "d6cdd7d4-4222-4c77-82ae-648693c6ad88" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "8dacfc20-d2cf-4c0a-8d7b-05fb7a8837c8" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA56C98FE", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:38 GMT", + "ETag" : "0x8D7807B5B163FB3", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:39 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd3c5-e01e-007c-0cd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "d6cdd7d4-4222-4c77-82ae-648693c6ad88" + "x-ms-request-id" : "23a46805-001e-001f-0664-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "8dacfc20-d2cf-4c0a-8d7b-05fb7a8837c8" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/aaajtfslistfilesystemsdetails180376fae5a9782999456?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/aaajtfslistfilesystemsdetails153724c675249a3b63468?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "ce1698db-c1d6-4764-9ef2-5437c1063918" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "26c495a0-2bc6-4f1b-a600-88596bc71646" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA5757436", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:38 GMT", + "ETag" : "0x8D7807B5B1E09C5", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:39 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd3e2-e01e-007c-26d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "ce1698db-c1d6-4764-9ef2-5437c1063918" + "x-ms-request-id" : "23a46810-001e-001f-0d64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "26c495a0-2bc6-4f1b-a600-88596bc71646" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=aaajtfs&include=metadata&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=aaajtfs&include=metadata&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "95faa92f-5c06-4a82-8730-3f6f8848ce58" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "8820d134-ea35-4eea-885c-1b2db0325a9c" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -55,20 +55,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd40c-e01e-007c-49d3-90d34f000000", - "Body" : "aaajtfsaaajtfslistfilesystemsdetails180376fae5a9782999456Fri, 01 Nov 2019 16:43:38 GMT\"0x8D75EEAA5757436\"unlockedavailable$account-encryption-keyfalsefalsefalsebar", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "95faa92f-5c06-4a82-8730-3f6f8848ce58", + "x-ms-request-id" : "23a46819-001e-001f-1464-b2eb66000000", + "Body" : "aaajtfsaaajtfslistfilesystemsdetails153724c675249a3b63468Sat, 14 Dec 2019 09:52:39 GMT\"0x8D7807B5B1E09C5\"unlockedavailable$account-encryption-keyfalsefalsefalsebar", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "8820d134-ea35-4eea-885c-1b2db0325a9c", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/aaajtfslistfilesystemsdetails180376fae5a9782999456?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/aaajtfslistfilesystemsdetails153724c675249a3b63468?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "6356540d-0a7f-4bdf-910a-ff6637736f85" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "b27a650c-194c-42bf-8158-f54e9c4962e2" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -76,18 +76,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd426-e01e-007c-60d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "6356540d-0a7f-4bdf-910a-ff6637736f85" + "x-ms-request-id" : "23a46827-001e-001f-2064-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "b27a650c-194c-42bf-8158-f54e9c4962e2" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfslistfilesystemsdetails&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtfslistfilesystemsdetails&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "636eb102-0cfa-48aa-90c2-e792efc77f0c" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "414ae3da-d899-43d6-9e02-bb96c5a197ca" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -95,20 +95,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd442-e01e-007c-7bd3-90d34f000000", - "Body" : "jtfslistfilesystemsdetailsjtfslistfilesystemsdetails025381f8d96fac343347fFri, 01 Nov 2019 16:43:38 GMT\"0x8D75EEAA56C98FE\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "636eb102-0cfa-48aa-90c2-e792efc77f0c", + "x-ms-request-id" : "23a46835-001e-001f-2d64-b2eb66000000", + "Body" : "jtfslistfilesystemsdetailsjtfslistfilesystemsdetails04977540c0d2b72c8d4d5Sat, 14 Dec 2019 09:52:39 GMT\"0x8D7807B5B163FB3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "414ae3da-d899-43d6-9e02-bb96c5a197ca", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsdetails025381f8d96fac343347f?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsdetails04977540c0d2b72c8d4d5?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "2865e48b-a2a6-43cd-84fb-bb624daa8fef" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "a73d6854-2500-46ef-a4b8-f58acbec842d" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -116,11 +116,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd45b-e01e-007c-12d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "2865e48b-a2a6-43cd-84fb-bb624daa8fef" + "x-ms-request-id" : "23a46841-001e-001f-3664-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "a73d6854-2500-46ef-a4b8-f58acbec842d" }, "Exception" : null } ], - "variables" : [ "jtfslistfilesystemsdetails025381f8d96fac343347f", "jtfslistfilesystemsdetails180376fae5a9782999456" ] + "variables" : [ "jtfslistfilesystemsdetails04977540c0d2b72c8d4d5", "jtfslistfilesystemsdetails153724c675249a3b63468" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemserror.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemserror.json index c2ac8e099e8a..1e16fdac7555 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemserror.json +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemserror.json @@ -1,47 +1,87 @@ { - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemserror094204812b3a48abea475c?restype=container", - "Headers" : { - "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", - "x-ms-client-request-id" : "4f9b17d9-8c14-4694-9120-9c78c171fd02" - }, - "Response" : { - "x-ms-version" : "2019-02-02", - "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D7802DB5DD7CC2", - "Last-Modified" : "Sat, 14 Dec 2019 00:36:50 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "f283edee-201e-00e6-3e16-b22186000000", - "Date" : "Sat, 14 Dec 2019 00:36:50 GMT", - "x-ms-client-request-id" : "4f9b17d9-8c14-4694-9120-9c78c171fd02" - }, - "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.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", - "x-ms-client-request-id" : "41dc6201-e074-4658-ac33-ef08ac413452" - }, - "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" : "f283ee29-201e-00e6-7116-b22186000000", - "Body" : "OutOfRangeInputOne of the request inputs is out of range.\nRequestId:f283ee29-201e-00e6-7116-b22186000000\nTime:2019-12-14T00:36:51.2002287Z", - "Date" : "Sat, 14 Dec 2019 00:36:51 GMT", - "x-ms-client-request-id" : "41dc6201-e074-4658-ac33-ef08ac413452", - "Content-Type" : "application/xml" - }, - "Exception" : null - } ], - "variables" : [ "jtfslistfilesystemserror094204812b3a48abea475c" ] -} + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemserror030349f44bb95e4be24af0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "6bbd5a18-752e-4314-8c0f-98592bfc7983" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D7807B5BBF0489", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "23a46955-001e-001f-1c64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "6bbd5a18-752e-4314-8c0f-98592bfc7983" + }, + "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.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "1dd30e37-72c7-4fcc-946b-bebe9ca9740c" + }, + "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" : "22d96359-601e-004b-7a64-b201ec000000", + "Body" : "OutOfRangeInputOne of the request inputs is out of range.\nRequestId:22d96359-601e-004b-7a64-b201ec000000\nTime:2019-12-14T09:52:40.5493977Z", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "1dd30e37-72c7-4fcc-946b-bebe9ca9740c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtfslistfilesystemserror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "cdb30993-987e-4d3e-851f-d04b54b2f04c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "23a4697c-001e-001f-3c64-b2eb66000000", + "Body" : "jtfslistfilesystemserrorjtfslistfilesystemserror030349f44bb95e4be24af0Sat, 14 Dec 2019 09:52:40 GMT\"0x8D7807B5BBF0489\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "cdb30993-987e-4d3e-851f-d04b54b2f04c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemserror030349f44bb95e4be24af0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "1c6d83c7-1f79-405e-84b1-e70b71359953" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "22d9639b-601e-004b-3764-b201ec000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "1c6d83c7-1f79-405e-84b1-e70b71359953" + }, + "Exception" : null + } ], + "variables" : [ "jtfslistfilesystemserror030349f44bb95e4be24af0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmarker.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmarker.json index 3acb7d4fb323..ba250c7a6d04 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmarker.json +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmarker.json @@ -1,242 +1,242 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker0634870861cac45ed54536?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker060113386f451823704118?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "f0a2fce9-435e-4e17-acbd-db5bc47400eb" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "b57f351f-d490-4fed-baaf-39ee1fac5460" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA496FA10", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A295C9B", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:37 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd1a2-e01e-007c-1bd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "f0a2fce9-435e-4e17-acbd-db5bc47400eb" + "x-ms-request-id" : "23a465f9-001e-001f-4e64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:36 GMT", + "x-ms-client-request-id" : "b57f351f-d490-4fed-baaf-39ee1fac5460" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker195252732386fa76ee488c?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker1783403b83c6eb3dc34cbf?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "9615e9bc-b617-4a98-ae62-0752edd09a58" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "35aafb5d-b084-4228-8ee2-7b88c7ec3be4" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA49F871B", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A306325", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:37 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd1ae-e01e-007c-24d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "9615e9bc-b617-4a98-ae62-0752edd09a58" + "x-ms-request-id" : "23a4660c-001e-001f-5c64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "35aafb5d-b084-4228-8ee2-7b88c7ec3be4" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker22134759bcf916b5d24d71?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker205487e02fef9f7cf14690?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "3b61549d-8b2b-4e46-97b6-ff11a2feadd3" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "9f95118f-8ecf-41a9-910c-ce7dcc922738" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA4A83B40", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A3790D9", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:37 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd1c7-e01e-007c-37d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "3b61549d-8b2b-4e46-97b6-ff11a2feadd3" + "x-ms-request-id" : "23a46615-001e-001f-6464-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "9f95118f-8ecf-41a9-910c-ce7dcc922738" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker3554168918767accf44625?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker36635449c3d44452c748ab?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "6111d996-a3a4-4f05-a2ed-f5b736c01562" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "9fc06983-2d86-4b78-9e14-8875e5c61afa" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA4B0C846", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A3E9771", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:37 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd1d1-e01e-007c-40d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "6111d996-a3a4-4f05-a2ed-f5b736c01562" + "x-ms-request-id" : "23a4661d-001e-001f-6a64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "9fc06983-2d86-4b78-9e14-8875e5c61afa" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker48806442bf5cc614554a7f?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker45993913b011c25a9742d5?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "a4d71a54-18e7-44e0-9b43-32a967857339" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "2f1822db-f92e-45f5-a0cc-56d85ddaa403" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA4B95551", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A4576F2", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:38 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd1db-e01e-007c-49d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "a4d71a54-18e7-44e0-9b43-32a967857339" + "x-ms-request-id" : "23a46628-001e-001f-7364-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "2f1822db-f92e-45f5-a0cc-56d85ddaa403" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker5229493adb252b1b224833?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker546516b2bd354242664af6?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "771d5226-7401-4fcf-8849-dcf5e61f5d4a" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "68be6397-150d-4e03-9536-4b66051ec0d7" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA4C1BB44", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A4CA493", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:38 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd1f5-e01e-007c-60d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "771d5226-7401-4fcf-8849-dcf5e61f5d4a" + "x-ms-request-id" : "23a46639-001e-001f-8064-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "68be6397-150d-4e03-9536-4b66051ec0d7" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker6469750b5ec5452b6949af?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker600862977122f47f4f4a67?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "f8fbe510-b97f-4df3-8516-3a51c6c3c3d9" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "62f64d25-637f-4078-9610-944534834d76" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA4CA4853", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A57A3BD", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:38 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd206-e01e-007c-6ed3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "f8fbe510-b97f-4df3-8516-3a51c6c3c3d9" + "x-ms-request-id" : "23a46669-001e-001f-2864-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "62f64d25-637f-4078-9610-944534834d76" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker761275a16822cc214a4896?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker7655555acd1a8ab4b342f1?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "a5ad5d4f-073a-4a42-ae07-114b283d105b" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "2303bdef-3c22-4de1-8a80-e36afe79c0e0" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA4D34A9E", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A880E44", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:38 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd21c-e01e-007c-7dd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "a5ad5d4f-073a-4a42-ae07-114b283d105b" + "x-ms-request-id" : "23a466d8-001e-001f-0a64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "2303bdef-3c22-4de1-8a80-e36afe79c0e0" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker8270069bfdae6c2b7142f1?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker8351188edf9f6b872a4e5f?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "98eea9d6-288a-4ba6-bacf-70a5466d1a6e" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "7b519dda-fe8e-480d-9539-00ed24201e2f" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA4DC4CEE", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A8F14D7", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:38 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd230-e01e-007c-10d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "98eea9d6-288a-4ba6-bacf-70a5466d1a6e" + "x-ms-request-id" : "23a466e2-001e-001f-1364-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "7b519dda-fe8e-480d-9539-00ed24201e2f" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker987525ca22c954a6e646b0?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker944722f97801acac1c4782?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "da28c1cb-03d5-4cc7-8aac-c7748ab37ac6" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "db4472d3-679f-4b36-9749-5a017675b638" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA4E4D9F4", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A95F45D", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:38 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd246-e01e-007c-25d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "da28c1cb-03d5-4cc7-8aac-c7748ab37ac6" + "x-ms-request-id" : "23a466f2-001e-001f-2064-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "db4472d3-679f-4b36-9749-5a017675b638" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker104401905f9993d5f96424?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker105576877c5e066234d438?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "ed8e9ab8-171a-4f15-afd4-41492a0146c7" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "76db54ee-c542-4cab-9385-1e8675e8fa11" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA4ED6703", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A9D492C", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:38 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd24f-e01e-007c-2dd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "ed8e9ab8-171a-4f15-afd4-41492a0146c7" + "x-ms-request-id" : "23a46706-001e-001f-3164-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "76db54ee-c542-4cab-9385-1e8675e8fa11" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?comp=list", + "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 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "9dfb4bf1-49d6-4985-925b-3e2add7cc984" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "91acef80-b3ca-4b43-a0cb-57dd58ef0194" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -244,20 +244,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd263-e01e-007c-40d3-90d34f000000", - "Body" : "jtfslistfilesystemsmarker0634870861cac45ed54536Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA496FA10\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker104401905f9993d5f96424Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4ED6703\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker195252732386fa76ee488cFri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA49F871B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker22134759bcf916b5d24d71Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4A83B40\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker3554168918767accf44625Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4B0C846\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker48806442bf5cc614554a7fFri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4B95551\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker5229493adb252b1b224833Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4C1BB44\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker6469750b5ec5452b6949afFri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4CA4853\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker761275a16822cc214a4896Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4D34A9E\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker8270069bfdae6c2b7142f1Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4DC4CEE\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker987525ca22c954a6e646b0Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4E4D9F4\"unlockedavailable$account-encryption-keyfalsefalsefalsemyjavafilesystembasic1572562105127Thu, 31 Oct 2019 22:48:25 GMT\"0x8D75E5470D9C324\"unlockedavailable$account-encryption-keyfalsefalsefalsemyjavafilesystembasic1572562120661Thu, 31 Oct 2019 22:48:41 GMT\"0x8D75E547A1DAA46\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "9dfb4bf1-49d6-4985-925b-3e2add7cc984", + "x-ms-request-id" : "23a46716-001e-001f-3f64-b2eb66000000", + "Body" : "$rootTue, 19 Nov 2019 11:40:20 GMT\"0x8D76CE542061417\"unlockedavailable$account-encryption-keyfalsefalsefalse$webSat, 14 Dec 2019 01:05:12 GMT\"0x8D78031ABF042E1\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcencrypteduploadfile05846648b8ad172df34c529Mon, 25 Nov 2019 18:07:40 GMT\"0x8D771D25CC86ADE\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcencryption0encyptedblockblobapitestencryption17269138bc0Thu, 12 Dec 2019 22:38:05 GMT\"0x8D77F53F49755B0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsfilesystemsaspermissiontostring058845af6e555f601Fri, 13 Dec 2019 22:12:41 GMT\"0x8D7801992969142\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker060113386f451823704118Sat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B5A295C9B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker105576877c5e066234d438Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A9D492C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker1783403b83c6eb3dc34cbfSat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B5A306325\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker205487e02fef9f7cf14690Sat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B5A3790D9\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker36635449c3d44452c748abSat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B5A3E9771\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker45993913b011c25a9742d5Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A4576F2\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker546516b2bd354242664af6Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A4CA493\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker600862977122f47f4f4a67Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A57A3BD\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker7655555acd1a8ab4b342f1Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A880E44\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker8351188edf9f6b872a4e5fSat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A8F14D7\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker944722f97801acac1c4782Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A95F45D\"unlockedavailable$account-encryption-keyfalsefalsefalsemyjavacontainerbufferedupload1574709539461Mon, 25 Nov 2019 19:19:03 GMT\"0x8D771DC559DAA3C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "91acef80-b3ca-4b43-a0cb-57dd58ef0194", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfslistfilesystemsmarker&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtfslistfilesystemsmarker&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "d4c908ed-2ebf-42f5-87af-b0bfb61862ce" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "4a9f4899-1255-474d-88bf-f3f5f056d10a" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -265,20 +265,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd27d-e01e-007c-58d3-90d34f000000", - "Body" : "jtfslistfilesystemsmarkerjtfslistfilesystemsmarker0634870861cac45ed54536Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA496FA10\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker104401905f9993d5f96424Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4ED6703\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker195252732386fa76ee488cFri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA49F871B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker22134759bcf916b5d24d71Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4A83B40\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker3554168918767accf44625Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4B0C846\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker48806442bf5cc614554a7fFri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4B95551\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker5229493adb252b1b224833Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4C1BB44\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker6469750b5ec5452b6949afFri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4CA4853\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker761275a16822cc214a4896Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4D34A9E\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker8270069bfdae6c2b7142f1Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4DC4CEE\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker987525ca22c954a6e646b0Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4E4D9F4\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "d4c908ed-2ebf-42f5-87af-b0bfb61862ce", + "x-ms-request-id" : "23a46731-001e-001f-5964-b2eb66000000", + "Body" : "jtfslistfilesystemsmarkerjtfslistfilesystemsmarker060113386f451823704118Sat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B5A295C9B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker105576877c5e066234d438Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A9D492C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker1783403b83c6eb3dc34cbfSat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B5A306325\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker205487e02fef9f7cf14690Sat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B5A3790D9\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker36635449c3d44452c748abSat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B5A3E9771\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker45993913b011c25a9742d5Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A4576F2\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker546516b2bd354242664af6Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A4CA493\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker600862977122f47f4f4a67Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A57A3BD\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker7655555acd1a8ab4b342f1Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A880E44\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker8351188edf9f6b872a4e5fSat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A8F14D7\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmarker944722f97801acac1c4782Sat, 14 Dec 2019 09:52:38 GMT\"0x8D7807B5A95F45D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "4a9f4899-1255-474d-88bf-f3f5f056d10a", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker0634870861cac45ed54536?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker060113386f451823704118?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "35dd0358-7d0f-43a4-9961-2116279f5cbd" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "52f7c0c1-a2e1-4cfe-bbc6-a1151fddb80e" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -286,18 +286,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd2a7-e01e-007c-7fd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "35dd0358-7d0f-43a4-9961-2116279f5cbd" + "x-ms-request-id" : "23a46749-001e-001f-6a64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "52f7c0c1-a2e1-4cfe-bbc6-a1151fddb80e" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker104401905f9993d5f96424?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker105576877c5e066234d438?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "61b414d5-6ae9-43ce-a44f-a1605d03a8f7" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "930b37e5-20d9-457e-a015-643da5ea39d5" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -305,18 +305,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd2c5-e01e-007c-17d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "61b414d5-6ae9-43ce-a44f-a1605d03a8f7" + "x-ms-request-id" : "23a46751-001e-001f-7264-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:37 GMT", + "x-ms-client-request-id" : "930b37e5-20d9-457e-a015-643da5ea39d5" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker195252732386fa76ee488c?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker1783403b83c6eb3dc34cbf?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "95043da3-1806-4c9f-b406-c8fcd4ab5ef2" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "8cad05bc-bf6d-4774-a8ec-42757520c03e" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -324,18 +324,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd2d3-e01e-007c-25d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "95043da3-1806-4c9f-b406-c8fcd4ab5ef2" + "x-ms-request-id" : "23a46761-001e-001f-0164-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "8cad05bc-bf6d-4774-a8ec-42757520c03e" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker22134759bcf916b5d24d71?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker205487e02fef9f7cf14690?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "25075d2a-b28d-408f-bdea-4abc5d142750" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "221d21a9-5774-4373-865b-cb076e39f12b" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -343,18 +343,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd2e5-e01e-007c-37d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "25075d2a-b28d-408f-bdea-4abc5d142750" + "x-ms-request-id" : "23a46769-001e-001f-0964-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "221d21a9-5774-4373-865b-cb076e39f12b" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker3554168918767accf44625?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker36635449c3d44452c748ab?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "1fbb5e88-ba10-4568-8104-6a4aefff28e0" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "848fada6-089e-45a4-80b3-db56c09f7dd7" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -362,18 +362,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd2fd-e01e-007c-4cd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "1fbb5e88-ba10-4568-8104-6a4aefff28e0" + "x-ms-request-id" : "23a46784-001e-001f-2164-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "848fada6-089e-45a4-80b3-db56c09f7dd7" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker48806442bf5cc614554a7f?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker45993913b011c25a9742d5?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "b05745cc-2497-4b23-b639-eff260e166ec" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "d33116e0-d3a3-4b48-8d17-499642c02f11" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -381,18 +381,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd316-e01e-007c-63d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "b05745cc-2497-4b23-b639-eff260e166ec" + "x-ms-request-id" : "23a46794-001e-001f-2d64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "d33116e0-d3a3-4b48-8d17-499642c02f11" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker5229493adb252b1b224833?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker546516b2bd354242664af6?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "20611176-e168-4b7f-8c5b-f32656e9e783" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "2fef3801-2d41-4d21-b7cc-27ab1bb6e716" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -400,18 +400,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd330-e01e-007c-7dd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "20611176-e168-4b7f-8c5b-f32656e9e783" + "x-ms-request-id" : "23a467af-001e-001f-4164-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "2fef3801-2d41-4d21-b7cc-27ab1bb6e716" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker6469750b5ec5452b6949af?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker600862977122f47f4f4a67?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "4eadb426-28ee-45b3-8feb-6ba3182171e2" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "ee122f66-ba6b-4276-9759-607b8977ef37" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -419,18 +419,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd353-e01e-007c-1fd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "4eadb426-28ee-45b3-8feb-6ba3182171e2" + "x-ms-request-id" : "23a467c1-001e-001f-4f64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "ee122f66-ba6b-4276-9759-607b8977ef37" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker761275a16822cc214a4896?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker7655555acd1a8ab4b342f1?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "3e486b94-4e97-4894-9625-da193521f28c" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "91084a30-afb4-4395-ae7b-be8eddd7dfb3" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -438,18 +438,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd379-e01e-007c-44d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "3e486b94-4e97-4894-9625-da193521f28c" + "x-ms-request-id" : "23a467cb-001e-001f-5864-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "91084a30-afb4-4395-ae7b-be8eddd7dfb3" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker8270069bfdae6c2b7142f1?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker8351188edf9f6b872a4e5f?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "45232521-4210-4ea2-bd59-a360f3b3ef8d" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "240cb869-2066-4374-b535-966f04e94cf5" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -457,18 +457,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd394-e01e-007c-5ed3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "45232521-4210-4ea2-bd59-a360f3b3ef8d" + "x-ms-request-id" : "23a467e2-001e-001f-6c64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "240cb869-2066-4374-b535-966f04e94cf5" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmarker987525ca22c954a6e646b0?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmarker944722f97801acac1c4782?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "0f30000b-aab9-43ee-acbe-a5ab14b566fa" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "01e046ec-a57e-4433-857e-c41da9c803fe" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -476,11 +476,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd3ad-e01e-007c-77d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "0f30000b-aab9-43ee-acbe-a5ab14b566fa" + "x-ms-request-id" : "23a467f0-001e-001f-7764-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "01e046ec-a57e-4433-857e-c41da9c803fe" }, "Exception" : null } ], - "variables" : [ "jtfslistfilesystemsmarker0634870861cac45ed54536", "jtfslistfilesystemsmarker195252732386fa76ee488c", "jtfslistfilesystemsmarker22134759bcf916b5d24d71", "jtfslistfilesystemsmarker3554168918767accf44625", "jtfslistfilesystemsmarker48806442bf5cc614554a7f", "jtfslistfilesystemsmarker5229493adb252b1b224833", "jtfslistfilesystemsmarker6469750b5ec5452b6949af", "jtfslistfilesystemsmarker761275a16822cc214a4896", "jtfslistfilesystemsmarker8270069bfdae6c2b7142f1", "jtfslistfilesystemsmarker987525ca22c954a6e646b0", "jtfslistfilesystemsmarker104401905f9993d5f96424" ] + "variables" : [ "jtfslistfilesystemsmarker060113386f451823704118", "jtfslistfilesystemsmarker1783403b83c6eb3dc34cbf", "jtfslistfilesystemsmarker205487e02fef9f7cf14690", "jtfslistfilesystemsmarker36635449c3d44452c748ab", "jtfslistfilesystemsmarker45993913b011c25a9742d5", "jtfslistfilesystemsmarker546516b2bd354242664af6", "jtfslistfilesystemsmarker600862977122f47f4f4a67", "jtfslistfilesystemsmarker7655555acd1a8ab4b342f1", "jtfslistfilesystemsmarker8351188edf9f6b872a4e5f", "jtfslistfilesystemsmarker944722f97801acac1c4782", "jtfslistfilesystemsmarker105576877c5e066234d438" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmaxresults.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmaxresults.json index 0024b458708a..2c55f607c097 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmaxresults.json +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmaxresults.json @@ -1,137 +1,137 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults093051b3e84979a98744?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults094431153c17784c3645?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "8e00e88a-8312-4744-a860-5d60c61d6ee0" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "ccd028dd-17a9-4cc7-9515-8902a0668f05" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA59FE741", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:39 GMT", + "ETag" : "0x8D7807B5B421537", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:39 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd47e-e01e-007c-35d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:38 GMT", - "x-ms-client-request-id" : "8e00e88a-8312-4744-a860-5d60c61d6ee0" + "x-ms-request-id" : "23a46850-001e-001f-4364-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "ccd028dd-17a9-4cc7-9515-8902a0668f05" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults121660b4e075aeaaf0461?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults1631985345b5e0e2fe431?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "f5cce1df-91bd-45d5-b340-61b00a0d478b" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "a494f120-e91e-4c74-9cd2-b7fa9ffb183f" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA5ADF389", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:39 GMT", + "ETag" : "0x8D7807B5B4BDB8B", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:39 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd4c0-e01e-007c-71d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "f5cce1df-91bd-45d5-b340-61b00a0d478b" + "x-ms-request-id" : "23a4685d-001e-001f-4e64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "a494f120-e91e-4c74-9cd2-b7fa9ffb183f" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults121660b4e075aeaaf0462?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults1631985345b5e0e2fe432?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "f6b6ed33-e1bd-4288-99c3-3180442751ea" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "151d0de4-e102-4111-92be-d0d7cc5b0eb4" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA5B6A7A6", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:39 GMT", + "ETag" : "0x8D7807B5B537E85", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:39 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd4db-e01e-007c-0ad3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "f6b6ed33-e1bd-4288-99c3-3180442751ea" + "x-ms-request-id" : "23a46868-001e-001f-5664-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "151d0de4-e102-4111-92be-d0d7cc5b0eb4" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults121660b4e075aeaaf0463?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults1631985345b5e0e2fe433?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "d07e2003-d1b3-4edb-ad95-27534dc6f713" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "28911068-9f4a-447f-a53c-bb27b720e59e" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA5BF82DE", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:39 GMT", + "ETag" : "0x8D7807B5B5AFA67", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:39 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd4f7-e01e-007c-23d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "d07e2003-d1b3-4edb-ad95-27534dc6f713" + "x-ms-request-id" : "23a46877-001e-001f-6164-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:38 GMT", + "x-ms-client-request-id" : "28911068-9f4a-447f-a53c-bb27b720e59e" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults121660b4e075aeaaf0464?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults1631985345b5e0e2fe434?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "eb55fd71-355a-4eac-9196-ea3359ddc593" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "c609ec35-9638-4862-9404-8bb18e265320" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA5C948A5", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:39 GMT", + "ETag" : "0x8D7807B5B618BB5", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:39 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd512-e01e-007c-3dd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "eb55fd71-355a-4eac-9196-ea3359ddc593" + "x-ms-request-id" : "23a46884-001e-001f-6b64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "c609ec35-9638-4862-9404-8bb18e265320" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults121660b4e075aeaaf0465?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults1631985345b5e0e2fe435?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "ad99d453-8f86-4056-b5ca-4ec3d514c612" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "1a206a2f-6f7c-4185-b891-bb45c4f18a04" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA5D1FCC3", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:39 GMT", + "ETag" : "0x8D7807B5B692EA5", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:39 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd531-e01e-007c-58d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "ad99d453-8f86-4056-b5ca-4ec3d514c612" + "x-ms-request-id" : "23a46893-001e-001f-7764-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "1a206a2f-6f7c-4185-b891-bb45c4f18a04" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfslistfilesystemsmaxresults121660b4e075aeaaf046&maxresults=3&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtfslistfilesystemsmaxresults1631985345b5e0e2fe43&maxresults=3&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "0624b871-228f-46a4-bb41-342044aba918" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "f166ef42-50e4-41d6-ad81-938bb2c03fab" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -139,20 +139,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd556-e01e-007c-79d3-90d34f000000", - "Body" : "jtfslistfilesystemsmaxresults121660b4e075aeaaf0463jtfslistfilesystemsmaxresults121660b4e075aeaaf0461Fri, 01 Nov 2019 16:43:39 GMT\"0x8D75EEAA5ADF389\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmaxresults121660b4e075aeaaf0462Fri, 01 Nov 2019 16:43:39 GMT\"0x8D75EEAA5B6A7A6\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmaxresults121660b4e075aeaaf0463Fri, 01 Nov 2019 16:43:39 GMT\"0x8D75EEAA5BF82DE\"unlockedavailable$account-encryption-keyfalsefalsefalse/gaprahns/jtfslistfilesystemsmaxresults121660b4e075aeaaf0464", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "0624b871-228f-46a4-bb41-342044aba918", + "x-ms-request-id" : "23a468a8-001e-001f-0764-b2eb66000000", + "Body" : "jtfslistfilesystemsmaxresults1631985345b5e0e2fe433jtfslistfilesystemsmaxresults1631985345b5e0e2fe431Sat, 14 Dec 2019 09:52:39 GMT\"0x8D7807B5B4BDB8B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmaxresults1631985345b5e0e2fe432Sat, 14 Dec 2019 09:52:39 GMT\"0x8D7807B5B537E85\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmaxresults1631985345b5e0e2fe433Sat, 14 Dec 2019 09:52:39 GMT\"0x8D7807B5B5AFA67\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtfslistfilesystemsmaxresults1631985345b5e0e2fe434", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "f166ef42-50e4-41d6-ad81-938bb2c03fab", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfslistfilesystemsmaxresults121660b4e075aeaaf046&marker=/gaprahns/jtfslistfilesystemsmaxresults121660b4e075aeaaf0464&maxresults=3&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtfslistfilesystemsmaxresults1631985345b5e0e2fe43&marker=/azstoragesdkaccount/jtfslistfilesystemsmaxresults1631985345b5e0e2fe434&maxresults=3&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "73c89587-ef89-47b2-8115-7e20866f921a" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "d67cffcf-6a00-4dbd-8e48-ba5af46e85a2" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -160,20 +160,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd566-e01e-007c-09d3-90d34f000000", - "Body" : "jtfslistfilesystemsmaxresults121660b4e075aeaaf046/gaprahns/jtfslistfilesystemsmaxresults121660b4e075aeaaf04643jtfslistfilesystemsmaxresults121660b4e075aeaaf0464Fri, 01 Nov 2019 16:43:39 GMT\"0x8D75EEAA5C948A5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmaxresults121660b4e075aeaaf0465Fri, 01 Nov 2019 16:43:39 GMT\"0x8D75EEAA5D1FCC3\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "73c89587-ef89-47b2-8115-7e20866f921a", + "x-ms-request-id" : "23a468b1-001e-001f-0e64-b2eb66000000", + "Body" : "jtfslistfilesystemsmaxresults1631985345b5e0e2fe43/azstoragesdkaccount/jtfslistfilesystemsmaxresults1631985345b5e0e2fe4343jtfslistfilesystemsmaxresults1631985345b5e0e2fe434Sat, 14 Dec 2019 09:52:39 GMT\"0x8D7807B5B618BB5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmaxresults1631985345b5e0e2fe435Sat, 14 Dec 2019 09:52:39 GMT\"0x8D7807B5B692EA5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "d67cffcf-6a00-4dbd-8e48-ba5af46e85a2", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults121660b4e075aeaaf0461?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults1631985345b5e0e2fe431?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "7a9036b4-09a1-4631-8756-db1e4e2bce0d" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "3f2d50d0-ab10-4268-83c0-e0b697d380fc" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -181,18 +181,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "3a6568c5-a01e-0034-67d3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "7a9036b4-09a1-4631-8756-db1e4e2bce0d" + "x-ms-request-id" : "22d9624e-601e-004b-0764-b201ec000000", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "3f2d50d0-ab10-4268-83c0-e0b697d380fc" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults121660b4e075aeaaf0462?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults1631985345b5e0e2fe432?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "e8f7d368-d838-4c65-8180-f3b69ec1e5d5" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "d226b447-4d56-4862-aca8-1db5d03e2d9c" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -200,18 +200,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd5dd-e01e-007c-79d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "e8f7d368-d838-4c65-8180-f3b69ec1e5d5" + "x-ms-request-id" : "23a46903-001e-001f-5364-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "d226b447-4d56-4862-aca8-1db5d03e2d9c" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults121660b4e075aeaaf0463?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults1631985345b5e0e2fe433?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "0378379c-c50b-482e-970a-bba7dea5ed15" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "cc7aea3d-7ea4-4430-8763-b08329cdacf1" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -219,18 +219,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "3a6568f7-a01e-0034-11d3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "0378379c-c50b-482e-970a-bba7dea5ed15" + "x-ms-request-id" : "22d9629e-601e-004b-4f64-b201ec000000", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "cc7aea3d-7ea4-4430-8763-b08329cdacf1" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults121660b4e075aeaaf0464?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults1631985345b5e0e2fe434?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "b7150f49-a3f8-4d95-b9a6-5093de7959b4" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "4a6ca10b-d419-44aa-8a9f-741ed08c6a63" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -238,18 +238,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd600-e01e-007c-1bd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "b7150f49-a3f8-4d95-b9a6-5093de7959b4" + "x-ms-request-id" : "23a4691d-001e-001f-6c64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "4a6ca10b-d419-44aa-8a9f-741ed08c6a63" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults121660b4e075aeaaf0465?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults1631985345b5e0e2fe435?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "35e89a4b-919a-4575-b670-19ca00d551fd" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "9bc5b9bf-eb0e-4791-b251-b6fe44042608" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -257,18 +257,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "3a65692a-a01e-0034-3fd3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "35e89a4b-919a-4575-b670-19ca00d551fd" + "x-ms-request-id" : "22d962f6-601e-004b-1f64-b201ec000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "9bc5b9bf-eb0e-4791-b251-b6fe44042608" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfslistfilesystemsmaxresults&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtfslistfilesystemsmaxresults&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "2f7c108c-b777-4a77-a155-e09602da6c39" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "ea7bce28-7716-4cf7-ac36-ee26e7f3eda9" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -276,20 +276,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd620-e01e-007c-3bd3-90d34f000000", - "Body" : "jtfslistfilesystemsmaxresultsjtfslistfilesystemsmaxresults093051b3e84979a98744Fri, 01 Nov 2019 16:43:39 GMT\"0x8D75EEAA59FE741\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "2f7c108c-b777-4a77-a155-e09602da6c39", + "x-ms-request-id" : "23a46935-001e-001f-0264-b2eb66000000", + "Body" : "jtfslistfilesystemsmaxresultsjtfslistfilesystemsmaxresults094431153c17784c3645Sat, 14 Dec 2019 09:52:39 GMT\"0x8D7807B5B421537\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "ea7bce28-7716-4cf7-ac36-ee26e7f3eda9", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmaxresults093051b3e84979a98744?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmaxresults094431153c17784c3645?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "f7a0bff6-506b-417a-a39d-4cc410a1ba24" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "e71145da-22eb-4838-bffe-d2a8d3d0716a" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -297,11 +297,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "3a65694e-a01e-0034-5ed3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:39 GMT", - "x-ms-client-request-id" : "f7a0bff6-506b-417a-a39d-4cc410a1ba24" + "x-ms-request-id" : "22d9632e-601e-004b-5464-b201ec000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "e71145da-22eb-4838-bffe-d2a8d3d0716a" }, "Exception" : null } ], - "variables" : [ "jtfslistfilesystemsmaxresults093051b3e84979a98744", "jtfslistfilesystemsmaxresults121660b4e075aeaaf046" ] + "variables" : [ "jtfslistfilesystemsmaxresults094431153c17784c3645", "jtfslistfilesystemsmaxresults1631985345b5e0e2fe43" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmin.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmin.json index d115ee8d5e5c..337848ef9f13 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmin.json +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemsmin.json @@ -1,32 +1,32 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmin082487d3598e272a14471e9?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmin050098fd54c1d4f3554be08?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "dc0198da-3ce9-43a9-96dd-d8609c9b4047" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "5b372aac-6bd1-4c58-95dd-a3e0eb0870bd" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA4749ECF", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:37 GMT", + "ETag" : "0x8D7807B5A05C66A", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:37 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd153-e01e-007c-5dd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:36 GMT", - "x-ms-client-request-id" : "dc0198da-3ce9-43a9-96dd-d8609c9b4047" + "x-ms-request-id" : "23a465a4-001e-001f-0964-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:36 GMT", + "x-ms-client-request-id" : "5b372aac-6bd1-4c58-95dd-a3e0eb0870bd" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?comp=list", + "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 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "5b6ecd17-1a13-4bf9-b123-49ba2a49130c" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "d4d2ed4a-7ac5-49b9-a907-defa67621317" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -34,20 +34,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd16a-e01e-007c-6fd3-90d34f000000", - "Body" : "jtfslistfilesystemsmin082487d3598e272a14471e9Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4749ECF\"unlockedavailable$account-encryption-keyfalsefalsefalsemyjavafilesystembasic1572562105127Thu, 31 Oct 2019 22:48:25 GMT\"0x8D75E5470D9C324\"unlockedavailable$account-encryption-keyfalsefalsefalsemyjavafilesystembasic1572562120661Thu, 31 Oct 2019 22:48:41 GMT\"0x8D75E547A1DAA46\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "5b6ecd17-1a13-4bf9-b123-49ba2a49130c", + "x-ms-request-id" : "23a465b2-001e-001f-1664-b2eb66000000", + "Body" : "$rootTue, 19 Nov 2019 11:40:20 GMT\"0x8D76CE542061417\"unlockedavailable$account-encryption-keyfalsefalsefalse$webSat, 14 Dec 2019 01:05:12 GMT\"0x8D78031ABF042E1\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcencrypteduploadfile05846648b8ad172df34c529Mon, 25 Nov 2019 18:07:40 GMT\"0x8D771D25CC86ADE\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcencryption0encyptedblockblobapitestencryption17269138bc0Thu, 12 Dec 2019 22:38:05 GMT\"0x8D77F53F49755B0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsfilesystemsaspermissiontostring058845af6e555f601Fri, 13 Dec 2019 22:12:41 GMT\"0x8D7801992969142\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemsmin050098fd54c1d4f3554be08Sat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B5A05C66A\"unlockedavailable$account-encryption-keyfalsefalsefalsemyjavacontainerbufferedupload1574709539461Mon, 25 Nov 2019 19:19:03 GMT\"0x8D771DC559DAA3C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:36 GMT", + "x-ms-client-request-id" : "d4d2ed4a-7ac5-49b9-a907-defa67621317", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfslistfilesystemsmin&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtfslistfilesystemsmin&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "6a3fc85e-1ac8-4ce7-b7a8-4a9ef068f854" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "35a66c7b-6573-4ff8-ad65-e977dcbfeab1" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -55,20 +55,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd179-e01e-007c-7cd3-90d34f000000", - "Body" : "jtfslistfilesystemsminjtfslistfilesystemsmin082487d3598e272a14471e9Fri, 01 Nov 2019 16:43:37 GMT\"0x8D75EEAA4749ECF\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "6a3fc85e-1ac8-4ce7-b7a8-4a9ef068f854", + "x-ms-request-id" : "23a465d4-001e-001f-3264-b2eb66000000", + "Body" : "jtfslistfilesystemsminjtfslistfilesystemsmin050098fd54c1d4f3554be08Sat, 14 Dec 2019 09:52:37 GMT\"0x8D7807B5A05C66A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:36 GMT", + "x-ms-client-request-id" : "35a66c7b-6573-4ff8-ad65-e977dcbfeab1", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemsmin082487d3598e272a14471e9?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemsmin050098fd54c1d4f3554be08?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "b8f6f3d8-36e2-43b1-a068-8cc3c2a42d0a" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "797a4ea8-4a94-4ad4-a87f-0afd29d7d3e4" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -76,11 +76,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd181-e01e-007c-04d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:37 GMT", - "x-ms-client-request-id" : "b8f6f3d8-36e2-43b1-a068-8cc3c2a42d0a" + "x-ms-request-id" : "23a465e5-001e-001f-3c64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:36 GMT", + "x-ms-client-request-id" : "797a4ea8-4a94-4ad4-a87f-0afd29d7d3e4" }, "Exception" : null } ], - "variables" : [ "jtfslistfilesystemsmin082487d3598e272a14471e9" ] + "variables" : [ "jtfslistfilesystemsmin050098fd54c1d4f3554be08" ] } \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemswithtimeoutstillbackedbypagedflux.json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemswithtimeoutstillbackedbypagedflux.json index 23836204593d..f8e49c68519a 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemswithtimeoutstillbackedbypagedflux.json +++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/ServiceAPITestlistfilesystemswithtimeoutstillbackedbypagedflux.json @@ -1,137 +1,137 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux021121cf?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux01699889?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "84123b33-042f-4973-b0bc-f0e520cfc78d" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "ece58c98-45f8-4609-9a3c-a67c151ca4de" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA65F13EF", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:40 GMT", + "ETag" : "0x8D7807B5BE02926", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:40 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd686-e01e-007c-1bd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "84123b33-042f-4973-b0bc-f0e520cfc78d" + "x-ms-request-id" : "23a46999-001e-001f-5664-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "ece58c98-45f8-4609-9a3c-a67c151ca4de" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux13923146?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux160859dc?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "d6cb9a05-9982-4fda-8620-a3c3c1f446a8" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "edce600a-70ec-495a-8498-31cd49c51139" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA6680CF5", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:40 GMT", + "ETag" : "0x8D7807B5BE6E508", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:40 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "3a656a07-a01e-0034-7fd3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "d6cb9a05-9982-4fda-8620-a3c3c1f446a8" + "x-ms-request-id" : "22d963c6-601e-004b-5f64-b201ec000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "edce600a-70ec-495a-8498-31cd49c51139" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux245610ef?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux269688b1?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "f510b5fa-edfb-4f3c-a65f-374277b0bcde" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "84a38c65-6da9-4008-b4eb-e43495e2f901" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA6713FA5", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:40 GMT", + "ETag" : "0x8D7807B5BEEAB9C", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:40 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd6a4-e01e-007c-38d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "f510b5fa-edfb-4f3c-a65f-374277b0bcde" + "x-ms-request-id" : "23a469be-001e-001f-6f64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:39 GMT", + "x-ms-client-request-id" : "84a38c65-6da9-4008-b4eb-e43495e2f901" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux37857117?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux37417669?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "92722f9d-8806-4c6b-bd05-2dea986933a1" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "30dbb4e3-0c32-4061-b6b1-31372c6bf430" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA67A5FC4", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:40 GMT", + "ETag" : "0x8D7807B5BF65227", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:40 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "3a656a4f-a01e-0034-3bd3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "92722f9d-8806-4c6b-bd05-2dea986933a1" + "x-ms-request-id" : "22d9640a-601e-004b-1864-b201ec000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "30dbb4e3-0c32-4061-b6b1-31372c6bf430" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux4678857a?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux42602896?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "567c9991-ca18-4dea-bbcf-68ed65b92e13" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "2d395a1a-aa52-44f1-a697-cc5471b3769c" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA6858E9E", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:40 GMT", + "ETag" : "0x8D7807B5BFD5524", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:40 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dc6fd6c6-e01e-007c-54d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "567c9991-ca18-4dea-bbcf-68ed65b92e13" + "x-ms-request-id" : "23a469e6-001e-001f-1264-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "2d395a1a-aa52-44f1-a697-cc5471b3769c" }, "Exception" : null }, { "Method" : "PUT", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux51746933?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux555984b7?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "b079955b-a462-4698-b9de-75a75ac7381c" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "115e19ba-e60e-4c9c-80a0-ce1b0608c3c2" }, "Response" : { "x-ms-version" : "2019-02-02", "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "0x8D75EEAA68E397B", - "Last-Modified" : "Fri, 01 Nov 2019 16:43:40 GMT", + "ETag" : "0x8D7807B5C043845", + "Last-Modified" : "Sat, 14 Dec 2019 09:52:40 GMT", "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "3a656a8a-a01e-0034-70d3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "b079955b-a462-4698-b9de-75a75ac7381c" + "x-ms-request-id" : "22d9643d-601e-004b-4864-b201ec000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "115e19ba-e60e-4c9c-80a0-ce1b0608c3c2" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?maxresults=3&comp=list", + "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 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "bc5be6e2-7b58-4dd1-bd04-9fc05ddb3da8" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "60e348c2-8697-472e-bb1c-9adcadca4412" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -139,20 +139,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd6f3-e01e-007c-7dd3-90d34f000000", - "Body" : "3jtfslistfilesystemswithtimeoutstillbackedbypagedflux021121cfFri, 01 Nov 2019 16:43:40 GMT\"0x8D75EEAA65F13EF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemswithtimeoutstillbackedbypagedflux13923146Fri, 01 Nov 2019 16:43:40 GMT\"0x8D75EEAA6680CF5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemswithtimeoutstillbackedbypagedflux245610efFri, 01 Nov 2019 16:43:40 GMT\"0x8D75EEAA6713FA5\"unlockedavailable$account-encryption-keyfalsefalsefalse/gaprahns/jtfslistfilesystemswithtimeoutstillbackedbypagedflux37857117", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "bc5be6e2-7b58-4dd1-bd04-9fc05ddb3da8", + "x-ms-request-id" : "23a46a0e-001e-001f-3364-b2eb66000000", + "Body" : "3$rootTue, 19 Nov 2019 11:40:20 GMT\"0x8D76CE542061417\"unlockedavailable$account-encryption-keyfalsefalsefalse$webSat, 14 Dec 2019 01:05:12 GMT\"0x8D78031ABF042E1\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcencrypteduploadfile05846648b8ad172df34c529Mon, 25 Nov 2019 18:07:40 GMT\"0x8D771D25CC86ADE\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtcencryption0encyptedblockblobapitestencryption17269138bc0", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "60e348c2-8697-472e-bb1c-9adcadca4412", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?marker=/gaprahns/jtfslistfilesystemswithtimeoutstillbackedbypagedflux37857117&maxresults=3&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtcencryption0encyptedblockblobapitestencryption17269138bc0&maxresults=3&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "b11531c6-4ed4-4465-82b8-abfa9c5d012a" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "a4435e92-f52b-433e-a853-c0c82df26b2b" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -160,20 +160,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "3a656ab9-a01e-0034-19d3-90e1d2000000", - "Body" : "/gaprahns/jtfslistfilesystemswithtimeoutstillbackedbypagedflux378571173jtfslistfilesystemswithtimeoutstillbackedbypagedflux37857117Fri, 01 Nov 2019 16:43:40 GMT\"0x8D75EEAA67A5FC4\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemswithtimeoutstillbackedbypagedflux4678857aFri, 01 Nov 2019 16:43:40 GMT\"0x8D75EEAA6858E9E\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemswithtimeoutstillbackedbypagedflux51746933Fri, 01 Nov 2019 16:43:40 GMT\"0x8D75EEAA68E397B\"unlockedavailable$account-encryption-keyfalsefalsefalse/gaprahns/myjavafilesystembasic1572562105127", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "b11531c6-4ed4-4465-82b8-abfa9c5d012a", + "x-ms-request-id" : "22d9648b-601e-004b-0c64-b201ec000000", + "Body" : "/azstoragesdkaccount/jtcencryption0encyptedblockblobapitestencryption17269138bc03jtcencryption0encyptedblockblobapitestencryption17269138bc0Thu, 12 Dec 2019 22:38:05 GMT\"0x8D77F53F49755B0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfsfilesystemsaspermissiontostring058845af6e555f601Fri, 13 Dec 2019 22:12:41 GMT\"0x8D7801992969142\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemswithtimeoutstillbackedbypagedflux01699889Sat, 14 Dec 2019 09:52:40 GMT\"0x8D7807B5BE02926\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtfslistfilesystemswithtimeoutstillbackedbypagedflux160859dc", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "a4435e92-f52b-433e-a853-c0c82df26b2b", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?marker=/gaprahns/myjavafilesystembasic1572562105127&maxresults=3&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtfslistfilesystemswithtimeoutstillbackedbypagedflux160859dc&maxresults=3&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "74f64e6b-3ee0-4f34-b948-762301303fe6" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "2c47d490-b907-421b-9d8a-545be87e62c1" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -181,20 +181,41 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd721-e01e-007c-26d3-90d34f000000", - "Body" : "/gaprahns/myjavafilesystembasic15725621051273myjavafilesystembasic1572562105127Thu, 31 Oct 2019 22:48:25 GMT\"0x8D75E5470D9C324\"unlockedavailable$account-encryption-keyfalsefalsefalsemyjavafilesystembasic1572562120661Thu, 31 Oct 2019 22:48:41 GMT\"0x8D75E547A1DAA46\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "74f64e6b-3ee0-4f34-b948-762301303fe6", + "x-ms-request-id" : "23a46a49-001e-001f-6664-b2eb66000000", + "Body" : "/azstoragesdkaccount/jtfslistfilesystemswithtimeoutstillbackedbypagedflux160859dc3jtfslistfilesystemswithtimeoutstillbackedbypagedflux160859dcSat, 14 Dec 2019 09:52:40 GMT\"0x8D7807B5BE6E508\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemswithtimeoutstillbackedbypagedflux269688b1Sat, 14 Dec 2019 09:52:40 GMT\"0x8D7807B5BEEAB9C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemswithtimeoutstillbackedbypagedflux37417669Sat, 14 Dec 2019 09:52:40 GMT\"0x8D7807B5BF65227\"unlockedavailable$account-encryption-keyfalsefalsefalse/azstoragesdkaccount/jtfslistfilesystemswithtimeoutstillbackedbypagedflux42602896", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "2c47d490-b907-421b-9d8a-545be87e62c1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?marker=/azstoragesdkaccount/jtfslistfilesystemswithtimeoutstillbackedbypagedflux42602896&maxresults=3&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "8dd9d625-1134-40d9-b3fd-98509a361288" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "22d964c3-601e-004b-3c64-b201ec000000", + "Body" : "/azstoragesdkaccount/jtfslistfilesystemswithtimeoutstillbackedbypagedflux426028963jtfslistfilesystemswithtimeoutstillbackedbypagedflux42602896Sat, 14 Dec 2019 09:52:40 GMT\"0x8D7807B5BFD5524\"unlockedavailable$account-encryption-keyfalsefalsefalsejtfslistfilesystemswithtimeoutstillbackedbypagedflux555984b7Sat, 14 Dec 2019 09:52:40 GMT\"0x8D7807B5C043845\"unlockedavailable$account-encryption-keyfalsefalsefalsemyjavacontainerbufferedupload1574709539461Mon, 25 Nov 2019 19:19:03 GMT\"0x8D771DC559DAA3C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "8dd9d625-1134-40d9-b3fd-98509a361288", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux13923146?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux160859dc?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "9d8c25b2-f118-4f65-82b5-c2407bbe2242" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "ac7caf92-6758-47dc-be40-bfaf810dd2e4" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -202,18 +223,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "3a656ad9-a01e-0034-37d3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "9d8c25b2-f118-4f65-82b5-c2407bbe2242" + "x-ms-request-id" : "23a46a6a-001e-001f-0364-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "ac7caf92-6758-47dc-be40-bfaf810dd2e4" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux245610ef?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux269688b1?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "d40c27c4-3e67-4ea5-956a-01e55b3a212c" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "314344fd-be0f-402b-9037-9ebbd9abee92" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -221,18 +242,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd74d-e01e-007c-4fd3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "d40c27c4-3e67-4ea5-956a-01e55b3a212c" + "x-ms-request-id" : "22d9651e-601e-004b-0f64-b201ec000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "314344fd-be0f-402b-9037-9ebbd9abee92" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux37857117?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux37417669?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "cff0299f-cac6-4a11-81b8-fb10605d9ee8" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "98a76f2a-15e3-41a8-89da-d83911099983" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -240,18 +261,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "3a656b09-a01e-0034-60d3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "cff0299f-cac6-4a11-81b8-fb10605d9ee8" + "x-ms-request-id" : "23a46a86-001e-001f-1b64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "98a76f2a-15e3-41a8-89da-d83911099983" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux4678857a?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux42602896?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "3c662262-b3f6-430d-9443-bd2814a4d247" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "672408ab-ffe9-47b1-ab1d-bbc68d16f297" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -259,18 +280,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "dc6fd77a-e01e-007c-77d3-90d34f000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "3c662262-b3f6-430d-9443-bd2814a4d247" + "x-ms-request-id" : "22d9655b-601e-004b-4364-b201ec000000", + "Date" : "Sat, 14 Dec 2019 09:52:41 GMT", + "x-ms-client-request-id" : "672408ab-ffe9-47b1-ab1d-bbc68d16f297" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux51746933?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux555984b7?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "577deadb-60fe-42fb-8d7f-3f8cdd907769" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "04cf81ca-ba5f-4e09-98d1-9955a6225c79" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -278,18 +299,18 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "3a656b3e-a01e-0034-11d3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "577deadb-60fe-42fb-8d7f-3f8cdd907769" + "x-ms-request-id" : "23a46aa9-001e-001f-3864-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "04cf81ca-ba5f-4e09-98d1-9955a6225c79" }, "Exception" : null }, { "Method" : "GET", - "Uri" : "https://gaprahns.blob.core.windows.net?prefix=jtfslistfilesystemswithtimeoutstillbackedbypagedflux&comp=list", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtfslistfilesystemswithtimeoutstillbackedbypagedflux&comp=list", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "20835dfb-1c86-41d2-9e71-708e850a5efa" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "ff9fed7b-a317-49f6-b69f-3726b1dd6825" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -297,20 +318,20 @@ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dc6fd793-e01e-007c-0ed3-90d34f000000", - "Body" : "jtfslistfilesystemswithtimeoutstillbackedbypagedfluxjtfslistfilesystemswithtimeoutstillbackedbypagedflux021121cfFri, 01 Nov 2019 16:43:40 GMT\"0x8D75EEAA65F13EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "20835dfb-1c86-41d2-9e71-708e850a5efa", + "x-ms-request-id" : "22d96592-601e-004b-7564-b201ec000000", + "Body" : "jtfslistfilesystemswithtimeoutstillbackedbypagedfluxjtfslistfilesystemswithtimeoutstillbackedbypagedflux01699889Sat, 14 Dec 2019 09:52:40 GMT\"0x8D7807B5BE02926\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Sat, 14 Dec 2019 09:52:41 GMT", + "x-ms-client-request-id" : "ff9fed7b-a317-49f6-b69f-3726b1dd6825", "Content-Type" : "application/xml" }, "Exception" : null }, { "Method" : "DELETE", - "Uri" : "https://gaprahns.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux021121cf?restype=container", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtfslistfilesystemswithtimeoutstillbackedbypagedflux01699889?restype=container", "Headers" : { "x-ms-version" : "2019-02-02", - "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0 1.8.0_221; Windows 10 10.0", - "x-ms-client-request-id" : "af231629-275d-4bb0-9f43-bd31acd35a05" + "User-Agent" : "azsdk-java-azure-storage-blob/12.2.0-beta.1 (11.0.5; Mac OS X 10.14.6)", + "x-ms-client-request-id" : "3ab14843-e9a8-4428-962a-3494384716b0" }, "Response" : { "x-ms-version" : "2019-02-02", @@ -318,11 +339,11 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "3a656b66-a01e-0034-33d3-90e1d2000000", - "Date" : "Fri, 01 Nov 2019 16:43:40 GMT", - "x-ms-client-request-id" : "af231629-275d-4bb0-9f43-bd31acd35a05" + "x-ms-request-id" : "23a46ac1-001e-001f-4b64-b2eb66000000", + "Date" : "Sat, 14 Dec 2019 09:52:40 GMT", + "x-ms-client-request-id" : "3ab14843-e9a8-4428-962a-3494384716b0" }, "Exception" : null } ], - "variables" : [ "jtfslistfilesystemswithtimeoutstillbackedbypagedflux021121cf", "jtfslistfilesystemswithtimeoutstillbackedbypagedflux13923146", "jtfslistfilesystemswithtimeoutstillbackedbypagedflux245610ef", "jtfslistfilesystemswithtimeoutstillbackedbypagedflux37857117", "jtfslistfilesystemswithtimeoutstillbackedbypagedflux4678857a", "jtfslistfilesystemswithtimeoutstillbackedbypagedflux51746933" ] + "variables" : [ "jtfslistfilesystemswithtimeoutstillbackedbypagedflux01699889", "jtfslistfilesystemswithtimeoutstillbackedbypagedflux160859dc", "jtfslistfilesystemswithtimeoutstillbackedbypagedflux269688b1", "jtfslistfilesystemswithtimeoutstillbackedbypagedflux37417669", "jtfslistfilesystemswithtimeoutstillbackedbypagedflux42602896", "jtfslistfilesystemswithtimeoutstillbackedbypagedflux555984b7" ] } \ No newline at end of file From 8e882049c70ab3c42a5e9bdb5e9edbe13d51ee73 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sat, 14 Dec 2019 18:21:20 -0800 Subject: [PATCH 21/34] Removing interface type PageRetrievalProvider --- .../core/http/rest/PageRetrieverProvider.java | 18 ------ .../com/azure/core/http/rest/PagedFlux.java | 59 ++++++++++++------- .../azure/core/http/rest/PagedFluxBase.java | 28 ++++----- .../core/util/paging/ContinuablePage.java | 2 +- .../util/paging/ContinuablePagedFluxCore.java | 12 ++-- .../rest/PagedFluxJavaDocCodeSnippets.java | 18 +++--- 6 files changed, 68 insertions(+), 69 deletions(-) delete mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java deleted file mode 100644 index a103b471794d..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PageRetrieverProvider.java +++ /dev/null @@ -1,18 +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.function.Function; -import java.util.function.Supplier; - -/** - * Type represents a Provider that when called return a Function to retrieve pages. - * - * @param

the Page type. - */ -@FunctionalInterface -public interface PageRetrieverProvider

extends Supplier>> { -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index 154a132fa5e3..bf97e0263151 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -64,35 +64,52 @@ public PagedFlux(Supplier>> firstPageRetriever) { */ public PagedFlux(Supplier>> firstPageRetriever, Function>> nextPageRetriever) { - this(new PageRetrieverProvider>() { - @Override - public Function>> get() { - return continuationToken -> continuationToken == null - ? firstPageRetriever.get().flux() - : nextPageRetriever.apply(continuationToken).flux(); - } - }); + this(() -> continuationToken -> continuationToken == null + ? firstPageRetriever.get().flux() + : nextPageRetriever.apply(continuationToken).flux(), true); + } + + + /** + * PRIVATE CONSTRUCTOR. SEE BELOW NOTES. + * + * Create PagedFlux backed by Page Retriever Function Supplier. + * + * @param provider the Page Retrieval Function Provider + * @param ignored param is ignored, exists in signature only to avoid conflict with first ctr + */ + // NOTES: Proposal for azure-core-v2: + // + // 1. Remove the first ctr "PagedFlux(Supplier>>)". + // 2. Add a new ctr "PagedFlux(Supplier>>>)". + // 3. Remove the factory method "PagedFlux::create" and this PRIVATE ctr in favour of #2. + // + private PagedFlux(Supplier>>> provider, boolean ignored) { + super(provider, ignored); } /** - * Creates an instance of {@link PagedFlux}. The constructor takes a provider, that when called should - * provide Page Retriever Function which accepts continuation token. The provider will be called for - * each Subscription to the PagedFlux instance. The Page Retriever Function can get called multiple - * times in serial fashion, each time after the completion of the Flux returned from the previous - * invocation. The final completion signal will be send to the Subscriber when the last Page emitted - * by the Flux returned by Page Continuation Function has {@code null} continuation token. + * Creates an instance of {@link PagedFlux} backed by a Page Retriever Function Supplier. + * When invoked supplier should provide Page Retriever Function which accepts continuation token. + * The provider will be called for each Subscription to the PagedFlux instance. The Page Retriever + * Function can get called multiple times in serial fashion, each time after the completion of the Flux + * returned from the previous invocation. The final completion signal will be send to the Subscriber + * when the last Page emitted by the Flux returned by Page Continuation Function has {@code null} + * continuation token. * * The provider is useful mainly in two scenarios: * 1. To manage state across multiple call to Page Retrieval Function within the same Subscription * 2. To decorate a PagedFlux to produce new PagedFlux * *

Decoration sample

- * {@codesnippet com.azure.core.http.rest.pagedflux.ctr.decoration} + * {@codesnippet com.azure.core.http.rest.pagedflux.create.decoration} * - * @param provider the Page Retrieval Provider + * @param provider the Page Retrieval Function Provider + * @param The type of items in a {@link PagedResponse} + * @return PagedFlux backed by the Page Retriever Function Supplier */ - public PagedFlux(PageRetrieverProvider> provider) { - super(provider); + public static PagedFlux create(Supplier>>> provider) { + return new PagedFlux<>(provider, true); } /** @@ -102,18 +119,18 @@ public PagedFlux(PageRetrieverProvider> provider) { * @param mapper The mapper function to convert from type T to type S. * @param The mapped type. * @return A PagedFlux of type S. - * @deprecated refer the decoration samples for PagedFlux constructor that takes provider + * @deprecated refer the decoration samples for {@link PagedFlux#create(Supplier)}. */ @Deprecated public PagedFlux mapPage(Function mapper) { - PageRetrieverProvider> provider = () -> continuationToken -> { + Supplier>>> provider = () -> continuationToken -> { Flux> flux = (continuationToken == null) ? byPage() : byPage(continuationToken); return flux .map(mapPagedResponse(mapper)); }; - return new PagedFlux<>(provider); + return PagedFlux.create(provider); } private Function, PagedResponse> mapPagedResponse(Function mapper) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index 8ad7cf47c8de..cd9869477a7c 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -36,7 +36,9 @@ * @see PagedResponse * @see Page * @see Flux + * @deprecated use {@link ContinuablePagedFluxCore}. */ +@Deprecated public class PagedFluxBase> extends ContinuablePagedFluxCore { /** * Creates an instance of {@link PagedFluxBase} that consists of only a single page. @@ -64,27 +66,21 @@ public PagedFluxBase(Supplier> firstPageRetriever) { */ public PagedFluxBase(Supplier> firstPageRetriever, Function> nextPageRetriever) { - this(new PageRetrieverProvider

() { - @Override - public Function> get() { - return continuationToken -> continuationToken == null - ? firstPageRetriever.get().flux() - : nextPageRetriever.apply(continuationToken).flux(); - } - }); + this(() -> continuationToken -> continuationToken == null + ? firstPageRetriever.get().flux() + : nextPageRetriever.apply(continuationToken).flux(), true); } /** - * Creates an instance of {@link PagedFluxBase}. The constructor takes a provider, that when called should - * provides Page Retriever Function which accepts continuation token. The provider will be called for - * each Subscription to the PagedFlux instance. The Page Retriever Function can get called multiple - * times in serial fashion, each time after the completion of the Flux returned from the previous - * invocation. The final completion signal will be send to the Subscriber when the last Page emitted - * by the Flux returned by Page Continuation Function has {@code null} continuation token. + * PACKAGE INTERNAL CONSTRUCTOR, exists only to support the PRIVATE PagedFlux.ctr(Supplier, boolean) + * use case. * - * @param provider the Page Retrieval Provider + * Create PagedFlux backed by Page Retriever Function Supplier. + * + * @param provider the Page Retrieval Function Provider + * @param ignored ignored */ - public PagedFluxBase(PageRetrieverProvider

provider) { + PagedFluxBase(Supplier>> provider, boolean ignored) { super(provider); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java index 5fa0a5416e28..a78151799cff 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java @@ -16,7 +16,7 @@ */ public interface ContinuablePage { /** - * @return a iterable stream of elements in the page. + * @return an iterable stream of elements in the page. */ IterableStream getElements(); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index 8973b0712b37..e944c0ec3823 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -83,13 +83,13 @@ Flux

byPage(Supplier>> provider, return Flux.defer(() -> { final Function> pageRetriever = provider.get(); final ContinuationState state = new ContinuationState<>(continuationToken); - return concatPagedFlux(state, pageRetriever); + return concatFluxOfPage(state, pageRetriever); }); } /** - * Get a Flux of {@link ContinuablePage} created by concat-ing Flux instances returned - * Page Retriever Function calls. The first Flux of {@link ContinuablePage} is identified + * Get a Flux of {@link ContinuablePage} created by concat-ing child Flux instances returned + * Page Retriever Function calls. The first child Flux of {@link ContinuablePage} is identified * by the continuation-token in the state. * * @param state the state to be used across multiple Page Retriever Function calls @@ -99,8 +99,8 @@ Flux

byPage(Supplier>> provider, * @param

The {@link ContinuablePage} holding items of type {@code T} * @return a Flux of {@link ContinuablePage} */ - private static > Flux

concatPagedFlux(ContinuationState state, - Function> pageRetriever) { + private static > + Flux

concatFluxOfPage(ContinuationState state, Function> pageRetriever) { if (state.isDone()) { return Flux.empty(); } else { @@ -110,7 +110,7 @@ private static > Flux

concatPagedFlux(C return Mono.empty(); })) .doOnNext(page -> state.setLastContinuationToken(page.getContinuationToken())) - .concatWith(Flux.defer(() -> concatPagedFlux(state, pageRetriever))); + .concatWith(Flux.defer(() -> concatFluxOfPage(state, pageRetriever))); } } diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java index d2595a5ec0b9..499694c0501d 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java @@ -143,14 +143,16 @@ protected void hookOnComplete() { } /** - * Code snippets for using {@link PagedFlux#PagedFlux(PageRetrieverProvider)} + * Code snippets for using {@link PagedFlux#create(Supplier)} * to create a PagedFlux by applying decoration on another PagedFlux. */ public void pagedFluxFromPagedFlux() { - // BEGIN: com.azure.core.http.rest.pagedflux.ctr.decoration + // BEGIN: com.azure.core.http.rest.pagedflux.create.decoration // Transform a PagedFlux with Integer items to PagedFlux of String items. final PagedFlux intPagedFlux = createAnInstance(); + + // PagedResponse to PagedResponse mapper final Function, PagedResponse> responseMapper = intResponse -> new PagedResponseBase(intResponse.getRequest(), intResponse.getStatusCode(), @@ -160,24 +162,26 @@ public void pagedFluxFromPagedFlux() { .map(intValue -> Integer.toString(intValue)).collect(Collectors.toList()), intResponse.getContinuationToken(), null); - final PageRetrieverProvider> provider = () -> continuationToken -> { + + final Supplier>>> provider = () -> continuationToken -> { Flux> flux = (continuationToken == null) ? intPagedFlux.byPage() : intPagedFlux.byPage(continuationToken); return flux.map(responseMapper); }; - PagedFlux strPagedFlux = new PagedFlux<>(provider); + PagedFlux strPagedFlux = PagedFlux.create(provider); // Create a PagedFlux from a PagedFlux with all exceptions mapped to a specific exception. final PagedFlux pagedFlux = createAnInstance(); - final PageRetrieverProvider> eprovider = () -> continuationToken -> { + final Supplier>>> eprovider = () -> continuationToken -> { Flux> flux = (continuationToken == null) ? pagedFlux.byPage() : pagedFlux.byPage(continuationToken); return flux.onErrorMap(t -> new PaginationException(t)); }; - final PagedFlux exceptionMappedPagedFlux = new PagedFlux<>(eprovider); - // END: com.azure.core.http.rest.pagedflux..ctr.decoration + final PagedFlux exceptionMappedPagedFlux = PagedFlux.create(eprovider); + + // END: com.azure.core.http.rest.pagedflux.create.decoration } /** From 759e88c08014c7662da767e4f846c3bdfd837c0d Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sun, 15 Dec 2019 02:57:24 -0800 Subject: [PATCH 22/34] Adding preferred page size option --- .../com/azure/core/http/rest/PagedFlux.java | 16 +-- .../azure/core/http/rest/PagedFluxBase.java | 7 +- .../core/util/paging/ContinuablePage.java | 2 +- .../util/paging/ContinuablePagedFlux.java | 23 +++- .../util/paging/ContinuablePagedFluxCore.java | 128 ++++++++++++------ .../azure/core/util/paging/PageRetriever.java | 26 ++++ .../rest/PagedFluxJavaDocCodeSnippets.java | 32 +++-- .../PagedFluxCoreJavaDocCodeSnippets.java | 16 +-- 8 files changed, 174 insertions(+), 76 deletions(-) create mode 100644 sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageRetriever.java diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index bf97e0263151..d3a01d09b4d8 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -7,6 +7,7 @@ import java.util.stream.Collectors; +import com.azure.core.util.paging.PageRetriever; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -64,27 +65,26 @@ public PagedFlux(Supplier>> firstPageRetriever) { */ public PagedFlux(Supplier>> firstPageRetriever, Function>> nextPageRetriever) { - this(() -> continuationToken -> continuationToken == null + this(() -> (continuationToken, pageSize) -> continuationToken == null ? firstPageRetriever.get().flux() : nextPageRetriever.apply(continuationToken).flux(), true); } - /** * PRIVATE CONSTRUCTOR. SEE BELOW NOTES. * * Create PagedFlux backed by Page Retriever Function Supplier. * - * @param provider the Page Retrieval Function Provider + * @param provider the Page Retrieval Provider * @param ignored param is ignored, exists in signature only to avoid conflict with first ctr */ // NOTES: Proposal for azure-core-v2: // // 1. Remove the first ctr "PagedFlux(Supplier>>)". - // 2. Add a new ctr "PagedFlux(Supplier>>>)". + // 2. Add a new ctr "PagedFlux(Supplier>>)". // 3. Remove the factory method "PagedFlux::create" and this PRIVATE ctr in favour of #2. // - private PagedFlux(Supplier>>> provider, boolean ignored) { + private PagedFlux(Supplier>> provider, boolean ignored) { super(provider, ignored); } @@ -104,11 +104,11 @@ private PagedFlux(Supplier>>> provider, b *

Decoration sample

* {@codesnippet com.azure.core.http.rest.pagedflux.create.decoration} * - * @param provider the Page Retrieval Function Provider + * @param provider the Page Retrieval Provider * @param The type of items in a {@link PagedResponse} * @return PagedFlux backed by the Page Retriever Function Supplier */ - public static PagedFlux create(Supplier>>> provider) { + public static PagedFlux create(Supplier>> provider) { return new PagedFlux<>(provider, true); } @@ -123,7 +123,7 @@ public static PagedFlux create(Supplier PagedFlux mapPage(Function mapper) { - Supplier>>> provider = () -> continuationToken -> { + Supplier>> provider = () -> (continuationToken, pageSize) -> { Flux> flux = (continuationToken == null) ? byPage() : byPage(continuationToken); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index cd9869477a7c..6a83be6162b7 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -4,6 +4,7 @@ package com.azure.core.http.rest; import com.azure.core.util.paging.ContinuablePagedFluxCore; +import com.azure.core.util.paging.PageRetriever; import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -66,7 +67,7 @@ public PagedFluxBase(Supplier> firstPageRetriever) { */ public PagedFluxBase(Supplier> firstPageRetriever, Function> nextPageRetriever) { - this(() -> continuationToken -> continuationToken == null + this(() -> (continuationToken, pageSize) -> continuationToken == null ? firstPageRetriever.get().flux() : nextPageRetriever.apply(continuationToken).flux(), true); } @@ -77,10 +78,10 @@ public PagedFluxBase(Supplier> firstPageRetriever, * * Create PagedFlux backed by Page Retriever Function Supplier. * - * @param provider the Page Retrieval Function Provider + * @param provider the Page Retrieval Provider * @param ignored ignored */ - PagedFluxBase(Supplier>> provider, boolean ignored) { + public PagedFluxBase(Supplier> provider, boolean ignored) { super(provider); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java index a78151799cff..356fe6674945 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java @@ -10,7 +10,7 @@ * of one or more pages. * * @param Type of the continuation token - * @param Type of the items in the page + * @param Type of the elements in the page * * @see ContinuablePagedFlux */ diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java index 9ded283df987..d2519836f786 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java @@ -11,7 +11,7 @@ * continuation tokens, allowing for restarting from a previously-retrieved continuation token. * * @param the type of continuation token - * @param the type of items in the page + * @param the type of elements in the page * @param

the type of page * * @see Flux @@ -30,4 +30,25 @@ public abstract class ContinuablePagedFlux * @return a Flux of {@link ContinuablePage} */ public abstract Flux

byPage(C continuationToken); + /** + * Get a Flux that emits stream of {@link ContinuablePage} in this Paged Flux, + * with each page containing number of elements equal to the preferred page size. + * Service may or may not honor the page size preference hence client MUST be + * prepared to handle pages with different page size. + * + * @param preferredPageSize the preferred page size + * @return a Flux of {@link ContinuablePage} + */ + public abstract Flux

byPage(int preferredPageSize); + /** + * Get a Flux that emits stream of {@link ContinuablePage} identified by the given + * continuation token and each page containing number of elements equal to the preferred + * page size. Service may or may not honor the page size preference hence client + * MUST be prepared to handle pages with different page size. + * + * @param continuationToken the continuation token + * @param preferredPageSize the preferred page size + * @return a Flux of {@link ContinuablePage} + */ + public abstract Flux

byPage(C continuationToken, int preferredPageSize); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index e944c0ec3823..c264e27182fe 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -9,7 +9,6 @@ import reactor.core.publisher.Mono; import java.util.Objects; -import java.util.function.Function; import java.util.function.Supplier; /** @@ -19,20 +18,19 @@ * and individual items in such pages. This type supports user-provided continuation tokens, * allowing for restarting from a previously-retrieved continuation token. * - * The constructor takes a provider, that when called should return Page Retriever Function which - * accepts continuation token. The provider is called for each Subscription to this Flux. - * Given provider is called per Subscription, the provider implementation can create one or more - * objects to store any state and Page Retriever Function can capture and use those objects. - * This indirectly associate the state objects to the Subscription. The Page Retriever Function - * can get called multiple times in serial fashion, each time after the completion of the Flux - * returned by the previous invocation. The final completion signal will be send to the Subscriber - * when the last Page emitted by the Flux returned by the Page Retrieval Function has {@code null} + * The constructor takes a Page Retriever provider, that when called should return {@link PageRetriever}. + * The provider is called for each Subscription to this Flux. Given provider is called per Subscription, + * the provider implementation can create one or more objects to store any state and Page Retriever + * can capture and use those objects. This indirectly associate the state objects to the Subscription. + * The Page Retriever can get called multiple times in serial fashion, each time after the completion + * of the Flux returned by the previous invocation. The final completion signal will be send to + * the Subscriber when the last Page emitted by the Flux returned by the Page Retriever has {@code null} * continuation token. * *

Extending PagedFluxCore for Custom Continuation Token support

* {@codesnippet com.azure.core.util.paging.pagedfluxcore.continuationtoken} * - * @param The type of items in a {@link ContinuablePage} + * @param The type of elements in a {@link ContinuablePage} * @param

The {@link ContinuablePage} holding items of type {@code T}. * * @see ContinuablePagedFlux @@ -40,21 +38,45 @@ */ public abstract class ContinuablePagedFluxCore> extends ContinuablePagedFlux { - private final Supplier>> pageRetrieverProvider; + private final Supplier> pageRetrieverProvider; + private final int defaultPageSize; /** * Creates an instance of {@link ContinuablePagedFluxCore}. * - * @param pageRetrieverProvider a provider that returns Page Retriever Function. + * @param pageRetrieverProvider a provider that returns {@link PageRetriever}. */ - protected ContinuablePagedFluxCore(Supplier>> pageRetrieverProvider) { + protected ContinuablePagedFluxCore(Supplier> pageRetrieverProvider) { this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, "'pageRetrieverProvider' function cannot be null."); + this.defaultPageSize = -1; + } + + /** + * Creates an instance of {@link ContinuablePagedFluxCore}. + * + * @param pageRetrieverProvider a provider that returns {@link PageRetriever}. + * @param defaultPageSize the default preferred page size + */ + protected ContinuablePagedFluxCore(Supplier> pageRetrieverProvider, int defaultPageSize) { + this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, + "'pageRetrieverProvider' function cannot be null."); + if (defaultPageSize <= 0) { + throw new IllegalArgumentException("defaultPageSize > 0 required but provided: " + defaultPageSize); + } + this.defaultPageSize = defaultPageSize; + } + + /** + * @return the page size configured for this {@link ContinuablePagedFluxCore}, -1 if unspecified. + */ + public int getDefaultPageSize() { + return this.defaultPageSize; } @Override public Flux

byPage() { - return byPage(this.pageRetrieverProvider, null); + return byPage(this.pageRetrieverProvider, null, this.defaultPageSize); } @Override @@ -62,7 +84,47 @@ public Flux

byPage(C continuationToken) { if (continuationToken == null) { return Flux.empty(); } - return byPage(this.pageRetrieverProvider, continuationToken); + return byPage(this.pageRetrieverProvider, continuationToken, this.defaultPageSize); + } + + @Override + public Flux

byPage(int preferredPageSize) { + if (preferredPageSize <= 0) { + return Flux.error(new IllegalArgumentException("preferredPageSize > 0 required but provided: " + + preferredPageSize)); + } + return byPage(this.pageRetrieverProvider, null, preferredPageSize); + } + + @Override + public Flux

byPage(C continuationToken, int preferredPageSize) { + if (preferredPageSize <= 0) { + return Flux.error(new IllegalArgumentException("preferredPageSize > 0 required but provided: " + + preferredPageSize)); + } + if (continuationToken == null) { + return Flux.empty(); + } + return byPage(this.pageRetrieverProvider, continuationToken, preferredPageSize); + } + + /** + * Subscribe to consume all items of type {@code T} in the sequence respectively. + * This is recommended for most common scenarios. This will seamlessly fetch next + * page when required and provide with a {@link Flux} of items. + * + * @param coreSubscriber The subscriber for this {@link ContinuablePagedFluxCore} + */ + @Override + public void subscribe(CoreSubscriber coreSubscriber) { + byPage(this.pageRetrieverProvider, null, this.defaultPageSize) + .flatMap(page -> { + IterableStream iterableStream = page.getElements(); + return iterableStream == null + ? Flux.empty() + : Flux.fromIterable(page.getElements()); + }) + .subscribe(coreSubscriber); } /** @@ -71,6 +133,7 @@ public Flux

byPage(C continuationToken) { * * @param provider the provider that when called returns Page Retriever Function * @param continuationToken the token to identify the pages to be retrieved + * @param pageSize the preferred page size * * @param the type of Continuation token * @param The type of items in a {@link ContinuablePage} @@ -78,12 +141,12 @@ public Flux

byPage(C continuationToken) { * @return a Flux of {@link ContinuablePage} identified by the given continuation token */ private static > - Flux

byPage(Supplier>> provider, - C continuationToken) { + Flux

byPage(Supplier> provider, + C continuationToken, int pageSize) { return Flux.defer(() -> { - final Function> pageRetriever = provider.get(); + final PageRetriever pageRetriever = provider.get(); final ContinuationState state = new ContinuationState<>(continuationToken); - return concatFluxOfPage(state, pageRetriever); + return concatFluxOfPage(state, pageRetriever, pageSize); }); } @@ -94,45 +157,28 @@ Flux

byPage(Supplier>> provider, * * @param state the state to be used across multiple Page Retriever Function calls * @param pageRetriever the Page Retriever Function + * @param pageSize the preferred page size + * * @param the type of Continuation token * @param The type of items in a {@link ContinuablePage} * @param

The {@link ContinuablePage} holding items of type {@code T} * @return a Flux of {@link ContinuablePage} */ private static > - Flux

concatFluxOfPage(ContinuationState state, Function> pageRetriever) { + Flux

concatFluxOfPage(ContinuationState state, PageRetriever pageRetriever, int pageSize) { if (state.isDone()) { return Flux.empty(); } else { - return pageRetriever.apply(state.getLastContinuationToken()) + return pageRetriever.get(state.getLastContinuationToken(), pageSize == -1 ? null : pageSize) .switchIfEmpty(Flux.defer(() -> { state.setLastContinuationToken(null); return Mono.empty(); })) .doOnNext(page -> state.setLastContinuationToken(page.getContinuationToken())) - .concatWith(Flux.defer(() -> concatFluxOfPage(state, pageRetriever))); + .concatWith(Flux.defer(() -> concatFluxOfPage(state, pageRetriever, pageSize))); } } - /** - * Subscribe to consume all items of type {@code T} in the sequence respectively. - * This is recommended for most common scenarios. This will seamlessly fetch next - * page when required and provide with a {@link Flux} of items. - * - * @param coreSubscriber The subscriber for this {@link ContinuablePagedFluxCore} - */ - @Override - public void subscribe(CoreSubscriber coreSubscriber) { - byPage() - .flatMap(page -> { - IterableStream iterableStream = page.getElements(); - return iterableStream == null - ? Flux.empty() - : Flux.fromIterable(page.getElements()); - }) - .subscribe(coreSubscriber); - } - /** * Internal type to store Continuation State. * diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageRetriever.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageRetriever.java new file mode 100644 index 000000000000..1e41d657b360 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageRetriever.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.util.paging; + +import reactor.core.publisher.Flux; + +/** + * A type representing contract to retrieve one or more pages. + * + * @param the continuation token type + * @param

the page elements type + */ +@FunctionalInterface +public interface PageRetriever { + /** + * Get a set of one or more pages starting from the page identified by + * the given continuation token. + * + * @param continuationToken the token identifying the page set + * @param pageSize the preferred number of items per page, a {@code null} value indicate + * that client prefer server's default page size + * @return a Flux that emits one or more pages + */ + Flux

get(C continuationToken, Integer pageSize); +} diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java index 499694c0501d..84e90eac9299 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java @@ -3,6 +3,7 @@ package com.azure.core.http.rest; +import com.azure.core.util.paging.PageRetriever; import org.reactivestreams.Subscription; import reactor.core.CoreSubscriber; import reactor.core.publisher.BaseSubscriber; @@ -163,24 +164,33 @@ public void pagedFluxFromPagedFlux() { intResponse.getContinuationToken(), null); - final Supplier>>> provider = () -> continuationToken -> { - Flux> flux = (continuationToken == null) - ? intPagedFlux.byPage() - : intPagedFlux.byPage(continuationToken); - return flux.map(responseMapper); + final Supplier>> provider = new Supplier<>() { + @Override + public PageRetriever> get() { + return (continuationToken, pageSize) -> { + Flux> flux = (continuationToken == null) + ? intPagedFlux.byPage() + : intPagedFlux.byPage(continuationToken); + return flux.map(responseMapper); + }; + } }; PagedFlux strPagedFlux = PagedFlux.create(provider); // Create a PagedFlux from a PagedFlux with all exceptions mapped to a specific exception. final PagedFlux pagedFlux = createAnInstance(); - final Supplier>>> eprovider = () -> continuationToken -> { - Flux> flux = (continuationToken == null) - ? pagedFlux.byPage() - : pagedFlux.byPage(continuationToken); - return flux.onErrorMap(t -> new PaginationException(t)); + final Supplier>> eprovider = new Supplier<>() { + @Override + public PageRetriever> get() { + return (continuationToken, pageSize) -> { + Flux> flux = (continuationToken == null) + ? pagedFlux.byPage() + : pagedFlux.byPage(continuationToken); + return flux.onErrorMap(t -> new PaginationException(t)); + }; + } }; final PagedFlux exceptionMappedPagedFlux = PagedFlux.create(eprovider); - // END: com.azure.core.http.rest.pagedflux.create.decoration } diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java index d22f89f8d3d1..903f1773c70d 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java @@ -6,7 +6,6 @@ import com.azure.core.util.IterableStream; import reactor.core.publisher.Flux; -import java.util.function.Function; import java.util.function.Supplier; /** @@ -68,21 +67,16 @@ Flux getFilePages(FileContinuationToken token) { } FileShareServiceClient client = null; // Initialize client - Supplier>> pageRetrieverProvider - = new Supplier>>() { + Supplier> pageRetrieverProvider + = new Supplier<>() { @Override - public Function> get() { - return new Function>() { - @Override - public Flux apply(FileContinuationToken token) { - return client.getFilePages(token); - } - }; + public PageRetriever get() { + return (continuationToken, pageSize) -> client.getFilePages(continuationToken); } }; class FilePagedFlux extends ContinuablePagedFluxCore { - FilePagedFlux(Supplier>> + FilePagedFlux(Supplier> pageRetrieverProvider) { super(pageRetrieverProvider); } From 33de1d9d1d1e0f5e5153337d182b11b61bc693fe Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sun, 15 Dec 2019 11:17:51 -0800 Subject: [PATCH 23/34] javadoc updates for PagedFlux types --- .../com/azure/core/http/rest/PagedFlux.java | 15 +++++++------ .../core/util/paging/ContinuablePage.java | 6 +++--- .../util/paging/ContinuablePagedFlux.java | 21 +++++++++---------- .../util/paging/ContinuablePagedFluxCore.java | 19 +++++++++-------- .../azure/core/util/paging/PageRetriever.java | 11 +++++----- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index d3a01d09b4d8..0fc5aa8f7537 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -89,16 +89,15 @@ private PagedFlux(Supplier>> provider, bo } /** - * Creates an instance of {@link PagedFlux} backed by a Page Retriever Function Supplier. - * When invoked supplier should provide Page Retriever Function which accepts continuation token. - * The provider will be called for each Subscription to the PagedFlux instance. The Page Retriever - * Function can get called multiple times in serial fashion, each time after the completion of the Flux - * returned from the previous invocation. The final completion signal will be send to the Subscriber - * when the last Page emitted by the Flux returned by Page Continuation Function has {@code null} - * continuation token. + * Creates an instance of {@link PagedFlux} backed by a Page Retriever Supplier (provider). + * When invoked provider should return {@link PageRetriever}. The provider will be called for each + * Subscription to the PagedFlux instance. The Page Retriever can get called multiple times in serial + * fashion, each time after the completion of the Flux returned from the previous invocation. + * The final completion signal will be send to the Subscriber when the last Page emitted by the Flux + * returned by Page Retriever has {@code null} continuation token. * * The provider is useful mainly in two scenarios: - * 1. To manage state across multiple call to Page Retrieval Function within the same Subscription + * 1. To manage state across multiple call to Page Retrieval within the same Subscription * 2. To decorate a PagedFlux to produce new PagedFlux * *

Decoration sample

diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java index 356fe6674945..b4bb4d465494 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java @@ -6,8 +6,8 @@ import com.azure.core.util.IterableStream; /** - * Represents Page from service that has reference (a.k.a continuation token) to next set - * of one or more pages. + * Represents Page from service that has reference to next set of one or more pages, + * such a reference is known as continuation token. * * @param Type of the continuation token * @param Type of the elements in the page @@ -21,7 +21,7 @@ public interface ContinuablePage { IterableStream getElements(); /** - * @return A reference to the next page, or {@code null} if there are no more pages. + * @return a reference to the next page, or {@code null} if there are no more pages. */ C getContinuationToken(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java index d2519836f786..385637aa346b 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java @@ -19,32 +19,31 @@ */ public abstract class ContinuablePagedFlux> extends Flux { /** - * @return a Flux that emits stream of {@link ContinuablePage} in this Paged Flux. + * @return a Flux of {@link ContinuablePage} in this Paged Flux. */ public abstract Flux

byPage(); /** - * Get a Flux that emits stream of {@link ContinuablePage} identified by the given - * continuation token. + * Get a Flux {@link ContinuablePage} identified by the given continuation token. * * @param continuationToken the continuation token * @return a Flux of {@link ContinuablePage} */ public abstract Flux

byPage(C continuationToken); /** - * Get a Flux that emits stream of {@link ContinuablePage} in this Paged Flux, - * with each page containing number of elements equal to the preferred page size. - * Service may or may not honor the page size preference hence client MUST be - * prepared to handle pages with different page size. + * Get a Flux of {@link ContinuablePage} in this Paged Flux, with each page containing + * number of elements equal to the preferred page size. Service may or may not honor + * the page size preference hence client MUST be prepared to handle pages with different + * page size. * * @param preferredPageSize the preferred page size * @return a Flux of {@link ContinuablePage} */ public abstract Flux

byPage(int preferredPageSize); /** - * Get a Flux that emits stream of {@link ContinuablePage} identified by the given - * continuation token and each page containing number of elements equal to the preferred - * page size. Service may or may not honor the page size preference hence client - * MUST be prepared to handle pages with different page size. + * Get a Flux of {@link ContinuablePage} identified by the given continuation token, with each + * page containing number of elements equal to the preferred page size. Service may or may not + * honor the page size preference hence client MUST be prepared to handle pages with different + * page size. * * @param continuationToken the continuation token * @param preferredPageSize the preferred page size diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index c264e27182fe..080e540033ca 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -14,18 +14,18 @@ /** * The default implementation of {@link ContinuablePagedFlux}. * - * This type is a Flux provides the ability to operate on pages of type {@link ContinuablePage} + * This type is a Flux that provides the ability to operate on pages of type {@link ContinuablePage} * and individual items in such pages. This type supports user-provided continuation tokens, * allowing for restarting from a previously-retrieved continuation token. * - * The constructor takes a Page Retriever provider, that when called should return {@link PageRetriever}. - * The provider is called for each Subscription to this Flux. Given provider is called per Subscription, - * the provider implementation can create one or more objects to store any state and Page Retriever - * can capture and use those objects. This indirectly associate the state objects to the Subscription. - * The Page Retriever can get called multiple times in serial fashion, each time after the completion - * of the Flux returned by the previous invocation. The final completion signal will be send to - * the Subscriber when the last Page emitted by the Flux returned by the Page Retriever has {@code null} - * continuation token. + * The type is backed by the Page Retriever provider provided in it's constructor. The provider is + * expected to return {@link PageRetriever} when called. The provider is invoked for each Subscription + * to this Flux. Given provider is called per Subscription, the provider implementation can create + * one or more objects to store any state and Page Retriever can capture and use those objects. + * This indirectly associate the state objects to the Subscription. The Page Retriever can get called + * multiple times in serial fashion, each time after the completion of the Flux returned by the previous + * invocation. The final completion signal will be send to the Subscriber when the last Page emitted by + * the Flux returned by the Page Retriever has {@code null} continuation token. * *

Extending PagedFluxCore for Custom Continuation Token support

* {@codesnippet com.azure.core.util.paging.pagedfluxcore.continuationtoken} @@ -57,6 +57,7 @@ protected ContinuablePagedFluxCore(Supplier> pageRetrieverPr * * @param pageRetrieverProvider a provider that returns {@link PageRetriever}. * @param defaultPageSize the default preferred page size + * @throws IllegalArgumentException if defaultPageSize is not greater than zero */ protected ContinuablePagedFluxCore(Supplier> pageRetrieverProvider, int defaultPageSize) { this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageRetriever.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageRetriever.java index 1e41d657b360..ff960e84a43d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageRetriever.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/PageRetriever.java @@ -6,7 +6,7 @@ import reactor.core.publisher.Flux; /** - * A type representing contract to retrieve one or more pages. + * A type representing the contract to retrieve one or more pages. * * @param the continuation token type * @param

the page elements type @@ -14,12 +14,13 @@ @FunctionalInterface public interface PageRetriever { /** - * Get a set of one or more pages starting from the page identified by + * Retrieve a set of one or more pages starting from the page identified by * the given continuation token. * - * @param continuationToken the token identifying the page set - * @param pageSize the preferred number of items per page, a {@code null} value indicate - * that client prefer server's default page size + * @param continuationToken the token identifying the page set, a {@code null} + * value indicate that retrieve pages from the beginning + * @param pageSize the preferred number of items per page, a {@code null} value + * indicate that client prefer server's default page size * @return a Flux that emits one or more pages */ Flux

get(C continuationToken, Integer pageSize); From 5afcc84663e7899d03663a0a18f7177b9c7b9067 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sun, 5 Jan 2020 11:30:14 -0800 Subject: [PATCH 24/34] javadoc update, use null instead of -1 for no page-size --- .../ConfigurationSettingPage.java | 2 -- .../core/util/paging/ContinuablePage.java | 8 +++++-- .../util/paging/ContinuablePagedFlux.java | 16 ++++++------- .../util/paging/ContinuablePagedFluxCore.java | 24 +++++++++---------- .../PagedFluxCoreJavaDocCodeSnippets.java | 2 +- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java index 23c39ca7021b..01eb3d87be07 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java @@ -39,6 +39,4 @@ public String getContinuationToken() { public IterableStream getElements() { return new IterableStream<>(items); } - - } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java index b4bb4d465494..343da2153a0c 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePage.java @@ -16,12 +16,16 @@ */ public interface ContinuablePage { /** - * @return an iterable stream of elements in the page. + * Get an iterable stream of elements in the page. + * + * @return elements in the page as iterable stream. */ IterableStream getElements(); /** - * @return a reference to the next page, or {@code null} if there are no more pages. + * Get reference to the next page. + * + * @return next page reference, or {@code null} if there are no more pages. */ C getContinuationToken(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java index 385637aa346b..32f9bc194a8a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFlux.java @@ -31,22 +31,22 @@ public abstract class ContinuablePagedFlux public abstract Flux

byPage(C continuationToken); /** * Get a Flux of {@link ContinuablePage} in this Paged Flux, with each page containing - * number of elements equal to the preferred page size. Service may or may not honor - * the page size preference hence client MUST be prepared to handle pages with different - * page size. + * number of elements equal to the preferred page size. * - * @param preferredPageSize the preferred page size + * @param preferredPageSize the preferred page size, service may or may not honor the page + * size preference hence client MUST be prepared to handle pages + * with different page size. * @return a Flux of {@link ContinuablePage} */ public abstract Flux

byPage(int preferredPageSize); /** * Get a Flux of {@link ContinuablePage} identified by the given continuation token, with each - * page containing number of elements equal to the preferred page size. Service may or may not - * honor the page size preference hence client MUST be prepared to handle pages with different - * page size. + * page containing number of elements equal to the preferred page size. * * @param continuationToken the continuation token - * @param preferredPageSize the preferred page size + * @param preferredPageSize the preferred page size, service may or may not honor the page + * size preference hence client MUST be prepared to handle pages + * with different page size. * @return a Flux of {@link ContinuablePage} */ public abstract Flux

byPage(C continuationToken, int preferredPageSize); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index 080e540033ca..536676ec01e4 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -39,7 +39,7 @@ public abstract class ContinuablePagedFluxCore> extends ContinuablePagedFlux { private final Supplier> pageRetrieverProvider; - private final int defaultPageSize; + private final Integer defaultPageSize; /** * Creates an instance of {@link ContinuablePagedFluxCore}. @@ -49,29 +49,29 @@ public abstract class ContinuablePagedFluxCore> pageRetrieverProvider) { this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, "'pageRetrieverProvider' function cannot be null."); - this.defaultPageSize = -1; + this.defaultPageSize = null; } /** * Creates an instance of {@link ContinuablePagedFluxCore}. * * @param pageRetrieverProvider a provider that returns {@link PageRetriever}. - * @param defaultPageSize the default preferred page size + * @param pageSize the preferred page size * @throws IllegalArgumentException if defaultPageSize is not greater than zero */ - protected ContinuablePagedFluxCore(Supplier> pageRetrieverProvider, int defaultPageSize) { + protected ContinuablePagedFluxCore(Supplier> pageRetrieverProvider, int pageSize) { this.pageRetrieverProvider = Objects.requireNonNull(pageRetrieverProvider, "'pageRetrieverProvider' function cannot be null."); - if (defaultPageSize <= 0) { - throw new IllegalArgumentException("defaultPageSize > 0 required but provided: " + defaultPageSize); + if (pageSize <= 0) { + throw new IllegalArgumentException("pageSize > 0 required but provided: " + pageSize); } - this.defaultPageSize = defaultPageSize; + this.defaultPageSize = pageSize; } /** - * @return the page size configured for this {@link ContinuablePagedFluxCore}, -1 if unspecified. + * @return the page size configured for this {@link ContinuablePagedFluxCore}, {@code null} if unspecified. */ - public int getDefaultPageSize() { + public Integer getPageSize() { return this.defaultPageSize; } @@ -143,7 +143,7 @@ public void subscribe(CoreSubscriber coreSubscriber) { */ private static > Flux

byPage(Supplier> provider, - C continuationToken, int pageSize) { + C continuationToken, Integer pageSize) { return Flux.defer(() -> { final PageRetriever pageRetriever = provider.get(); final ContinuationState state = new ContinuationState<>(continuationToken); @@ -166,11 +166,11 @@ Flux

byPage(Supplier> provider, * @return a Flux of {@link ContinuablePage} */ private static > - Flux

concatFluxOfPage(ContinuationState state, PageRetriever pageRetriever, int pageSize) { + Flux

concatFluxOfPage(ContinuationState state, PageRetriever pageRetriever, Integer pageSize) { if (state.isDone()) { return Flux.empty(); } else { - return pageRetriever.get(state.getLastContinuationToken(), pageSize == -1 ? null : pageSize) + return pageRetriever.get(state.getLastContinuationToken(), pageSize) .switchIfEmpty(Flux.defer(() -> { state.setLastContinuationToken(null); return Mono.empty(); diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java index 903f1773c70d..8702466138cd 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java @@ -26,7 +26,7 @@ class ContinuationState { } void setLastContinuationToken(C token) { - this.isDone = token == null ? true : false; + this.isDone = token == null; this.lastContinuationToken = token; } From 879f7ca7a32c12289ec995647dbb1c98493f5d5e Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sun, 5 Jan 2020 14:02:07 -0800 Subject: [PATCH 25/34] Udating keyvault, storage-blob-batch and azure-core-test referenced version of azure-core to 1.2.0 (to get new page abstractions) --- sdk/core/azure-core-test/pom.xml | 2 +- sdk/keyvault/azure-security-keyvault-certificates/pom.xml | 2 +- sdk/keyvault/azure-security-keyvault-keys/pom.xml | 2 +- sdk/keyvault/azure-security-keyvault-secrets/pom.xml | 2 +- sdk/storage/azure-storage-blob-batch/pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/core/azure-core-test/pom.xml b/sdk/core/azure-core-test/pom.xml index e173f7bf7453..98d7c1f9e9e5 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -38,7 +38,7 @@ com.azure azure-core - 1.1.0 + 1.2.0 diff --git a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml index 8105e9ca71f8..f0de2dcbe716 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml @@ -36,7 +36,7 @@ com.azure azure-core - 1.1.0 + 1.2.0 diff --git a/sdk/keyvault/azure-security-keyvault-keys/pom.xml b/sdk/keyvault/azure-security-keyvault-keys/pom.xml index 252e1c63465e..4255b4428919 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-keys/pom.xml @@ -37,7 +37,7 @@ com.azure azure-core - 1.1.0 + 1.2.0 diff --git a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml index e16e3f8fdea9..714e484d1663 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml @@ -34,7 +34,7 @@ com.azure azure-core - 1.1.0 + 1.2.0 diff --git a/sdk/storage/azure-storage-blob-batch/pom.xml b/sdk/storage/azure-storage-blob-batch/pom.xml index 5c832199c9e4..c0e134136a49 100644 --- a/sdk/storage/azure-storage-blob-batch/pom.xml +++ b/sdk/storage/azure-storage-blob-batch/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.1.0 + 1.2.0 com.azure From ee078a80a047fc2c261af1c2ca81d0a0ec9fe374 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sun, 5 Jan 2020 14:02:36 -0800 Subject: [PATCH 26/34] Fixing checkstyles in textanalytics samples --- .../java/com/azure/ai/textanalytics/AnalyzeSentimentAsync.java | 1 - .../java/com/azure/ai/textanalytics/RecognizePiiAsync.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentAsync.java index 1f494bd95532..66339c3867bd 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentAsync.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentAsync.java @@ -5,7 +5,6 @@ import com.azure.ai.textanalytics.models.TextSentiment; -import java.util.List; import java.util.concurrent.TimeUnit; /** diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiAsync.java index afd58791a33a..3186b57f3cf9 100644 --- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiAsync.java +++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/RecognizePiiAsync.java @@ -33,7 +33,7 @@ public static void main(String[] args) { System.out.printf( "Recognized personal identifiable information entity: %s, entity type: %s, entity subtype: %s, offset: %s, length: %s, score: %s.%n", entity.getText(), - entity.getType() , + entity.getType(), entity.getSubtype() == null || entity.getSubtype().isEmpty() ? "N/A" : entity.getSubtype(), entity.getOffset(), entity.getLength(), From 5363af6b7f41cc623f8697acdfb2e43d77e40a15 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sun, 5 Jan 2020 16:16:31 -0800 Subject: [PATCH 27/34] Explicitly specify type in code-snippet --- .../rest/PagedFluxJavaDocCodeSnippets.java | 46 ++++++++++--------- .../PagedFluxCoreJavaDocCodeSnippets.java | 2 +- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java index 84e90eac9299..4dbc8f5762a2 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java @@ -164,32 +164,34 @@ public void pagedFluxFromPagedFlux() { intResponse.getContinuationToken(), null); - final Supplier>> provider = new Supplier<>() { - @Override - public PageRetriever> get() { - return (continuationToken, pageSize) -> { - Flux> flux = (continuationToken == null) - ? intPagedFlux.byPage() - : intPagedFlux.byPage(continuationToken); - return flux.map(responseMapper); - }; - } - }; + final Supplier>> provider + = new Supplier>>() { + @Override + public PageRetriever> get() { + return (continuationToken, pageSize) -> { + Flux> flux = (continuationToken == null) + ? intPagedFlux.byPage() + : intPagedFlux.byPage(continuationToken); + return flux.map(responseMapper); + }; + } + }; PagedFlux strPagedFlux = PagedFlux.create(provider); // Create a PagedFlux from a PagedFlux with all exceptions mapped to a specific exception. final PagedFlux pagedFlux = createAnInstance(); - final Supplier>> eprovider = new Supplier<>() { - @Override - public PageRetriever> get() { - return (continuationToken, pageSize) -> { - Flux> flux = (continuationToken == null) - ? pagedFlux.byPage() - : pagedFlux.byPage(continuationToken); - return flux.onErrorMap(t -> new PaginationException(t)); - }; - } - }; + final Supplier>> eprovider + = new Supplier>>() { + @Override + public PageRetriever> get() { + return (continuationToken, pageSize) -> { + Flux> flux = (continuationToken == null) + ? pagedFlux.byPage() + : pagedFlux.byPage(continuationToken); + return flux.onErrorMap(t -> new PaginationException(t)); + }; + } + }; final PagedFlux exceptionMappedPagedFlux = PagedFlux.create(eprovider); // END: com.azure.core.http.rest.pagedflux.create.decoration } diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java index 8702466138cd..c1d2182a3fff 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/paging/PagedFluxCoreJavaDocCodeSnippets.java @@ -68,7 +68,7 @@ Flux getFilePages(FileContinuationToken token) { FileShareServiceClient client = null; // Initialize client Supplier> pageRetrieverProvider - = new Supplier<>() { + = new Supplier>() { @Override public PageRetriever get() { return (continuationToken, pageSize) -> client.getFilePages(continuationToken); From f23ac6ebeeda1d8b4d6f6b55bbbff2014ee3eff9 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Sun, 5 Jan 2020 23:38:13 -0800 Subject: [PATCH 28/34] updating azure-core version of kevault-certificates, keys, secrets, storage-batch, azure-core-test to unreleased 1.2.0 --- sdk/core/azure-core-test/pom.xml | 2 +- sdk/keyvault/azure-security-keyvault-certificates/pom.xml | 2 +- sdk/keyvault/azure-security-keyvault-keys/pom.xml | 2 +- sdk/keyvault/azure-security-keyvault-secrets/pom.xml | 2 +- sdk/storage/azure-storage-blob-batch/pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/core/azure-core-test/pom.xml b/sdk/core/azure-core-test/pom.xml index 98d7c1f9e9e5..5d3fafa7caae 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -38,7 +38,7 @@ com.azure azure-core - 1.2.0 + 1.2.0 diff --git a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml index f0de2dcbe716..ac169e224370 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml @@ -36,7 +36,7 @@ com.azure azure-core - 1.2.0 + 1.2.0 diff --git a/sdk/keyvault/azure-security-keyvault-keys/pom.xml b/sdk/keyvault/azure-security-keyvault-keys/pom.xml index 4255b4428919..2b18941e2473 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-keys/pom.xml @@ -37,7 +37,7 @@ com.azure azure-core - 1.2.0 + 1.2.0 diff --git a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml index 714e484d1663..d4b1608baf89 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml @@ -34,7 +34,7 @@ com.azure azure-core - 1.2.0 + 1.2.0 diff --git a/sdk/storage/azure-storage-blob-batch/pom.xml b/sdk/storage/azure-storage-blob-batch/pom.xml index c0e134136a49..62ba59c8ac34 100644 --- a/sdk/storage/azure-storage-blob-batch/pom.xml +++ b/sdk/storage/azure-storage-blob-batch/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.2.0 + 1.2.0 com.azure From d78a70b7672b88a830724f7b5e4b5d1a14531dd5 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Mon, 6 Jan 2020 12:00:46 -0800 Subject: [PATCH 29/34] Adding revapi supression for new base ContinuablePagedFluxCore --- .../src/main/resources/revapi/revapi.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eng/code-quality-reports/src/main/resources/revapi/revapi.json b/eng/code-quality-reports/src/main/resources/revapi/revapi.json index 02f850424869..fad154a951fb 100644 --- a/eng/code-quality-reports/src/main/resources/revapi/revapi.json +++ b/eng/code-quality-reports/src/main/resources/revapi/revapi.json @@ -83,7 +83,13 @@ "new": "missing\\-class ((com\\.azure\\.messaging\\.eventhubs\\.models\\..+)|(com\\.azure\\.storage\\.blob\\.BlobContainerAsyncClient))", "exampleUseChainInNewApi": ".*com\\.azure\\.messaging\\.eventhubs\\.checkpointstore\\.blob\\..*", "justification": "azure-messaging-eventhubs and azure-storage-blob are used in the Event Hubs checkpoint store." + }, + { + "regex": true, + "code": "java\\.missing\\.(oldSuperType|newSuperType)", + "new": "class com\\.azure\\.core\\.http\\.rest\\.((PagedFlux)|(PagedFluxBase)).*", + "justification": "azure.core 1.2.0 will introduce a new base type for GAed PagedFlux. Since the base type is not in azure.core <= 1.1.0, revapi is reporting it. This entry should be removed after 1.2.0 release." } ] } -] +] \ No newline at end of file From 79b1543602f234a3e43523cc9d3c889fac4dc548 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Tue, 14 Jan 2020 16:04:30 -0800 Subject: [PATCH 30/34] bump up azure-core versions of client-libs that uses new page types --- sdk/appconfiguration/azure-data-appconfiguration/pom.xml | 2 +- sdk/core/azure-core-test/pom.xml | 2 +- sdk/keyvault/azure-security-keyvault-certificates/pom.xml | 2 +- sdk/keyvault/azure-security-keyvault-keys/pom.xml | 2 +- sdk/keyvault/azure-security-keyvault-secrets/pom.xml | 2 +- sdk/storage/azure-storage-blob-batch/pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml index 04cb2d18f302..8cf0e1b83719 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml +++ b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml @@ -36,7 +36,7 @@ com.azure azure-core - 1.2.0 + 1.3.0-beta.1 org.slf4j diff --git a/sdk/core/azure-core-test/pom.xml b/sdk/core/azure-core-test/pom.xml index e000a5103087..db3b8c6c6e69 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -38,7 +38,7 @@ com.azure azure-core - 1.2.0 + 1.3.0-beta.1 diff --git a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml index 0646470c3100..7cbab45d62eb 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-certificates/pom.xml @@ -36,7 +36,7 @@ com.azure azure-core - 1.2.0 + 1.3.0-beta.1 diff --git a/sdk/keyvault/azure-security-keyvault-keys/pom.xml b/sdk/keyvault/azure-security-keyvault-keys/pom.xml index 05b424d0373b..8366d6315186 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-keys/pom.xml @@ -37,7 +37,7 @@ com.azure azure-core - 1.2.0 + 1.3.0-beta.1 diff --git a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml index 4d0319527b0f..4f25d2c8fe74 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-security-keyvault-secrets/pom.xml @@ -34,7 +34,7 @@ com.azure azure-core - 1.2.0 + 1.3.0-beta.1 diff --git a/sdk/storage/azure-storage-blob-batch/pom.xml b/sdk/storage/azure-storage-blob-batch/pom.xml index 44ffd690ea57..9d0154552842 100644 --- a/sdk/storage/azure-storage-blob-batch/pom.xml +++ b/sdk/storage/azure-storage-blob-batch/pom.xml @@ -55,7 +55,7 @@ com.azure azure-core - 1.2.0 + 1.3.0-beta.1 com.azure From f01f1c976b7feb1fae6ef4217b0c5595025cd505 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Tue, 14 Jan 2020 18:43:11 -0800 Subject: [PATCH 31/34] javadoc improvments --- .../main/java/com/azure/core/http/rest/Page.java | 4 +++- .../java/com/azure/core/http/rest/PagedFlux.java | 14 ++++---------- .../com/azure/core/http/rest/PagedFluxBase.java | 2 +- .../core/util/paging/ContinuablePagedFluxCore.java | 5 ++++- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java index dcd5b6a32b13..e8b6ecb34cab 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java @@ -16,7 +16,9 @@ */ public interface Page extends ContinuablePage { /** - * @return list of elements in the page. + * Get list of elements in the page. + * + * @return the page elements * * @deprecated use {@link this#getElements()}. */ diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index 0fc5aa8f7537..45039386569e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -71,19 +71,11 @@ public PagedFlux(Supplier>> firstPageRetriever, } /** - * PRIVATE CONSTRUCTOR. SEE BELOW NOTES. - * * Create PagedFlux backed by Page Retriever Function Supplier. * * @param provider the Page Retrieval Provider * @param ignored param is ignored, exists in signature only to avoid conflict with first ctr */ - // NOTES: Proposal for azure-core-v2: - // - // 1. Remove the first ctr "PagedFlux(Supplier>>)". - // 2. Add a new ctr "PagedFlux(Supplier>>)". - // 3. Remove the factory method "PagedFlux::create" and this PRIVATE ctr in favour of #2. - // private PagedFlux(Supplier>> provider, boolean ignored) { super(provider, ignored); } @@ -97,8 +89,10 @@ private PagedFlux(Supplier>> provider, bo * returned by Page Retriever has {@code null} continuation token. * * The provider is useful mainly in two scenarios: - * 1. To manage state across multiple call to Page Retrieval within the same Subscription - * 2. To decorate a PagedFlux to produce new PagedFlux + *

    + *
  • To manage state across multiple call to Page Retrieval within the same Subscription. + *
  • To decorate a PagedFlux to produce new PagedFlux. + *
* *

Decoration sample

* {@codesnippet com.azure.core.http.rest.pagedflux.create.decoration} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java index 6a83be6162b7..473bdf04d6c1 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -81,7 +81,7 @@ public PagedFluxBase(Supplier> firstPageRetriever, * @param provider the Page Retrieval Provider * @param ignored ignored */ - public PagedFluxBase(Supplier> provider, boolean ignored) { + PagedFluxBase(Supplier> provider, boolean ignored) { super(provider); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java index 536676ec01e4..c78467779781 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedFluxCore.java @@ -30,6 +30,7 @@ *

Extending PagedFluxCore for Custom Continuation Token support

* {@codesnippet com.azure.core.util.paging.pagedfluxcore.continuationtoken} * + * @param the type of the continuation token * @param The type of elements in a {@link ContinuablePage} * @param

The {@link ContinuablePage} holding items of type {@code T}. * @@ -69,7 +70,9 @@ protected ContinuablePagedFluxCore(Supplier> pageRetrieverPr } /** - * @return the page size configured for this {@link ContinuablePagedFluxCore}, {@code null} if unspecified. + * Get the page size configured this {@link ContinuablePagedFluxCore}. + * + * @return the page size configured, {@code null} if unspecified. */ public Integer getPageSize() { return this.defaultPageSize; From ac3a8f4866bcdd64d64b1642a8c68f9cd56754ab Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Thu, 16 Jan 2020 16:56:50 -0800 Subject: [PATCH 32/34] Page::getElements() should not return null --- .../implementation/ConfigurationSettingPage.java | 2 +- .../test/implementation/RestProxyWithMockTests.java | 6 ++---- .../main/java/com/azure/core/http/rest/Page.java | 3 ++- .../com/azure/core/http/rest/PagedResponse.java | 3 ++- .../com/azure/core/http/rest/PagedResponseBase.java | 4 +--- .../core/implementation/serializer/ItemPage.java | 4 +--- .../java/com/azure/core/util/IterableStream.java | 13 +++++++++++++ .../implementation/CertificatePropertiesPage.java | 2 +- .../certificates/implementation/ContactPage.java | 2 +- .../implementation/DeletedCertificatePage.java | 2 +- .../implementation/IssuerPropertiesPage.java | 2 +- .../keys/implementation/DeletedKeyPage.java | 2 +- .../keys/implementation/KeyPropertiesPage.java | 2 +- .../secrets/implementation/DeletedSecretPage.java | 2 +- .../implementation/SecretPropertiesPage.java | 2 +- 15 files changed, 30 insertions(+), 21 deletions(-) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java index 01eb3d87be07..75d763750c8b 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java @@ -37,6 +37,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return new IterableStream<>(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } } diff --git a/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java b/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java index 934cda0ff137..2093c8eba63a 100644 --- a/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java +++ b/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -490,7 +489,7 @@ static class ConformingPage implements Page { @Override public IterableStream getElements() { - return new IterableStream<>(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } @Override @@ -612,9 +611,8 @@ public void service2getPageSerializes() { StepVerifier.create(createService(Service2.class).getPageAsyncSerializes(page)) .assertNext(response -> { assertEquals(page.getContinuationToken(), response.getContinuationToken()); - assertNull(response.getItems()); + assertEquals(0, response.getItems().size()); }) .verifyComplete(); } - } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java index e8b6ecb34cab..ba6e106a9145 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java @@ -6,6 +6,7 @@ import com.azure.core.util.IterableStream; import com.azure.core.util.paging.ContinuablePage; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -26,7 +27,7 @@ public interface Page extends ContinuablePage { default List getItems() { IterableStream iterableStream = this.getElements(); return iterableStream == null - ? null + ? new ArrayList<>() : this.getElements().stream().collect(Collectors.toList()); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java index afba800cf1a7..3db5ef75837f 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java @@ -5,6 +5,7 @@ import com.azure.core.util.IterableStream; import java.io.Closeable; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -26,7 +27,7 @@ public interface PagedResponse extends Page, Response>, Closeable default List getValue() { IterableStream iterableStream = this.getElements(); return iterableStream == null - ? null + ? new ArrayList<>() : iterableStream.stream().collect(Collectors.toList()); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java index 5a99069e26cc..7910c52e5d09 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java @@ -64,9 +64,7 @@ public PagedResponseBase(HttpRequest request, int statusCode, HttpHeaders header */ @Override public IterableStream getElements() { - return items == null - ? null - : new IterableStream(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } /** 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 d03de25fe709..91465d699c24 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 @@ -32,9 +32,7 @@ class ItemPage implements Page { @Override public IterableStream getElements() { - return items == null - ? null - : new IterableStream(items); + return items == null ? IterableStream.empty() : new IterableStream(items); } @Override 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 index c213418c4093..bbe972e391ac 100644 --- 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 @@ -6,6 +6,7 @@ import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Flux; +import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.Objects; @@ -37,6 +38,7 @@ public class IterableStream implements Iterable { * to Reactor how many elements should be prefetched before another batch is requested. */ private static final int DEFAULT_BATCH_SIZE = 1; + private static final IterableStream EMPTY = new IterableStream<>(new ArrayList<>()); private final ClientLogger logger = new ClientLogger(IterableStream.class); private final Flux flux; @@ -98,4 +100,15 @@ public Iterator iterator() { return Collections.emptyIterator(); } } + + /** + * Returns an {@link IterableStream} that does not contain any values. + * + * @param the type of the value + * @return an empty {@link IterableStream} + */ + @SuppressWarnings("unchecked") + public static IterableStream empty() { + return (IterableStream) EMPTY; + } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java index 10ed16c1faf1..8eb87332fb22 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java @@ -45,7 +45,7 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return new IterableStream<>(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java index fa8ec4b93980..70e05b17d4f3 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java @@ -29,7 +29,7 @@ public final class ContactPage implements Page { */ @Override public IterableStream getElements() { - return new IterableStream<>(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } @Override diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java index 92cd553e911a..2768a6e72223 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java @@ -45,6 +45,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return new IterableStream<>(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java index 03cac2e701bb..3a4f8262d022 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java @@ -45,6 +45,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return new IterableStream<>(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java index f762e9c100b9..dedccb5f3d21 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java @@ -45,6 +45,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return new IterableStream<>(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java index c5c1197bb12a..95a2a0c12d21 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java @@ -45,7 +45,7 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return new IterableStream(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java index e501fe33cd32..88edc9ca232d 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java @@ -45,6 +45,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return new IterableStream(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java index 2b928a6698e0..45faa321386b 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java @@ -45,6 +45,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return new IterableStream(items); + return items == null ? IterableStream.empty() : new IterableStream<>(items); } } From b08ec165ffcec3c2a4e22f38719b366f95ec0dcb Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Thu, 16 Jan 2020 16:58:14 -0800 Subject: [PATCH 33/34] PagedFlux javadoc update Co-Authored-By: Jonathan Giles --- .../src/main/java/com/azure/core/http/rest/PagedFlux.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index 45039386569e..462a9a7253aa 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -15,7 +15,7 @@ import java.util.function.Supplier; /** - * This type is a Flux provides the ability to operate on paginated REST response of type {@link PagedResponse} + * This type is a Flux that provides the ability to operate on paginated REST responses of type {@link PagedResponse} * and individual items in such pages. When processing the response by page, each response will contain the items * in the page as well as the REST response details like status code and headers. * From 43e83e415aabd04ddfdcfa137002bd331146d8a3 Mon Sep 17 00:00:00 2001 From: Anu Thomas Chandy Date: Thu, 16 Jan 2020 18:36:09 -0800 Subject: [PATCH 34/34] Adding IterableStream::of(Iterable) factory method --- .../implementation/ConfigurationSettingPage.java | 2 +- .../implementation/RestProxyWithMockTests.java | 2 +- .../azure/core/http/rest/PagedResponseBase.java | 2 +- .../core/implementation/serializer/ItemPage.java | 2 +- .../java/com/azure/core/util/IterableStream.java | 16 ++++++++++++---- .../CertificatePropertiesPage.java | 2 +- .../certificates/implementation/ContactPage.java | 2 +- .../implementation/DeletedCertificatePage.java | 2 +- .../implementation/IssuerPropertiesPage.java | 2 +- .../keys/implementation/DeletedKeyPage.java | 2 +- .../keys/implementation/KeyPropertiesPage.java | 2 +- .../implementation/DeletedSecretPage.java | 2 +- .../implementation/SecretPropertiesPage.java | 2 +- 13 files changed, 24 insertions(+), 16 deletions(-) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java index 75d763750c8b..40d786823af2 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java @@ -37,6 +37,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } } diff --git a/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java b/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java index 2093c8eba63a..0e18c72c66a0 100644 --- a/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java +++ b/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java @@ -489,7 +489,7 @@ static class ConformingPage implements Page { @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } @Override diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java index 7910c52e5d09..778c2009e04c 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponseBase.java @@ -64,7 +64,7 @@ public PagedResponseBase(HttpRequest request, int statusCode, HttpHeaders header */ @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } /** 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 91465d699c24..03396e611209 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 @@ -32,7 +32,7 @@ class ItemPage implements Page { @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream(items); + return IterableStream.of(items); } @Override 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 index bbe972e391ac..8ade263790dc 100644 --- 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 @@ -102,13 +102,21 @@ public Iterator iterator() { } /** - * Returns an {@link IterableStream} that does not contain any values. + * Create an {@link IterableStream} from an {@link Iterable}. * + * An empty {@link IterableStream} will be returned if the input iterable + * is {@code null}. + * + * @param iterable the source iterable * @param the type of the value - * @return an empty {@link IterableStream} + * @return an {@link IterableStream} */ @SuppressWarnings("unchecked") - public static IterableStream empty() { - return (IterableStream) EMPTY; + public static IterableStream of(Iterable iterable) { + if (iterable == null) { + return (IterableStream) EMPTY; + } else { + return new IterableStream(iterable); + } } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java index 8eb87332fb22..54f9ed3b14d8 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesPage.java @@ -45,7 +45,7 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java index 70e05b17d4f3..17e0a3891515 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java @@ -29,7 +29,7 @@ public final class ContactPage implements Page { */ @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } @Override diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java index 2768a6e72223..ad1818c27aaa 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java @@ -45,6 +45,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java index 3a4f8262d022..ab9c40ad8a2e 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerPropertiesPage.java @@ -45,6 +45,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java index dedccb5f3d21..a1d67e08fd9a 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java @@ -45,6 +45,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java index 95a2a0c12d21..d2c9bb6ce7d9 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyPropertiesPage.java @@ -45,7 +45,7 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java index 88edc9ca232d..3468a5b715fe 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java @@ -45,6 +45,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } } diff --git a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java index 45faa321386b..41091bfd6f50 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java +++ b/sdk/keyvault/azure-security-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretPropertiesPage.java @@ -45,6 +45,6 @@ public String getContinuationToken() { */ @Override public IterableStream getElements() { - return items == null ? IterableStream.empty() : new IterableStream<>(items); + return IterableStream.of(items); } }