param1Value = "yes"; param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85"; param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding); postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; testPostRequest = "POST " + url + " HTTP/1.1\r\n" + "Content-type: " + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n" + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n" + "\r\n" + postBody; s = getSamplerForRequest(url, testPostRequest, contentEncoding); assertEquals(HTTPSamplerBase.POST, s.getMethod()); assertEquals(contentEncoding, s.getContentEncoding()); // Check arguments arguments = s.getArguments(); assertEquals(2, arguments.getArgumentCount()); checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false); checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
param1Value = "yes"; param2Value = "0+5 -\u00c5%C3%85"; param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding); postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; testPostRequest = "POST " + url + " HTTP/1.1\r\n" + "Content-type: " + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n" + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n" + "\r\n" + postBody; s = getSamplerForRequest(url, testPostRequest, contentEncoding); assertEquals(HTTPSamplerBase.POST, s.getMethod()); assertEquals(contentEncoding, s.getContentEncoding()); // Check arguments arguments = s.getArguments(); assertEquals(2, arguments.getArgumentCount()); checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false); checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
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 testPostRequestEncodings() Method name: void testPostRequestEncodings()
Number of AST nodes: 12 Number of AST nodes: 12
1
param1Value = "yes";
1
param1Value = "yes";
2
        param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85";
2
        param2Value = "0+5 -\u00c5%C3%85";
3
        param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
3
        param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
4
        postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; 
4
        postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; 
5
        testPostRequest = 
5
        testPostRequest = 
6
            "POST " + url + " HTTP/1.1\r\n"
6
            "POST " + url + " HTTP/1.1\r\n"
7
            + "Content-type: "
7
            + "Content-type: "
8
            + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
8
            + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
9
            + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
9
            + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
10
            + "\r\n"
10
            + "\r\n"
11
            + postBody;
11
            + postBody;
12
        s = getSamplerForRequest(url, testPostRequest, contentEncoding);
12
        s = getSamplerForRequest(url, testPostRequest, contentEncoding);
13
        assertEquals(HTTPSamplerBase.POST, s.getMethod());
13
        assertEquals(HTTPSamplerBase.POST, s.getMethod());
14
        assertEquals(contentEncoding, s.getContentEncoding());
14
        assertEquals(contentEncoding, s.getContentEncoding());
15
        // Check arguments
15
        // Check arguments
16
        arguments = s.getArguments();
16
        arguments = s.getArguments();
17
        assertEquals(2, arguments.getArgumentCount());
17
        assertEquals(2, arguments.getArgumentCount());
18
        checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
18
        checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
19
        checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
19
        checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
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 comparisons144
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    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
    16
    param1Value = "yes";
    16
    param1Value = "yes";
    30
    param2Value = "0+5 -\u00c5%C3%85";
    Differences
    Expression1Expression2Difference
    param1Valueparam2ValueVARIABLE_NAME_MISMATCH
    "yes""0+5 -\u00c5%C3%85"LITERAL_VALUE_MISMATCH
    30
    param2Value = "0+5 -\u00c5%C3%85";
    17
    param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85";
    17
    param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85";
    31
    param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
    Differences
    Expression1Expression2Difference
    param2Valueparam2ValueEncodedVARIABLE_NAME_MISMATCH
    "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85"URLEncoder.encode(param2Value,contentEncoding)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression URLEncoder.encode(param2Value,contentEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    31
    param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
    18
    param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
    18
    param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
    29
    param1Value = "yes";
    Differences
    Expression1Expression2Difference
    param2ValueEncodedparam1ValueVARIABLE_NAME_MISMATCH
    URLEncoder.encode(param2Value,contentEncoding)"yes"TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression URLEncoder.encode(param2Value,contentEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29
    param1Value = "yes";
    19
    postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n";
    32
    postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n";
    20
    testPostRequest = "POST " + url + " HTTP/1.1\r\n" + "Content-type: " + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n" + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n" + "\r\n" + postBody;
    33
    testPostRequest = "POST " + url + " HTTP/1.1\r\n" + "Content-type: " + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n" + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n" + "\r\n" + postBody;
    21
    s = getSamplerForRequest(url, testPostRequest, contentEncoding);
    34
    s = getSamplerForRequest(url, testPostRequest, contentEncoding);
    22
    assertEquals(HTTPSamplerBase.POST, s.getMethod());
    35
    assertEquals(HTTPSamplerBase.POST, s.getMethod());
    23
    assertEquals(contentEncoding, s.getContentEncoding());
    36
    assertEquals(contentEncoding, s.getContentEncoding());
    24
    arguments = s.getArguments();
    37
    arguments = s.getArguments();
    25
    assertEquals(2, arguments.getArgumentCount());
    38
    assertEquals(2, arguments.getArgumentCount());
    26
    checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
    26
    checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
    40
    checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
    Differences
    Expression1Expression2Difference
    01LITERAL_VALUE_MISMATCH
    "param1""param2"LITERAL_VALUE_MISMATCH
    param1Valueparam2ValueVARIABLE_NAME_MISMATCH
    param1Valueparam2ValueEncodedVARIABLE_NAME_MISMATCH
    falsetrueLITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression param2Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression param2ValueEncoded cannot be parameterized, because it has dependencies to/from statements that will be extracted
    40
    checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
    27
    checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
    27
    checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
    39
    checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
    Differences
    Expression1Expression2Difference
    10LITERAL_VALUE_MISMATCH
    "param2""param1"LITERAL_VALUE_MISMATCH
    param2Valueparam1ValueVARIABLE_NAME_MISMATCH
    param2ValueEncodedparam1ValueVARIABLE_NAME_MISMATCH
    truefalseLITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression param2Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression param2ValueEncoded cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    39
    checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
    Precondition Violations (10)
    Row Violation
    1Expression URLEncoder.encode(param2Value,contentEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression URLEncoder.encode(param2Value,contentEncoding) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression param2Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression param2ValueEncoded cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression param2Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression param2ValueEncoded cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression param1Value cannot be parameterized, because it has dependencies to/from statements that will be extracted