params = new LinkedList(); params.add(new CompoundVariable("<value,? field=\"(pinposition\\d+)\">(\\d+)</value>")); params.add(new CompoundVariable("$1$")); params.add(new CompoundVariable("3")); variable.setParameters(params); String match = variable.execute(result, null); assertEquals("pinposition3", match);
params.add(new CompoundVariable("YMD")); params.add(new CompoundVariable("NAME")); variable.setParameters(params); value = variable.execute(result, null); assertEquals(8,value.length()); assertEquals(value,vars.get("NAME"));
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/TestRegexFunction.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/TestTimeFunction.java
Method name: void testComma() Method name: void testYMD()
Number of AST nodes: 7 Number of AST nodes: 6
1
params = new LinkedList();
2
			params.add(new CompoundVariable("<value,? field=\"(pinposition\\d+)\">(\\d+)</value>"));
1
params.add(new CompoundVariable("
3
			params.add(new CompoundVariable("$1$"));
2
YMD"));
4
			params.add(new CompoundVariable("3"));
3
			params.add(new CompoundVariable("NAME"));
5
			variable.setParameters(params);
4
			variable.setParameters(params);
6
			String match = variable.execute(result, null);
5
			value = variable.execute(result, null);
7
			assertEquals("pinposition3", match
6
			assertEquals(8,value.length());
8
);
7
            assertEquals(value,vars.get("NAME"));
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 different classes having the same super class
Number of node comparisons42
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    params = new LinkedList();
                                                          
    2
    params.add(new CompoundVariable("<value,? field=\"(pinposition\\d+)\">(\\d+)</value>"));
    2
    params.add(new CompoundVariable("<value,? field=\"(pinposition\\d+)\">(\\d+)</value>"));
    1
    params.add(new CompoundVariable("YMD"));
    Differences
    Expression1Expression2Difference
    "(\\d+)""YMD"LITERAL_VALUE_MISMATCH
    1
    params.add(new CompoundVariable("YMD"));
    3
    params.add(new CompoundVariable("$1$"));
    3
    params.add(new CompoundVariable("$1$"));
    2
    params.add(new CompoundVariable("NAME"));
    Differences
    Expression1Expression2Difference
    "$1$""NAME"LITERAL_VALUE_MISMATCH
    2
    params.add(new CompoundVariable("NAME"));
    4
    params.add(new CompoundVariable("3"));
                                                                                      
    5
    variable.setParameters(params);
    5
    variable.setParameters(params);
    3
    variable.setParameters(params);
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.functions.RegexFunctionorg.apache.jmeter.functions.FunctionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.functions.RegexFunction of variable variable does not match with type org.apache.jmeter.functions.Function of variable variable
    • Make classes org.apache.jmeter.functions.RegexFunction and org.apache.jmeter.functions.Function extend a common superclass
    3
    variable.setParameters(params);
                                                                                  
    4
    value = variable.execute(result, null);
    Preondition Violations
    Unmatched statement value=variable.execute(result,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    value = variable.execute(result, null);
                                                                        
    5
    assertEquals(8, value.length());
    6
    String match = variable.execute(result, null);
    6
    String match = variable.execute(result, null);
    Preondition Violations
    Unmatched statement String match=variable.execute(result,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
    7
    assertEquals("pinposition3", match);
    7
    assertEquals("pinposition3", match);
    6
    assertEquals(value, vars.get("NAME"));
    Differences
    Expression1Expression2Difference
    "pinposition3"valueTYPE_COMPATIBLE_REPLACEMENT
    matchvars.get("NAME")TYPE_COMPATIBLE_REPLACEMENT
    6
    assertEquals(value, vars.get("NAME"));
    Precondition Violations (3)
    Row Violation
    1Type org.apache.jmeter.functions.RegexFunction of variable variable does not match with type org.apache.jmeter.functions.Function of variable variable
    2Unmatched statement value=variable.execute(result,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement String match=variable.execute(result,null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted