1 | void testParseExample8() throws Exception {↵ | | 1 | void testParseExample1() throws Exception {↵
|
2 | StringProperty prop = new StringProperty("html", "${__regexFunction((\\\\$\\d+\\.\\d+),$1$)}");↵ | | 2 | StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}");↵
|
3 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 3 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
4 | newProp.setRunningVersion(true);↵ | | 4 | newProp.setRunningVersion(true);↵
|
5 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵ | | 5 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
6 | assertEquals("$3.47", newProp.getStringValue());↵ | | 6 | assertEquals("hello world", newProp.getStringValue());↵
|
7 | }↵ | | 7 | }↵
|
|
8 | public void testParseExample9() throws Exception {↵ | | 8 | public void testParseExample2() throws Exception {↵
|
9 | StringProperty prop = new StringProperty("html", "${__regexFunction(([$]\\d+\\.\\d+),$1$)}");↵ | | 9 | StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>,$1$)}}");↵
|
10 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 10 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
11 | newProp.setRunningVersion(true);↵ | | 11 | newProp.setRunningVersion(true);↵
|
12 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵ | | 12 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
13 | assertEquals("$3.47", newProp.getStringValue());↵ | | 13 | assertEquals("It should say:${hello world}", newProp.getStringValue());↵
|
14 | }↵ | | 14 | }↵
|
|
15 | public void testParseExample10() throws Exception {↵ | | 15 | public void testParseExample3() throws Exception {↵
|
16 | StringProperty prop = new StringProperty("html", "${__regexFunction(\\ "↵ | | 16 | StringProperty prop = new StringProperty("html", "${__regexFunction(↵
|
17 | + "(\\\\\\$\\d+\\.\\d+\\,\\\\$\\d+\\.\\d+),$1↵ | | 17 | <html>(.*)</html>,$1$)}"↵
|
18 | $)}");↵ | | 18 | + "${__regexFunction(<html>(.*o)(.*o)(.*)</html>," + "$1$$3$)}");↵
|
19 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 19 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
20 | newProp.setRunningVersion(true);↵ | | 20 | newProp.setRunningVersion(true);↵
|
21 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵ | | 21 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
22 | assertEquals("$3.47,$5.67", newProp.getStringValue());↵ | | 22 | assertEquals("hello worldhellorld", newProp.getStringValue());↵
|
23 | }↵ | | 23 | }↵
|
|
24 | public void testNestedExample1() throws Exception {↵ | | 24 | public void testParseExample4() throws Exception {↵
|
25 | StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>,"↵ | | 25 | StringProperty prop = new StringProperty("html", "${↵
|
26 | + "$1$)}${__regexFunction(<html>(.*o)(.*o)(.*)" + "</html>,$1$$3$)}");↵ | | 26 | non-existing function}");↵
|
27 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 27 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
28 | newProp.setRunningVersion(true);↵ | | 28 | newProp.setRunningVersion(true);↵
|
29 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵ | | 29 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
30 | assertEquals("hello worldhellorld", newProp.getStringValue());↵ | | 30 | assertEquals("${non-existing function}", newProp.getStringValue());↵
|
31 | }↵ | | 31 | }↵
|
|
32 | public void testNestedExample2() throws Exception {↵ | | 32 | public void testParseExample6() throws Exception {↵
|
33 | StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>,$1$)}");↵ | | 33 | StringProperty prop = new StringProperty("html", "${server}");↵
|
34 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 34 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
35 | newProp.setRunningVersion(true);↵ | | 35 | newProp.setRunningVersion(true);↵
|
36 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵ | | 36 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
37 | assertEquals("hello world", newProp.getStringValue());↵ | | 37 | assertEquals("jakarta.apache.org", newProp.getStringValue());↵
|
38 | | | 38 |
|