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: 8 | Number of AST nodes: 8 | |||
1 | if (getCollectionAccessStrategy() == null) {↵ | 1 | if (getEntityAccessStrategy() == null) {↵ | |
2 | Configuration cfg = createConfiguration();↵ | 2 | Configuration cfg = createConfiguration();↵ | |
3 | JBossCacheRegionFactory rf = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());↵ | 3 | JBossCacheRegionFactory rf = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());↵ | |
4 | Cache localCache = rf.getCacheInstanceManager().getEntityCacheInstance();↵ | 4 | Cache localCache = rf.getCacheInstanceManager().getEntityCacheInstance();↵ | |
5 | optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;↵ | 5 | optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;↵ | |
6 | ↵ | 6 | ↵ | |
7 | // Sleep a bit to avoid concurrent FLUSH problem↵ | 7 | // Sleep a bit to avoid concurrent FLUSH problem↵ | |
8 | avoidConcurrentFlush();↵ | 8 | avoidConcurrentFlush();↵ | |
9 | ↵ | 9 | ↵ | |
10 | CollectionRegion localCollectionRegion = rf.buildCollectionRegion(REGION_NAME, cfg.getProperties(), null);↵ | 10 | EntityRegion localEntityRegion = rf.buildEntityRegion(REGION_NAME, cfg.getProperties(), null);↵ | |
11 | setCollectionAccessStrategy(localCollectionRegion.buildAccessStrategy(getAccessType()));↵ | 11 | setEntityRegionAccessStrategy(localEntityRegion.buildAccessStrategy(getAccessType()));↵ | |
12 | } | 12 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 64 |
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 64.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | if (getCollectionAccessStrategy() == null) |
| 2 | if (getEntityAccessStrategy() == null) | |||||||||||||||||||||
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 | CollectionRegion localCollectionRegion = rf.buildCollectionRegion(REGION_NAME, cfg.getProperties(), null); |
| 8 | EntityRegion localEntityRegion = rf.buildEntityRegion(REGION_NAME, cfg.getProperties(), null); | |||||||||||||||||||||
|
| 9 | setEntityRegionAccessStrategy(localEntityRegion.buildAccessStrategy(getAccessType())); | ||||||||||||||||||||||
9 | setCollectionAccessStrategy(localCollectionRegion.buildAccessStrategy(getAccessType())); |
| |
Row | Violation |
---|---|
1 | Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable getCollectionAccessStrategy() does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable getEntityAccessStrategy() |
2 | Expression rf.buildCollectionRegion(REGION_NAME,cfg.getProperties(),null) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression rf.buildEntityRegion(REGION_NAME,cfg.getProperties(),null) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement setEntityRegionAccessStrategy(localEntityRegion.buildAccessStrategy(getAccessType())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement setEntityRegionAccessStrategy(localEntityRegion.buildAccessStrategy(getAccessType())); 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 |
6 | Unmatched statement setCollectionAccessStrategy(localCollectionRegion.buildAccessStrategy(getAccessType())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Unmatched statement setCollectionAccessStrategy(localCollectionRegion.buildAccessStrategy(getAccessType())); 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 |