Package org.springframework.scripting.support

Examples of org.springframework.scripting.support.StandardScriptEvaluator.evaluate()


  @Test
  public void testGroovyScriptFromStringUsingJsr223() {
    StandardScriptEvaluator evaluator = new StandardScriptEvaluator();
    evaluator.setLanguage("Groovy");
    Object result = evaluator.evaluate(new StaticScriptSource("return 3 * 2"));
    assertEquals(6, result);
  }

  @Test
  public void testGroovyScriptFromFileUsingJsr223() {
View Full Code Here


  }

  @Test
  public void testGroovyScriptFromFileUsingJsr223() {
    ScriptEvaluator evaluator = new StandardScriptEvaluator();
    Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.groovy", getClass())));
    assertEquals(6, result);
  }

  @Test
  public void testGroovyScriptWithArgumentsUsingJsr223() {
View Full Code Here

    StandardScriptEvaluator evaluator = new StandardScriptEvaluator();
    evaluator.setLanguage("Groovy");
    Map<String, Object> arguments = new HashMap<String, Object>();
    arguments.put("a", 3);
    arguments.put("b", 2);
    Object result = evaluator.evaluate(new StaticScriptSource("return a * b"), arguments);
    assertEquals(6, result);
  }

}
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.