Search in sources :

Example 6 with ScriptEngineManager

use of javax.script.ScriptEngineManager in project spring-framework by spring-projects.

the class ScriptTemplateView method createEngineFromName.

protected ScriptEngine createEngineFromName() {
    if (this.scriptEngineManager == null) {
        this.scriptEngineManager = new ScriptEngineManager(getApplicationContext().getClassLoader());
    }
    ScriptEngine engine = StandardScriptUtils.retrieveEngineByName(this.scriptEngineManager, this.engineName);
    loadScripts(engine);
    return engine;
}
Also used : ScriptEngineManager(javax.script.ScriptEngineManager) ScriptEngine(javax.script.ScriptEngine)

Example 7 with ScriptEngineManager

use of javax.script.ScriptEngineManager in project es6draft by anba.

the class CompilableTest method setUp.

@Before
public void setUp() {
    manager = new ScriptEngineManager();
    engine = manager.getEngineByName("es6draft");
    assertThat(engine, notNullValue());
    assertThat(engine, instanceOf(Compilable.class));
    compilable = (Compilable) engine;
}
Also used : Compilable(javax.script.Compilable) ScriptEngineManager(javax.script.ScriptEngineManager) Before(org.junit.Before)

Example 8 with ScriptEngineManager

use of javax.script.ScriptEngineManager in project es6draft by anba.

the class ScriptEngineFactoryTest method setUp.

@Before
public void setUp() {
    ScriptEngineManager manager = new ScriptEngineManager();
    for (ScriptEngineFactory factory : manager.getEngineFactories()) {
        if (ENGINE_NAME.equals(factory.getEngineName())) {
            this.factory = factory;
            return;
        }
    }
    fail("script engine factory not found");
}
Also used : ScriptEngineFactory(javax.script.ScriptEngineFactory) ScriptEngineManager(javax.script.ScriptEngineManager) Before(org.junit.Before)

Example 9 with ScriptEngineManager

use of javax.script.ScriptEngineManager in project es6draft by anba.

the class ScriptEngineTest method setUp.

@Before
public void setUp() {
    manager = new ScriptEngineManager();
    engine = manager.getEngineByName("es6draft");
    assertThat(engine, notNullValue());
}
Also used : ScriptEngineManager(javax.script.ScriptEngineManager) Before(org.junit.Before)

Example 10 with ScriptEngineManager

use of javax.script.ScriptEngineManager in project es6draft by anba.

the class ScriptEngineScopeTest method setUp.

@Before
public void setUp() {
    manager = new ScriptEngineManager();
    engine = manager.getEngineByName("es6draft");
    assertThat(engine, notNullValue());
}
Also used : ScriptEngineManager(javax.script.ScriptEngineManager) Before(org.junit.Before)

Aggregations

ScriptEngineManager (javax.script.ScriptEngineManager)84 ScriptEngine (javax.script.ScriptEngine)46 Test (org.junit.Test)19 ScriptException (javax.script.ScriptException)15 ScriptEngineFactory (javax.script.ScriptEngineFactory)11 QuickTest (com.hazelcast.test.annotation.QuickTest)10 Invocable (javax.script.Invocable)10 IOException (java.io.IOException)8 GroovyScriptEngineFactory (org.codehaus.groovy.jsr223.GroovyScriptEngineFactory)8 Before (org.junit.Before)8 FileReader (java.io.FileReader)7 File (java.io.File)6 Reader (java.io.Reader)6 Bindings (javax.script.Bindings)6 Map (java.util.Map)5 HashMap (java.util.HashMap)3 SimpleBindings (javax.script.SimpleBindings)3 NashornScriptEngine (jdk.nashorn.api.scripting.NashornScriptEngine)3 Plugin (the.bytecode.club.bytecodeviewer.api.Plugin)3 Person (com.winterbe.java8.samples.lambda.Person)2