/** * Tests that named region attributes are registered when the cache is * created. */ public void testRegisteringNamedRegionAttributes() { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs; String id1 = "id1"; attrs = new RegionAttributesCreation(cache); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setMirrorType(MirrorType.KEYS); cache.setRegionAttributes(id1, attrs); String id2 = "id2"; attrs = new RegionAttributesCreation(cache); attrs.setScope(Scope.DISTRIBUTED_NO_ACK); attrs.setMirrorType(MirrorType.KEYS_VALUES); attrs.setConcurrencyLevel(15); cache.setRegionAttributes(id2, attrs); String id3 = "id3"; attrs = new RegionAttributesCreation(cache); attrs.setScope(Scope.LOCAL); attrs.setValueConstraint(Integer.class); cache.setRegionAttributes(id3, attrs); testXml(cache); }
attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.REPLICATE); creation.createRegion(getUniqueName(), attrs);
attrs.setScope(Scope.DISTRIBUTED_NO_ACK); attrs.setScope(Scope.DISTRIBUTED_NO_ACK); attrs.setMirrorType(MirrorType.KEYS_VALUES); attrs.setInitialCapacity(142); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setMirrorType(MirrorType.KEYS); attrs.setInitialCapacity(242); attrs.setScope(Scope.GLOBAL); attrs.setLoadFactor(43.43f);
attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.REPLICATE); creation.createRegion(getUniqueName(), attrs);
/** * Tests a region with non-default region attributes */ public void testNonDefaultRegionAttributes() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setScope(Scope.DISTRIBUTED_NO_ACK); attrs.setMirrorType(MirrorType.KEYS_VALUES); attrs.setInitialCapacity(142); attrs.setLoadFactor(42.42f); attrs.setStatisticsEnabled(false); cache.createRegion("root", attrs); testXml(cache); }
/** * 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()); }
attrs.setScope(Scope.DISTRIBUTED_NO_ACK); attrs.setScope(Scope.DISTRIBUTED_NO_ACK); attrs.setInitialCapacity(142); attrs.setLoadFactor(42.42f); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setInitialCapacity(242); attrs.setStatisticsEnabled(true); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setLoadFactor(43.43f); attrs.setStatisticsEnabled(true);
attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.REPLICATE); attrs.setDiskStoreName(getUniqueName());
attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.REPLICATE); creation.createRegion(getUniqueName(), attrs);
attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); attrs.setDiskStoreName(getUniqueName()+1); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); attrs.setDiskStoreName(getUniqueName()+2); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); Region subwithdefaultdiskstore = root.createSubregion("subwithdefaultdiskstore", attrs);
attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.REPLICATE); creation.createRegion(getUniqueName(), attrs);
CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.REPLICATE); attrs.setConcurrencyChecksEnabled(true); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.EMPTY); attrs.setConcurrencyChecksEnabled(true); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setConcurrencyChecksEnabled(true); cache.createRegion("normal", attrs);
public void testRedefineOfDefaultDiskStore() throws CacheException { CacheCreation cache = new CacheCreation(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setAutoCompact(!DiskStoreFactory.DEFAULT_AUTO_COMPACT); DiskStore ds1 = dsf.create(DiskStoreFactory.DEFAULT_DISK_STORE_NAME); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); AttributesFactory factory = new AttributesFactory(attrs); RegionAttributes ra = factory.create(); RegionCreation root; try { root = (RegionCreation)cache.createRegion("root", ra); } catch (Exception ex) { fail("Unexpected exception", ex); } testXml(cache); Cache c = getCache(); assertNotNull(c); DiskStore ds2 = c.findDiskStore(DiskStoreFactory.DEFAULT_DISK_STORE_NAME); assertNotNull(ds2); assertEquals(ds1.getAutoCompact(), ds2.getAutoCompact()); }
attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); attrs.setDiskStoreName(getUniqueName());
RegionAttributesCreation attr = new RegionAttributesCreation(cc); if (regDef.getScope() != null) attr.setScope(regDef.getScope()); if (regDef.getMirroring() != null) attr.setMirrorType(regDef.getMirroring());
attrs.setScope(Scope.GLOBAL); attrs.setKeyConstraint(Integer.class); attrs.setCacheListener(new MyTestCacheListener()); attrs.setScope(Scope.LOCAL); attrs.setEarlyAck(true); attrs.setValueConstraint(String.class); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setEarlyAck(false); attrs.setValueConstraint(Long.class);
attrs.setScope(Scope.LOCAL); attrs.setEarlyAck(false); attrs.setMulticastEnabled(true); attrs = new RegionAttributesCreation(creation); attrs.setId(attrId); attrs.setScope(Scope.DISTRIBUTED_NO_ACK); attrs.setEarlyAck(false); attrs.setMulticastEnabled(true); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setEarlyAck(false); attrs.setMulticastEnabled(true);