response.setResponseData(html.getBytes()); mod.setArgumentName("session_id"); HTTPSamplerBase sampler = createSampler(); sampler.addArgument("session_id", "adfasdfdsafasdfasd"); context.setCurrentSampler(sampler); context.setPreviousResult(response); mod.process(); Arguments args = sampler.getArguments(); assertEquals("jfdkjdkf jddkfdfjkdjfdf\"", ((Argument) args.getArguments().get(0).getObjectValue()) .getValue());
response.setResponseData(html.getBytes()); mod.setArgumentName("sessionid"); HTTPSamplerBase sampler = createSampler(); sampler.addArgument("sessionid", "xyzxyzxyz"); context.setCurrentSampler(sampler); context.setPreviousResult(response); mod.process(); Arguments args = sampler.getArguments(); assertEquals("xyzxyzxyz", ((Argument) args.getArguments().get(0).getObjectValue()) .getValue());
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java
Method name: void testGrabSessionId() Method name: void testGrabSessionIdURLinJSON()
Number of AST nodes: 9 Number of AST nodes: 9
1
response.setResponseData(html.getBytes());
1
response.setResponseData(html.getBytes());
2
			mod.setArgumentName("session_id");
2
			mod.setArgumentName("sessionid");
3
			HTTPSamplerBase sampler = createSampler();
3
			HTTPSamplerBase sampler = createSampler();
4
			sampler.addArgument("session_id", "adfasdfdsafasdfasd");
4
			sampler.addArgument("sessionid", "xyzxyzxyz");
5
			context.setCurrentSampler(sampler);
5
			context.setCurrentSampler(sampler);
6
			context.setPreviousResult(response);
6
			context.setPreviousResult(response);
7
			mod.process();
7
			mod.process();
8
			Arguments args = sampler.getArguments();
8
			Arguments args = sampler.getArguments();
9
			assertEquals("jfdkjdkf jddkfdfjkdjfdf\"", ((Argument) args.getArguments().get(0).getObjectValue())
9
			assertEquals("xyzxyzxyz", ((Argument) args.getArguments().get(0).getObjectValue())
10
					.getValue());
10
					.getValue());
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 comparisons81
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    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
    3
    response.setResponseData(html.getBytes());
    3
    response.setResponseData(html.getBytes());
    4
    mod.setArgumentName("session_id");
    4
    mod.setArgumentName("session_id");
    4
    mod.setArgumentName("sessionid");
    Differences
    Expression1Expression2Difference
    "session_id""sessionid"LITERAL_VALUE_MISMATCH
    4
    mod.setArgumentName("sessionid");
    5
    HTTPSamplerBase sampler = createSampler();
    5
    HTTPSamplerBase sampler = createSampler();
    6
    sampler.addArgument("session_id", "adfasdfdsafasdfasd");
    6
    sampler.addArgument("session_id", "adfasdfdsafasdfasd");
    6
    sampler.addArgument("sessionid", "xyzxyzxyz");
    Differences
    Expression1Expression2Difference
    "session_id""sessionid"LITERAL_VALUE_MISMATCH
    "adfasdfdsafasdfasd""xyzxyzxyz"LITERAL_VALUE_MISMATCH
    6
    sampler.addArgument("sessionid", "xyzxyzxyz");
    7
    context.setCurrentSampler(sampler);
    7
    context.setCurrentSampler(sampler);
    8
    context.setPreviousResult(response);
    8
    context.setPreviousResult(response);
    9
    mod.process();
    9
    mod.process();
    10
    Arguments args = sampler.getArguments();
    10
    Arguments args = sampler.getArguments();
    11
    assertEquals("jfdkjdkf jddkfdfjkdjfdf\"", ((Argument)args.getArguments().get(0).getObjectValue()).getValue());
    11
    assertEquals("jfdkjdkf jddkfdfjkdjfdf\"", ((Argument)args.getArguments().get(0).getObjectValue()).getValue());
    11
    assertEquals("xyzxyzxyz", ((Argument)args.getArguments().get(0).getObjectValue()).getValue());
    Differences
    Expression1Expression2Difference
    "jfdkjdkf jddkfdfjkdjfdf\"""xyzxyzxyz"LITERAL_VALUE_MISMATCH
    11
    assertEquals("xyzxyzxyz", ((Argument)args.getArguments().get(0).getObjectValue()).getValue());
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables sampler , while Clone fragment #2 returns variables