From b92e82cba39c3d8625cf32984cf5dfca9b2be9a8 Mon Sep 17 00:00:00 2001 From: samvaity Date: Sat, 15 Apr 2023 14:40:58 -0700 Subject: [PATCH] take latest dep --- sdk/metricsadvisor/azure-ai-metricsadvisor/pom.xml | 2 +- .../MetricsAdvisorAdministrationClientTestBase.java | 13 ++----------- .../MetricsAdvisorClientTestBase.java | 13 ++----------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/pom.xml b/sdk/metricsadvisor/azure-ai-metricsadvisor/pom.xml index a6469acd6893d..6f4a511cf73d1 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/pom.xml +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/pom.xml @@ -57,7 +57,7 @@ com.azure azure-core-test - 1.16.0 + 1.16.1 test diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java index b79e544b7e1b7..1f515b9c89e00 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorAdministrationClientTestBase.java @@ -5,9 +5,6 @@ import com.azure.ai.metricsadvisor.administration.MetricsAdvisorAdministrationClientBuilder; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.core.credential.AccessToken; -import com.azure.core.credential.TokenCredential; -import com.azure.core.credential.TokenRequestContext; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; @@ -15,11 +12,10 @@ import com.azure.core.test.http.AssertingHttpClientBuilder; import com.azure.core.test.models.BodilessMatcher; import com.azure.core.test.models.CustomMatcher; +import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.Configuration; import com.azure.identity.DefaultAzureCredentialBuilder; -import reactor.core.publisher.Mono; -import java.time.OffsetDateTime; import java.util.Arrays; import static com.azure.ai.metricsadvisor.MetricsAdvisorClientBuilderTest.PLAYBACK_ENDPOINT; @@ -83,12 +79,7 @@ MetricsAdvisorAdministrationClientBuilder getMetricsAdvisorAdministrationBuilder } } else { if (interceptorManager.isPlaybackMode()) { - builder.credential(new TokenCredential() { - @Override - public Mono getToken(TokenRequestContext tokenRequestContext) { - return Mono.just(new AccessToken("mockToken", OffsetDateTime.now().plusHours(2))); - } - }); + builder.credential(new MockTokenCredential()); interceptorManager.addMatchers(Arrays.asList(new BodilessMatcher())); } else if (interceptorManager.isRecordMode()) { builder diff --git a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java index 0ba61a6440b8a..3533cdcf19d5b 100644 --- a/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java +++ b/sdk/metricsadvisor/azure-ai-metricsadvisor/src/test/java/com/azure/ai/metricsadvisor/MetricsAdvisorClientTestBase.java @@ -4,9 +4,6 @@ package com.azure.ai.metricsadvisor; import com.azure.ai.metricsadvisor.models.MetricsAdvisorKeyCredential; -import com.azure.core.credential.AccessToken; -import com.azure.core.credential.TokenCredential; -import com.azure.core.credential.TokenRequestContext; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.HttpLogOptions; @@ -14,11 +11,10 @@ import com.azure.core.test.http.AssertingHttpClientBuilder; import com.azure.core.test.models.BodilessMatcher; import com.azure.core.test.models.CustomMatcher; +import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.Configuration; import com.azure.identity.DefaultAzureCredentialBuilder; -import reactor.core.publisher.Mono; -import java.time.OffsetDateTime; import java.util.Arrays; import static com.azure.ai.metricsadvisor.TestUtils.AZURE_METRICS_ADVISOR_ENDPOINT; @@ -75,12 +71,7 @@ MetricsAdvisorClientBuilder getMetricsAdvisorBuilderInternal(HttpClient httpClie } } else { if (interceptorManager.isPlaybackMode()) { - builder.credential(new TokenCredential() { - @Override - public Mono getToken(TokenRequestContext tokenRequestContext) { - return Mono.just(new AccessToken("mockToken", OffsetDateTime.now().plusHours(2))); - } - }); + builder.credential(new MockTokenCredential()); // setting bodiless matcher to "exclude" matching request bodies with UUID's interceptorManager.addMatchers(Arrays.asList(new BodilessMatcher())); } else if (interceptorManager.isRecordMode()) {