HTTPSamplerBase config = makeUrlConfig("/subdir/index\\..*"); 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(); 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/subdir/index.html", newUrl);
HTTPSamplerBase config = makeUrlConfig("/subdir/index\\.h.*"); HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/one/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(); 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/subdir/index.html", 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 testSimpleParse4() Method name: void testSimpleParse5()
Number of AST nodes: 13 Number of AST nodes: 13
1
HTTPSamplerBase config = makeUrlConfig("/subdir/index\\..*");
1
HTTPSamplerBase config = makeUrlConfig("/subdir/index\\.h.*");
2
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
2
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/one/previous.html");
3
            String responseText = "<html><head><title>Test page</title></head><body>"
3
            String responseText = "<html><head><title>Test page</title></head><body>"
4
                    + "<A HREF=\"index.html\">Goto index page</A></body></html>";
4
                    + "<a href=\"../index.html\">Goto index page</a></body></html>";
5
            HTTPSampleResult result = new HTTPSampleResult();
5
            HTTPSampleResult result = new HTTPSampleResult();
6
            result.setResponseData(responseText.getBytes());
6
            result.setResponseData(responseText.getBytes());
7
            result.setSampleLabel(context.toString());
7
            result.setSampleLabel(context.toString());
8
            result.setURL(context.getUrl());
8
            result.setURL(context.getUrl());
9
            jmctx.setCurrentSampler(context);
9
            jmctx.setCurrentSampler(context);
10
            jmctx.setCurrentSampler(config);
10
            jmctx.setCurrentSampler(config);
11
            jmctx.setPreviousResult(result);
11
            jmctx.setPreviousResult(result);
12
            parser.process();
12
            parser.process();
13
            String newUrl = config.getUrl().toString();
13
            String newUrl = config.getUrl().toString();
14
            assertEquals("http://www.apache.org/subdir/index.html", newUrl);
14
            assertEquals("http://www.apache.org/subdir/index.html", newUrl);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are declared in the same class
Number of node comparisons97
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements13
    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
    1
    HTTPSamplerBase config = makeUrlConfig("/subdir/index\\..*");
    1
    HTTPSamplerBase config = makeUrlConfig("/subdir/index\\..*");
    1
    HTTPSamplerBase config = makeUrlConfig("/subdir/index\\.h.*");
    Differences
    Expression1Expression2Difference
    "/subdir/index\\..*""/subdir/index\\.h.*"LITERAL_VALUE_MISMATCH
    1
    HTTPSamplerBase config = makeUrlConfig("/subdir/index\\.h.*");
    2
    HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
    2
    HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
    2
    HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/one/previous.html");
    Differences
    Expression1Expression2Difference
    "http://www.apache.org/subdir/previous.html""http://www.apache.org/subdir/one/previous.html"LITERAL_VALUE_MISMATCH
    2
    HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/one/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>";
    3
    String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"../index.html\">Goto index page</a></body></html>";
    Differences
    Expression1Expression2Difference
    "Goto index page""Goto index page"LITERAL_VALUE_MISMATCH
    3
    String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"../index.html\">Goto index page</a></body></html>";
    4
    HTTPSampleResult result = new HTTPSampleResult();
    4
    HTTPSampleResult result = new HTTPSampleResult();
    5
    result.setResponseData(responseText.getBytes());
    5
    result.setResponseData(responseText.getBytes());
    6
    result.setSampleLabel(context.toString());
    6
    result.setSampleLabel(context.toString());
    7
    result.setURL(context.getUrl());
    7
    result.setURL(context.getUrl());
    8
    jmctx.setCurrentSampler(context);
    8
    jmctx.setCurrentSampler(context);
    9
    jmctx.setCurrentSampler(config);
    9
    jmctx.setCurrentSampler(config);
    10
    jmctx.setPreviousResult(result);
    10
    jmctx.setPreviousResult(result);
    11
    parser.process();
    11
    parser.process();
    12
    String newUrl = config.getUrl().toString();
    12
    String newUrl = config.getUrl().toString();
    13
    assertEquals("http://www.apache.org/subdir/index.html", newUrl);
    13
    assertEquals("http://www.apache.org/subdir/index.html", newUrl);
    Precondition Violations (0)
    Row Violation