From 8afb99c659aef0fd5f96daa29ae0678caa480741 Mon Sep 17 00:00:00 2001 From: zane-neo Date: Thu, 7 Dec 2023 13:29:14 +0800 Subject: [PATCH] Fix failure ITs Signed-off-by: zane-neo --- .../transport/TransportPPLQueryResponseTest.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugin/src/test/java/org/opensearch/sql/plugin/transport/TransportPPLQueryResponseTest.java b/plugin/src/test/java/org/opensearch/sql/plugin/transport/TransportPPLQueryResponseTest.java index 9a6cfbd19a..ba065c1ebe 100644 --- a/plugin/src/test/java/org/opensearch/sql/plugin/transport/TransportPPLQueryResponseTest.java +++ b/plugin/src/test/java/org/opensearch/sql/plugin/transport/TransportPPLQueryResponseTest.java @@ -10,8 +10,11 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -34,13 +37,14 @@ public void testFromActionResponseDifferentClassLoader() InstantiationException, IllegalAccessException, NoSuchMethodException, - InvocationTargetException { + InvocationTargetException, + URISyntaxException { ClassLoader loader = TransportPPLQueryResponseTest.class.getClassLoader(); - String classFilePath = + URI resourceURI = loader .getResource("org/opensearch/sql/plugin/transport/TransportPPLQueryResponse.class") - .getPath(); - + .toURI(); + Path classFilePath = Paths.get(resourceURI); CustomClassLoader classLoader1 = new CustomClassLoader(classFilePath); CustomClassLoader classLoader2 = new CustomClassLoader(classFilePath); @@ -62,8 +66,8 @@ class CustomClassLoader extends ClassLoader { private final Path classFilePath; - public CustomClassLoader(String classFilePath) { - this.classFilePath = Path.of(classFilePath); + public CustomClassLoader(Path classFilePath) { + this.classFilePath = classFilePath; } @Override