Search in sources :

Example 6 with ResourceScriptSource

use of org.springframework.scripting.support.ResourceScriptSource in project spring-framework by spring-projects.

the class GroovyScriptEvaluatorTests method testGroovyScriptFromFile.

@Test
public void testGroovyScriptFromFile() {
    ScriptEvaluator evaluator = new GroovyScriptEvaluator();
    Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.groovy", getClass())));
    assertEquals(6, result);
}
Also used : StandardScriptEvaluator(org.springframework.scripting.support.StandardScriptEvaluator) ScriptEvaluator(org.springframework.scripting.ScriptEvaluator) ResourceScriptSource(org.springframework.scripting.support.ResourceScriptSource) ClassPathResource(org.springframework.core.io.ClassPathResource) Test(org.junit.Test)

Example 7 with ResourceScriptSource

use of org.springframework.scripting.support.ResourceScriptSource in project spring-framework by spring-projects.

the class GroovyScriptEvaluatorTests method testGroovyScriptFromFileUsingJsr223.

@Test
public void testGroovyScriptFromFileUsingJsr223() {
    ScriptEvaluator evaluator = new StandardScriptEvaluator();
    Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.groovy", getClass())));
    assertEquals(6, result);
}
Also used : StandardScriptEvaluator(org.springframework.scripting.support.StandardScriptEvaluator) StandardScriptEvaluator(org.springframework.scripting.support.StandardScriptEvaluator) ScriptEvaluator(org.springframework.scripting.ScriptEvaluator) ResourceScriptSource(org.springframework.scripting.support.ResourceScriptSource) ClassPathResource(org.springframework.core.io.ClassPathResource) Test(org.junit.Test)

Example 8 with ResourceScriptSource

use of org.springframework.scripting.support.ResourceScriptSource in project spring-framework by spring-projects.

the class BshScriptEvaluatorTests method testBshScriptFromFile.

@Test
public void testBshScriptFromFile() {
    ScriptEvaluator evaluator = new BshScriptEvaluator();
    Object result = evaluator.evaluate(new ResourceScriptSource(new ClassPathResource("simple.bsh", getClass())));
    assertEquals(6, result);
}
Also used : ScriptEvaluator(org.springframework.scripting.ScriptEvaluator) ResourceScriptSource(org.springframework.scripting.support.ResourceScriptSource) ClassPathResource(org.springframework.core.io.ClassPathResource) Test(org.junit.Test)

Aggregations

ResourceScriptSource (org.springframework.scripting.support.ResourceScriptSource)8 Test (org.junit.Test)7 ClassPathResource (org.springframework.core.io.ClassPathResource)7 DefaultPointcutAdvisor (org.springframework.aop.support.DefaultPointcutAdvisor)4 AspectJExpressionPointcut (org.springframework.aop.aspectj.AspectJExpressionPointcut)3 ScriptEvaluator (org.springframework.scripting.ScriptEvaluator)3 StandardScriptEvaluator (org.springframework.scripting.support.StandardScriptEvaluator)2 IOException (java.io.IOException)1