1 | void testParseExample1() throws Exception {↵ | | 1 | void testParseExample6() throws Exception {↵
|
2 | StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}");↵ | | 2 | StringProperty prop = new StringProperty("html", "${server}");↵
|
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("hello world", newProp.getStringValue());↵ | | 6 | assertEquals("jakarta.apache.org", newProp.getStringValue());↵
|
7 | }↵ | | 7 | }↵
|
|
8 | public void testParseExample2() throws Exception {↵ | | 8 | public void testParseExample5() throws Exception {↵
|
9 | StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>,$1$)}}");↵ | | 9 | StringProperty prop = new StringProperty("html", "");↵
|
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.StringProperty", newProp.getClass().getName());↵
|
13 | assertEquals("It should say:${hello world}", newProp.getStringValue());↵ | | 13 | assertEquals("", newProp.getStringValue());↵
|
14 | }↵ | | 14 | }↵
|
|
15 | public void testParseExample3() throws Exception {↵ | | 15 | public void testParseExample7() throws Exception {↵
|
16 | StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}"↵ | | 16 | StringProperty prop = new StringProperty("html", "${__regexFunction(\\<↵
|
17 | + "${__regexFunction(<html>(.*o)(.*o)(.*)</html>," + "$1$$3$)}");↵ | | 17 | ([a-z]*)\\>,$1$)}");↵
|
18 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 18 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
19 | newProp.setRunningVersion(true);↵ | | 19 | newProp.setRunningVersion(true);↵
|
20 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵ | | 20 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
21 | assertEquals("hello worldhellorld", newProp.getStringValue());↵ | | 21 | assertEquals("html", newProp.getStringValue());↵
|
22 | }↵ | | 22 | }↵
|
|
23 | public void testParseExample4() throws Exception {↵ | | 23 | public void testParseExample8() throws Exception {↵
|
24 | StringProperty prop = new StringProperty("html", "${non-existing function}");↵ | | 24 | StringProperty prop = new StringProperty("html", "${__regexFunction((\\\\$\\d+\\.\\d+),$1$)}");↵
|
25 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 25 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
26 | newProp.setRunningVersion(true);↵ | | 26 | newProp.setRunningVersion(true);↵
|
27 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵ | | 27 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
28 | assertEquals("${non-existing function}", newProp.getStringValue());↵ | | 28 | assertEquals("$3.47", newProp.getStringValue());↵
|
29 | }↵ | | 29 | }↵
|
|
30 | public void testParseExample6() throws Exception {↵ | | 30 | public void testParseExample9() throws Exception {↵
|
31 | StringProperty prop = new StringProperty("html", "${server}");↵ | | 31 | StringProperty prop = new StringProperty("html", "${__regexFunction(([$]\\d+\\.\\d+),$1$)}");↵
|
32 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 32 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
33 | newProp.setRunningVersion(true);↵ | | 33 | newProp.setRunningVersion(true);↵
|
34 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵ | | 34 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
35 | assertEquals("jakarta.apache.org", newProp.getStringValue());↵ | | 35 | assertEquals("$3.47", newProp.getStringValue());↵
|
36 | }↵ | | 36 | }↵
|
|
37 | public void testParseExample5() throws Exception {↵ | | 37 | public void testParseExample10() throws Exception {↵
|
38 | StringProperty prop = new StringProperty("html", "↵ | | 38 | StringProperty prop = new StringProperty("html", "${__regexFunction(\\ "↵
|
39 | ");↵ | | 39 | + "(\\\\\\$\\d+\\.\\d+\\,\\\\$\\d+\\.\\d+),$1$)}");↵
|
40 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 40 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
41 | newProp.setRunningVersion(true);↵ | | 41 | newProp.setRunningVersion(true);↵
|
42 | assertEquals("org.apache.jmeter.testelement.property.StringProperty", newProp.getClass().getName());↵ | | 42 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
43 | assertEquals("", newProp.getStringValue());↵ | | 43 | assertEquals("$3.47,$5.67", newProp.getStringValue());↵
|
44 | }↵ | | 44 | }↵
|
|
45 | public void testParseExample7() throws Exception {↵ | | 45 | public void testNestedExample1() throws Exception {↵
|
46 | StringProperty prop = new StringProperty("html", "${__regexFunction(\\<([a-z]*)\\↵ | | 46 | StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>,"↵
|
47 | >,$1$)}");↵ | | 47 | + "$1$)}${__regexFunction(<html>(.*o)(.*o)(.*)" + "</html>,$1$$3$)}");↵
|
48 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 48 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
49 | newProp.setRunningVersion(true);↵ | | 49 | newProp.setRunningVersion(true);↵
|
50 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵ | | 50 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
51 | assertEquals("html", newProp.getStringValue());↵ | | 51 | assertEquals("hello worldhellorld", newProp.getStringValue());↵
|
52 | }↵ | | 52 | }↵
|
|
53 | public void testParseExample8() throws Exception {↵ | | 53 | public void testNestedExample2() throws Exception {↵
|
54 | StringProperty prop = new StringProperty("html", "${__regexFunction((\\\\$\\d+\\.\\d+),$1$)}");↵ | | 54 | StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>,$1$)}");↵
|
55 | JMeterProperty newProp = transformer.transformValue(prop);↵ | | 55 | JMeterProperty newProp = transformer.transformValue(prop);↵
|
56 | newProp.setRunningVersion(true);↵ | | 56 | newProp.setRunningVersion(true);↵
|
57 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵ | | 57 | assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());↵
|
58 | assertEquals("$3.47", newProp.getStringValue());↵ | | 58 | assertEquals("hello world", newProp.getStringValue());↵
|
59 | | | 59 |
|