forked from qiujiayu/AutoLoadCache
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOgnlTest.java
More file actions
22 lines (16 loc) · 723 Bytes
/
OgnlTest.java
File metadata and controls
22 lines (16 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.test.script;
import junit.framework.TestCase;
import com.jarvis.cache.script.AbstractScriptParser;
import com.jarvis.cache.script.OgnlParser;
public class OgnlTest extends TestCase {
public void testJavaScript() throws Exception {
String keySpEL="'test_'+#args[0]+'_'+#args[1]";
Object[] arguments=new Object[]{"1111", "2222"};
AbstractScriptParser scriptParser=new OgnlParser();
String res=scriptParser.getDefinedCacheKey(keySpEL, arguments, null, false);
System.out.println(res);
// 自定义函数使用
Boolean rv=scriptParser.getElValue("@@empty(#args[0])", arguments, Boolean.class);
assertFalse(rv);
}
}