11package com .trivadis .plsql .formatter .sqlcl .tests ;
22
3+ import com .oracle .truffle .js .scriptengine .GraalJSScriptEngine ;
34import oracle .dbtools .raptor .newscriptrunner .*;
45import org .junit .jupiter .api .Assertions ;
56import 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