Search in sources :

Example 11 with GroovyScriptEngine

use of groovy.util.GroovyScriptEngine in project groovy by apache.

the class Groovy1567 method testGroovyScriptEngineVsGroovyShell.

@Test
public void testGroovyScriptEngineVsGroovyShell() throws Exception {
    // @todo refactor this path
    File currentDir = new File("src/test/groovy/bugs");
    String file = "scriptForGroovy1567.groovy";
    Binding binding = new Binding();
    GroovyShell shell = new GroovyShell(binding);
    String[] test = null;
    // 
    shell.run(new File(currentDir, file), test);
    String[] roots = new String[] { currentDir.getAbsolutePath() };
    GroovyScriptEngine gse = new GroovyScriptEngine(roots);
    binding = new Binding();
    // a MME was ensued here stating no 't.start()' was available in the script
    gse.run(file, binding);
}
Also used : Binding(groovy.lang.Binding) GroovyScriptEngine(groovy.util.GroovyScriptEngine) File(java.io.File) GroovyShell(groovy.lang.GroovyShell) Test(org.junit.Test)

Aggregations

GroovyScriptEngine (groovy.util.GroovyScriptEngine)11 Binding (groovy.lang.Binding)5 File (java.io.File)5 GroovyShell (groovy.lang.GroovyShell)3 ResourceException (groovy.util.ResourceException)3 ScriptException (groovy.util.ScriptException)3 Closure (groovy.lang.Closure)2 GitBlitException (com.gitblit.GitBlitException)1 UserModel (com.gitblit.models.UserModel)1 Script (groovy.lang.Script)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Test (org.junit.Test)1 KnowledgeBaseScript (org.openksavi.sponge.kb.KnowledgeBaseScript)1