From a84376185fe499b7bbb92374ea55b79c70f64a0c Mon Sep 17 00:00:00 2001 From: Naveen Tatikonda Date: Wed, 30 Mar 2022 10:52:17 -0500 Subject: [PATCH] remove hardcoded URL (#338) Signed-off-by: Naveen Tatikonda (cherry picked from commit b276aa3b09b5a720b5a1ef225370b4c42ed85300) --- build-tools/knnplugin-coverage.gradle | 1 + src/test/java/org/opensearch/knn/KNNRestTestCase.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build-tools/knnplugin-coverage.gradle b/build-tools/knnplugin-coverage.gradle index c87b09b06..30129c0db 100644 --- a/build-tools/knnplugin-coverage.gradle +++ b/build-tools/knnplugin-coverage.gradle @@ -43,6 +43,7 @@ task dummyIntegTest(type: Test) { integTest { systemProperty 'jacoco.dir', "${jacocoDir}" + systemProperty 'jmx.serviceUrl', "service:jmx:rmi:///jndi/rmi://127.0.0.1:7777/jmxrmi" } jacocoTestReport { diff --git a/src/test/java/org/opensearch/knn/KNNRestTestCase.java b/src/test/java/org/opensearch/knn/KNNRestTestCase.java index 3afac33a8..a3bc8fc9f 100644 --- a/src/test/java/org/opensearch/knn/KNNRestTestCase.java +++ b/src/test/java/org/opensearch/knn/KNNRestTestCase.java @@ -92,7 +92,7 @@ public static void dumpCoverage() throws IOException, MalformedObjectNameExcepti return; } - String serverUrl = "service:jmx:rmi:///jndi/rmi://127.0.0.1:7777/jmxrmi"; + String serverUrl = System.getProperty("jmx.serviceUrl"); try (JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(serverUrl))) { IProxy proxy = MBeanServerInvocationHandler.newProxyInstance( connector.getMBeanServerConnection(), new ObjectName("org.jacoco:type=Runtime"), IProxy.class,