From 4808beeba5b9fa59ef77b64828959f96b3cfd176 Mon Sep 17 00:00:00 2001 From: Jorge Beauregard Date: Wed, 7 Oct 2020 14:34:59 -0600 Subject: [PATCH] Removed SUCCESS as a terminal state --- .../administration/PhoneNumberAsyncClient.java | 7 +++---- .../PhoneNumberAsyncClientIntegrationTest.java | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java index a8e2677581968..979507befa82e 100644 --- a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java @@ -805,12 +805,11 @@ public PollerFlux beginCreateSearch( getSearchById(pollingContext.getLatestResponse().getValue().getSearchId()) .flatMap(getSearchResponse -> { SearchStatus status = getSearchResponse.getStatus(); - if (status.equals(SearchStatus.SUCCESS) - || status.equals(SearchStatus.EXPIRED) + if (status.equals(SearchStatus.EXPIRED) || status.equals(SearchStatus.CANCELLED) || status.equals(SearchStatus.RESERVED)) { - return Mono.just(new PollResponse<>( - LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getSearchResponse)); + return Mono.just(new PollResponse<>( + LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getSearchResponse)); } if (status.equals(SearchStatus.ERROR)) { return Mono.just(new PollResponse<>( diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java index 1bbeee7199585..807c347e38cb6 100644 --- a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java @@ -23,7 +23,6 @@ import com.azure.communication.common.PhoneNumber; import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.Response; -import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.core.util.Context; import org.junit.jupiter.api.Test;