Package org.springframework.scripting.support

Examples of org.springframework.scripting.support.ResourceScriptSource


  @Test
  public void testManualGroovyBeanWithDynamicPointcutProxyTargetClass() throws Exception {
    LogUserAdvice logAdvice = new LogUserAdvice();

    GroovyScriptFactory scriptFactory = new GroovyScriptFactory("GroovyServiceImpl.grv");
    TestService target = (TestService) scriptFactory.getScriptedObject(new ResourceScriptSource(
        new ClassPathResource("GroovyServiceImpl.grv", getClass())));

    AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
    pointcut.setExpression(String.format("@within(%s.Log)", ClassUtils.getPackageName(getClass())));
    testAdvice(new DefaultPointcutAdvisor(pointcut, logAdvice), logAdvice, target, "GroovyServiceImpl", true);
View Full Code Here


  }

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

   * @param resource the {@link org.springframework.core.io.Resource} location of the script to use.
   */
  public void setScript(Resource resource) {
    Assert.notNull(resource, "The script resource cannot be null");

    this.script = new ResourceScriptSource(resource);
  }
View Full Code Here

  }

  @Test(expected = ScriptingException.class)
  public void testGetScriptAsStringError() {
    DefaultRedisScript<Long> redisScript = new DefaultRedisScript<Long>();
    redisScript.setScriptSource(new ResourceScriptSource(new ClassPathResource("nonexistent")));
    redisScript.setResultType(Long.class);
    redisScript.getScriptAsString();
  }
View Full Code Here

  /**
   * @param scriptLocation The location of the script
   */
  public void setLocation(Resource scriptLocation) {
    this.scriptSource = new ResourceScriptSource(scriptLocation);
  }
View Full Code Here

TOP

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

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.