Package org.springframework.scripting.support

Examples of org.springframework.scripting.support.StaticScriptSource


*/
public class DefaultRedisScriptTests {

  @Test
  public void testGetSha1() {
    StaticScriptSource script = new StaticScriptSource("return KEYS[1]");
    DefaultRedisScript<String> redisScript = new DefaultRedisScript<String>();
    redisScript.setScriptSource(script);
    redisScript.setResultType(String.class);
    String sha1 = redisScript.getSha1();
    // Ensure multiple calls return same sha
    assertEquals(sha1, redisScript.getSha1());
    script.setScript("return KEYS[2]");
    // Sha should now be different as script text has changed
    assertFalse(sha1.equals(redisScript.getSha1()));
  }
View Full Code Here


    template.setKeySerializer(new StringRedisSerializer());
    template.setValueSerializer(personSerializer);
    template.setConnectionFactory(connFactory);
    template.afterPropertiesSet();
    DefaultRedisScript<String> script = new DefaultRedisScript<String>();
    script.setScriptSource(new StaticScriptSource("redis.call('SET',KEYS[1], ARGV[1])\nreturn 'FOO'"));
    script.setResultType(String.class);
    ScriptExecutor<String> scriptExecutor = new DefaultScriptExecutor<String>(template);
    Person joe = new Person("Joe", "Schmoe", 23);
    String result = scriptExecutor.execute(script, personSerializer, new StringRedisSerializer(),
        Collections.singletonList("bar"), joe);
View Full Code Here

  /**
   * @param script The script text
   */
  public void setScriptText(String scriptText) {
    this.scriptSource = new StaticScriptSource(scriptText);
  }
View Full Code Here

TOP

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

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.