final String KEY = KEY_BASE + testCount++; assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis())); assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis())); localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1)); assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis())); remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1)); assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis())); // Wait for async propagation sleep(250); if (evict) localAccessStrategy.evict(KEY); else localAccessStrategy.remove(KEY); assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis())); assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
final String KEY = KEY_BASE + testCount++; assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis())); assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis())); localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1)); assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis())); remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1)); assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis())); // Wait for async propagation sleep(250); if (evict) localAccessStrategy.evict(KEY); else localAccessStrategy.remove(KEY); assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis())); // sleep(1000); assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
Method name: void evictOrRemoveTest(boolean) Method name: void evictOrRemoveTest(boolean)
Number of AST nodes: 13 Number of AST nodes: 13
1
final String KEY = KEY_BASE + testCount++;
1
final String KEY = KEY_BASE + testCount++;
2
        
2
        
3
        assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
3
        assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
4
        assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
4
        assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
5
        
5
        
6
        localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
6
        localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
7
        assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
7
        assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
8
        remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
8
        remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
9
        assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
9
        assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
10
        
10
        
11
        // Wait for async propagation
11
        // Wait for async propagation
12
        sleep(250);
12
        sleep(250);
13
        
13
        
14
        if (evict)
14
        if (evict)
15
            localAccessStrategy.evict(KEY);
15
            localAccessStrategy.evict(KEY);
16
        else
16
        else
17
            localAccessStrategy.remove(KEY);
17
            localAccessStrategy.remove(KEY);
18
        
18
        
19
        assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis()));
19
        assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis()));
20
        
20
        
21
//        sleep(1000);
22
        
21
        assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
23
        assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
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.4
Clones locationClones are in different classes having the same super class
Number of node comparisons91
  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)22.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    final String KEY = KEY_BASE + testCount++;
    1
    final String KEY = KEY_BASE + testCount++;
    2
    assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
    2
    assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
    3
    assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    Differences
    Expression1Expression2Difference
    "local is clean""remote is clean"LITERAL_VALUE_MISMATCH
    localAccessStrategyremoteAccessStrategyVARIABLE_NAME_MISMATCH
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable remoteAccessStrategy
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    3
    assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    3
    assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    3
    assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    2
    assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
    Differences
    Expression1Expression2Difference
    "remote is clean""local is clean"LITERAL_VALUE_MISMATCH
    remoteAccessStrategylocalAccessStrategyVARIABLE_NAME_MISMATCH
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable remoteAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    2
    assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
    4
    localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
    4
    localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
    6
    remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
    Differences
    Expression1Expression2Difference
    localAccessStrategyremoteAccessStrategyVARIABLE_NAME_MISMATCH
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable remoteAccessStrategy
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    6
    remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
    5
    assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
    5
    assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
    7
    assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    Differences
    Expression1Expression2Difference
    localAccessStrategyremoteAccessStrategyVARIABLE_NAME_MISMATCH
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable remoteAccessStrategy
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    7
    assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    6
    remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
    6
    remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
    4
    localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
    Differences
    Expression1Expression2Difference
    remoteAccessStrategylocalAccessStrategyVARIABLE_NAME_MISMATCH
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable remoteAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    4
    localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
    7
    assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    7
    assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    5
    assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
    Differences
    Expression1Expression2Difference
    remoteAccessStrategylocalAccessStrategyVARIABLE_NAME_MISMATCH
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable remoteAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    5
    assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
    8
    sleep(250);
    8
    sleep(250);
    9
    if (evict)
    9
    if (evict)
    10
    localAccessStrategy.evict(KEY);
    10
    localAccessStrategy.evict(KEY);
    10
    localAccessStrategy.evict(KEY);
    Differences
    Expression1Expression2Difference
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    10
    localAccessStrategy.evict(KEY);
    else
    else
    11
    localAccessStrategy.remove(KEY);
    11
    localAccessStrategy.remove(KEY);
    11
    localAccessStrategy.remove(KEY);
    Differences
    Expression1Expression2Difference
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    11
    localAccessStrategy.remove(KEY);
    12
    assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis()));
    12
    assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis()));
    13
    assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    Differences
    Expression1Expression2Difference
    localAccessStrategyremoteAccessStrategyVARIABLE_NAME_MISMATCH
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable remoteAccessStrategy
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    13
    assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    13
    assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    13
    assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
    12
    assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis()));
    Differences
    Expression1Expression2Difference
    remoteAccessStrategylocalAccessStrategyVARIABLE_NAME_MISMATCH
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable remoteAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    12
    assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis()));
    Precondition Violations (22)
    Row Violation
    1Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable remoteAccessStrategy
    2Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable remoteAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    3Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable remoteAccessStrategy
    6Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable remoteAccessStrategy
    9Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable remoteAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    12Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable remoteAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    15Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    16Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy
    17Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable localAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable remoteAccessStrategy
    20Expression remoteAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Expression localAccessStrategy cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable remoteAccessStrategy does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable localAccessStrategy