1 | public class CollectionRegionImplTestCase extends AbstractEntityCollectionRegionTestCase {↵ | | 1 | public class EntityRegionImplTestCase extends AbstractEntityCollectionRegionTestCase {↵
|
| | | 2 | ↵
|
2 | /**↵ | | 3 | /**↵
|
3 | * Create a new EntityRegionImplTestCase.↵ | | 4 | * Create a new EntityRegionImplTestCase.↵
|
4 | * ↵ | | 5 | * ↵
|
5 | * @param name↵ | | 6 | * @param name↵
|
6 | */↵ | | 7 | */↵
|
7 | public CollectionRegionImplTestCase(String name) {↵ | | 8 | public EntityRegionImplTestCase(String name) {↵
|
8 | super(name);↵ | | 9 | super(name);↵
|
9 | }↵ | | 10 | } ↵
|
10 | ↵ | | 11 | ↵
|
11 | @Override↵ | | 12 | @Override↵
|
12 | protected void supportedAccessTypeTest(RegionFactory regionFactory, Properties properties) {↵ | | 13 | protected void supportedAccessTypeTest(RegionFactory regionFactory, Properties properties) {↵
|
13 | ↵ | | 14 | ↵
|
14 | CollectionRegion region = regionFactory.buildCollectionRegion("test", properties, null);↵ | | 15 | EntityRegion region = regionFactory.buildEntityRegion("test", properties, null);↵
|
15 | ↵ | | 16 | ↵
|
16 | assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());↵ | | 17 | assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());↵
|
17 | ↵ | | 18 | ↵
|
18 | try↵ | | 19 | try↵
|
19 | {↵ | | 20 | {↵
|
20 | region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();↵ | | 21 | region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();↵
|
21 | fail("Did not get READ_ONLY");↵ | | 22 | fail("Did not get READ_ONLY");↵
|
22 | }↵ | | 23 | }↵
|
23 | catch (UnsupportedOperationException good) {}↵ | | 24 | catch (UnsupportedOperationException good) {}↵
|
24 | ↵ | | 25 | ↵
|
25 | try↵ | | 26 | try↵
|
26 | {↵ | | 27 | {↵
|
27 | region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);↵ | | 28 | region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);↵
|
28 | fail("Incorrectly got NONSTRICT_READ_WRITE");↵ | | 29 | fail("Incorrectly got NONSTRICT_READ_WRITE");↵
|
29 | }↵ | | 30 | }↵
|
30 | catch (CacheException good) {}↵ | | 31 | catch (CacheException good) {}↵
|
31 | ↵ | | 32 | ↵
|
32 | try↵ | | 33 | try↵
|
33 | {↵ | | 34 | {↵
|
34 | region.buildAccessStrategy(AccessType.READ_WRITE);↵ | | 35 | region.buildAccessStrategy(AccessType.READ_WRITE);↵
|
35 | fail("Incorrectly got READ_WRITE");↵ | | 36 | fail("Incorrectly got READ_WRITE");↵
|
36 | }↵ | | 37 | }↵
|
37 | catch (CacheException good) {}↵ | | 38 | catch (CacheException good) {} ↵
|
| | | 39 | ↵
|
38 | }↵ | | 40 | }↵
|
|
39 | @Override↵ | | 41 | @Override↵
|
40 | protected Region createRegion(JBossCacheRegionFactory regionFactory, String regionName, Properties properties, CacheDataDescription cdd) {↵ | | 42 | protected Region createRegion(JBossCacheRegionFactory regionFactory, String regionName, Properties properties, CacheDataDescription cdd) {↵
|
41 | return regionFactory.buildCollectionRegion(regionName, properties, cdd);↵ | | 43 | return regionFactory.buildEntityRegion(regionName, properties, cdd);↵
|
42 | }↵ | | 44 | }↵
|
|
43 | @Override↵ | | 45 | @Override↵
|
44 | protected Cache getJBossCache(JBossCacheRegionFactory regionFactory) {↵ | | 46 | protected Cache getJBossCache(JBossCacheRegionFactory regionFactory) {↵
|
45 | CacheInstanceManager mgr = regionFactory.getCacheInstanceManager();↵ | | 47 | CacheInstanceManager mgr = regionFactory.getCacheInstanceManager();↵
|
46 | return mgr.getCollectionCacheInstance();↵ | | 48 | return mgr.getEntityCacheInstance();↵
|
47 | }↵ | | 49 | }↵
|
|
48 | @Override↵ | | 50 | @Override↵
|
49 | protected Fqn getRegionFqn(String regionName, String regionPrefix) {↵ | | 51 | protected Fqn getRegionFqn(String regionName, String regionPrefix) {↵
|
50 | return BasicRegionAdapter.getTypeLastRegionFqn(regionName, regionPrefix, CollectionRegionImpl.TYPE);↵ | | 52 | return BasicRegionAdapter.getTypeLastRegionFqn(regionName, regionPrefix, EntityRegionImpl.TYPE);↵
|
51 | }↵ | | 53 | }↵
|
|
52 | @Override↵ | | 54 | @Override↵
|
53 | protected void putInRegion(Region region, Object key, Object value) {↵ | | 55 | protected void putInRegion(Region region, Object key, Object value) {↵
|
54 | ((CollectionRegion) region).buildAccessStrategy(AccessType.TRANSACTIONAL).putFromLoad(key, value, System.currentTimeMillis(), new Integer(1));↵ | | 56 | ((EntityRegion) region).buildAccessStrategy(AccessType.TRANSACTIONAL).insert(key, value, new Integer(1));↵
|
55 | }↵ | | 57 | }↵
|
|
56 | @Override↵ | | 58 | @Override↵
|
57 | protected void removeFromRegion(Region region, Object key) {↵ | | 59 | protected void removeFromRegion(Region region, Object key) {↵
|
58 | ((CollectionRegion) region).buildAccessStrategy(AccessType.TRANSACTIONAL).remove(key) | | 60 | ((EntityRegion) region).buildAccessStrategy(AccessType.TRANSACTIONAL).remove(key)
|