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: 25 | Number of AST nodes: 25 | |||
1 | res = executeSampler(sampler);↵ | 1 | res = executeSampler(sampler);↵ | |
2 | expectedPostBody = titleValue + descriptionValue;↵ | 2 | expectedPostBody = titleValue + descriptionValue;↵ | |
3 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);↵ | 3 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);↵ | |
4 | // Test sending data as UTF-8, with values similar to __VIEWSTATE parameter that .net uses↵ | 4 | // Test sending data as UTF-8↵ | |
5 | sampler = createHttpSampler(samplerType);↵ | 5 | sampler = createHttpSampler(samplerType);↵ | |
6 | contentEncoding = "UTF-8";↵ | 6 | contentEncoding = "UTF-8";↵ | |
7 | titleValue = "/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc=";↵ | 7 | titleValue = "mytitle\u0153\u20a1\u0115\u00c5";↵ | |
8 | descriptionValue = "mydescription";↵ | 8 | descriptionValue = "mydescription\u0153\u20a1\u0115\u00c5";↵ | |
9 | setupUrl(sampler, contentEncoding);↵ | 9 | setupUrl(sampler, contentEncoding);↵ | |
10 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);↵ | 10 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);↵ | |
11 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);↵ | 11 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);↵ | |
12 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);↵ | 12 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);↵ | |
13 | res = executeSampler(sampler);↵ | 13 | res = executeSampler(sampler);↵ | |
14 | expectedPostBody = titleValue + descriptionValue;↵ | 14 | expectedPostBody = titleValue + descriptionValue;↵ | |
15 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);↵ | 15 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);↵ | |
16 | ↵ | |||
17 | // Test sending data as UTF-8, with + as part of the value,↵ | 16 | // Test sending data as UTF-8, with ↵ | |
18 | // where the value is set in sampler as not urluencoded, but the ↵ | |||
19 | // isalwaysencoded flag of the argument is set to false.↵ | |||
20 | // This mimics the HTTPSamplerBase.addNonEncodedArgument, which the↵ | |||
21 | // Proxy server calls in some cases↵ | 17 | values that will change when urlencoded↵ | |
22 | sampler = createHttpSampler(samplerType);↵ | 18 | sampler = createHttpSampler(samplerType);↵ | |
23 | contentEncoding = "UTF-8";↵ | 19 | contentEncoding = "UTF-8";↵ | |
24 | titleValue = "mytitle++";↵ | 20 | titleValue = "mytitle/=";↵ | |
25 | descriptionValue = "mydescription+";↵ | 21 | descriptionValue = "mydescription /\\";↵ | |
26 | setupUrl(sampler, contentEncoding);↵ | 22 | setupUrl(sampler, contentEncoding);↵ | |
27 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);↵ | 23 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);↵ | |
28 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);↵ | 24 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);↵ | |
29 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);↵ | 25 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);↵ | |
30 | res = executeSampler(sampler);↵ | 26 | res = executeSampler(sampler);↵ | |
31 | expectedPostBody = titleValue + descriptionValue;↵ | 27 | expectedPostBody = titleValue + descriptionValue;↵ | |
32 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 28 |
| |
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 | 115 |
Number of mapped statements | 25 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 12 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 20 | res = executeSampler(sampler); | ||||||||||||
| 21 | expectedPostBody = titleValue + descriptionValue; | ||||||||||||
| 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); | |||||||||||
| 29 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | ||||||||||||
| 30 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | ||||||||||||
| 31 | res = executeSampler(sampler); | ||||||||||||
|
| 32 | expectedPostBody = titleValue + descriptionValue; | |||||||||||
| 33 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | ||||||||||||
71 | res = executeSampler(sampler); | 42 | res = executeSampler(sampler); | |||||||||||
72 | expectedPostBody = titleValue + descriptionValue; | 43 | expectedPostBody = titleValue + descriptionValue; | |||||||||||
73 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 44 | 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); | 40 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | |||||||||||
81 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | 41 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | |||||||||||
82 | res = executeSampler(sampler); | 42 | res = executeSampler(sampler); | |||||||||||
83 | expectedPostBody = titleValue + descriptionValue; | 43 | expectedPostBody = titleValue + descriptionValue; | |||||||||||
84 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 44 | 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); | |||||||||||
91 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | 40 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | |||||||||||
92 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | 41 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | |||||||||||
93 | res = executeSampler(sampler); | 42 | res = executeSampler(sampler); | |||||||||||
94 | expectedPostBody = titleValue + descriptionValue; | 43 | expectedPostBody = titleValue + descriptionValue; | |||||||||||
95 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 44 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); |
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 | Unmatched statement expectedPostBody=titleValue + descriptionValue; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables titleValue, descriptionValue |