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());
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, with value that will change
// if they are url encoded
// Values are similar to __VIEWSTATE parameter that .net uses
endOfLine = "\r\n";
titleValue = "/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc=";
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 | ↵
|
3 | // A HTTP POST request, multipart/form-data, simple values,↵ | | 4 | // A HTTP POST request, multipart/form-data, ↵
|
4 | // with \n as end of line, which should also be handl↵ | | 5 | with value that will change↵
|
5 | ed,↵ | | 6 | // if they are url encoded↵
|
6 | // and with more headers in each multipart↵ | | 7 | // Values are similar to __VIEWSTATE parameter that .net uses↵
|
7 | endOfLine = "\n";↵ | | 8 | endOfLine = "\r\n";↵
|
8 | titleValue = "mytitle";↵ | | 9 | titleValue = "/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc=";↵
|
9 | descriptionValue = "mydescription";↵ | | 10 | descriptionValue = "mydescription";↵
|
10 | postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);↵ | | 11 | postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);↵
|
11 | testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);↵ | | 12 | testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);↵
|
|
12 | s = getSamplerForRequest(url, testPostRequest, contentEncoding);↵ | | 13 | s = getSamplerForRequest(url, testPostRequest, contentEncoding);↵
|
13 | assertEquals(HTTPSamplerBase.POST, s.getMethod());↵ | | 14 | assertEquals(HTTPSamplerBase.POST, s.getMethod());↵
|
14 | assertEquals(contentEncoding, s.getContentEncoding());↵ | | 15 | assertEquals(contentEncoding, s.getContentEncoding());↵
|
15 | assertTrue(s.getDoMultipartPost());↵ | | 16 | assertTrue(s.getDoMultipartPost());↵
|
16 | ↵ | | 17 | ↵
|
17 | // Check arguments↵ | | 18 | // Check arguments↵
|
18 | arguments = s.getArguments();↵ | | 19 | arguments = s.getArguments();↵
|
19 | assertEquals(2, arguments.getArgumentCount()); | | 20 | 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 |
28 | checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false); | | 41 | checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false); |
29 | checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false); | | 42 | checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false); |
30 | endOfLine = "\n"; | | 43 | endOfLine = "\r\n"; |
31 | titleValue = "mytitle"; | | 44 | titleValue = "/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc="; |
32 | descriptionValue = "mydescription"; | | 45 | descriptionValue = "mydescription"; |
33 | postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine); | | 46 | postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine); |
34 | testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine); | | 47 | testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine); |
35 | s = getSamplerForRequest(url, testPostRequest, contentEncoding); | | 48 | s = getSamplerForRequest(url, testPostRequest, contentEncoding); |
36 | assertEquals(HTTPSamplerBase.POST, s.getMethod()); | | 49 | assertEquals(HTTPSamplerBase.POST, s.getMethod()); |
37 | assertEquals(contentEncoding, s.getContentEncoding()); | | 50 | assertEquals(contentEncoding, s.getContentEncoding()); |
38 | assertTrue(s.getDoMultipartPost()); | | 51 | assertTrue(s.getDoMultipartPost()); |
39 | arguments = s.getArguments(); | | 52 | arguments = s.getArguments(); |
40 | assertEquals(2, arguments.getArgumentCount()); | | 53 | 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 |