From d50b0b72a72a8dc10eae472c48a8017c28bf2365 Mon Sep 17 00:00:00 2001 From: Bill Wert Date: Thu, 28 Sep 2023 22:29:16 -0700 Subject: [PATCH] Use the working directory to search for the root of the repo from. --- .../java/com/azure/core/test/utils/TestProxyManager.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyManager.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyManager.java index a9fbe5fddf9bf..736871ddf13a0 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyManager.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestProxyManager.java @@ -17,20 +17,18 @@ import java.time.Duration; import java.util.Map; -import static com.azure.core.test.utils.TestUtils.toURI; - /** * Manages running the test recording proxy server */ public final class TestProxyManager { private static final ClientLogger LOGGER = new ClientLogger(TestProxyManager.class); private static Process proxy; - private static final Path TEST_CLASS_PATH = Paths.get(toURI(TestProxyManager.class.getResource(TestProxyManager.class.getSimpleName() + ".class"))); + private static final Path WORKING_DIRECTORY = Paths.get(System.getProperty("user.dir")); static { Runtime.getRuntime().addShutdownHook(new Thread(TestProxyManager::stopProxy)); if (runningLocally()) { - TestProxyDownloader.installTestProxy(TEST_CLASS_PATH); + TestProxyDownloader.installTestProxy(WORKING_DIRECTORY); } } @@ -51,7 +49,7 @@ public static synchronized void startProxy() { ProcessBuilder builder = new ProcessBuilder(commandLine, "--storage-location", - TestUtils.getRepoRootResolveUntil(TEST_CLASS_PATH, "eng").toString()); + TestUtils.getRepoRootResolveUntil(WORKING_DIRECTORY, "eng").toString()); Map environment = builder.environment(); environment.put("LOGGING__LOGLEVEL", "Information"); environment.put("LOGGING__LOGLEVEL__MICROSOFT", "Warning");