setupUrl(sampler, contentEncoding); setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); res = executeSampler(sampler); expectedPostBody = titleValue + descriptionValue; checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); // Test sending data as UTF-8 sampler = createHttpSampler(samplerType); contentEncoding = "UTF-8"; titleValue = "mytitle\u0153\u20a1\u0115\u00c5"; descriptionValue = "mydescription\u0153\u20a1\u0115\u00c5"; setupUrl(sampler, contentEncoding); setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); res = executeSampler(sampler); expectedPostBody = titleValue + descriptionValue; checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); // Test sending data as UTF-8, with values that will change when urlencoded sampler = createHttpSampler(samplerType); contentEncoding = "UTF-8"; titleValue = "mytitle/="; descriptionValue = "mydescription /\\"; setupUrl(sampler, contentEncoding); setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
setupUrl(sampler, contentEncoding); setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); res = executeSampler(sampler); expectedPostBody = titleValue + descriptionValue; checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); // Test sending data as UTF-8, with values that will change when urlencoded sampler = createHttpSampler(samplerType); contentEncoding = "UTF-8"; titleValue = "mytitle/="; descriptionValue = "mydescription /\\"; setupUrl(sampler, contentEncoding); setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue); ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false); ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false); res = executeSampler(sampler); expectedPostBody = titleValue + descriptionValue; checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody); // Test sending data as UTF-8, with values that will change when urlencoded, and where // we tell the sampler to urlencode the parameter value sampler = createHttpSampler(samplerType); contentEncoding = "UTF-8"; titleValue = "mytitle/="; descriptionValue = "mydescription /\\"; setupUrl(sampler, contentEncoding); setupFormData(sampler, true, titleField, titleValue, descriptionField, descriptionValue);
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
Method name: void testPostRequest_BodyFromParameterValues(int, String) Method name: void testPostRequest_BodyFromParameterValues(int, String)
Number of AST nodes: 24 Number of AST nodes: 24
1
setupUrl(sampler, contentEncoding);
1
setupUrl(sampler, contentEncoding);
2
        setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
2
        setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
3
        ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
3
        ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
4
        ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
4
        ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
5
        res = executeSampler(sampler);
5
        res = executeSampler(sampler);
6
        expectedPostBody = titleValue + descriptionValue;
6
        expectedPostBody = titleValue + descriptionValue;
7
        checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
7
        checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
8
        // Test sending data as UTF-8
8
        // Test sending data as UTF-8, with values that will change when urlencoded
9
        sampler = createHttpSampler(samplerType);
9
        sampler = createHttpSampler(samplerType);
10
        contentEncoding = "UTF-8";
10
        contentEncoding = "UTF-8";
11
        titleValue = "mytitle\u0153\u20a1\u0115\u00c5";
11
        titleValue = "mytitle/=";
12
        descriptionValue = "mydescription\u0153\u20a1\u0115\u00c5";
12
        descriptionValue = "mydescription   /\\";
13
        setupUrl(sampler, contentEncoding);
13
        setupUrl(sampler, contentEncoding);
14
        setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
14
        setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
15
        ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
15
        ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
16
        ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
16
        ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
17
        res = executeSampler(sampler);
17
        res = executeSampler(sampler);
18
        expectedPostBody = titleValue + descriptionValue;
18
        expectedPostBody = titleValue + descriptionValue;
19
        checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
19
        checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
20
        // Test sending data as UTF-8, with values that will change when urlencoded
20
        // Test sending data as UTF-8, with values that will change when urlencoded, and where
21
        // we tell the sampler to urlencode the parameter value
21
        sampler = createHttpSampler(samplerType);
22
        sampler = createHttpSampler(samplerType);
22
        contentEncoding = "UTF-8";
23
        contentEncoding = "UTF-8";
23
        titleValue = "mytitle/=";
24
        titleValue = "mytitle/=";
24
        descriptionValue = "mydescription   /\\";
25
        descriptionValue = "mydescription   /\\";
25
        setupUrl(sampler, contentEncoding);
26
        setupUrl(sampler, contentEncoding);
26
        setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
27
        setupFormData(sampler, true, titleField, titleValue, descriptionField, descriptionValue);
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 comparisons108
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements24
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment8
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    16
    setupUrl(sampler, contentEncoding);
    27
    setupUrl(sampler, contentEncoding);
    17
    setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
    17
    setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
    50
    setupFormData(sampler, true, titleField, titleValue, descriptionField, descriptionValue);
    Differences
    Expression1Expression2Difference
    falsetrueLITERAL_VALUE_MISMATCH
    50
    setupFormData(sampler, true, titleField, titleValue, descriptionField, descriptionValue);
    18
    ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
    29
    ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
    19
    ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
    30
    ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
    20
    res = executeSampler(sampler);
    31
    res = executeSampler(sampler);
    21
    expectedPostBody = titleValue + descriptionValue;
    32
    expectedPostBody = titleValue + descriptionValue;
    22
    checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
    33
    checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
    23
    sampler = createHttpSampler(samplerType);
    34
    sampler = createHttpSampler(samplerType);
    24
    contentEncoding = "UTF-8";
    35
    contentEncoding = "UTF-8";
    25
    titleValue = "mytitle\u0153\u20a1\u0115\u00c5";
    25
    titleValue = "mytitle\u0153\u20a1\u0115\u00c5";
    36
    titleValue = "mytitle/=";
    Differences
    Expression1Expression2Difference
    "mytitle\u0153\u20a1\u0115\u00c5""mytitle/="LITERAL_VALUE_MISMATCH
    36
    titleValue = "mytitle/=";
    26
    descriptionValue = "mydescription\u0153\u20a1\u0115\u00c5";
    26
    descriptionValue = "mydescription\u0153\u20a1\u0115\u00c5";
    37
    descriptionValue = "mydescription /\\";
    Differences
    Expression1Expression2Difference
    "mydescription\u0153\u20a1\u0115\u00c5""mydescription /\\"LITERAL_VALUE_MISMATCH
    37
    descriptionValue = "mydescription   /\\";
    27
    setupUrl(sampler, contentEncoding);
    27
    setupUrl(sampler, contentEncoding);
    28
    setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
    28
    setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
    29
    ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
    29
    ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
    30
    ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
    30
    ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
    31
    res = executeSampler(sampler);
    31
    res = executeSampler(sampler);
    32
    expectedPostBody = titleValue + descriptionValue;
    32
    expectedPostBody = titleValue + descriptionValue;
    33
    checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
    33
    checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
    34
    sampler = createHttpSampler(samplerType);
    34
    sampler = createHttpSampler(samplerType);
    35
    contentEncoding = "UTF-8";
    35
    contentEncoding = "UTF-8";
    36
    titleValue = "mytitle/=";
    47
    titleValue = "mytitle/=";
    37
    descriptionValue = "mydescription   /\\";
    48
    descriptionValue = "mydescription   /\\";
    38
    setupUrl(sampler, contentEncoding);
    38
    setupUrl(sampler, contentEncoding);
    39
    setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
    39
    setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
                                                                                                                                                                        
    40
    ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
                                                                                                                                                                        
    41
    ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
                                                                    
    42
    res = executeSampler(sampler);
    Preondition Violations
    Unmatched statement res=executeSampler(sampler); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    42
    res = executeSampler(sampler);
                                                                                                          
    43
    expectedPostBody = titleValue + descriptionValue;
    Preondition Violations
    Unmatched statement expectedPostBody=titleValue + descriptionValue; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    43
    expectedPostBody = titleValue + descriptionValue;
                                                                                                                                                                                                
    44
    checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
                                                                                          
    45
    sampler = createHttpSampler(samplerType);
    Preondition Violations
    Unmatched statement sampler=createHttpSampler(samplerType); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    45
    sampler = createHttpSampler(samplerType);
                                                            
    46
    contentEncoding = "UTF-8";
                                                                                
    49
    setupUrl(sampler, contentEncoding);
    Precondition Violations (4)
    Row Violation
    1Unmatched statement res=executeSampler(sampler); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement expectedPostBody=titleValue + descriptionValue; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement sampler=createHttpSampler(samplerType); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Clone fragment #1 returns variables sampler, titleValue, descriptionValue, contentEncoding , while Clone fragment #2 returns variables sampler, titleValue, descriptionValue, contentEncoding