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 similar to __VIEWSTATE parameter that .net uses↵ | 2 | // Test sending data as UTF-8↵ | |
3 | sampler = createHttpSampler(samplerType);↵ | 3 | sampler = createHttpSampler(samplerType);↵ | |
4 | contentEncoding = "UTF-8";↵ | 4 | contentEncoding = "UTF-8";↵ | |
5 | titleValue = "/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc=";↵ | 5 | titleValue = "mytitle\u0153\u20a1\u0115\u00c5";↵ | |
6 | descriptionValue = "mydescription";↵ | 6 | descriptionValue = "mydescription\u0153\u20a1\u0115\u00c5";↵ | |
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 | ↵ | |||
15 | // Test sending data as UTF-8, with + as part of the value,↵ | 14 | // Test sending data as UTF-8, with ↵ | |
16 | // where the value is set in sampler as not urluencoded, but the ↵ | |||
17 | // isalwaysencoded flag of the argument is set to false.↵ | |||
18 | // This mimics the HTTPSamplerBase.addNonEncodedArgument, which the↵ | |||
19 | // Proxy server calls in some cases↵ | 15 | values that will change when urlencoded↵ | |
20 | sampler = createHttpSampler(samplerType);↵ | 16 | sampler = createHttpSampler(samplerType);↵ | |
21 | contentEncoding = "UTF-8";↵ | 17 | contentEncoding = "UTF-8";↵ | |
22 | titleValue = "mytitle++";↵ | 18 | titleValue = "mytitle/=";↵ | |
23 | descriptionValue = "mydescription+";↵ | 19 | descriptionValue = "mydescription /\\";↵ | |
24 | setupUrl(sampler, contentEncoding);↵ | 20 | setupUrl(sampler, contentEncoding);↵ | |
25 | setupFormData(sampler, false, 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 | 124 |
Number of mapped statements | 18 |
Number of unmapped statements in the first code fragment | 0 |
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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 22 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | ||||||||||||
| 23 | sampler = createHttpSampler(samplerType); | ||||||||||||
| 24 | contentEncoding = "UTF-8"; | ||||||||||||
| 27 | setupUrl(sampler, contentEncoding); | ||||||||||||
|
| 28 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); | |||||||||||
73 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 33 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | |||||||||||
74 | sampler = createHttpSampler(samplerType); | 34 | sampler = createHttpSampler(samplerType); | |||||||||||
75 | contentEncoding = "UTF-8"; | 35 | contentEncoding = "UTF-8"; | |||||||||||
76 | titleValue = "/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc="; |
| 25 | titleValue = "mytitle\u0153\u20a1\u0115\u00c5"; | ||||||||||
77 | descriptionValue = "mydescription"; |
| 26 | descriptionValue = "mydescription\u0153\u20a1\u0115\u00c5"; | ||||||||||
78 | setupUrl(sampler, contentEncoding); | 38 | setupUrl(sampler, contentEncoding); | |||||||||||
79 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); | 39 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); | |||||||||||
80 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | 29 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | |||||||||||
81 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | 30 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | |||||||||||
82 | res = executeSampler(sampler); | 31 | res = executeSampler(sampler); | |||||||||||
83 | expectedPostBody = titleValue + descriptionValue; | 32 | expectedPostBody = titleValue + descriptionValue; | |||||||||||
84 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 33 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | |||||||||||
85 | sampler = createHttpSampler(samplerType); | 34 | sampler = createHttpSampler(samplerType); | |||||||||||
86 | contentEncoding = "UTF-8"; | 35 | contentEncoding = "UTF-8"; | |||||||||||
87 | titleValue = "mytitle++"; |
| 36 | titleValue = "mytitle/="; | ||||||||||
88 | descriptionValue = "mydescription+"; |
| 37 | descriptionValue = "mydescription /\\"; | ||||||||||
89 | setupUrl(sampler, contentEncoding); | 38 | setupUrl(sampler, contentEncoding); | |||||||||||
90 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); | 39 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); |
Row | Violation |
---|---|
1 | Unmatched statement setupFormData(sampler,false,titleField,titleValue,descriptionField,descriptionValue); 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, titleValue, descriptionValue, contentEncoding , while Clone fragment #2 returns variables titleValue, descriptionValue, sampler, contentEncoding |