HTTPSamplerBase config = makeUrlConfig(".*/index\\.html"); HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html"); String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"index.html\">Goto index page</a></body></html>"; HTTPSampleResult result = new HTTPSampleResult(); jmctx.setCurrentSampler(context); jmctx.setCurrentSampler(config); result.setResponseData(responseText.getBytes()); result.setSampleLabel(context.toString()); result.setSamplerData(context.toString()); result.setURL(context.getUrl()); jmctx.setPreviousResult(result); parser.process(); assertEquals("http://www.apache.org/subdir/index.html", config.getUrl().toString());
HTTPSamplerBase config = makeUrlConfig(".*index.*"); config.getArguments().addArgument("param1", "value1"); HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html"); String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>"; HTTPSampleResult result = new HTTPSampleResult(); result.setResponseData(responseText.getBytes()); result.setSampleLabel(context.toString()); result.setURL(context.getUrl()); jmctx.setCurrentSampler(context); jmctx.setCurrentSampler(config); jmctx.setPreviousResult(result); parser.process(); String newUrl = config.getUrl().toString(); assertEquals("http://www.apache.org/home/index.html?param1=value1", newUrl);
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java
Method name: void testSimpleParse() Method name: void testSimpleParse3()
Number of AST nodes: 13 Number of AST nodes: 14
1
HTTPSamplerBase config = makeUrlConfig(".*/index\\.html
1
HTTPSamplerBase config = makeUrlConfig(".*index.*");
2
");
2
            config.getArguments().addArgument("param1", "value1");
3
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
3
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
4
            String responseText = "<html><head><title>Test page</title></head><body>"
4
            String responseText = "<html><head><title>Test page</title></head><body>"
5
                    + "<a href=\"index.html\">Goto index page</a></body></html>";
5
                    + "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";
6
            HTTPSampleResult result = new HTTPSampleResult();
6
            HTTPSampleResult result = new HTTPSampleResult();
7
            jmctx.setCurrentSampler(context);
8
            jmctx.setCurrentSampler(config);
9
            result.setResponseData(responseText.getBytes());
7
            result.setResponseData(responseText.getBytes());
10
            result.setSampleLabel(context.toString());
8
            result.setSampleLabel(context.toString());
11
            result.setSamplerData(context.toString());
9
            result.setURL(context.getUrl());
12
            result.setURL(context.getUrl()
10
            jmctx.setCurrentSampler(context);
13
);
11
            jmctx.setCurrentSampler(config);
14
            jmctx.setPreviousResult(result);
12
            jmctx.setPreviousResult(result);
15
            parser.process();
13
            parser.process();
14
            String newUrl = config.getUrl().toString();
16
            assertEquals("http://www.apache.org/subdir/index.html", config.getUrl().toString());
15
            assertEquals("http://www.apache.org/home/index.html?param1=value1", newUrl);
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 comparisons110
  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 fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    HTTPSamplerBase config = makeUrlConfig(".*/index\\.html");
    1
    HTTPSamplerBase config = makeUrlConfig(".*/index\\.html");
    1
    HTTPSamplerBase config = makeUrlConfig(".*index.*");
    Differences
    Expression1Expression2Difference
    ".*/index\\.html"".*index.*"LITERAL_VALUE_MISMATCH
    1
    HTTPSamplerBase config = makeUrlConfig(".*index.*");
    2
    HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
    3
    HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
    3
    String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"index.html\">Goto index page</a></body></html>";
    3
    String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"index.html\">Goto index page</a></body></html>";
    4
    String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";
    Differences
    Expression1Expression2Difference
    "Goto index page"""LITERAL_VALUE_MISMATCH
    "Test page" + "Goto index page""Test page" + "" + "Goto index page"INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    4
    String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";
    4
    HTTPSampleResult result = new HTTPSampleResult();
    5
    HTTPSampleResult result = new HTTPSampleResult();
    5
    jmctx.setCurrentSampler(context);
    9
    jmctx.setCurrentSampler(context);
    6
    jmctx.setCurrentSampler(config);
    10
    jmctx.setCurrentSampler(config);
    7
    result.setResponseData(responseText.getBytes());
    6
    result.setResponseData(responseText.getBytes());
    8
    result.setSampleLabel(context.toString());
    7
    result.setSampleLabel(context.toString());
                                                                                              
    13
    String newUrl = config.getUrl().toString();
    Preondition Violations
    Unmatched statement String newUrl=config.getUrl().toString(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13
    String newUrl = config.getUrl().toString();
    9
    result.setSamplerData(context.toString());
    9
    result.setSamplerData(context.toString());
    14
    assertEquals("http://www.apache.org/home/index.html?param1=value1", newUrl);
    Differences
    Expression1Expression2Difference
    setSamplerDataassertEqualsMETHOD_INVOCATION_NAME_MISMATCH
    result.setSamplerData(context.toString())assertEquals("http://www.apache.org/home/index.html?param1=value1",newUrl)ARGUMENT_NUMBER_MISMATCH
    resultMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression result.setSamplerData(context.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression result.setSamplerData(context.toString()) is a void method call, and thus it cannot be parameterized
    Expression assertEquals("http://www.apache.org/home/index.html?param1=value1",newUrl) is a void method call, and thus it cannot be parameterized
    Expression result.setSamplerData(context.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression result.setSamplerData(context.toString()) is a void method call, and thus it cannot be parameterized
    Expression assertEquals("http://www.apache.org/home/index.html?param1=value1",newUrl) is a void method call, and thus it cannot be parameterized
    14
    assertEquals("http://www.apache.org/home/index.html?param1=value1", newUrl);
    10
    result.setURL(context.getUrl());
    8
    result.setURL(context.getUrl());
    11
    jmctx.setPreviousResult(result);
    11
    jmctx.setPreviousResult(result);
    12
    parser.process();
    12
    parser.process();
    13
    assertEquals("http://www.apache.org/subdir/index.html", config.getUrl().toString());
    13
    assertEquals("http://www.apache.org/subdir/index.html", config.getUrl().toString());
    2
    config.getArguments().addArgument("param1", "value1");
    Differences
    Expression1Expression2Difference
    assertEqualsaddArgumentMETHOD_INVOCATION_NAME_MISMATCH
    "http://www.apache.org/subdir/index.html""param1"LITERAL_VALUE_MISMATCH
    config.getUrl().toString()"value1"TYPE_COMPATIBLE_REPLACEMENT
    config.getArguments()MISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression assertEquals("http://www.apache.org/subdir/index.html",config.getUrl().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression config.getArguments().addArgument("param1","value1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals("http://www.apache.org/subdir/index.html",config.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    Expression config.getArguments().addArgument("param1","value1") is a void method call, and thus it cannot be parameterized
    Expression config.getUrl().toString() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals("http://www.apache.org/subdir/index.html",config.getUrl().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression config.getArguments().addArgument("param1","value1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals("http://www.apache.org/subdir/index.html",config.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    Expression config.getArguments().addArgument("param1","value1") is a void method call, and thus it cannot be parameterized
    2
    config.getArguments().addArgument("param1", "value1");
    Precondition Violations (17)
    Row Violation
    1Unmatched statement String newUrl=config.getUrl().toString(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression result.setSamplerData(context.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression result.setSamplerData(context.toString()) is a void method call, and thus it cannot be parameterized
    4Expression assertEquals("http://www.apache.org/home/index.html?param1=value1",newUrl) is a void method call, and thus it cannot be parameterized
    5Expression result.setSamplerData(context.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression result.setSamplerData(context.toString()) is a void method call, and thus it cannot be parameterized
    7Expression assertEquals("http://www.apache.org/home/index.html?param1=value1",newUrl) is a void method call, and thus it cannot be parameterized
    8Expression assertEquals("http://www.apache.org/subdir/index.html",config.getUrl().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression config.getArguments().addArgument("param1","value1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression assertEquals("http://www.apache.org/subdir/index.html",config.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    11Expression config.getArguments().addArgument("param1","value1") is a void method call, and thus it cannot be parameterized
    12Expression config.getUrl().toString() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression assertEquals("http://www.apache.org/subdir/index.html",config.getUrl().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression config.getArguments().addArgument("param1","value1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression assertEquals("http://www.apache.org/subdir/index.html",config.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    16Expression config.getArguments().addArgument("param1","value1") is a void method call, and thus it cannot be parameterized
    17Clone fragment #1 returns variables , while Clone fragment #2 returns variables config