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/PostWriterTest.java | |||
Method name: byte[] createExpectedFormdataOutput(String, String, String, String, String, String, boolean, boolean)
|
Method name: byte[] createExpectedFormdataOutput(String, String, String, String, String, String, boolean, boolean)
|
|||
Number of AST nodes: 49 | Number of AST nodes: 50 | |||
1 | final byte[] DASH_DASH = new String("--").getBytes(ISO_8859_1);↵ | 1 | final byte[] DASH_DASH = "--".getBytes(↵ | |
2 | HTTP_ENCODING);↵ | |||
3 | // All form parameter always have text/plain as mime type↵ | |||
4 | final String mimeType="text/plain";//TODO make this a parameter?↵ | |||
5 | ↵ | |||
2 | final ByteArrayOutputStream output = new ByteArrayOutputStream();↵ | 6 | final ByteArrayOutputStream output = new ByteArrayOutputStream();↵ | |
3 | if(firstMultipart) {↵ | 7 | if(firstMultipart) {↵ | |
4 | output.write(DASH_DASH);↵ | 8 | output.write(DASH_DASH);↵ | |
5 | output.write(boundaryString.getBytes(ISO_8859_1));↵ | 9 | output.write(boundaryString.getBytes(HTTP_ENCODING));↵ | |
6 | output.write(CRLF);↵ | 10 | output.write(CRLF);↵ | |
7 | }↵ | 11 | }↵ | |
8 | output.write("Content-Disposition: form-data; name=\"".getBytes(ISO_8859_1));↵ | 12 | output.write("Content-Disposition: form-data; name=\"".getBytes(HTTP_ENCODING));↵ | |
9 | output.write(titleField.getBytes(ISO_8859_1));↵ | 13 | output.write(titleField.getBytes(HTTP_ENCODING));↵ | |
10 | output.write("\"".getBytes(ISO_8859_1));↵ | 14 | output.write("\"".getBytes(HTTP_ENCODING));↵ | |
11 | output.write(CRLF);↵ | 15 | output.write(CRLF);↵ | |
12 | output.write("Content-Type: text/plain".getBytes(ISO_8859_1));↵ | 16 | output.write("Content-Type: ".getBytes(↵ | |
13 | if(contentEncoding != null) {↵ | |||
14 | ↵ | 17 | HTTP_ENCODING));↵ | |
18 | output.write(mimeType.getBytes(HTTP_ENCODING));↵ | |||
15 | output.write("; charset=".getBytes(ISO_8859_1));↵ | 19 | output.write("; charset=".getBytes(HTTP_ENCODING));↵ | |
16 | output.write(contentEncoding.getBytes(ISO_8859_1));↵ | 20 | output.write((contentEncoding↵ | |
17 | }↵ | 21 | ==null ? PostWriter.ENCODING : contentEncoding).getBytes(HTTP_ENCODING));↵ | |
18 | output.write(CRLF);↵ | 22 | output.write(CRLF);↵ | |
19 | output.write("Content-Transfer-Encoding: 8bit".getBytes(ISO_8859_1));↵ | 23 | output.write("Content-Transfer-Encoding: 8bit".getBytes(HTTP_ENCODING));↵ | |
20 | output.write(CRLF);↵ | 24 | output.write(CRLF);↵ | |
21 | output.write(CRLF);↵ | 25 | output.write(CRLF);↵ | |
22 | if(contentEncoding != null) {↵ | 26 | if(contentEncoding != null) {↵ | |
23 | output.write(titleValue.getBytes(contentEncoding));↵ | 27 | output.write(titleValue.getBytes(contentEncoding));↵ | |
24 | }↵ | 28 | }↵ | |
25 | else {↵ | 29 | else {↵ | |
26 | output.write(titleValue.getBytes());↵ | 30 | output.write(titleValue.getBytes());↵ | |
27 | }↵ | 31 | }↵ | |
28 | output.write(CRLF);↵ | 32 | output.write(CRLF);↵ | |
29 | output.write(DASH_DASH);↵ | 33 | output.write(DASH_DASH);↵ | |
30 | output.write(boundaryString.getBytes(ISO_8859_1));↵ | 34 | output.write(boundaryString.getBytes(HTTP_ENCODING));↵ | |
31 | output.write(CRLF);↵ | 35 | output.write(CRLF);↵ | |
32 | output.write("Content-Disposition: form-data; name=\"".getBytes(ISO_8859_1));↵ | 36 | output.write("Content-Disposition: form-data; name=\"".getBytes(HTTP_ENCODING));↵ | |
33 | output.write(descriptionField.getBytes(ISO_8859_1));↵ | 37 | output.write(descriptionField.getBytes(HTTP_ENCODING));↵ | |
34 | output.write("\"".getBytes(ISO_8859_1));↵ | 38 | output.write("\"".getBytes(HTTP_ENCODING));↵ | |
35 | output.write(CRLF);↵ | 39 | output.write(CRLF);↵ | |
36 | output.write("Content-Type: text/plain".getBytes(ISO_8859_1));↵ | 40 | output.write("Content-Type: ".getBytes(↵ | |
37 | if(contentEncoding != null) {↵ | |||
38 | ↵ | 41 | HTTP_ENCODING));↵ | |
42 | output.write(mimeType.getBytes(HTTP_ENCODING));↵ | |||
39 | output.write("; charset=".getBytes(ISO_8859_1));↵ | 43 | output.write("; charset=".getBytes(HTTP_ENCODING));↵ | |
40 | output.write(contentEncoding.getBytes(ISO_8859_1));↵ | 44 | output.write((contentEncoding↵ | |
41 | }↵ | 45 | ==null ? PostWriter.ENCODING : contentEncoding).getBytes(HTTP_ENCODING));↵ | |
42 | output.write(CRLF);↵ | 46 | output.write(CRLF);↵ | |
43 | output.write("Content-Transfer-Encoding: 8bit".getBytes(ISO_8859_1));↵ | 47 | output.write("Content-Transfer-Encoding: 8bit".getBytes(HTTP_ENCODING));↵ | |
44 | output.write(CRLF);↵ | 48 | output.write(CRLF);↵ | |
45 | output.write(CRLF);↵ | 49 | output.write(CRLF);↵ | |
46 | if(contentEncoding != null) {↵ | 50 | if(contentEncoding != null) {↵ | |
47 | output.write(descriptionValue.getBytes(contentEncoding));↵ | 51 | output.write(descriptionValue.getBytes(contentEncoding));↵ | |
48 | }↵ | 52 | }↵ | |
49 | else {↵ | 53 | else {↵ | |
50 | output.write(descriptionValue.getBytes());↵ | 54 | output.write(descriptionValue.getBytes());↵ | |
51 | }↵ | 55 | }↵ | |
52 | output.write(CRLF);↵ | 56 | output.write(CRLF);↵ | |
53 | output.write(DASH_DASH);↵ | 57 | output.write(DASH_DASH);↵ | |
54 | output.write(boundaryString.getBytes(ISO_8859_1));↵ | 58 | output.write(boundaryString.getBytes(HTTP_ENCODING));↵ | |
55 | if(lastMultipart) {↵ | 59 | if(lastMultipart) {↵ | |
56 | output.write(DASH_DASH);↵ | 60 | output.write(DASH_DASH);↵ | |
57 | }↵ | 61 | }↵ | |
58 | output.write(CRLF);↵ | 62 | output.write(CRLF);↵ | |
59 | ↵ | 63 | ↵ | |
60 | output.flush();↵ | 64 | output.flush();↵ | |
61 | output.close();↵ | 65 | output.close();↵ | |
62 | return output.toByteArray(); | 66 |
| |
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) | 1.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 945 |
Number of mapped statements | 38 |
Number of unmapped statements in the first code fragment | 7 |
Number of unmapped statements in the second code fragment | 8 |
Time elapsed for statement mapping (ms) | 492.3 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | final byte[] DASH_DASH = new String("--").getBytes(ISO_8859_1); |
| 1 | final byte[] DASH_DASH = "--".getBytes(HTTP_ENCODING); | |||||||||||||
| 2 | final String mimeType = "text/plain"; | |||||||||||||||
2 | final ByteArrayOutputStream output = new ByteArrayOutputStream(); | 3 | final ByteArrayOutputStream output = new ByteArrayOutputStream(); | ||||||||||||||
3 | if (firstMultipart) | 4 | if (firstMultipart) | ||||||||||||||
4 | output.write(DASH_DASH); | 5 | output.write(DASH_DASH); | ||||||||||||||
5 | output.write(boundaryString.getBytes(ISO_8859_1)); |
| 6 | output.write(boundaryString.getBytes(HTTP_ENCODING)); | |||||||||||||
6 | output.write(CRLF); | 7 | output.write(CRLF); | ||||||||||||||
7 | output.write("Content-Disposition: form-data; name=\"".getBytes(ISO_8859_1)); |
| 8 | output.write("Content-Disposition: form-data; name=\"".getBytes(HTTP_ENCODING)); | |||||||||||||
8 | output.write(titleField.getBytes(ISO_8859_1)); |
| 9 | output.write(titleField.getBytes(HTTP_ENCODING)); | |||||||||||||
9 | output.write("\"".getBytes(ISO_8859_1)); |
| 10 | output.write("\"".getBytes(HTTP_ENCODING)); | |||||||||||||
10 | output.write(CRLF); | 11 | output.write(CRLF); | ||||||||||||||
11 | output.write("Content-Type: text/plain".getBytes(ISO_8859_1)); |
| 12 | output.write("Content-Type: ".getBytes(HTTP_ENCODING)); | |||||||||||||
| 17 | output.write("Content-Transfer-Encoding: 8bit".getBytes(HTTP_ENCODING)); | |||||||||||||||
| 18 | output.write(CRLF); | |||||||||||||||
|
| 19 | output.write(CRLF); | ||||||||||||||
12 | if (contentEncoding != null) | 20 | if (contentEncoding != null) | ||||||||||||||
13 | output.write("; charset=".getBytes(ISO_8859_1)); |
| | ||||||||||||||
14 | output.write(contentEncoding.getBytes(ISO_8859_1)); |
| 21 | output.write(titleValue.getBytes(contentEncoding)); | |||||||||||||
| else | ||||||||||||||||
|
| 22 | output.write(titleValue.getBytes()); | ||||||||||||||
15 | output.write(CRLF); |
| 13 | output.write(mimeType.getBytes(HTTP_ENCODING)); | |||||||||||||
16 | output.write("Content-Transfer-Encoding: 8bit".getBytes(ISO_8859_1)); |
| 14 | output.write("; charset=".getBytes(HTTP_ENCODING)); | |||||||||||||
17 | output.write(CRLF); |
| 15 | output.write((contentEncoding == null ? PostWriter.ENCODING : contentEncoding).getBytes(HTTP_ENCODING)); | |||||||||||||
18 | output.write(CRLF); | 16 | output.write(CRLF); | ||||||||||||||
19 | if (contentEncoding != null) | 39 | if (contentEncoding != null) | ||||||||||||||
20 | output.write(titleValue.getBytes(contentEncoding)); |
| 40 | output.write(descriptionValue.getBytes(contentEncoding)); | |||||||||||||
else | else | ||||||||||||||||
21 | output.write(titleValue.getBytes()); |
| 41 | output.write(descriptionValue.getBytes()); | |||||||||||||
22 | output.write(CRLF); | 23 | output.write(CRLF); | ||||||||||||||
23 | output.write(DASH_DASH); | 24 | output.write(DASH_DASH); | ||||||||||||||
24 | output.write(boundaryString.getBytes(ISO_8859_1)); |
| 25 | output.write(boundaryString.getBytes(HTTP_ENCODING)); | |||||||||||||
25 | output.write(CRLF); | 26 | output.write(CRLF); | ||||||||||||||
26 | output.write("Content-Disposition: form-data; name=\"".getBytes(ISO_8859_1)); |
| 27 | output.write("Content-Disposition: form-data; name=\"".getBytes(HTTP_ENCODING)); | |||||||||||||
27 | output.write(descriptionField.getBytes(ISO_8859_1)); |
| 28 | output.write(descriptionField.getBytes(HTTP_ENCODING)); | |||||||||||||
28 | output.write("\"".getBytes(ISO_8859_1)); |
| 29 | output.write("\"".getBytes(HTTP_ENCODING)); | |||||||||||||
29 | output.write(CRLF); | 30 | output.write(CRLF); | ||||||||||||||
30 | output.write("Content-Type: text/plain".getBytes(ISO_8859_1)); |
| 31 | output.write("Content-Type: ".getBytes(HTTP_ENCODING)); | |||||||||||||
31 | if (contentEncoding != null) | | |||||||||||||||
32 | output.write("; charset=".getBytes(ISO_8859_1)); | | |||||||||||||||
33 | output.write(contentEncoding.getBytes(ISO_8859_1)); |
| | ||||||||||||||
34 | output.write(CRLF); |
| 32 | output.write(mimeType.getBytes(HTTP_ENCODING)); | |||||||||||||
35 | output.write("Content-Transfer-Encoding: 8bit".getBytes(ISO_8859_1)); |
| 33 | output.write("; charset=".getBytes(HTTP_ENCODING)); | |||||||||||||
36 | output.write(CRLF); |
| 34 | output.write((contentEncoding == null ? PostWriter.ENCODING : contentEncoding).getBytes(HTTP_ENCODING)); | |||||||||||||
37 | output.write(CRLF); | 35 | output.write(CRLF); | ||||||||||||||
| 36 | output.write("Content-Transfer-Encoding: 8bit".getBytes(HTTP_ENCODING)); | |||||||||||||||
| 37 | output.write(CRLF); | |||||||||||||||
|
| 38 | output.write(CRLF); | ||||||||||||||
38 | if (contentEncoding != null) | | |||||||||||||||
39 | output.write(descriptionValue.getBytes(contentEncoding)); |
| | ||||||||||||||
else | | ||||||||||||||||
40 | output.write(descriptionValue.getBytes()); |
| | ||||||||||||||
41 | output.write(CRLF); | 42 | output.write(CRLF); | ||||||||||||||
42 | output.write(DASH_DASH); | 43 | output.write(DASH_DASH); | ||||||||||||||
43 | output.write(boundaryString.getBytes(ISO_8859_1)); |
| 44 | output.write(boundaryString.getBytes(HTTP_ENCODING)); | |||||||||||||
44 | if (lastMultipart) | 45 | if (lastMultipart) | ||||||||||||||
45 | output.write(DASH_DASH); | 46 | output.write(DASH_DASH); |
Row | Violation |
---|---|
1 | Unmatched statement output.write(CRLF); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement output.write("; charset=".getBytes(ISO_8859_1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement output.write(titleValue.getBytes()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement output.write(contentEncoding.getBytes(ISO_8859_1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement output.write(CRLF); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement output.write(descriptionValue.getBytes(contentEncoding)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Unmatched statement output.write(descriptionValue.getBytes()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |