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: 13 | Number of AST nodes: 13 | |||
1 | contentEncoding = "UTF-8";↵ | 1 | contentEncoding = "ISO-8859-1";↵ | |
2 | param1Value = "yes";↵ | 2 | param1Value = "yes";↵ | |
3 | param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85";↵ | 3 | param2Value = "0+5 -\u00c5%C3%85";↵ | |
4 | param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);↵ | 4 | param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);↵ | |
5 | postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; ↵ | 5 | postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; ↵ | |
6 | testPostRequest = ↵ | 6 | testPostRequest = ↵ | |
7 | "POST " + url + " HTTP/1.1\r\n"↵ | 7 | "POST " + url + " HTTP/1.1\r\n"↵ | |
8 | + "Content-type: "↵ | 8 | + "Content-type: "↵ | |
9 | + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"↵ | 9 | + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"↵ | |
10 | + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"↵ | 10 | + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"↵ | |
11 | + "\r\n"↵ | 11 | + "\r\n"↵ | |
12 | + postBody;↵ | 12 | + postBody;↵ | |
13 | s = getSamplerForRequest(url, testPostRequest, contentEncoding);↵ | 13 | s = getSamplerForRequest(url, testPostRequest, contentEncoding);↵ | |
14 | assertEquals(HTTPSamplerBase.POST, s.getMethod());↵ | 14 | assertEquals(HTTPSamplerBase.POST, s.getMethod());↵ | |
15 | assertEquals(contentEncoding, s.getContentEncoding());↵ | 15 | assertEquals(contentEncoding, s.getContentEncoding());↵ | |
16 | // Check arguments↵ | 16 | // Check arguments↵ | |
17 | arguments = s.getArguments();↵ | 17 | arguments = s.getArguments();↵ | |
18 | assertEquals(2, arguments.getArgumentCount());↵ | 18 | assertEquals(2, arguments.getArgumentCount());↵ | |
19 | checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);↵ | 19 | checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);↵ | |
20 | checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true); | 20 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are in the same method |
Number of node comparisons | 169 |
Number of mapped statements | 13 |
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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
15 | contentEncoding = "UTF-8"; |
| 28 | contentEncoding = "ISO-8859-1"; | ||||||||||
16 | param1Value = "yes"; | 29 | param1Value = "yes"; | |||||||||||
17 | param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85"; |
| 30 | param2Value = "0+5 -\u00c5%C3%85"; | ||||||||||
18 | param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding); | 31 | param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding); | |||||||||||
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); | 39 | checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false); | |||||||||||
27 | checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true); | 40 | checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true); |
Row | Violation |
---|