File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java | File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java | |||
Method name: void testPostRequest_BodyFromParameterValues(int, String)
|
Method name: void testPostRequest_BodyFromParameterValues(int, String)
|
|||
Number of AST nodes: 18 | Number of AST nodes: 18 | |||
1 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);↵ | 1 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);↵ | |
2 | // Test sending data as UTF-8, with values that will change when urlencoded↵ | 2 | // Test sending data as UTF-8, with values that have been urlencoded↵ | |
3 | sampler = createHttpSampler(samplerType);↵ | 3 | sampler = createHttpSampler(samplerType);↵ | |
4 | contentEncoding = "UTF-8";↵ | 4 | contentEncoding = "UTF-8";↵ | |
5 | titleValue = "mytitle/=";↵ | 5 | titleValue = "mytitle%2F%3D";↵ | |
6 | descriptionValue = "mydescription /\\";↵ | 6 | descriptionValue = "mydescription+++%2F%5C";↵ | |
7 | setupUrl(sampler, contentEncoding);↵ | 7 | setupUrl(sampler, contentEncoding);↵ | |
8 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);↵ | 8 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);↵ | |
9 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);↵ | 9 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);↵ | |
10 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);↵ | 10 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);↵ | |
11 | res = executeSampler(sampler);↵ | 11 | res = executeSampler(sampler);↵ | |
12 | expectedPostBody = titleValue + descriptionValue;↵ | 12 | expectedPostBody = titleValue + descriptionValue;↵ | |
13 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);↵ | 13 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);↵ | |
14 | // Test sending data as UTF-8, with values that will change when urlencoded, and where↵ | 14 | // Test sending data as UTF-8, with values that have been urlencoded, and↵ | |
15 | // we tell the sampler to urlencode the parameter value↵ | 15 | // where we tell the sampler to urlencode the parameter values↵ | |
16 | sampler = createHttpSampler(samplerType);↵ | 16 | sampler = createHttpSampler(samplerType);↵ | |
17 | contentEncoding = "UTF-8";↵ | 17 | contentEncoding = "UTF-8";↵ | |
18 | titleValue = "mytitle/=";↵ | 18 | titleValue = "mytitle%2F%3D";↵ | |
19 | descriptionValue = "mydescription /\\";↵ | 19 | descriptionValue = "mydescription+++%2F%5C";↵ | |
20 | setupUrl(sampler, contentEncoding);↵ | 20 | setupUrl(sampler, contentEncoding);↵ | |
21 | setupFormData(sampler, true, titleField, titleValue, descriptionField, descriptionValue); | 21 |
| |
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 | 156 |
Number of mapped statements | 18 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
33 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 53 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | |||||||||||
34 | sampler = createHttpSampler(samplerType); | 54 | sampler = createHttpSampler(samplerType); | |||||||||||
35 | contentEncoding = "UTF-8"; | 55 | contentEncoding = "UTF-8"; | |||||||||||
36 | titleValue = "mytitle/="; |
| 56 | titleValue = "mytitle%2F%3D"; | ||||||||||
37 | descriptionValue = "mydescription /\\"; |
| 57 | descriptionValue = "mydescription+++%2F%5C"; | ||||||||||
38 | setupUrl(sampler, contentEncoding); | 58 | setupUrl(sampler, contentEncoding); | |||||||||||
39 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); | 59 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); | |||||||||||
40 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | 60 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | |||||||||||
41 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | 61 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | |||||||||||
42 | res = executeSampler(sampler); | 62 | res = executeSampler(sampler); | |||||||||||
43 | expectedPostBody = titleValue + descriptionValue; | 63 | expectedPostBody = titleValue + descriptionValue; | |||||||||||
44 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 53 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | |||||||||||
45 | sampler = createHttpSampler(samplerType); | 54 | sampler = createHttpSampler(samplerType); | |||||||||||
46 | contentEncoding = "UTF-8"; | 55 | contentEncoding = "UTF-8"; | |||||||||||
47 | titleValue = "mytitle/="; |
| 67 | titleValue = "mytitle%2F%3D"; | ||||||||||
48 | descriptionValue = "mydescription /\\"; |
| 68 | descriptionValue = "mydescription+++%2F%5C"; | ||||||||||
49 | setupUrl(sampler, contentEncoding); | 58 | setupUrl(sampler, contentEncoding); | |||||||||||
| 64 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | ||||||||||||
|
| 65 | sampler = createHttpSampler(samplerType); | |||||||||||
| 66 | contentEncoding = "UTF-8"; | ||||||||||||
| 69 | setupUrl(sampler, contentEncoding); | ||||||||||||
50 | setupFormData(sampler, true, titleField, titleValue, descriptionField, descriptionValue); | 70 | setupFormData(sampler, true, titleField, titleValue, descriptionField, descriptionValue); |
Row | Violation |
---|---|
1 | Unmatched statement sampler=createHttpSampler(samplerType); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Clone fragment #1 returns variables sampler, contentEncoding, titleValue, descriptionValue , while Clone fragment #2 returns variables sampler, contentEncoding, res, expectedPostBody, titleValue, descriptionValue |