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 + as part of the value, // where the value is set in sampler as not urluencoded, but the // isalwaysencoded flag of the argument is set to false. // This mimics the HTTPSamplerBase.addNonEncodedArgument, which the // Proxy server calls in some cases 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);
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: 11 Number of AST nodes: 11
1
expectedPostBody = titleValue + descriptionValue;
1
expectedPostBody = titleValue + descriptionValue;
2
        checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
2
        checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
3
        
3
        // Test sending data as UTF-8, with values that will change when urlencoded
4
        // Test sending data as UTF-8, with + as part of the value,
5
        // where the value is set in sampler as not urluencoded, but the 
6
        // isalwaysencoded flag of the argument is set to false.
7
        // This mimics the HTTPSamplerBase.addNonEncodedArgument, which the
8
        // Proxy server calls in some cases
4
        sampler = createHttpSampler(samplerType);
9
        sampler = createHttpSampler(samplerType);
5
        contentEncoding = "UTF-8";
10
        contentEncoding = "UTF-8";
6
        titleValue = "mytitle/=";
11
        titleValue = "mytitle++";
7
        descriptionValue = "mydescription   /\\";
12
        descriptionValue = "mydescription+";
8
        setupUrl(sampler, contentEncoding);
13
        setupUrl(sampler, contentEncoding);
9
        setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
14
        setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
10
        ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
15
        ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
11
        ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
16
        ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
12
        res = executeSampler(sampler);
17
        res = executeSampler(sampler);
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 comparisons121
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    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
    32
    expectedPostBody = titleValue + descriptionValue;
    83
    expectedPostBody = titleValue + descriptionValue;
    33
    checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
    84
    checkPostRequestBody(sampler, res, samplerDefaultEncoding, contentEncoding, expectedPostBody);
    34
    sampler = createHttpSampler(samplerType);
    85
    sampler = createHttpSampler(samplerType);
    35
    contentEncoding = "UTF-8";
    86
    contentEncoding = "UTF-8";
    36
    titleValue = "mytitle/=";
    36
    titleValue = "mytitle/=";
    87
    titleValue = "mytitle++";
    Differences
    Expression1Expression2Difference
    "mytitle/=""mytitle++"LITERAL_VALUE_MISMATCH
    87
    titleValue = "mytitle++";
    37
    descriptionValue = "mydescription   /\\";
    37
    descriptionValue = "mydescription /\\";
    88
    descriptionValue = "mydescription+";
    Differences
    Expression1Expression2Difference
    "mydescription /\\""mydescription+"LITERAL_VALUE_MISMATCH
    88
    descriptionValue = "mydescription+";
    38
    setupUrl(sampler, contentEncoding);
    89
    setupUrl(sampler, contentEncoding);
    39
    setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
    90
    setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
    40
    ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
    91
    ((HTTPArgument)sampler.getArguments().getArgument(0)).setAlwaysEncoded(false);
    41
    ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
    92
    ((HTTPArgument)sampler.getArguments().getArgument(1)).setAlwaysEncoded(false);
    42
    res = executeSampler(sampler);
    93
    res = executeSampler(sampler);
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables titleValue, descriptionValue, sampler, contentEncoding, res , while Clone fragment #2 returns variables titleValue, descriptionValue, sampler, contentEncoding, res