CollectionRegion region = regionFactory.buildCollectionRegion("test", properties, null); assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion()); try { region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion(); fail("Did not get READ_ONLY"); } catch (UnsupportedOperationException good) {} try { region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); fail("Incorrectly got NONSTRICT_READ_WRITE"); } catch (CacheException good) {} try { region.buildAccessStrategy(AccessType.READ_WRITE); fail("Incorrectly got READ_WRITE"); } catch (CacheException good) {}
EntityRegion region = regionFactory.buildEntityRegion("test", properties, null); assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion()); try { region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion(); fail("Did not get READ_ONLY"); } catch (UnsupportedOperationException good) {} try { region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); fail("Incorrectly got NONSTRICT_READ_WRITE"); } catch (CacheException good) {} try { region.buildAccessStrategy(AccessType.READ_WRITE); fail("Incorrectly got READ_WRITE"); } catch (CacheException good) {}
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/CollectionRegionImplTestCase.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/EntityRegionImplTestCase.java
Method name: void supportedAccessTypeTest(RegionFactory, Properties) Method name: void supportedAccessTypeTest(RegionFactory, Properties)
Number of AST nodes: 11 Number of AST nodes: 11
1
CollectionRegion region = regionFactory.buildCollectionRegion("test", properties, null);
1
EntityRegion region = regionFactory.buildEntityRegion("test", properties, null);
2
        
2
        
3
        assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
3
        assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
4
        
4
        
5
        try
5
        try
6
        {
6
        {
7
            region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
7
            region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
8
            fail("Did not get READ_ONLY");
8
            fail("Did not get READ_ONLY");
9
        }
9
        }
10
        catch (UnsupportedOperationException good) {}
10
        catch (UnsupportedOperationException good) {}
11
        
11
        
12
        try
12
        try
13
        {
13
        {
14
            region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
14
            region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
15
            fail("Incorrectly got NONSTRICT_READ_WRITE");
15
            fail("Incorrectly got NONSTRICT_READ_WRITE");
16
        }
16
        }
17
        catch (CacheException good) {}
17
        catch (CacheException good) {}
18
        
18
        
19
        try
19
        try
20
        {
20
        {
21
            region.buildAccessStrategy(AccessType.READ_WRITE);
21
            region.buildAccessStrategy(AccessType.READ_WRITE);
22
            fail("Incorrectly got READ_WRITE");
22
            fail("Incorrectly got READ_WRITE");
23
        }
23
        }
24
        catch (CacheException good) {}
24
        catch (CacheException good) {}
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 comparisons61
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)5.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                  
    1
    EntityRegion region = regionFactory.buildEntityRegion("test", properties, null);
    1
    CollectionRegion region = regionFactory.buildCollectionRegion("test", properties, null);
                                                                                                                                                                                  
    2
    assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
    2
    assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
    2
    assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
    Differences
    Expression1Expression2Difference
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    org.hibernate.cache.CollectionRegionorg.hibernate.cache.EntityRegionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.TRANSACTIONAL) does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.TRANSACTIONAL)
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    Type org.hibernate.cache.CollectionRegion of variable region does not match with type org.hibernate.cache.EntityRegion of variable region
    • Make classes org.hibernate.cache.CollectionRegion and org.hibernate.cache.EntityRegion extend a common superclass
    2
    assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
    3
    try
    3
    try
    4
    region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
    4
    region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
    4
    region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
    Differences
    Expression1Expression2Difference
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    org.hibernate.cache.CollectionRegionorg.hibernate.cache.EntityRegionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression region.buildAccessStrategy(AccessType.READ_ONLY) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression region.buildAccessStrategy(AccessType.READ_ONLY) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.READ_ONLY) does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.READ_ONLY)
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    Type org.hibernate.cache.CollectionRegion of variable region does not match with type org.hibernate.cache.EntityRegion of variable region
    • Make classes org.hibernate.cache.CollectionRegion and org.hibernate.cache.EntityRegion extend a common superclass
    4
    region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
    5
    fail("Did not get READ_ONLY");
    5
    fail("Did not get READ_ONLY");
    6
    try
    6
    try
                                                                                                                                  
    7
    region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
    Preondition Violations
    Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    7
    region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
    7
    region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
    7
    region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
    Preondition Violations
    Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                  
    8
    fail("Incorrectly got NONSTRICT_READ_WRITE");
    8
    fail("Incorrectly got NONSTRICT_READ_WRITE");
    9
    try
    9
    try
                                                                                                                
    10
    region.buildAccessStrategy(AccessType.READ_WRITE);
    Preondition Violations
    Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    10
    region.buildAccessStrategy(AccessType.READ_WRITE);
    10
    region.buildAccessStrategy(AccessType.READ_WRITE);
    10
    region.buildAccessStrategy(AccessType.READ_WRITE);
    Preondition Violations
    Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                
    11
    fail("Incorrectly got READ_WRITE");
    11
    fail("Incorrectly got READ_WRITE");
    Precondition Violations (10)
    Row Violation
    1Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.TRANSACTIONAL) does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.TRANSACTIONAL)
    2Type org.hibernate.cache.CollectionRegion of variable region does not match with type org.hibernate.cache.EntityRegion of variable region
    3Expression region.buildAccessStrategy(AccessType.READ_ONLY) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    4Expression region.buildAccessStrategy(AccessType.READ_ONLY) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    5Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.READ_ONLY) does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.READ_ONLY)
    6Type org.hibernate.cache.CollectionRegion of variable region does not match with type org.hibernate.cache.EntityRegion of variable region
    7Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    8Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    9Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    10Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted