Search in sources :

Example 6 with ScriptEngineFactory

use of javax.script.ScriptEngineFactory in project hazelcast by hazelcast.

the class HazelcastOSGiScriptEngineFactoryTest method scriptEngineFactoriesIteratedAndAccessedSuccessfully.

@Test
public void scriptEngineFactoriesIteratedAndAccessedSuccessfully() {
    OSGiScriptEngineManager scriptEngineManager = (OSGiScriptEngineManager) ScriptEngineManagerContext.getScriptEngineManager();
    List<ScriptEngineFactory> engineFactories = scriptEngineManager.getEngineFactories();
    assertNotNull(engineFactories);
    for (ScriptEngineFactory engineFactory : engineFactories) {
        assertTrue(engineFactory instanceof OSGiScriptEngineFactory);
    }
    scriptEngineManager.reloadManagers();
    engineFactories = scriptEngineManager.getEngineFactories();
    assertNotNull(engineFactories);
    for (ScriptEngineFactory engineFactory : engineFactories) {
        assertTrue(engineFactory instanceof OSGiScriptEngineFactory);
    }
}
Also used : ScriptEngineFactory(javax.script.ScriptEngineFactory) GroovyScriptEngineFactory(org.codehaus.groovy.jsr223.GroovyScriptEngineFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 7 with ScriptEngineFactory

use of javax.script.ScriptEngineFactory in project hazelcast by hazelcast.

the class HazelcastOSGiScriptEngineTest method putAndGetContextSuccessfully.

@Test
public void putAndGetContextSuccessfully() {
    ScriptEngineManager scriptEngineManager = ScriptEngineManagerContext.getScriptEngineManager();
    List<ScriptEngineFactory> engineFactories = scriptEngineManager.getEngineFactories();
    assertNotNull(engineFactories);
    for (ScriptEngineFactory engineFactory : engineFactories) {
        verifyThatPutAndGetContextSuccessfully(engineFactory.getScriptEngine());
    }
}
Also used : ScriptEngineFactory(javax.script.ScriptEngineFactory) GroovyScriptEngineFactory(org.codehaus.groovy.jsr223.GroovyScriptEngineFactory) ScriptEngineManager(javax.script.ScriptEngineManager) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with ScriptEngineFactory

use of javax.script.ScriptEngineFactory in project hazelcast by hazelcast.

the class HazelcastOSGiScriptEngineTest method putAndGetSuccessfully.

@Test
public void putAndGetSuccessfully() {
    ScriptEngineManager scriptEngineManager = ScriptEngineManagerContext.getScriptEngineManager();
    List<ScriptEngineFactory> engineFactories = scriptEngineManager.getEngineFactories();
    assertNotNull(engineFactories);
    for (ScriptEngineFactory engineFactory : engineFactories) {
        verifyThatPutAndGetSuccessfully(engineFactory.getScriptEngine());
    }
}
Also used : ScriptEngineFactory(javax.script.ScriptEngineFactory) GroovyScriptEngineFactory(org.codehaus.groovy.jsr223.GroovyScriptEngineFactory) ScriptEngineManager(javax.script.ScriptEngineManager) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 9 with ScriptEngineFactory

use of javax.script.ScriptEngineFactory in project OpenAM by OpenRock.

the class SandboxedGroovyScriptEngineTest method shouldReturnCorrectEngineFactory.

@Test
public void shouldReturnCorrectEngineFactory() throws Exception {
    // Given
    // When
    ScriptEngineFactory result = testEngine.getFactory();
    // Then
    assertThat(result).isEqualTo(engineFactory);
}
Also used : ScriptEngineFactory(javax.script.ScriptEngineFactory) Test(org.testng.annotations.Test)

Example 10 with ScriptEngineFactory

use of javax.script.ScriptEngineFactory in project zaproxy by zaproxy.

the class ExtensionScript method getScriptingEngines.

public List<String> getScriptingEngines() {
    List<String> engineNames = new ArrayList<>();
    List<ScriptEngineFactory> engines = mgr.getEngineFactories();
    for (ScriptEngineFactory engine : engines) {
        engineNames.add(engine.getLanguageName() + LANG_ENGINE_SEP + engine.getEngineName());
    }
    for (ScriptEngineWrapper sew : this.engineWrappers) {
        if (!engines.contains(sew.getEngine().getFactory())) {
            engineNames.add(sew.getLanguageName() + LANG_ENGINE_SEP + sew.getEngineName());
        }
    }
    Collections.sort(engineNames);
    return engineNames;
}
Also used : ScriptEngineFactory(javax.script.ScriptEngineFactory) ArrayList(java.util.ArrayList)

Aggregations

ScriptEngineFactory (javax.script.ScriptEngineFactory)30 ScriptEngineManager (javax.script.ScriptEngineManager)11 ScriptEngine (javax.script.ScriptEngine)9 Test (org.junit.Test)9 QuickTest (com.hazelcast.test.annotation.QuickTest)8 GroovyScriptEngineFactory (org.codehaus.groovy.jsr223.GroovyScriptEngineFactory)8 ArrayList (java.util.ArrayList)4 URL (java.net.URL)2 HashMap (java.util.HashMap)2 LinkedHashSet (java.util.LinkedHashSet)2 JSONWriter (org.apache.felix.utils.json.JSONWriter)2 Result (com.buschmais.jqassistant.core.analysis.api.Result)1 RuleExecutorException (com.buschmais.jqassistant.core.rule.api.executor.RuleExecutorException)1 OSQLScriptEngineFactory (com.orientechnologies.orient.core.sql.OSQLScriptEngineFactory)1 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1