Skip to content

Commit 99f4850

Browse files
committed
【支持qlexpress表达式】冲突
1 parent dac03f5 commit 99f4850

File tree

1 file changed

+46
-0
lines changed
  • core/src/test/java/com/taobao/arthas/core/command/express

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.taobao.arthas.core.command.express;
2+
3+
import com.taobao.arthas.core.advisor.Advice;
4+
import ognl.OgnlException;
5+
import org.junit.jupiter.api.BeforeEach;
6+
import org.junit.jupiter.api.Test;
7+
8+
import static org.junit.jupiter.api.Assertions.assertTrue;
9+
10+
/**
11+
* https://github.com/alibaba/arthas/issues/2954
12+
*/
13+
public class OgnlTest {
14+
15+
private Express express;
16+
17+
@BeforeEach
18+
public void setUp() throws OgnlException, ExpressException {
19+
FlowContext context = new FlowContext();
20+
Object[] params = new Object[4];
21+
params[0] = context;
22+
Advice advice = Advice.newForAfterReturning(null, getClass(), null, null, params, null);
23+
express = ExpressFactory.unpooledExpress(null).bind(advice).bind("cost", 123);
24+
}
25+
26+
@Test
27+
public void testStringEquals() throws OgnlException, ExpressException {
28+
String conditionExpress = "\"aaa\".equals(params[0].flowAttribute.getBxApp())";
29+
boolean result = express.is(conditionExpress);
30+
assertTrue(result);
31+
}
32+
33+
@Test
34+
public void testObjectEquals() throws OgnlException, ExpressException {
35+
String conditionExpress = "params[0].flowAttribute.getBxApp().equals(\"aaa\")";
36+
boolean result = express.is(conditionExpress);
37+
assertTrue(result);
38+
}
39+
40+
@Test
41+
public void testEqualSign() throws OgnlException, ExpressException {
42+
String conditionExpress = "\"aaa\" == params[0].flowAttribute.getBxApp()";
43+
boolean result = express.is(conditionExpress);
44+
assertTrue(result);
45+
}
46+
}

0 commit comments

Comments
 (0)