use of groovy.util.GroovyScriptEngine in project groovy-core by groovy.
the class Groovy1567_Bug method testGroovyScriptEngineVsGroovyShell.
public void testGroovyScriptEngineVsGroovyShell() throws IOException, ResourceException, ScriptException {
// @todo refactor this path
File currentDir = new File("./src/test/groovy/bugs");
String file = "bug1567_script.groovy";
Binding binding = new Binding();
GroovyShell shell = new GroovyShell(binding);
String[] test = null;
Object result = 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);
}
use of groovy.util.GroovyScriptEngine in project groovy by apache.
the class Groovy1567_Bug method testGroovyScriptEngineVsGroovyShell.
public void testGroovyScriptEngineVsGroovyShell() throws IOException, ResourceException, ScriptException {
// @todo refactor this path
File currentDir = new File("./src/test/groovy/bugs");
String file = "bug1567_script.groovy";
Binding binding = new Binding();
GroovyShell shell = new GroovyShell(binding);
String[] test = null;
Object result = 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);
}
use of groovy.util.GroovyScriptEngine in project pom-manipulation-ext by release-engineering.
the class TestUtils method runScript.
/**
* Run runScript.groovy script in workingDir directory.
*
* @param workingDir - Directory with groovy script.
* @param file - groovy script to run
* @throws Exception if an error occurs
*/
private static void runScript(String workingDir, String file) throws Exception {
File verify = new File(workingDir + "/" + file + ".groovy");
if (!verify.isFile()) {
return;
}
Binding binding = new Binding();
binding.setVariable("basedir", workingDir);
GroovyScriptEngine engine = new GroovyScriptEngine(workingDir);
engine.run(file + ".groovy", binding);
}
use of groovy.util.GroovyScriptEngine in project groovy-core by groovy.
the class GroovyClassLoaderDeadlockTest method testNoDeadlockWhenTwoThreadsCompileScripts.
public void testNoDeadlockWhenTwoThreadsCompileScripts() throws IOException, InterruptedException {
String[] roots = new String[] { PATH };
GroovyScriptEngine gse = new GroovyScriptEngine(roots);
Runner[] runners = new Runner[] { new Runner(gse, "script0.groovy", 0), new Runner(gse, "script1.groovy", 1) };
for (Runner runner : runners) {
runner.start();
}
for (Runner runner : runners) {
runner.join();
}
assertEquals("0+0=0", runners[0].getResult());
assertEquals("1+1=2", runners[1].getResult());
}
use of groovy.util.GroovyScriptEngine in project groovy by apache.
the class GroovyClassLoaderDeadlockTest method testNoDeadlockWhenTwoThreadsCompileScripts.
public void testNoDeadlockWhenTwoThreadsCompileScripts() throws IOException, InterruptedException {
String[] roots = new String[] { PATH };
GroovyScriptEngine gse = new GroovyScriptEngine(roots);
Runner[] runners = new Runner[] { new Runner(gse, "script0.groovy", 0), new Runner(gse, "script1.groovy", 1) };
for (Runner runner : runners) {
runner.start();
}
for (Runner runner : runners) {
runner.join();
}
assertEquals("0+0=0", runners[0].getResult());
assertEquals("1+1=2", runners[1].getResult());
}
Aggregations