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 | setupUrl(sampler, contentEncoding);↵ | 1 | setupUrl(sampler, contentEncoding);↵ | |
2 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);↵ | 2 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);↵ | |
3 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);↵ | 3 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);↵ | |
4 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);↵ | 4 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);↵ | |
5 | res = executeSampler(sampler);↵ | 5 | res = executeSampler(sampler);↵ | |
6 | expectedPostBody = titleValue + descriptionValue;↵ | 6 | expectedPostBody = titleValue + descriptionValue;↵ | |
7 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);↵ | 7 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);↵ | |
8 | ↵ | |||
8 | // Test sending data as UTF-8↵ | 9 | // Test sending data as UTF-8, with + as part of the value,↵ | |
10 | // where the value is set in sampler as not urluencoded, but the ↵ | |||
11 | // isalwaysencoded flag of the argument is set to false.↵ | |||
12 | // This mimics the HTTPSamplerBase.addNonEncodedArgument, which the↵ | |||
13 | // Proxy server calls in some cases↵ | |||
9 | sampler = createHttpSampler(samplerType);↵ | 14 | sampler = createHttpSampler(samplerType);↵ | |
10 | contentEncoding = "UTF-8";↵ | 15 | contentEncoding = "UTF-8";↵ | |
11 | titleValue = "mytitle\u0153\u20a1\u0115\u00c5";↵ | 16 | titleValue = "mytitle++";↵ | |
12 | descriptionValue = "mydescription\u0153\u20a1\u0115\u00c5";↵ | 17 | descriptionValue = "mydescription+";↵ | |
13 | setupUrl(sampler, contentEncoding);↵ | 18 | setupUrl(sampler, contentEncoding);↵ | |
14 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);↵ | 19 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);↵ | |
15 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);↵ | 20 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);↵ | |
16 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);↵ | 21 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);↵ | |
17 | res = executeSampler(sampler);↵ | 22 | res = executeSampler(sampler);↵ | |
18 | expectedPostBody = titleValue + descriptionValue;↵ | 23 | expectedPostBody = titleValue + descriptionValue;↵ | |
19 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 24 |
| |
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 | 44 |
Number of mapped statements | 18 |
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 | setupUrl(sampler, contentEncoding); | 78 | setupUrl(sampler, contentEncoding); | |||||||||||
17 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); | 79 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); | |||||||||||
18 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | 80 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | |||||||||||
19 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | 81 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | |||||||||||
20 | res = executeSampler(sampler); | 82 | res = executeSampler(sampler); | |||||||||||
21 | expectedPostBody = titleValue + descriptionValue; | 83 | expectedPostBody = titleValue + descriptionValue; | |||||||||||
22 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 84 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | |||||||||||
23 | sampler = createHttpSampler(samplerType); | 85 | sampler = createHttpSampler(samplerType); | |||||||||||
24 | contentEncoding = "UTF-8"; | 86 | contentEncoding = "UTF-8"; | |||||||||||
25 | titleValue = "mytitle\u0153\u20a1\u0115\u00c5"; |
| 87 | titleValue = "mytitle++"; | ||||||||||
26 | descriptionValue = "mydescription\u0153\u20a1\u0115\u00c5"; |
| 88 | descriptionValue = "mydescription+"; | ||||||||||
27 | setupUrl(sampler, contentEncoding); | 89 | setupUrl(sampler, contentEncoding); | |||||||||||
28 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); | 90 | setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); | |||||||||||
29 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | 91 | ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); | |||||||||||
30 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | 92 | ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); | |||||||||||
31 | res = executeSampler(sampler); | 93 | res = executeSampler(sampler); | |||||||||||
32 | expectedPostBody = titleValue + descriptionValue; | 94 | expectedPostBody = titleValue + descriptionValue; | |||||||||||
33 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); | 95 | checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); |
Row | Violation |
---|