Examples of execute2()


Examples of test.command.TestInvocationContext.execute2()

  public void testContextAccessInScript() throws Exception {
    Class<? extends GroovyScriptCommand> clazz = loader.parseClass("System.out.println('bar:' + bar) ; return bar;");
    TestInvocationContext ctx = new TestInvocationContext();
    ctx.getSession().put("bar", "bar_value");
    ctx.execute2(clazz);
    assertEquals(Arrays.asList("bar_value"), ctx.getProducedItems());
  }

  public void testArgumentAccessInScript() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("return args[0];");
View Full Code Here

Examples of test.command.TestInvocationContext.execute2()

  }

  public void testArgumentAccessInScript() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("return args[0];");
    TestInvocationContext ctx = new TestInvocationContext();
    ctx.execute2(clazz, "arg_value");
    assertEquals(Arrays.asList("arg_value"), ctx.getProducedItems());
  }

  public void testArgumentAccessInClosure() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("{ arg -> context.provide(arg) };");
View Full Code Here

Examples of test.command.TestInvocationContext.execute2()

  }

  public void testArgumentAccessInClosure() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("{ arg -> context.provide(arg) };");
    TestInvocationContext ctx = new TestInvocationContext();
    ctx.execute2(clazz, "arg_value");
    assertEquals(Arrays.asList("arg_value"), ctx.getProducedItems());
  }

  public void testResolveContext() throws Exception {
    Class<? extends BaseCommand> clazz = loader.parseClass("class foo {\n" +
View Full Code Here

Examples of test.command.TestInvocationContext.execute2()

  }

  public void testResolveContextInScript() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("return context");
    TestInvocationContext context = new TestInvocationContext();
    context.execute2(clazz);
    assertEquals(1, context.getProducedItems().size());
    assertInstance(InvocationContext.class, context.getProducedItems().get(0));
  }

  public void testScriptUseReturnValue() throws Exception {
View Full Code Here

Examples of test.command.TestInvocationContext.execute2()

  }

  public void testScriptUseReturnValue() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("return 'def'");
    TestInvocationContext ctx = new TestInvocationContext();
    ctx.execute2(clazz);
    assertEquals(Arrays.asList("def"), ctx.getProducedItems());
  }

  public void testScriptDiscardImplicitReturnValue() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("def a = 'def'");
View Full Code Here

Examples of test.command.TestInvocationContext.execute2()

  }

  public void testScriptDiscardImplicitReturnValue() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("def a = 'def'");
    TestInvocationContext ctx = new TestInvocationContext();
    ctx.execute2(clazz);
    assertEquals(0, ctx.getProducedItems().size());
  }

  public void testScriptReturnExplicitReturnValue() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("return 'def'");
View Full Code Here

Examples of test.command.TestInvocationContext.execute2()

  }

  public void testScriptReturnExplicitReturnValue() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("return 'def'");
    TestInvocationContext ctx = new TestInvocationContext();
    ctx.execute2(clazz);
    assertEquals(Arrays.asList("def"), ctx.getProducedItems());
  }
}
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.