use of org.apache.geode.internal.cache.xmlcache.RegionCreation in project geode by apache.
the class CacheXml66DUnitTest method testLOCAL_PERSISTENT_OVERFLOW.
@Test
public void testLOCAL_PERSISTENT_OVERFLOW() throws Exception {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation) cache.createRegion("cpolocal", "LOCAL_PERSISTENT_OVERFLOW");
testXml(cache);
GemFireCacheImpl c = (GemFireCacheImpl) getCache();
Region r = c.getRegion("cpolocal");
assertNotNull(r);
RegionAttributes ra = r.getAttributes();
assertEquals(DataPolicy.PERSISTENT_REPLICATE, ra.getDataPolicy());
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE, c.getResourceManager().getEvictionHeapPercentage(), 0);
}
use of org.apache.geode.internal.cache.xmlcache.RegionCreation in project geode by apache.
the class CacheXml66DUnitTest method testCustomEntryXml.
/**
* Test both customEntryIdleTime and customEntryTimeToLife
*/
@Test
public void testCustomEntryXml() throws Exception {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
attrs.setScope(Scope.DISTRIBUTED_NO_ACK);
RegionCreation root = (RegionCreation) cache.createRegion("root", attrs);
{
attrs = new RegionAttributesCreation(cache);
attrs.setScope(Scope.DISTRIBUTED_NO_ACK);
attrs.setInitialCapacity(142);
attrs.setLoadFactor(42.42f);
attrs.setStatisticsEnabled(true);
attrs.setCustomEntryIdleTimeout(new Expiry1());
attrs.setCustomEntryTimeToLive(new Expiry5());
root.createSubregion("one", attrs);
}
{
attrs = new RegionAttributesCreation(cache);
attrs.setScope(Scope.DISTRIBUTED_ACK);
attrs.setInitialCapacity(242);
attrs.setStatisticsEnabled(true);
attrs.setCustomEntryIdleTimeout(new Expiry2());
Region region = root.createSubregion("two", attrs);
{
attrs = new RegionAttributesCreation(cache);
attrs.setScope(Scope.DISTRIBUTED_ACK);
attrs.setLoadFactor(43.43f);
attrs.setStatisticsEnabled(true);
attrs.setCustomEntryIdleTimeout(new Expiry3());
attrs.setCustomEntryTimeToLive(new Expiry4());
region.createSubregion("three", attrs);
}
}
testXml(cache);
}
use of org.apache.geode.internal.cache.xmlcache.RegionCreation in project geode by apache.
the class CacheXml66DUnitTest method testPARTITION_REDUNDANT_PERSISTENT.
@Test
public void testPARTITION_REDUNDANT_PERSISTENT() throws Exception {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation) cache.createRegion("prpartition", "PARTITION_REDUNDANT_PERSISTENT");
testXml(cache);
GemFireCacheImpl c = (GemFireCacheImpl) getCache();
Region r = c.getRegion("prpartition");
assertNotNull(r);
RegionAttributes ra = r.getAttributes();
assertEquals(DataPolicy.PERSISTENT_PARTITION, ra.getDataPolicy());
assertNotNull(ra.getPartitionAttributes());
assertEquals(1, ra.getPartitionAttributes().getRedundantCopies());
}
use of org.apache.geode.internal.cache.xmlcache.RegionCreation in project geode by apache.
the class CacheXml66DUnitTest method testClientLOCAL_PERSISTENT.
@Test
public void testClientLOCAL_PERSISTENT() throws Exception {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation) cache.createRegion("cplocal", "LOCAL_PERSISTENT");
testXml(cache);
GemFireCacheImpl c = (GemFireCacheImpl) getCache();
assertEquals(true, c.isClient());
Region r = c.getRegion("cplocal");
assertNotNull(r);
RegionAttributes ra = r.getAttributes();
assertEquals(DataPolicy.PERSISTENT_REPLICATE, ra.getDataPolicy());
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals(null, ra.getPoolName());
}
use of org.apache.geode.internal.cache.xmlcache.RegionCreation in project geode by apache.
the class CacheXml66DUnitTest method testEntriesInRootRegion.
/**
* Tests creating a cache with entries defined in the root region
*/
@Test
public void testEntriesInRootRegion() throws Exception {
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);
}
Aggregations