/** * Version-dependent support for generating dummy region attributes * from the the given cache and attributes factory. */ protected static RegionAttributes getDummyRegionAttributes( Cache dummyCache, RegionAttributes ratts) { return new RegionAttributesCreation((CacheCreation)dummyCache, ratts, false); } }
public void setRegionAttributes(String id, RegionAttributes attrs) { RegionAttributes a = attrs; if (!(a instanceof RegionAttributesCreation)) { a = new RegionAttributesCreation(this, a, false); } this.namedRegionAttributes.put(id, a); this.regionAttributesNames.add(id); }
public void setRegionAttributes(String id, RegionAttributes attrs) { RegionAttributes a = attrs; if (!(a instanceof RegionAttributesCreation)) { a = new RegionAttributesCreation(this, a, false); } this.namedRegionAttributes.put(id, a); this.regionAttributesNames.add(id); }
/** * Tests creating a cache whose keys are constrained */ public void testConstrainedKeys() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setKeyConstraint(String.class); cache.createRegion("root", attrs); testXml(cache); }
public void testNoConnectionPools() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setPoolName("mypool"); cache.createVMRegion("rootNORMAL", attrs); try { testXml(cache); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { } } public void testAlreadyExistingPool() throws CacheException {
/** * Tests a cache listener with no parameters */ public void testCacheListener() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); CacheListener listener = new MyTestCacheListener(); attrs.setCacheListener(listener); cache.createRegion("root", attrs); testXml(cache); }
/** * Tests the <code>overflowThreshold</code> and * <code>persistBackup</code> related attributes */ public void testOverflowAndBackup() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setMirrorType(MirrorType.KEYS_VALUES); attrs.setPersistBackup(true); cache.createRegion("root", attrs); testXml(cache); }
/** * Tests a cache writer with no parameters */ public void testCacheWriter() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); CacheWriter writer = new MyTestCacheWriter(); attrs.setCacheWriter(writer); cache.createRegion("root", attrs); testXml(cache); }
/** * Tests a cache loader an interesting combination of declarables */ public void testCacheLoaderWithDeclarables() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); CacheLoaderWithDeclarables loader = new CacheLoaderWithDeclarables(); attrs.setCacheLoader(loader); cache.createRegion("root", attrs); testXml(cache); }
/** * Tests creating a cache with entries defined in the root region */ public void testEntriesInRootRegion() throws CacheException { CacheCreation cache = new CacheCreation(); RegionCreation root = (RegionCreation) cache.createRegion("root", new RegionAttributesCreation(cache)); root.put("KEY1", "VALUE1"); root.put("KEY2", "VALUE2"); root.put("KEY3", "VALUE3"); testXml(cache); }
public void testCacheServerEnableTcpNoDelay() throws CacheException { CacheCreation cache = new CacheCreation(); CacheServer cs = cache.addCacheServer(); cs.setTcpNoDelay(true); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache); }
public void testCacheServerDisableTcpNoDelay() throws CacheException { CacheCreation cache = new CacheCreation(); CacheServer cs = cache.addCacheServer(); cs.setTcpNoDelay(false); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache); }
public void testEvictionLRUEntryAttributes() throws Exception { final String rName = getUniqueName(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(80, EvictionAction.LOCAL_DESTROY)); cache.createRegion(rName, attrs); testXml(cache); }
public void testEvictionLRUMemoryAttributes() throws Exception { final String rName = getUniqueName(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(10, new EvictionObjectSizer())); cache.createRegion(rName, attrs); testXml(cache); }
public void testEvictionLRUHeapAttributes() throws Exception { final String rName = getUniqueName(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEvictionAttributes(EvictionAttributes .createLRUHeapAttributes(new EvictionObjectSizer(), EvictionAction.LOCAL_DESTROY)); cache.createRegion(rName, attrs); testXml(cache); }
/** * Test EnableGateway region attribute * @since 4.2 */ public void testEnableGatewayAttribute() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEnableGateway(true); cache.createRegion("root", attrs); testXml(cache); assertEquals(true, cache.getRegion("root").getAttributes().getEnableGateway()); }
/** * Test EnableBridgeConflation region attribute * @since 4.2 */ public void testEnableBridgeConflationAttribute() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEnableBridgeConflation(true); cache.createRegion("root", attrs); testXml(cache); assertEquals(true, cache.getRegion("root").getAttributes().getEnableBridgeConflation()); }
/** * Test EnableSubscriptionConflation region attribute * @since 5.7 */ public void testEnableSubscriptionConflationAttribute() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEnableSubscriptionConflation(true); cache.createRegion("root", attrs); testXml(cache); assertEquals(true, cache.getRegion("root").getAttributes().getEnableSubscriptionConflation()); } }
/** * Test EnableAsyncConflation region attribute * @since 4.2 */ public void testEnableAsyncConflationAttribute() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setEnableAsyncConflation(true); cache.createRegion("root", attrs); testXml(cache); assertEquals(true, cache.getRegion("root").getAttributes().getEnableAsyncConflation()); } /**
/** * Tests the is-lock-grantor attribute in xml. */ public void testIsLockGrantorAttribute() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setLockGrantor(true); attrs.setScope(Scope.GLOBAL); attrs.setMirrorType(MirrorType.KEYS_VALUES); cache.createRegion("root", attrs); testXml(cache); assertEquals(true, cache.getRegion("root").getAttributes().isLockGrantor()); }