HTTPSamplerBase config = makeUrlConfig(".*index.*?param2=.+1"); 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(); String newUrl = config.getUrl().toString(); result.setResponseData(responseText.getBytes()); result.setSampleLabel(context.toString()); result.setURL(context.getUrl()); jmctx.setCurrentSampler(context); jmctx.setCurrentSampler(config); jmctx.setPreviousResult(result); parser.process(); assertEquals(newUrl, config.getUrl().toString());
HTTPSamplerBase config = makeUrlConfig(".*login\\.html"); 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.setPreviousResult(result); parser.process(); String newUrl = config.getUrl().toString(); assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl)); assertEquals(config.getUrl().toString(), 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 testFailSimpleParse1() Method name: void testFailSimpleParse2()
Number of AST nodes: 13 Number of AST nodes: 13
1
HTTPSamplerBase config = makeUrlConfig(".*index.*?param2=.+1");
1
HTTPSamplerBase config = makeUrlConfig(".*login\\.html");
2
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
2
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/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=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";
4
                    + "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";
5
            HTTPSampleResult result = new HTTPSampleResult();
5
            HTTPSampleResult result = new HTTPSampleResult();
6
            String newUrl = config.getUrl().toString();
7
            result.setResponseData(responseText.getBytes());
6
            result.setResponseData(responseText.getBytes());
8
            result.setSampleLabel(context.toString());
7
            result.setSampleLabel(context.toString());
9
            result.setURL(context.getUrl());
8
            result.setURL(context.getUrl());
10
            jmctx.setCurrentSampler(context);
9
            jmctx.setCurrentSampler(context);
11
            jmctx.setCurrentSampler(config);
10
            jmctx.set
12
            jmctx.setPreviousResult(result);
11
PreviousResult(result);
13
            parser.process(
12
            parser.process();
13
            String newUrl = config.getUrl().toString();
14
);
14
            assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl));
15
            assertEquals(newUrl, config.getUrl().toString());
15
            assertEquals(config.getUrl().toString(), 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 comparisons97
  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 fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    HTTPSamplerBase config = makeUrlConfig(".*index.*?param2=.+1");
    1
    HTTPSamplerBase config = makeUrlConfig(".*index.*?param2=.+1");
    1
    HTTPSamplerBase config = makeUrlConfig(".*login\\.html");
    Differences
    Expression1Expression2Difference
    ".*index.*?param2=.+1"".*login\\.html"LITERAL_VALUE_MISMATCH
    1
    HTTPSamplerBase config = makeUrlConfig(".*login\\.html");
    2
    HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
    2
    HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
    3
    String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";
    3
    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();
    4
    HTTPSampleResult result = new HTTPSampleResult();
    5
    String newUrl = config.getUrl().toString();
    11
    String newUrl = config.getUrl().toString();
    6
    result.setResponseData(responseText.getBytes());
    5
    result.setResponseData(responseText.getBytes());
    7
    result.setSampleLabel(context.toString());
    6
    result.setSampleLabel(context.toString());
    8
    result.setURL(context.getUrl());
    7
    result.setURL(context.getUrl());
    9
    jmctx.setCurrentSampler(context);
    8
    jmctx.setCurrentSampler(context);
    10
    jmctx.setCurrentSampler(config);
    10
    jmctx.setCurrentSampler(config);
    13
    assertEquals(config.getUrl().toString(), newUrl);
    Differences
    Expression1Expression2Difference
    setCurrentSamplerassertEqualsMETHOD_INVOCATION_NAME_MISMATCH
    jmctx.setCurrentSampler(config)assertEquals(config.getUrl().toString(),newUrl)ARGUMENT_NUMBER_MISMATCH
    jmctxMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression jmctx.setCurrentSampler(config) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals(config.getUrl().toString(),newUrl) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression jmctx.setCurrentSampler(config) is a void method call, and thus it cannot be parameterized
    Expression assertEquals(config.getUrl().toString(),newUrl) is a void method call, and thus it cannot be parameterized
    Expression jmctx.setCurrentSampler(config) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals(config.getUrl().toString(),newUrl) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression jmctx.setCurrentSampler(config) is a void method call, and thus it cannot be parameterized
    Expression assertEquals(config.getUrl().toString(),newUrl) is a void method call, and thus it cannot be parameterized
    13
    assertEquals(config.getUrl().toString(), newUrl);
    11
    jmctx.setPreviousResult(result);
    9
    jmctx.setPreviousResult(result);
    12
    parser.process();
    10
    parser.process();
    13
    assertEquals(newUrl, config.getUrl().toString());
    13
    assertEquals(newUrl, config.getUrl().toString());
    12
    assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl));
    Differences
    Expression1Expression2Difference
    assertEqualsassertTrueMETHOD_INVOCATION_NAME_MISMATCH
    assertEquals(newUrl,config.getUrl().toString())assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl))ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression assertEquals(newUrl,config.getUrl().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals(newUrl,config.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    Expression assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl)) is a void method call, and thus it cannot be parameterized
    Expression assertEquals(newUrl,config.getUrl().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertEquals(newUrl,config.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    Expression assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl)) is a void method call, and thus it cannot be parameterized
    12
    assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl));
    Precondition Violations (16)
    Row Violation
    1Expression jmctx.setCurrentSampler(config) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression assertEquals(config.getUrl().toString(),newUrl) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression jmctx.setCurrentSampler(config) is a void method call, and thus it cannot be parameterized
    4Expression assertEquals(config.getUrl().toString(),newUrl) is a void method call, and thus it cannot be parameterized
    5Expression jmctx.setCurrentSampler(config) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression assertEquals(config.getUrl().toString(),newUrl) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression jmctx.setCurrentSampler(config) is a void method call, and thus it cannot be parameterized
    8Expression assertEquals(config.getUrl().toString(),newUrl) is a void method call, and thus it cannot be parameterized
    9Expression assertEquals(newUrl,config.getUrl().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression assertEquals(newUrl,config.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    12Expression assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl)) is a void method call, and thus it cannot be parameterized
    13Expression assertEquals(newUrl,config.getUrl().toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression assertEquals(newUrl,config.getUrl().toString()) is a void method call, and thus it cannot be parameterized
    16Expression assertTrue(!"http://www.apache.org/home/index.html?param1=value1".equals(newUrl)) is a void method call, and thus it cannot be parameterized