@Test public void testCanLoadGroovyStage() throws Exception { GroovyRunnerStage runner = new GroovyRunnerStage(); String className = "DumbGroovyStage"; String script = "import com.findwise.hydra.local.LocalDocument;" + "import com.findwise.hydra.stage.groovyrunner.GroovyStage;" + " public class " + className + " implements GroovyStage{" + "public void process(LocalDocument doc){}" + "}"; GroovyStage stage = runner.loadGroovyStage(script); assertEquals(className, stage.getClass().getCanonicalName()); }
@SuppressWarnings("unchecked") public GroovyStage loadGroovyStage(String script) throws InstantiationException, IllegalAccessException { GroovyClassLoader loader = new GroovyClassLoader(this.getClass() .getClassLoader()); Class<GroovyStage> parsedClass = loader.parseClass(script); return parsedClass.newInstance(); }
GroovyRunnerStage extends AbstractProcessStage { @SuppressWarnings("unchecked") public GroovyStage loadGroovyStage(String script) throws InstantiationException, IllegalAccessException { GroovyClassLoader loader = new GroovyClassLoader(this.getClass() .getClassLoader()); Class<GroovyStage> parsedClass = loader.parseClass(script); return parsedClass.newInstance(); } }
GroovyRunnerStage extends AbstractProcessStage { @SuppressWarnings("unchecked") public GroovyStage loadGroovyStage(String script) throws InstantiationException, IllegalAccessException { GroovyClassLoader loader = new GroovyClassLoader(this.getClass() .getClassLoader()); Class<GroovyStage> parsedClass = loader.parseClass(script); return parsedClass.newInstance(); }  }
GroovyRunnerStage extends AbstractProcessStage { @SuppressWarnings("unchecked") public GroovyStage loadGroovyStage(String script) throws InstantiationException, IllegalAccessException { GroovyClassLoader loader = new GroovyClassLoader(this.getClass() .getClassLoader()); Class<GroovyStage> parsedClass = loader.parseClass(script); return parsedClass.newInstance(); }  @Override void process(LocalDocument doc); @Override void init(); @SuppressWarnings("unchecked") GroovyStage loadGroovyStage(String script); void setGroovyScript(String script); String getGroovyScript(); }
GroovyRunnerStage extends AbstractProcessStage { @SuppressWarnings("unchecked") public GroovyStage loadGroovyStage(String script) throws InstantiationException, IllegalAccessException { GroovyClassLoader loader = new GroovyClassLoader(this.getClass() .getClassLoader()); Class<GroovyStage> parsedClass = loader.parseClass(script); return parsedClass.newInstance(); }  @Override void process(LocalDocument doc); @Override void init(); @SuppressWarnings("unchecked") GroovyStage loadGroovyStage(String script); void setGroovyScript(String script); String getGroovyScript();  }