Package groovy.lang

Examples of groovy.lang.Script


    public void testCompileScriptToDir() throws Exception {
        scriptCompilationHandler.compileToDir(scriptSource, classLoader, scriptCacheDir, null, expectedScriptClass);

        checkScriptClassesInCache();

        Script script = scriptCompilationHandler.loadFromDir(scriptSource, classLoader, scriptCacheDir,
                expectedScriptClass).newInstance();
        evaluateScript(script);
    }
View Full Code Here


        final ScriptSource scriptSource = scriptSource("// ignore me\n");
        scriptCompilationHandler.compileToDir(scriptSource, classLoader, scriptCacheDir, null, expectedScriptClass);

        checkEmptyScriptInCache();

        Script script = scriptCompilationHandler.loadFromDir(scriptSource, classLoader, scriptCacheDir,
                expectedScriptClass).newInstance();
        assertThat(script, is(expectedScriptClass));
    }
View Full Code Here

        final ScriptSource scriptSource = scriptSource("");
        scriptCompilationHandler.compileToDir(scriptSource, classLoader, scriptCacheDir, null, expectedScriptClass);

        checkEmptyScriptInCache();

        Script script = scriptCompilationHandler.loadFromDir(scriptSource, classLoader, scriptCacheDir,
                expectedScriptClass).newInstance();
        assertThat(script, is(expectedScriptClass));
    }
View Full Code Here

        final ScriptSource scriptSource = scriptSource("class SomeClass {}");
        scriptCompilationHandler.compileToDir(scriptSource, classLoader, scriptCacheDir, null, expectedScriptClass);

        checkEmptyScriptInCache();

        Script script = scriptCompilationHandler.loadFromDir(scriptSource, classLoader, scriptCacheDir,
                expectedScriptClass).newInstance();
        assertThat(script, is(expectedScriptClass));
    }
View Full Code Here

        final ScriptSource scriptSource = scriptSource("def method() { println 'hi' }");
        scriptCompilationHandler.compileToDir(scriptSource, classLoader, scriptCacheDir, null, expectedScriptClass);

        checkScriptClassesInCache();

        Script script = scriptCompilationHandler.loadFromDir(scriptSource, classLoader, scriptCacheDir,
                expectedScriptClass).newInstance();
        assertThat(script, is(expectedScriptClass));
    }
View Full Code Here

        final ScriptSource scriptSource = scriptSource("String a");
        scriptCompilationHandler.compileToDir(scriptSource, classLoader, scriptCacheDir, null, expectedScriptClass);

        checkScriptClassesInCache();

        Script script = scriptCompilationHandler.loadFromDir(scriptSource, classLoader, scriptCacheDir,
                expectedScriptClass).newInstance();
        assertThat(script, is(expectedScriptClass));
    }
View Full Code Here

            }
        };

        ScriptSource source = scriptSource("transformMe()");
        scriptCompilationHandler.compileToDir(source, classLoader, scriptCacheDir, visitor, expectedScriptClass);
        Script script = scriptCompilationHandler.loadFromDir(source, classLoader, scriptCacheDir, expectedScriptClass).newInstance();
        evaluateScript(script);
    }
View Full Code Here

     * Process the input files.
     */
    private void processFiles() throws CompilationFailedException, IOException {
        GroovyShell groovy = new GroovyShell(conf);

        Script s;

        if (isScriptFile) {
            s = groovy.parse(huntForTheScriptFile(script));
        } else {
            s = groovy.parse(script, "main");
View Full Code Here

        mock.startElement("", "module", "module", attrs);
        mock.endElement("", "module", "module");

        replayControls();

        Script script = new GroovyShell().parse("processor.module(id:'basic', version:'1.0.0')");

        runScript(script, mock);
    }
View Full Code Here

        parser.initialize(resource, getClassResolver());

        GroovyCodeSource source = new GroovyCodeSource(resource.getResourceURL());

        Script script = new GroovyShell().parse(source);

        try
        {
            runScript(script, parser);
View Full Code Here

TOP

Related Classes of groovy.lang.Script

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.