Package groovy.lang

Examples of groovy.lang.GroovyObject


    public Object onCall(MuleEventContext eventContext) throws Exception
    {
        if (refreshableBean instanceof GroovyObject)
        {
            GroovyObject script = (GroovyObject)refreshableBean;
            MetaMethod onCall = script.getMetaClass().pickMethod("onCall", MULE_EVENT_CONTEXT);

            if (onCall != null)
            {
                return script.invokeMethod(ON_CALL, eventContext);
            }
            else
            {
                if (StringUtils.isEmpty(methodName))
                {
                    throw new DefaultMuleException(CoreMessages.propertiesNotSet("methodName"));
                }
               
                return script.invokeMethod(methodName, eventContext.getMessage().getPayload());
            }
           
        }
       
        throw new Exception(new DefaultMuleException("script engine not supported"));
View Full Code Here


            String value = writer.toString();
            if (value != null) {
                InputStream in = new ByteArrayInputStream(value.getBytes());
                GroovyClassLoader loader = new GroovyClassLoader();
                Class groovyClass = loader.parseClass(groovyFileStream);
                GroovyObject groovyObject =
                    (GroovyObject) groovyClass.newInstance();
                Object[] arg = { in };
                Object obj = groovyObject.invokeMethod(methodName, arg);
                if (obj == null) {
                    throw new AxisFault(Messages.getMessage("groovyNoanswer"));
                }
               
                SOAPFactory fac = null;
View Full Code Here

  public static GroovyObject parse(String args) {
    GroovyClassLoader cl = new GroovyClassLoader();
    try {
      final Class<?> clazz = cl.parseClass(args);
      final GroovyObject newInstance = (GroovyObject) clazz.newInstance();
      return newInstance;
    }
    catch (Exception e) {
      throw new ExecutionException(e.getMessage(), e);
    }
View Full Code Here

import junit.framework.TestCase;

public class GroovyParserTest extends TestCase {

  public void testParse() {
    GroovyObject go = GroovyParser.parse("class Test { \n String doStuff() { return \"Do stuff\" } }");
    String result = (String) go.invokeMethod("doStuff", null);
    assertEquals("Do stuff", result);
   
    //GroovyEngine ge = new GroovyEngine();
    GroovyShell sh = new GroovyShell();
    List<?> evaluate = (List<?>) sh.evaluate("[1, 2, 3]");
View Full Code Here

* @version $Revision: 21516 $
*/
public class NodePrinterTest extends TestSupport {

    public void testTree() throws Exception {
        GroovyObject object = compile("src/test/groovy/tree/TreeTest.groovy");
        object.invokeMethod("testTree", null);
    }
View Full Code Here

        GroovyObject object = compile("src/test/groovy/tree/TreeTest.groovy");
        object.invokeMethod("testTree", null);
    }

    public void testVerboseTree() throws Exception {
        GroovyObject object = compile("src/test/groovy/tree/VerboseTreeTest.groovy");
        object.invokeMethod("testTree", null);
    }
View Full Code Here

        GroovyObject object = compile("src/test/groovy/tree/VerboseTreeTest.groovy");
        object.invokeMethod("testTree", null);
    }

    public void testSmallTree() throws Exception {
        GroovyObject object = compile("src/test/groovy/tree/SmallTreeTest.groovy");
        object.invokeMethod("testTree", null);
    }
View Full Code Here

        GroovyObject object = compile("src/test/groovy/tree/SmallTreeTest.groovy");
        object.invokeMethod("testTree", null);
    }

    public void testLittleClosure() throws Exception {
        GroovyObject object = compile("src/test/groovy/LittleClosureTest.groovy");
        object.invokeMethod("testClosure", null);
    }
View Full Code Here

        GroovyObject object = compile("src/test/groovy/LittleClosureTest.groovy");
        object.invokeMethod("testClosure", null);
    }

    public void testNestedClosureBug() throws Exception {
        GroovyObject object = compile("src/test/groovy/tree/NestedClosureBugTest.groovy");
        object.invokeMethod("testNestedClosureBug", null);
    }
View Full Code Here

        GroovyObject object = compile("src/test/groovy/tree/NestedClosureBugTest.groovy");
        object.invokeMethod("testNestedClosureBug", null);
    }

    public void testClosureClassLoaderBug() throws Exception {
        GroovyObject object = compile("src/test/groovy/tree/ClosureClassLoaderBug.groovy");
        object.invokeMethod("testTree", null);
    }
View Full Code Here

TOP

Related Classes of groovy.lang.GroovyObject

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.