File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/TestJexlFunction.java | File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/proxy/TestProxyControl.java | |||
Method name: void testReplace2()
|
Method name: void testContentTypeExclude()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 8 | |||
1 | vars.put("URL", "/query.cgi?s1=1&s2=2&s3=3");↵ | |||
2 | params.add(new CompoundVariable("vars.get('URL').replaceAll('&','&')"));↵ | |||
3 | params.add(new CompoundVariable("URL"));↵ | |||
4 | function.setParameters(params);↵ | |||
5 | String ret = function.execute(result, null);↵ | |||
6 | assertEquals("/query.cgi?s1=1&s2=2&s3=3", ret);↵ | |||
7 | ↵ | 1 | SampleResult result = new SampleResult();↵ | |
2 | control.setContentTypeExclude("text/css");↵ | |||
3 | result.setContentType(null);↵ | |||
4 | assertTrue("Should allow if no content-type present", control.filterContentType(result)); ↵ | |||
5 | result.setContentType("text/html; charset=utf-8");↵ | |||
6 | assertTrue("Should allow text/html", control.filterContentType(result)); ↵ | |||
7 | result.setContentType("text/css");↵ | |||
8 | assertEquals(ret,vars.getObject("URL")); | 8 | assertFalse("Should not allow text/css", control.filterContentType(result)); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 56 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | SampleResult result = new SampleResult(); | ||||||||||||||||||||||||
1 | vars.put("URL", "/query.cgi?s1=1&s2=2&s3=3"); | | ||||||||||||||||||||||||
| 2 | control.setContentTypeExclude("text/css"); | ||||||||||||||||||||||||
2 | params.add(new CompoundVariable("vars.get('URL').replaceAll('&','&')")); | | ||||||||||||||||||||||||
| 3 | result.setContentType(null); | ||||||||||||||||||||||||
3 | params.add(new CompoundVariable("URL")); | | ||||||||||||||||||||||||
4 | function.setParameters(params); |
| 4 | assertTrue("Should allow if no content-type present", control.filterContentType(result)); | ||||||||||||||||||||||
5 | String ret = function.execute(result, null); |
| | |||||||||||||||||||||||
6 | assertEquals("/query.cgi?s1=1&s2=2&s3=3", ret); |
| 5 | result.setContentType("text/html; charset=utf-8"); | ||||||||||||||||||||||
|
| 6 | assertTrue("Should allow text/html", control.filterContentType(result)); | |||||||||||||||||||||||
7 | assertEquals(ret, vars.getObject("URL")); |
| 7 | result.setContentType("text/css"); | ||||||||||||||||||||||
|
| 8 | assertFalse("Should not allow text/css", control.filterContentType(result)); |
Row | Violation |
---|---|
1 | Expression function.setParameters(params) is a void method call, and thus it cannot be parameterized |
2 | Expression assertTrue("Should allow if no content-type present",control.filterContentType(result)) is a void method call, and thus it cannot be parameterized |
3 | Expression function.setParameters(params) is a void method call, and thus it cannot be parameterized |
4 | Expression assertTrue("Should allow if no content-type present",control.filterContentType(result)) is a void method call, and thus it cannot be parameterized |
5 | Unmatched statement String ret=function.execute(result,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Expression result.setContentType("text/html; charset=utf-8") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression assertEquals("/query.cgi?s1=1&s2=2&s3=3",ret) is a void method call, and thus it cannot be parameterized |
8 | Expression result.setContentType("text/html; charset=utf-8") is a void method call, and thus it cannot be parameterized |
9 | Expression result.setContentType("text/html; charset=utf-8") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression assertEquals("/query.cgi?s1=1&s2=2&s3=3",ret) is a void method call, and thus it cannot be parameterized |
11 | Expression result.setContentType("text/html; charset=utf-8") is a void method call, and thus it cannot be parameterized |
12 | Unmatched statement assertTrue("Should allow text/html",control.filterContentType(result)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | Expression result.setContentType("text/css") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression assertEquals(ret,vars.getObject("URL")) is a void method call, and thus it cannot be parameterized |
15 | Expression result.setContentType("text/css") is a void method call, and thus it cannot be parameterized |
16 | Expression result.setContentType("text/css") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
17 | Expression assertEquals(ret,vars.getObject("URL")) is a void method call, and thus it cannot be parameterized |
18 | Expression result.setContentType("text/css") is a void method call, and thus it cannot be parameterized |
19 | Unmatched statement assertFalse("Should not allow text/css",control.filterContentType(result)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |