DATAREDIS-1030 - Refine RedisScript creation.
Allow RedisScript.of(…) creation from a Resource. Original Pull Request: #473
This commit is contained in:
committed by
Christoph Strobl
parent
ac4909f139
commit
85669e6e69
@@ -28,6 +28,7 @@ import org.springframework.scripting.support.StaticScriptSource;
|
||||
*
|
||||
* @author Jennifer Hickey
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class DefaultRedisScriptTests {
|
||||
|
||||
@@ -55,6 +56,14 @@ public class DefaultRedisScriptTests {
|
||||
assertThat(redisScript.getScriptAsString()).isEqualTo("return ARGS[1]");
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-1030
|
||||
public void testGetScriptAsStringFromResource() {
|
||||
|
||||
RedisScript<String> redisScript = RedisScript
|
||||
.of(new ClassPathResource("org/springframework/data/redis/core/script/cas.lua"));
|
||||
assertThat(redisScript.getScriptAsString()).startsWith("local current = redis.call('GET', KEYS[1])");
|
||||
}
|
||||
|
||||
@Test(expected = ScriptingException.class)
|
||||
public void testGetScriptAsStringError() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user