From ec4bbe43b061b0b5c3949a94d76c3f659dc2ff89 Mon Sep 17 00:00:00 2001 From: Franko Morales Date: Mon, 26 Jul 2021 13:38:27 -0700 Subject: [PATCH] Moving RedirectPolicy from Common to CallingServer --- .../checkstyle/checkstyle-suppressions.xml | 2 +- .../CHANGELOG.md | 3 +- .../azure-communication-callingserver/pom.xml | 23 ++++++++++++ .../CallingServerClientBuilder.java | 2 +- .../implementation/RedirectPolicy.java | 6 ++-- .../implementation/RedirectPolicyTests.java | 2 +- .../azure-communication-common/README.md | 2 +- .../azure-communication-common/pom.xml | 35 ------------------- 8 files changed, 31 insertions(+), 44 deletions(-) rename sdk/communication/{azure-communication-common/src/main/java/com/azure/communication/common => azure-communication-callingserver/src/main/java/com/azure/communication/callingserver}/implementation/RedirectPolicy.java (93%) rename sdk/communication/{azure-communication-common/src/test/java/com/azure/communication/common => azure-communication-callingserver/src/test/java/com/azure/communication/callingserver}/implementation/RedirectPolicyTests.java (98%) diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index e9199779c6333..5e14428e154d9 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -608,5 +608,5 @@ the main ServiceBusClientBuilder. --> + files="com.azure.communication.callingserver.implementation.RedirectPolicy.java"/> diff --git a/sdk/communication/azure-communication-callingserver/CHANGELOG.md b/sdk/communication/azure-communication-callingserver/CHANGELOG.md index 31324e375416a..9f033f7a91547 100644 --- a/sdk/communication/azure-communication-callingserver/CHANGELOG.md +++ b/sdk/communication/azure-communication-callingserver/CHANGELOG.md @@ -1,8 +1,7 @@ # Release History -## 1.0.0-beta.4 (unreleased) - ## 1.0.0-beta.3 (2021-07-26) +### Features Added - Added RedirectPolicy as a new HttpPolicy to redirect requests based on the HttpResponse. ## 1.0.0-beta.2 (2021-06-25) diff --git a/sdk/communication/azure-communication-callingserver/pom.xml b/sdk/communication/azure-communication-callingserver/pom.xml index 88a123dbecc65..330174043d067 100644 --- a/sdk/communication/azure-communication-callingserver/pom.xml +++ b/sdk/communication/azure-communication-callingserver/pom.xml @@ -176,4 +176,27 @@ + + + + is.jdk.11 + + [9,) + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + + --add-opens com.azure.communication.callingserver/com.azure.communication.callingserver.implementation=ALL-UNNAMED + + + + + + + diff --git a/sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/CallingServerClientBuilder.java b/sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/CallingServerClientBuilder.java index 35fc1fe8ba8da..f8cea4a37d14a 100644 --- a/sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/CallingServerClientBuilder.java +++ b/sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/CallingServerClientBuilder.java @@ -5,7 +5,7 @@ import com.azure.communication.callingserver.implementation.AzureCommunicationCallingServerServiceImpl; import com.azure.communication.callingserver.implementation.AzureCommunicationCallingServerServiceImplBuilder; -import com.azure.communication.common.implementation.RedirectPolicy; +import com.azure.communication.callingserver.implementation.RedirectPolicy; import com.azure.communication.common.implementation.CommunicationConnectionString; import com.azure.communication.common.implementation.HmacAuthenticationPolicy; import com.azure.core.annotation.ServiceClientBuilder; diff --git a/sdk/communication/azure-communication-common/src/main/java/com/azure/communication/common/implementation/RedirectPolicy.java b/sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/implementation/RedirectPolicy.java similarity index 93% rename from sdk/communication/azure-communication-common/src/main/java/com/azure/communication/common/implementation/RedirectPolicy.java rename to sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/implementation/RedirectPolicy.java index f9008074d900a..53a763b5e069c 100644 --- a/sdk/communication/azure-communication-common/src/main/java/com/azure/communication/common/implementation/RedirectPolicy.java +++ b/sdk/communication/azure-communication-callingserver/src/main/java/com/azure/communication/callingserver/implementation/RedirectPolicy.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.communication.common.implementation; +package com.azure.communication.callingserver.implementation; import com.azure.core.http.HttpPipelineCallContext; import com.azure.core.http.HttpPipelineNextPolicy; @@ -14,8 +14,8 @@ import java.util.Set; /** - * HttpPipelinePolicy to redirect requests when 302 message is received to the new location marked by the - * Location header. + * HttpPipelinePolicy to redirect requests when a redirect response (Http codes 301 or 302) is received to the + * new location marked by the Location header. */ public final class RedirectPolicy implements HttpPipelinePolicy { private static final int MAX_REDIRECTS = 10; diff --git a/sdk/communication/azure-communication-common/src/test/java/com/azure/communication/common/implementation/RedirectPolicyTests.java b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/implementation/RedirectPolicyTests.java similarity index 98% rename from sdk/communication/azure-communication-common/src/test/java/com/azure/communication/common/implementation/RedirectPolicyTests.java rename to sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/implementation/RedirectPolicyTests.java index 8e0e57247d089..0322ae31546ef 100644 --- a/sdk/communication/azure-communication-common/src/test/java/com/azure/communication/common/implementation/RedirectPolicyTests.java +++ b/sdk/communication/azure-communication-callingserver/src/test/java/com/azure/communication/callingserver/implementation/RedirectPolicyTests.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.communication.common.implementation; +package com.azure.communication.callingserver.implementation; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpMethod; diff --git a/sdk/communication/azure-communication-common/README.md b/sdk/communication/azure-communication-common/README.md index eb6553634f226..df2d5c6fd41ff 100644 --- a/sdk/communication/azure-communication-common/README.md +++ b/sdk/communication/azure-communication-common/README.md @@ -62,4 +62,4 @@ Check out other client libraries for Azure communication service [cla]: https://cla.microsoft.com [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ -[coc_contact]: mailto:opencode@microsoft.com \ No newline at end of file +[coc_contact]: mailto:opencode@microsoft.com diff --git a/sdk/communication/azure-communication-common/pom.xml b/sdk/communication/azure-communication-common/pom.xml index ebce18bf9706d..d76ce1c5074ae 100644 --- a/sdk/communication/azure-communication-common/pom.xml +++ b/sdk/communication/azure-communication-common/pom.xml @@ -84,40 +84,5 @@ 3.4.8 test - - org.mockito - mockito-core - 3.9.0 - test - - - org.hamcrest - hamcrest-all - 1.3 - test - - - - - java-lts - - [11,) - - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M3 - - - --add-opens com.azure.communication.common/com.azure.communication.common.implementation=ALL-UNNAMED - - - - - - -