From c81fbb169f1d826674442ce116f54bca260239b6 Mon Sep 17 00:00:00 2001 From: linghengqian Date: Thu, 30 Mar 2023 21:35:33 +0800 Subject: [PATCH] Fix wrong classpath in Espresso context --- .../infra/util/expr/EspressoInlineExpressionParser.java | 2 +- .../infra/util/expr/InlineExpressionParserTest.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java index 5ff3334b01baa..c1ed78db7c05c 100644 --- a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java +++ b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java @@ -44,7 +44,7 @@ public final class EspressoInlineExpressionParser { URL resource = Thread.currentThread().getContextClassLoader().getResource("espresso-need-libs"); assert null != resource; String dir = resource.getPath(); - String javaClasspath = String.join(":", dir + "/groovy.jar", dir + "/guava.jar", dir + "/shardingsphere-infra-util.jar"); + String javaClasspath = String.join(":", dir + "/groovy.jar", dir + "/guava.jar", dir + "/shardingsphere-infra-util-groovy.jar"); POLYGLOT = Context.newBuilder().allowAllAccess(true) .option("java.Properties.org.graalvm.home", javaHome) .option("java.MultiThreaded", "true") diff --git a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParserTest.java b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParserTest.java index f68edf39d1e0b..2649dd283dbfc 100644 --- a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParserTest.java +++ b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParserTest.java @@ -18,6 +18,7 @@ package org.apache.shardingsphere.infra.util.expr; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledInNativeImage; import java.util.Collections; import java.util.List; @@ -120,9 +121,8 @@ void assertHandlePlaceHolder() { * Because `org.graalvm.polyglot.Value#as` does not allow this type to be returned from the guest JVM. */ @Test + @DisabledInNativeImage void assertEvaluateClosure() { - if (!System.getProperty("java.vm.name").equals("Substrate VM")) { - assertThat(new InlineExpressionParser("${1+2}").evaluateClosure().call().toString(), is("3")); - } + assertThat(new InlineExpressionParser("${1+2}").evaluateClosure().call().toString(), is("3")); } }