String url = "http://localhost/matrix.html"; // A HTTP POST request, with encoding not known String contentEncoding = ""; String param1Value = "yes"; String param2Value = "0+5 -\u00c5%C3%85"; String param2ValueEncoded = URLEncoder.encode(param2Value,"UTF-8"); String postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; String 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; // Use null for url and contentEncoding, to simulate that HttpRequestHdr do not // know the encoding for the page HTTPSamplerBase s = getSamplerForRequest(null, testPostRequest, null); assertEquals(HTTPSamplerBase.POST, s.getMethod()); assertEquals(contentEncoding, s.getContentEncoding()); // Check arguments Arguments arguments = s.getArguments(); assertEquals(2, arguments.getArgumentCount()); checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false); // When the encoding is not known, the argument will get the encoded value, and the "encode?" set to false checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2ValueEncoded, param2ValueEncoded, contentEncoding, false); // A HTTP POST request, with UTF-8 encoding contentEncoding = "UTF-8"; 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); // A HTTP POST request, with ISO-8859-1 encoding contentEncoding = "ISO-8859-1"; 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);
String url = "http://localhost/matrix.html"; // A HTTP GET request, with encoding not known String contentEncoding = ""; String param1Value = "yes"; String param2Value = "0+5 -\u00c5\uc385%C3%85"; String param2ValueEncoded = URLEncoder.encode(param2Value,"UTF-8"); String testGetRequest = "GET " + url + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " " + "HTTP/1.1\r\n\r\n"; // Use null for url and contentEncoding, to simulate that HttpRequestHdr do not // know the encoding for the page HTTPSamplerBase s = getSamplerForRequest(null, testGetRequest, null); assertEquals(HTTPSamplerBase.GET, s.getMethod()); assertEquals(contentEncoding, s.getContentEncoding()); // Check arguments Arguments arguments = s.getArguments(); assertEquals(2, arguments.getArgumentCount()); checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false); // When the encoding is not known, the argument will get the encoded value, and the "encode?" set to false checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2ValueEncoded, param2ValueEncoded, contentEncoding, false); // A HTTP GET request, with UTF-8 encoding contentEncoding = "UTF-8"; param1Value = "yes"; param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85"; param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding); testGetRequest = "GET " + url + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " " + "HTTP/1.1\r\n\r\n"; s = getSamplerForRequest(url, testGetRequest, contentEncoding); assertEquals(HTTPSamplerBase.GET, 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); // A HTTP GET request, with ISO-8859-1 encoding contentEncoding = "ISO-8859-1"; param1Value = "yes"; param2Value = "0+5 -\u00c5%C3%85"; param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding); testGetRequest = "GET " + url + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " " + "HTTP/1.1\r\n\r\n"; s = getSamplerForRequest(url, testGetRequest, contentEncoding); assertEquals(HTTPSamplerBase.GET, 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 testGetRequestEncodings()
Number of AST nodes: 40 Number of AST nodes: 37
1
String url = "http://localhost/matrix.html";
1
String url = "http://localhost/matrix.html";
2
        // A HTTP POST request, with encoding not known
2
        // A HTTP GET request, with encoding not known
3
        String contentEncoding = "";
3
        String contentEncoding = "";
4
        String param1Value = "yes";
4
        String param1Value = "yes";
5
        String param2Value = "0+5 -\u00c5%C3%85";
5
        String param2Value = "0+5 -\u00c5\uc385%C3%85";
6
        String param2ValueEncoded = URLEncoder.encode(param2Value,"UTF-8");
6
        String param2ValueEncoded = URLEncoder.encode(param2Value,"UTF-8");
7
        String postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; 
7
        String 
8
        String testPostRequest = 
8
testGetRequest = 
9
            "POST " + url + " HTTP/1.1\r\n"
9
            "GET " + url
10
            + "Content-type: "
11
            + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
12
            + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
13
            + "\r\n"
14
            + postBody;
15
        
10
            + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " "
11
            + "HTTP/1.1\r\n\r\n";
16
        // Use null for url and contentEncoding, to simulate that HttpRequestHdr do not
12
        // Use null for url and contentEncoding, to simulate that HttpRequestHdr do not
17
        // know the encoding for the page
13
        // know the encoding for the page
18
        HTTPSamplerBase s = getSamplerForRequest(null, testPostRequest, null);
14
        HTTPSamplerBase s = getSamplerForRequest(null, testGetRequest, null);
19
        assertEquals(HTTPSamplerBase.POST, s.getMethod());
15
        assertEquals(HTTPSamplerBase.GET, s.getMethod());
20
        assertEquals(contentEncoding, s.getContentEncoding());
16
        assertEquals(contentEncoding, s.getContentEncoding());
21
        // Check arguments
17
        // Check arguments
22
        Arguments arguments = s.getArguments();
18
        Arguments arguments = s.getArguments();
23
        assertEquals(2, arguments.getArgumentCount());
19
        assertEquals(2, arguments.getArgumentCount());
24
        checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
20
        checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
25
        // When the encoding is not known, the argument will get the encoded value, and the "encode?" set to false
21
        // When the encoding is not known, the argument will get the encoded value, and the "encode?" set to false
26
        checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2ValueEncoded, param2ValueEncoded, contentEncoding, false);
22
        checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2ValueEncoded, param2ValueEncoded, contentEncoding, false);
27
        // A HTTP POST request, with UTF-8 encoding
23
        // A HTTP GET request, with UTF-8 encoding
28
        contentEncoding = "UTF-8";
24
        contentEncoding = "UTF-8";
29
        param1Value = "yes";
25
        param1Value = "yes";
30
        param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85";
26
        param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85";
31
        param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
27
        param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
32
        postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; 
28
        
33
        testPostRequest = 
29
testGetRequest = 
34
            "POST " + url + " HTTP/1.1\r\n"
30
            "GET " + url
35
            + "Content-type: "
36
            + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
37
            + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
38
            + "\r\n"
39
            + postBody;
31
            + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " "
32
            + "HTTP/1.1\r\n\r\n";
40
        s = getSamplerForRequest(url, testPostRequest, contentEncoding);
33
        s = getSamplerForRequest(url, testGetRequest, contentEncoding);
41
        assertEquals(HTTPSamplerBase.POST, s.getMethod());
34
        assertEquals(HTTPSamplerBase.GET, s.getMethod());
42
        assertEquals(contentEncoding, s.getContentEncoding());
35
        assertEquals(contentEncoding, s.getContentEncoding());
43
        // Check arguments
36
        // Check arguments
44
        arguments = s.getArguments();
37
        arguments = s.getArguments();
45
        assertEquals(2, arguments.getArgumentCount());
38
        assertEquals(2, arguments.getArgumentCount());
46
        checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
39
        checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
47
        checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
40
        checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
48
        // A HTTP POST request, with ISO-8859-1 encoding
41
        // A HTTP GET request, with ISO-8859-1 encoding
49
        contentEncoding = "ISO-8859-1";
42
        contentEncoding = "ISO-8859-1";
50
        param1Value = "yes";
43
        param1Value = "yes";
51
        param2Value = "0+5 -\u00c5%C3%85";
44
        param2Value = "0+5 -\u00c5%C3%85";
52
        param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
45
        param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
53
        postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n"; 
46
        
54
        testPostRequest = 
47
testGetRequest = 
55
            "POST " + url + " HTTP/1.1\r\n"
48
            "GET " + url
56
            + "Content-type: "
57
            + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
58
            + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
59
            + "\r\n"
60
            + postBody;
49
            + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " "
50
            + "HTTP/1.1\r\n\r\n";
61
        s = getSamplerForRequest(url, testPostRequest, contentEncoding);
51
        s = getSamplerForRequest(url, testGetRequest, contentEncoding);
62
        assertEquals(HTTPSamplerBase.POST, s.getMethod());
52
        assertEquals(HTTPSamplerBase.GET, s.getMethod());
63
        assertEquals(contentEncoding, s.getContentEncoding());
53
        assertEquals(contentEncoding, s.getContentEncoding());
64
        // Check arguments
54
        // Check arguments
65
        arguments = s.getArguments();
55
        arguments = s.getArguments();
66
        assertEquals(2, arguments.getArgumentCount());
56
        assertEquals(2, arguments.getArgumentCount());
67
        checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
57
        checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
68
        checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
58
        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 declared in the same class
Number of node comparisons503
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements37
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    String url = "http://localhost/matrix.html";
    1
    String url = "http://localhost/matrix.html";
    2
    String contentEncoding = "";
    2
    String contentEncoding = "";
    3
    String param1Value = "yes";
    3
    String param1Value = "yes";
    4
    String param2Value = "0+5 -\u00c5%C3%85";
    4
    String param2Value = "0+5 -\u00c5%C3%85";
    4
    String param2Value = "0+5 -\u00c5\uc385%C3%85";
    Differences
    Expression1Expression2Difference
    "0+5 -\u00c5%C3%85""0+5 -\u00c5\uc385%C3%85"LITERAL_VALUE_MISMATCH
    4
    String param2Value = "0+5 -\u00c5\uc385%C3%85";
    5
    String param2ValueEncoded = URLEncoder.encode(param2Value, "UTF-8");
    5
    String param2ValueEncoded = URLEncoder.encode(param2Value, "UTF-8");
    6
    String postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n";
    6
    String postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n";
    Preondition Violations
    Unmatched statement String postBody="param1=" + param1Value + "¶m2="+ param2ValueEncoded+ "\r\n"; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                            
    7
    String 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;
    7
    String 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;
    6
    String testGetRequest = "GET " + url + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " " + "HTTP/1.1\r\n\r\n";
    Differences
    Expression1Expression2Difference
    testPostRequesttestGetRequestVARIABLE_NAME_MISMATCH
    "POST ""GET "LITERAL_VALUE_MISMATCH
    "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"GET " + url + "?param1="+ param1Value+ "¶m2="+ param2ValueEncoded+ " "+ "HTTP/1.1\r\n\r\n"INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    Preondition Violations
    Expression "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 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression "GET " + url + "?param1="+ param1Value+ "¶m2="+ param2ValueEncoded+ " "+ "HTTP/1.1\r\n\r\n" cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    String testGetRequest = "GET " + url + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " " + "HTTP/1.1\r\n\r\n";
    8
    HTTPSamplerBase s = getSamplerForRequest(null, testPostRequest, null);
    8
    HTTPSamplerBase s = getSamplerForRequest(null, testPostRequest, null);
    7
    HTTPSamplerBase s = getSamplerForRequest(null, testGetRequest, null);
    Differences
    Expression1Expression2Difference
    testPostRequesttestGetRequestVARIABLE_NAME_MISMATCH
    7
    HTTPSamplerBase s = getSamplerForRequest(null, testGetRequest, null);
    9
    assertEquals(HTTPSamplerBase.POST, s.getMethod());
    9
    assertEquals(HTTPSamplerBase.POST, s.getMethod());
    8
    assertEquals(HTTPSamplerBase.GET, s.getMethod());
    Differences
    Expression1Expression2Difference
    POSTGETVARIABLE_NAME_MISMATCH
    8
    assertEquals(HTTPSamplerBase.GET, s.getMethod());
    10
    assertEquals(contentEncoding, s.getContentEncoding());
    9
    assertEquals(contentEncoding, s.getContentEncoding());
    11
    Arguments arguments = s.getArguments();
    10
    Arguments arguments = s.getArguments();
    12
    assertEquals(2, arguments.getArgumentCount());
    11
    assertEquals(2, arguments.getArgumentCount());
    13
    checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
    12
    checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
    14
    checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2ValueEncoded, param2ValueEncoded, contentEncoding, false);
    13
    checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2ValueEncoded, param2ValueEncoded, contentEncoding, false);
    15
    contentEncoding = "UTF-8";
    14
    contentEncoding = "UTF-8";
    16
    param1Value = "yes";
    15
    param1Value = "yes";
    17
    param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85";
    16
    param2Value = "0+5 -\u007c\u2aa1\u266a\u0153\u20a1\u0115\u0364\u00c5\u2052\uc385%C3%85";
    18
    param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
    17
    param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
    19
    postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n";
    19
    postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n";
    Preondition Violations
    Unmatched statement postBody="param1=" + param1Value + "¶m2="+ param2ValueEncoded+ "\r\n"; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                
    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;
    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;
    18
    testGetRequest = "GET " + url + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " " + "HTTP/1.1\r\n\r\n";
    Differences
    Expression1Expression2Difference
    testPostRequesttestGetRequestVARIABLE_NAME_MISMATCH
    "POST ""GET "LITERAL_VALUE_MISMATCH
    "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"GET " + url + "?param1="+ param1Value+ "¶m2="+ param2ValueEncoded+ " "+ "HTTP/1.1\r\n\r\n"INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    Preondition Violations
    Expression "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 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression "GET " + url + "?param1="+ param1Value+ "¶m2="+ param2ValueEncoded+ " "+ "HTTP/1.1\r\n\r\n" cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18
    testGetRequest = "GET " + url + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " " + "HTTP/1.1\r\n\r\n";
    21
    s = getSamplerForRequest(url, testPostRequest, contentEncoding);
    21
    s = getSamplerForRequest(url, testPostRequest, contentEncoding);
    19
    s = getSamplerForRequest(url, testGetRequest, contentEncoding);
    Differences
    Expression1Expression2Difference
    testPostRequesttestGetRequestVARIABLE_NAME_MISMATCH
    19
    s = getSamplerForRequest(url, testGetRequest, contentEncoding);
    22
    assertEquals(HTTPSamplerBase.POST, s.getMethod());
    22
    assertEquals(HTTPSamplerBase.POST, s.getMethod());
    20
    assertEquals(HTTPSamplerBase.GET, s.getMethod());
    Differences
    Expression1Expression2Difference
    POSTGETVARIABLE_NAME_MISMATCH
    20
    assertEquals(HTTPSamplerBase.GET, s.getMethod());
    23
    assertEquals(contentEncoding, s.getContentEncoding());
    21
    assertEquals(contentEncoding, s.getContentEncoding());
    24
    arguments = s.getArguments();
    22
    arguments = s.getArguments();
    25
    assertEquals(2, arguments.getArgumentCount());
    23
    assertEquals(2, arguments.getArgumentCount());
    26
    checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
    24
    checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
    27
    checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
    25
    checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
    28
    contentEncoding = "ISO-8859-1";
    26
    contentEncoding = "ISO-8859-1";
    29
    param1Value = "yes";
    27
    param1Value = "yes";
    30
    param2Value = "0+5 -\u00c5%C3%85";
    28
    param2Value = "0+5 -\u00c5%C3%85";
    31
    param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
    29
    param2ValueEncoded = URLEncoder.encode(param2Value, contentEncoding);
    32
    postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n";
    32
    postBody = "param1=" + param1Value + "¶m2=" + param2ValueEncoded + "\r\n";
    Preondition Violations
    Unmatched statement postBody="param1=" + param1Value + "¶m2="+ param2ValueEncoded+ "\r\n"; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                
    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;
    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;
    30
    testGetRequest = "GET " + url + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " " + "HTTP/1.1\r\n\r\n";
    Differences
    Expression1Expression2Difference
    testPostRequesttestGetRequestVARIABLE_NAME_MISMATCH
    "POST ""GET "LITERAL_VALUE_MISMATCH
    "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"GET " + url + "?param1="+ param1Value+ "¶m2="+ param2ValueEncoded+ " "+ "HTTP/1.1\r\n\r\n"INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    Preondition Violations
    Expression "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 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression "GET " + url + "?param1="+ param1Value+ "¶m2="+ param2ValueEncoded+ " "+ "HTTP/1.1\r\n\r\n" cannot be parameterized, because it has dependencies to/from statements that will be extracted
    30
    testGetRequest = "GET " + url + "?param1=" + param1Value + "¶m2=" + param2ValueEncoded + " " + "HTTP/1.1\r\n\r\n";
    34
    s = getSamplerForRequest(url, testPostRequest, contentEncoding);
    34
    s = getSamplerForRequest(url, testPostRequest, contentEncoding);
    31
    s = getSamplerForRequest(url, testGetRequest, contentEncoding);
    Differences
    Expression1Expression2Difference
    testPostRequesttestGetRequestVARIABLE_NAME_MISMATCH
    31
    s = getSamplerForRequest(url, testGetRequest, contentEncoding);
    35
    assertEquals(HTTPSamplerBase.POST, s.getMethod());
    35
    assertEquals(HTTPSamplerBase.POST, s.getMethod());
    32
    assertEquals(HTTPSamplerBase.GET, s.getMethod());
    Differences
    Expression1Expression2Difference
    POSTGETVARIABLE_NAME_MISMATCH
    32
    assertEquals(HTTPSamplerBase.GET, s.getMethod());
    36
    assertEquals(contentEncoding, s.getContentEncoding());
    33
    assertEquals(contentEncoding, s.getContentEncoding());
    37
    arguments = s.getArguments();
    34
    arguments = s.getArguments();
    38
    assertEquals(2, arguments.getArgumentCount());
    35
    assertEquals(2, arguments.getArgumentCount());
    39
    checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
    36
    checkArgument((HTTPArgument)arguments.getArgument(0), "param1", param1Value, param1Value, contentEncoding, false);
    40
    checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
    37
    checkArgument((HTTPArgument)arguments.getArgument(1), "param2", param2Value, param2ValueEncoded, contentEncoding, true);
    Precondition Violations (10)
    Row Violation
    1Unmatched statement String postBody="param1=" + param1Value + "¶m2="+ param2ValueEncoded+ "\r\n"; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression "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 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression "GET " + url + "?param1="+ param1Value+ "¶m2="+ param2ValueEncoded+ " "+ "HTTP/1.1\r\n\r\n" cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Unmatched statement postBody="param1=" + param1Value + "¶m2="+ param2ValueEncoded+ "\r\n"; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Expression "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 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression "GET " + url + "?param1="+ param1Value+ "¶m2="+ param2ValueEncoded+ " "+ "HTTP/1.1\r\n\r\n" cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Unmatched statement postBody="param1=" + param1Value + "¶m2="+ param2ValueEncoded+ "\r\n"; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Expression "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 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression "GET " + url + "?param1="+ param1Value+ "¶m2="+ param2ValueEncoded+ " "+ "HTTP/1.1\r\n\r\n" cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Clone fragment #1 returns variables param1Value, param2ValueEncoded , while Clone fragment #2 returns variables