if (getPropertyAsBoolean(USER_DEFINED)) { res.sampleStart(); ldap.modifyTest(getUserModAttributes(), getPropertyAsString(BASE_ENTRY_DN)); res.sampleEnd(); } else { ldap.createTest(getBasicAttributes(), getPropertyAsString(ADD)); setProperty(new StringProperty(MODIFY, getPropertyAsString(ADD))); res.sampleStart(); ldap.modifyTest(getModificationItem(), getPropertyAsString(MODIFY)); res.sampleEnd(); ldap.deleteTest(getPropertyAsString(ADD)); }
if (getPropertyAsBoolean(USER_DEFINED)) { res.sampleStart(); ldap.createTest(getUserAttributes(), getPropertyAsString(BASE_ENTRY_DN)); res.sampleEnd(); } else { res.sampleStart(); ldap.createTest(getBasicAttributes(), getPropertyAsString(ADD)); res.sampleEnd(); ldap.deleteTest(getPropertyAsString(ADD)); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/ldap/sampler/LDAPSampler.java
Method name: void modifyTest(LdapClient, SampleResult) Method name: void addTest(LdapClient, SampleResult)
Number of AST nodes: 10 Number of AST nodes: 8
1
if (getPropertyAsBoolean(USER_DEFINED)) {
1
if (getPropertyAsBoolean(USER_DEFINED)) {
2
			res.sampleStart();
2
			res.sampleStart();
3
			ldap.modifyTest(getUserModAttributes(), getPropertyAsString(BASE_ENTRY_DN));
3
			ldap.createTest(getUserAttributes(), getPropertyAsString(BASE_ENTRY_DN));
4
			res.sampleEnd();
4
			res.sampleEnd();
5
		} else {
5
		} else {
6
			ldap.createTest(getBasicAttributes(), getPropertyAsString(ADD));
6
			
7
			setProperty(new StringProperty(MODIFY, getPropertyAsString(ADD)));
8
			res.sampleStart();
7
res.sampleStart();
9
			ldap.modifyTest(getModificationItem(), getPropertyAsString(MODIFY));
8
			ldap.createTest(getBasicAttributes(), getPropertyAsString(ADD));
10
			res.sampleEnd();
9
			res.sampleEnd();
11
			ldap.deleteTest(getPropertyAsString(ADD));
10
			ldap.deleteTest(getPropertyAsString(ADD));
12
		}
11
		}
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.1
Clones locationClones are declared in the same class
Number of node comparisons80
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)10.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (getPropertyAsBoolean(USER_DEFINED))
    1
    if (getPropertyAsBoolean(USER_DEFINED))
    2
    res.sampleStart();
    2
    res.sampleStart();
    3
    ldap.modifyTest(getUserModAttributes(), getPropertyAsString(BASE_ENTRY_DN));
    3
    ldap.modifyTest(getUserModAttributes(), getPropertyAsString(BASE_ENTRY_DN));
    3
    ldap.createTest(getUserAttributes(), getPropertyAsString(BASE_ENTRY_DN));
    Differences
    Expression1Expression2Difference
    modifyTestcreateTestMETHOD_INVOCATION_NAME_MISMATCH
    getUserModAttributesgetUserAttributesMETHOD_INVOCATION_NAME_MISMATCH
    javax.naming.directory.ModificationItem[]javax.naming.directory.BasicAttributesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression ldap.modifyTest(getUserModAttributes(),getPropertyAsString(BASE_ENTRY_DN)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ldap.createTest(getUserAttributes(),getPropertyAsString(BASE_ENTRY_DN)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ldap.modifyTest(getUserModAttributes(),getPropertyAsString(BASE_ENTRY_DN)) is a void method call, and thus it cannot be parameterized
    Expression ldap.createTest(getUserAttributes(),getPropertyAsString(BASE_ENTRY_DN)) is a void method call, and thus it cannot be parameterized
    Type javax.naming.directory.ModificationItem[] of variable getUserModAttributes() does not match with type javax.naming.directory.BasicAttributes of variable getUserAttributes()
    • Make classes javax.naming.directory.ModificationItem[] and javax.naming.directory.BasicAttributes extend a common superclass
    3
    ldap.createTest(getUserAttributes(), getPropertyAsString(BASE_ENTRY_DN));
    4
    res.sampleEnd();
    4
    res.sampleEnd();
    else
    else
    5
    ldap.createTest(getBasicAttributes(), getPropertyAsString(ADD));
    5
    ldap.createTest(getBasicAttributes(), getPropertyAsString(ADD));
    Preondition Violations
    Unmatched statement ldap.createTest(getBasicAttributes(),getPropertyAsString(ADD)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                        
    6
    setProperty(new StringProperty(MODIFY, getPropertyAsString(ADD)));
    6
    setProperty(new StringProperty(MODIFY, getPropertyAsString(ADD)));
    Preondition Violations
    Unmatched statement setProperty(new StringProperty(MODIFY,getPropertyAsString(ADD))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                            
    7
    res.sampleStart();
    5
    res.sampleStart();
    8
    ldap.modifyTest(getModificationItem(), getPropertyAsString(MODIFY));
    8
    ldap.modifyTest(getModificationItem(), getPropertyAsString(MODIFY));
    6
    ldap.createTest(getBasicAttributes(), getPropertyAsString(ADD));
    Differences
    Expression1Expression2Difference
    modifyTestcreateTestMETHOD_INVOCATION_NAME_MISMATCH
    getModificationItemgetBasicAttributesMETHOD_INVOCATION_NAME_MISMATCH
    javax.naming.directory.ModificationItem[]javax.naming.directory.BasicAttributesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression ldap.createTest(getBasicAttributes(),getPropertyAsString(ADD)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ldap.modifyTest(getModificationItem(),getPropertyAsString(MODIFY)) is a void method call, and thus it cannot be parameterized
    Expression ldap.createTest(getBasicAttributes(),getPropertyAsString(ADD)) is a void method call, and thus it cannot be parameterized
    Type javax.naming.directory.ModificationItem[] of variable getModificationItem() does not match with type javax.naming.directory.BasicAttributes of variable getBasicAttributes()
    • Make classes javax.naming.directory.ModificationItem[] and javax.naming.directory.BasicAttributes extend a common superclass
    6
    ldap.createTest(getBasicAttributes(), getPropertyAsString(ADD));
    9
    res.sampleEnd();
    7
    res.sampleEnd();
    10
    ldap.deleteTest(getPropertyAsString(ADD));
    8
    ldap.deleteTest(getPropertyAsString(ADD));
    Precondition Violations (11)
    Row Violation
    1Expression ldap.modifyTest(getUserModAttributes(),getPropertyAsString(BASE_ENTRY_DN)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ldap.createTest(getUserAttributes(),getPropertyAsString(BASE_ENTRY_DN)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ldap.modifyTest(getUserModAttributes(),getPropertyAsString(BASE_ENTRY_DN)) is a void method call, and thus it cannot be parameterized
    4Expression ldap.createTest(getUserAttributes(),getPropertyAsString(BASE_ENTRY_DN)) is a void method call, and thus it cannot be parameterized
    5Type javax.naming.directory.ModificationItem[] of variable getUserModAttributes() does not match with type javax.naming.directory.BasicAttributes of variable getUserAttributes()
    6Unmatched statement ldap.createTest(getBasicAttributes(),getPropertyAsString(ADD)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement setProperty(new StringProperty(MODIFY,getPropertyAsString(ADD))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Expression ldap.createTest(getBasicAttributes(),getPropertyAsString(ADD)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression ldap.modifyTest(getModificationItem(),getPropertyAsString(MODIFY)) is a void method call, and thus it cannot be parameterized
    10Expression ldap.createTest(getBasicAttributes(),getPropertyAsString(ADD)) is a void method call, and thus it cannot be parameterized
    11Type javax.naming.directory.ModificationItem[] of variable getModificationItem() does not match with type javax.naming.directory.BasicAttributes of variable getBasicAttributes()