Package org.springframework.scripting.support

Examples of org.springframework.scripting.support.StandardScriptEvaluator


    assertEquals(6, result);
  }

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


    assertEquals(6, result);
  }

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

    assertEquals(6, result);
  }

  @Test
  public void testGroovyScriptWithArgumentsUsingJsr223() {
    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

    this.itemBindingVariableName = itemBindingVariableName;
  }

  @Override
  public void afterPropertiesSet() throws Exception {
    scriptEvaluator = new StandardScriptEvaluator();

    Assert.state(scriptSource != null || script != null,
        "Either the script source or script file must be provided");

    Assert.state(scriptSource == null || script == null,
View Full Code Here

TOP

Related Classes of org.springframework.scripting.support.StandardScriptEvaluator

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.