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, 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
        
4
        // A HTTP POST request, multipart/form-data, simple values,
4
        // A HTTP POST request, multipart/form-data, 
5
        // with \r\n as end of line, which is according to spec,
6
        // and with more headers in each multipart
7
        endOfLine = "\r\n";
8
        titleValue = "mytitle
5
with value that will change
6
        // if they are url encoded
7
        // Values are similar to __VIEWSTATE parameter that .net uses
8
        endOfLine = "\r\n";
9
";
9
        titleValue = "/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc=";
10
        descriptionValue = "mydescription";
10
        descriptionValue = "mydescription";
11
        postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);
11
        postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);
12
        testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
12
        testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
13
        s = getSamplerForRequest(url, testPostRequest, contentEncoding);
13
        s = getSamplerForRequest(url, testPostRequest, contentEncoding);
14
        assertEquals(HTTPSamplerBase.POST, s.getMethod());
14
        assertEquals(HTTPSamplerBase.POST, s.getMethod());
15
        assertEquals(contentEncoding, s.getContentEncoding());
15
        assertEquals(contentEncoding, s.getContentEncoding());
16
        assertTrue(s.getDoMultipartPost());
16
        assertTrue(s.getDoMultipartPost());
17
        
17
        
18
        // Check arguments
18
        // Check arguments
19
        arguments = s.getArguments();
19
        arguments = s.getArguments();
20
        assertEquals(2, arguments.getArgumentCount());
20
        assertEquals(2, arguments.getArgumentCount());
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in the same method
Number of node comparisons169
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    15
    checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false);
    41
    checkArgument((HTTPArgument)arguments.getArgument(0), "title", titleValue, titleValue, contentEncoding, false);
    16
    checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false);
    42
    checkArgument((HTTPArgument)arguments.getArgument(1), "description", descriptionValue, descriptionValue, contentEncoding, false);
    17
    endOfLine = "\r\n";
    43
    endOfLine = "\r\n";
    18
    titleValue = "mytitle";
    18
    titleValue = "mytitle";
    44
    titleValue = "/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc=";
    Differences
    Expression1Expression2Difference
    "mytitle""/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc="LITERAL_VALUE_MISMATCH
    44
    titleValue = "/wEPDwULLTE2MzM2OTA0NTYPZBYCAgMPZ/rA+8DZ2dnZ2dnZ2d/GNDar6OshPwdJc=";
    19
    descriptionValue = "mydescription";
    45
    descriptionValue = "mydescription";
    20
    postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);
    46
    postBody = createMultipartFormBody(titleValue, descriptionValue, contentEncoding, true, boundary, endOfLine);
    21
    testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
    47
    testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
    22
    s = getSamplerForRequest(url, testPostRequest, contentEncoding);
    48
    s = getSamplerForRequest(url, testPostRequest, contentEncoding);
    23
    assertEquals(HTTPSamplerBase.POST, s.getMethod());
    49
    assertEquals(HTTPSamplerBase.POST, s.getMethod());
    24
    assertEquals(contentEncoding, s.getContentEncoding());
    50
    assertEquals(contentEncoding, s.getContentEncoding());
    25
    assertTrue(s.getDoMultipartPost());
    51
    assertTrue(s.getDoMultipartPost());
    26
    arguments = s.getArguments();
    52
    arguments = s.getArguments();
    27
    assertEquals(2, arguments.getArgumentCount());
    53
    assertEquals(2, arguments.getArgumentCount());
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables titleValue, arguments, descriptionValue , while Clone fragment #2 returns variables titleValue, arguments, descriptionValue