Configuration cfg = createConfiguration(); JBossCacheRegionFactory rf = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport()); Cache localCache = rf.getCacheInstanceManager().getEntityCacheInstance(); optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC; // Sleep a bit to avoid concurrent FLUSH problem avoidConcurrentFlush(); CollectionRegion localCollectionRegion = rf.buildCollectionRegion(REGION_NAME, cfg.getProperties(), null); setCollectionAccessStrategy(localCollectionRegion.buildAccessStrategy(getAccessType()));
Configuration cfg = createConfiguration(); JBossCacheRegionFactory rf = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport()); Cache localCache = rf.getCacheInstanceManager().getEntityCacheInstance(); optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC; // Sleep a bit to avoid concurrent FLUSH problem avoidConcurrentFlush(); EntityRegion localEntityRegion = rf.buildEntityRegion(REGION_NAME, cfg.getProperties(), null); setEntityRegionAccessStrategy(localEntityRegion.buildAccessStrategy(getAccessType()));
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/OptimisticTransactionalExtraAPITestCase.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/OptimisticTransactionalExtraAPITestCase.java
Method name: void setUp() Method name: void setUp()
Number of AST nodes: 7 Number of AST nodes: 7
1
Configuration cfg = createConfiguration();
1
Configuration cfg = createConfiguration();
2
            JBossCacheRegionFactory rf  = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
2
            JBossCacheRegionFactory rf  = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
3
            Cache localCache = rf.getCacheInstanceManager().getEntityCacheInstance();
3
            Cache localCache = rf.getCacheInstanceManager().getEntityCacheInstance();
4
            optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
4
            optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
5
            
5
            
6
            // Sleep a bit to avoid concurrent FLUSH problem
6
            // Sleep a bit to avoid concurrent FLUSH problem
7
            avoidConcurrentFlush();
7
            avoidConcurrentFlush();
8
            
8
            
9
            CollectionRegion localCollectionRegion = rf.buildCollectionRegion(REGION_NAME, cfg.getProperties(), null);
9
            EntityRegion localEntityRegion = rf.buildEntityRegion(REGION_NAME, cfg.getProperties(), null);
10
            setCollectionAccessStrategy(localCollectionRegion.buildAccessStrategy(getAccessType()));
10
            setEntityRegionAccessStrategy(localEntityRegion.buildAccessStrategy(getAccessType()));
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 comparisons37
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    Configuration cfg = createConfiguration();
    3
    Configuration cfg = createConfiguration();
    4
    JBossCacheRegionFactory rf = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
    4
    JBossCacheRegionFactory rf = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
    5
    Cache localCache = rf.getCacheInstanceManager().getEntityCacheInstance();
    5
    Cache localCache = rf.getCacheInstanceManager().getEntityCacheInstance();
    6
    optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
    6
    optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
    7
    avoidConcurrentFlush();
    7
    avoidConcurrentFlush();
                                                                                                                                                                                              
    8
    EntityRegion localEntityRegion = rf.buildEntityRegion(REGION_NAME, cfg.getProperties(), null);
    8
    CollectionRegion localCollectionRegion = rf.buildCollectionRegion(REGION_NAME, cfg.getProperties(), null);
                                                                                                                                                                                                                      
                                                                                                                                                                                      
    9
    setEntityRegionAccessStrategy(localEntityRegion.buildAccessStrategy(getAccessType()));
    9
    setCollectionAccessStrategy(localCollectionRegion.buildAccessStrategy(getAccessType()));
                                                                                                                                                                                          
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables cfg, rf , while Clone fragment #2 returns variables cfg, rf