checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false);
checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false);
// A HTTP POST request, multipart/form-data, simple values,
// with \r\n as end of line, which is according to spec,
// and with more headers in each multipart
endOfLine = "\r\n";
titleValue = "mytitle";
descriptionValue = "mydescription";
postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);
testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
s = getSamplerForRequest(url, testPostRequest, contentEncoding);
assertEquals(HTTPSamplerBase.POST, s.getMethod());
assertEquals(contentEncoding, s.getContentEncoding());
assertTrue(s.getDoMultipartPost());
// Check arguments
arguments = s.getArguments();
assertEquals(2, arguments.getArgumentCount());
checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false);
checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false);
// A HTTP POST request, multipart/form-data, simple values,
// with \n as end of line, which should also be handled,
// and with more headers in each multipart
endOfLine = "\n";
titleValue = "mytitle";
descriptionValue = "mydescription";
postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);
testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
s = getSamplerForRequest(url, testPostRequest, contentEncoding);
assertEquals(HTTPSamplerBase.POST, s.getMethod());
assertEquals(contentEncoding, s.getContentEncoding());
assertTrue(s.getDoMultipartPost());
// Check arguments
arguments = s.getArguments();
assertEquals(2, arguments.getArgumentCount());
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/proxy/TestHttpRequestHdr.java
|
|
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/proxy/TestHttpRequestHdr.java
|
Method name: void testPostMultipartFormData()
|
|
Method name: void testPostMultipartFormData()
|
Number of AST nodes: 13
|
|
Number of AST nodes: 13
|
|
1 | checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false);↵ | | 1 | checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false);↵
|
2 | checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false);↵ | | 2 | checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false);↵
|
3 | ↵ | | |
|
4 | // A HTTP POST request, multipart/form-data, simple values,↵ | | 3 | // A HTTP POST request, multipart/form-data, simple values,↵
|
5 | // with \r\n as end of line, which is according to spec,↵ | | 4 | // with \n as end of line, which should also be handled,↵
|
6 | // and with more headers in each multipart↵ | | 5 | // and with more headers in each multipart↵
|
7 | endOfLine = "\r\n";↵ | | 6 | endOfLine = "\n";↵
|
8 | titleValue = "mytitle";↵ | | 7 | titleValue = "mytitle";↵
|
9 | descriptionValue = "mydescription";↵ | | 8 | descriptionValue = "mydescription";↵
|
10 | postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);↵ | | 9 | postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);↵
|
11 | testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);↵ | | 10 | testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);↵
|
|
12 | s = getSamplerForRequest(url, testPostRequest, contentEncoding);↵ | | 11 | s = getSamplerForRequest(url, testPostRequest, contentEncoding);↵
|
13 | assertEquals(HTTPSamplerBase.POST, s.getMethod());↵ | | 12 | assertEquals(HTTPSamplerBase.POST, s.getMethod());↵
|
14 | assertEquals(contentEncoding, s.getContentEncoding());↵ | | 13 | assertEquals(contentEncoding, s.getContentEncoding());↵
|
15 | assertTrue(s.getDoMultipartPost());↵ | | 14 | assertTrue(s.getDoMultipartPost());↵
|
16 | ↵ | | 15 | ↵
|
17 | // Check arguments↵ | | 16 | // Check arguments↵
|
18 | arguments = s.getArguments();↵ | | 17 | arguments = s.getArguments();↵
|
19 | assertEquals(2, arguments.getArgumentCount()); | | 18 | assertEquals(2, arguments.getArgumentCount());
|
See real code fragment |
|
See real code fragment |
Summary
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 | 169 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 13 |
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 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
15 | checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false); | | 28 | checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false); |
16 | checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false); | | 29 | checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false); |
17 | endOfLine = "\r\n"; | | 30 | endOfLine = "\n"; |
18 | titleValue = "mytitle"; | | 31 | titleValue = "mytitle"; |
19 | descriptionValue = "mydescription"; | | 32 | descriptionValue = "mydescription"; |
20 | postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine); | | 33 | postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine); |
21 | testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine); | | 34 | testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine); |
22 | s = getSamplerForRequest(url, testPostRequest, contentEncoding); | | 35 | s = getSamplerForRequest(url, testPostRequest, contentEncoding); |
23 | assertEquals(HTTPSamplerBase.POST, s.getMethod()); | | 36 | assertEquals(HTTPSamplerBase.POST, s.getMethod()); |
24 | assertEquals(contentEncoding, s.getContentEncoding()); | | 37 | assertEquals(contentEncoding, s.getContentEncoding()); |
25 | assertTrue(s.getDoMultipartPost()); | | 38 | assertTrue(s.getDoMultipartPost()); |
26 | arguments = s.getArguments(); | | 39 | arguments = s.getArguments(); |
27 | assertEquals(2, arguments.getArgumentCount()); | | 40 | assertEquals(2, arguments.getArgumentCount()); |
Precondition Violations (1)
Row |
Violation |
1 | Clone fragment #1 returns variables titleValue, arguments, descriptionValue , while Clone fragment #2 returns variables titleValue, arguments, descriptionValue |