Package groovy.lang

Examples of groovy.lang.GroovyShell.evaluate()


     *
     * @param script the script that should pass without any exception thrown
     */
    protected void assertScript(final String script) throws Exception {
        GroovyShell shell = new GroovyShell();
        shell.evaluate(script, getTestClassName());
    }

    protected String getTestClassName() {
        return TEST_SCRIPT_NAME_PREFIX + getMethodName() + (counter++) + ".groovy";
    }
View Full Code Here


        Binding binding = new Binding();
        binding.setVariable( "env", System.getenv() );
        binding.setVariable( "sys", System.getProperties() );
        CompilerConfiguration config = new CompilerConfiguration();
        GroovyShell shell = new GroovyShell( binding, config );
        Object result = shell.evaluate( "return \"" + expression + "\"" );
        if ( result == null )
        {
            return "";
        }
        else
View Full Code Here

            GroovyShell interpreter = new GroovyShell( loader, binding, config );

            try
            {
                return interpreter.evaluate( script );
            }
            catch ( ThreadDeath e )
            {
                throw e;
            }
View Full Code Here

            Debug.logVerbose("Evaluating -- " + expression, module);
            Debug.logVerbose("Using Context -- " + context, module);
        }
        try {
            GroovyShell shell = new GroovyShell(getBinding(context));
            o = shell.evaluate(StringUtil.convertOperatorSubstitutions(expression));
            if (Debug.verboseOn()) {
                Debug.logVerbose("Evaluated to -- " + o, module);
            }
            // read back the context info
            Binding binding = shell.getContext();
View Full Code Here

    variables.setVariable("out", out);
    final GroovyShell shell = new GroovyShell(getClass().getClassLoader(), variables);
    try
    {
      LOG.debug("Evaluating script: " + StringUtils.abbreviate(script, 20));
            shell.evaluate(script);
    }
    catch (final CompilationFailedException e)
    {
      LOG.error("CompilationFailedException", e);
      throw new StepExecutionException("Cannot compile groovy code: " + script, step, e);
View Full Code Here

        binding.setVariable("table", table);
        binding.setVariable("row", row);

        GroovyShell shell = new GroovyShell(getClass().getClassLoader(), binding);
        shell.evaluate(script);
        return binding.getVariables();
    }


    protected <V> List<Object> invokeWithClosure(Class<?> clz, List<String> attributes, Closure<V> callable) {
View Full Code Here

            Debug.logVerbose("Evaluating -- " + expression, module);
            Debug.logVerbose("Using Context -- " + context, module);
        }
        try {
            GroovyShell shell = new GroovyShell(getBinding(context));
            o = shell.evaluate(StringUtil.convertOperatorSubstitutions(expression));
            if (Debug.verboseOn()) {
                Debug.logVerbose("Evaluated to -- " + o, module);
            }
            // read back the context info
            Binding binding = shell.getContext();
View Full Code Here

    }

    private void init() {
        ClassLoader loader = getClass().getClassLoader();
        GroovyShell shell = new GroovyShell(loader);
        shell.evaluate(new InputStreamReader(loader.getResourceAsStream("org/apache/camel/language/groovy/ConfigureCamel.groovy")));

        // TODO compile Groovy as part of build!
        //new ConfigureCamel().run();
    }
}
View Full Code Here

    }

    private void init() {
        ClassLoader loader = getClass().getClassLoader();
        GroovyShell shell = new GroovyShell(loader);
        shell.evaluate(loader.getResourceAsStream("org/apache/camel/language/groovy/ConfigureCamel.groovy"));

        // TODO compile Groovy as part of build!
        //new ConfigureCamel().run();
    }
}
View Full Code Here

    }

    private void init() {
        ClassLoader loader = getClass().getClassLoader();
        GroovyShell shell = new GroovyShell(loader);
        shell.evaluate(new InputStreamReader(loader.getResourceAsStream("org/apache/camel/language/groovy/ConfigureCamel.groovy")));

        // TODO compile Groovy as part of build!
        //new ConfigureCamel().run();
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.