Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 85014bc

Browse files
fix test to make it work with latest JS script engine
1 parent debe2a9 commit 85014bc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

standalone/src/test/java/com/trivadis/plsql/formatter/sqlcl/tests/AbstractSqlclTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.trivadis.plsql.formatter.sqlcl.tests;
22

3+
import com.oracle.truffle.js.scriptengine.GraalJSScriptEngine;
34
import oracle.dbtools.raptor.newscriptrunner.*;
45
import org.junit.jupiter.api.Assertions;
56
import org.junit.jupiter.api.BeforeEach;
@@ -19,7 +20,7 @@ public abstract class AbstractSqlclTest {
1920

2021
protected final ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
2122
protected final ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("JavaScript");
22-
protected final ScriptContext scriptContext = new SimpleScriptContext();
23+
protected final ScriptContext scriptContext = scriptEngine.getContext();
2324
protected final ScriptRunnerContext ctx = new ScriptRunnerContext();
2425
protected final ScriptExecutor sqlcl = new ScriptExecutor(null);
2526
protected final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
@@ -66,7 +67,9 @@ public void setup() {
6667
var bindings = new SimpleBindings();
6768
bindings.put("polyglot.js.allowHostAccess", true);
6869
bindings.put("polyglot.js.allowHostClassLookup", (Predicate<String>) s -> true);
70+
bindings.put("allowExperimentalOptions", true);
6971
scriptContext.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
72+
((GraalJSScriptEngine)scriptEngine).getPolyglotContext().enter();
7073
sqlcl.setOut(bufferedOutputStream);
7174
ctx.setOutputStreamWrapper(wrapListenBufferOutputStream);
7275
sqlcl.setScriptRunnerContext(ctx);

0 commit comments

Comments
 (0)