Java Code Examples for org.springframework.scripting.ScriptEvaluator#evaluate()

The following examples show how to use org.springframework.scripting.ScriptEvaluator#evaluate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GroovyScriptEvaluatorTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testGroovyScriptWithArguments() {
	ScriptEvaluator evaluator = new GroovyScriptEvaluator();
	Map<String, Object> arguments = new HashMap<>();
	arguments.put("a", 3);
	arguments.put("b", 2);
	Object result = evaluator.evaluate(new StaticScriptSource("return a * b"), arguments);
	assertEquals(6, result);
}
 
Example 2
Source File: GroovyScriptEvaluatorTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGroovyScriptWithArguments() {
	ScriptEvaluator evaluator = new GroovyScriptEvaluator();
	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);
}
 
Example 3
Source File: BshScriptEvaluatorTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testGroovyScriptWithArguments() {
	ScriptEvaluator evaluator = new BshScriptEvaluator();
	Map<String, Object> arguments = new HashMap<>();
	arguments.put("a", 3);
	arguments.put("b", 2);
	Object result = evaluator.evaluate(new StaticScriptSource("return a * b;"), arguments);
	assertEquals(6, result);
}
 
Example 4
Source File: BshScriptEvaluatorTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGroovyScriptWithArguments() {
	ScriptEvaluator evaluator = new BshScriptEvaluator();
	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);
}
 
Example 5
Source File: GroovyScriptEvaluatorTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testGroovyScriptWithArguments() {
	ScriptEvaluator evaluator = new GroovyScriptEvaluator();
	Map<String, Object> arguments = new HashMap<>();
	arguments.put("a", 3);
	arguments.put("b", 2);
	Object result = evaluator.evaluate(new StaticScriptSource("return a * b"), arguments);
	assertEquals(6, result);
}
 
Example 6
Source File: BshScriptEvaluatorTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testGroovyScriptWithArguments() {
	ScriptEvaluator evaluator = new BshScriptEvaluator();
	Map<String, Object> arguments = new HashMap<>();
	arguments.put("a", 3);
	arguments.put("b", 2);
	Object result = evaluator.evaluate(new StaticScriptSource("return a * b;"), arguments);
	assertEquals(6, result);
}
 
Example 7
Source File: GroovyScriptEvaluatorTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void testGroovyScriptFromFileUsingJsr223() {
	ScriptEvaluator evaluator = new StandardScriptEvaluator();
	Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.groovy", getClass())));
	assertEquals(6, result);
}
 
Example 8
Source File: BshScriptEvaluatorTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void testBshScriptFromFile() {
	ScriptEvaluator evaluator = new BshScriptEvaluator();
	Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.bsh", getClass())));
	assertEquals(6, result);
}
 
Example 9
Source File: BshScriptEvaluatorTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void testBshScriptFromString() {
	ScriptEvaluator evaluator = new BshScriptEvaluator();
	Object result = evaluator.evaluate(new StaticScriptSource("return 3 * 2;"));
	assertEquals(6, result);
}
 
Example 10
Source File: GroovyScriptEvaluatorTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void testGroovyScriptFromFileUsingJsr223() {
	ScriptEvaluator evaluator = new StandardScriptEvaluator();
	Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.groovy", getClass())));
	assertEquals(6, result);
}
 
Example 11
Source File: GroovyScriptEvaluatorTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void testGroovyScriptFromFile() {
	ScriptEvaluator evaluator = new GroovyScriptEvaluator();
	Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.groovy", getClass())));
	assertEquals(6, result);
}
 
Example 12
Source File: GroovyScriptEvaluatorTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void testGroovyScriptFromString() {
	ScriptEvaluator evaluator = new GroovyScriptEvaluator();
	Object result = evaluator.evaluate(new StaticScriptSource("return 3 * 2"));
	assertEquals(6, result);
}
 
Example 13
Source File: BshScriptEvaluatorTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void testBshScriptFromFile() {
	ScriptEvaluator evaluator = new BshScriptEvaluator();
	Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.bsh", getClass())));
	assertEquals(6, result);
}
 
Example 14
Source File: BshScriptEvaluatorTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void testBshScriptFromString() {
	ScriptEvaluator evaluator = new BshScriptEvaluator();
	Object result = evaluator.evaluate(new StaticScriptSource("return 3 * 2;"));
	assertEquals(6, result);
}
 
Example 15
Source File: GroovyScriptEvaluatorTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void testGroovyScriptFromString() {
	ScriptEvaluator evaluator = new GroovyScriptEvaluator();
	Object result = evaluator.evaluate(new StaticScriptSource("return 3 * 2"));
	assertEquals(6, result);
}
 
Example 16
Source File: GroovyScriptEvaluatorTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void testGroovyScriptFromString() {
	ScriptEvaluator evaluator = new GroovyScriptEvaluator();
	Object result = evaluator.evaluate(new StaticScriptSource("return 3 * 2"));
	assertEquals(6, result);
}
 
Example 17
Source File: BshScriptEvaluatorTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void testBshScriptFromFile() {
	ScriptEvaluator evaluator = new BshScriptEvaluator();
	Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.bsh", getClass())));
	assertEquals(6, result);
}
 
Example 18
Source File: BshScriptEvaluatorTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void testBshScriptFromString() {
	ScriptEvaluator evaluator = new BshScriptEvaluator();
	Object result = evaluator.evaluate(new StaticScriptSource("return 3 * 2;"));
	assertEquals(6, result);
}
 
Example 19
Source File: GroovyScriptEvaluatorTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void testGroovyScriptFromFileUsingJsr223() {
	ScriptEvaluator evaluator = new StandardScriptEvaluator();
	Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.groovy", getClass())));
	assertEquals(6, result);
}
 
Example 20
Source File: GroovyScriptEvaluatorTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void testGroovyScriptFromFile() {
	ScriptEvaluator evaluator = new GroovyScriptEvaluator();
	Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.groovy", getClass())));
	assertEquals(6, result);
}