File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/proxy/TestHttpRequestHdr.java | File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/proxy/TestHttpRequestHdr.java | |||
Method name: void testPostRequestEncodings()
|
Method name: void testPostRequestEncodings()
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | param1Value = "yes";↵ | 1 | param1Value = "yes";↵ | |
2 | param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85";↵ | 2 | param2Value = "0+5 -\u00c5%C3%85";↵ | |
3 | param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);↵ | 3 | param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);↵ | |
4 | postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; ↵ | 4 | postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; ↵ | |
5 | testPostRequest = ↵ | 5 | testPostRequest = ↵ | |
6 | "POST " + url + " HTTP/1.1\r\n"↵ | 6 | "POST " + url + " HTTP/1.1\r\n"↵ | |
7 | + "Content-type: "↵ | 7 | + "Content-type: "↵ | |
8 | + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"↵ | 8 | + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"↵ | |
9 | + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"↵ | 9 | + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"↵ | |
10 | + "\r\n"↵ | 10 | + "\r\n"↵ | |
11 | + postBody;↵ | 11 | + postBody;↵ | |
12 | s = getSamplerForRequest(url, testPostRequest, contentEncoding);↵ | 12 | s = getSamplerForRequest(url, testPostRequest, contentEncoding);↵ | |
13 | assertEquals(HTTPSamplerBase.POST, s.getMethod());↵ | 13 | assertEquals(HTTPSamplerBase.POST, s.getMethod());↵ | |
14 | assertEquals(contentEncoding, s.getContentEncoding());↵ | 14 | assertEquals(contentEncoding, s.getContentEncoding());↵ | |
15 | // Check arguments↵ | 15 | // Check arguments↵ | |
16 | arguments = s.getArguments();↵ | 16 | arguments = s.getArguments();↵ | |
17 | assertEquals(2, arguments.getArgumentCount());↵ | 17 | assertEquals(2, arguments.getArgumentCount());↵ | |
18 | checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);↵ | 18 | checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);↵ | |
19 | checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true); | 19 |
| |
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 the same method |
Number of node comparisons | 144 |
Number of mapped statements | 12 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16 | param1Value = "yes"; |
| 30 | param2Value = "0+5 -\u00c5%C3%85"; | ||||||||||||||||||||||||||
17 | param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85"; |
| 31 | param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding); | ||||||||||||||||||||||||||
18 | param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding); |
| 29 | param1Value = "yes"; | ||||||||||||||||||||||||||
19 | postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; | 32 | postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; | |||||||||||||||||||||||||||
20 | testPostRequest = "POST " + url + " HTTP/1.1\r\n" + "Content-type: " + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n" + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n" + "\r\n" + postBody; | 33 | testPostRequest = "POST " + url + " HTTP/1.1\r\n" + "Content-type: " + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n" + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n" + "\r\n" + postBody; | |||||||||||||||||||||||||||
21 | s = getSamplerForRequest(url, testPostRequest, contentEncoding); | 34 | s = getSamplerForRequest(url, testPostRequest, contentEncoding); | |||||||||||||||||||||||||||
22 | assertEquals(HTTPSamplerBase.POST, s.getMethod()); | 35 | assertEquals(HTTPSamplerBase.POST, s.getMethod()); | |||||||||||||||||||||||||||
23 | assertEquals(contentEncoding, s.getContentEncoding()); | 36 | assertEquals(contentEncoding, s.getContentEncoding()); | |||||||||||||||||||||||||||
24 | arguments = s.getArguments(); | 37 | arguments = s.getArguments(); | |||||||||||||||||||||||||||
25 | assertEquals(2, arguments.getArgumentCount()); | 38 | assertEquals(2, arguments.getArgumentCount()); | |||||||||||||||||||||||||||
26 | checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false); |
| 40 | checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true); | ||||||||||||||||||||||||||
27 | checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true); |
| 39 | checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false); |
Row | Violation |
---|---|
1 | Expression URLEncoder.encode(param2Value,contentEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression URLEncoder.encode(param2Value,contentEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression param2Value cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression param2ValueEncoded cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression param2Value cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression param2ValueEncoded cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted |