use of org.apache.geode.internal.cache.GemFireCacheImpl in project geode by apache.
the class CacheXml66DUnitTest method testClientLOCAL_OVERFLOW.
@Test
public void testClientLOCAL_OVERFLOW() throws Exception {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation) cache.createRegion("localoverflow", "LOCAL_OVERFLOW");
testXml(cache);
GemFireCacheImpl c = (GemFireCacheImpl) getCache();
assertEquals(true, c.isClient());
Region r = c.getRegion("localoverflow");
assertNotNull(r);
RegionAttributes ra = r.getAttributes();
assertEquals(DataPolicy.NORMAL, ra.getDataPolicy());
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals(null, ra.getPoolName());
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.GemFireCacheImpl in project geode by apache.
the class CacheXml66DUnitTest method testPdxAttributes.
@Test
public void testPdxAttributes() throws Exception {
CacheCreation creation = new CacheCreation();
creation.setPdxPersistent(true);
creation.setPdxReadSerialized(true);
creation.setPdxIgnoreUnreadFields(true);
creation.setPdxDiskStore("my_disk_store");
TestPdxSerializer serializer = new TestPdxSerializer();
Properties props = new Properties();
props.setProperty("hello", "there");
serializer.init(props);
creation.setPdxSerializer(serializer);
testXml(creation);
Cache c = getCache();
assertTrue(c instanceof GemFireCacheImpl);
c.loadCacheXml(generate(creation));
assertEquals("my_disk_store", c.getPdxDiskStore());
assertEquals(serializer, c.getPdxSerializer());
assertEquals(true, c.getPdxPersistent());
assertEquals(true, c.getPdxReadSerialized());
assertEquals(true, c.getPdxIgnoreUnreadFields());
// test that we can override the cache.xml attributes
{
closeCache();
CacheFactory cf = new CacheFactory();
cf.setPdxDiskStore("new disk store");
c = getCache(cf);
assertTrue(c instanceof GemFireCacheImpl);
c.loadCacheXml(generate(creation));
assertEquals("new disk store", c.getPdxDiskStore());
assertEquals(serializer, c.getPdxSerializer());
assertEquals(true, c.getPdxPersistent());
assertEquals(true, c.getPdxReadSerialized());
assertEquals(true, c.getPdxIgnoreUnreadFields());
}
{
closeCache();
CacheFactory cf = new CacheFactory();
cf.setPdxPersistent(false);
cf.setPdxIgnoreUnreadFields(false);
c = getCache(cf);
assertTrue(c instanceof GemFireCacheImpl);
c.loadCacheXml(generate(creation));
assertEquals("my_disk_store", c.getPdxDiskStore());
assertEquals(serializer, c.getPdxSerializer());
assertEquals(false, c.getPdxPersistent());
assertEquals(true, c.getPdxReadSerialized());
assertEquals(false, c.getPdxIgnoreUnreadFields());
}
{
closeCache();
CacheFactory cf = new CacheFactory();
cf.setPdxSerializer(null);
c = getCache(cf);
assertTrue(c instanceof GemFireCacheImpl);
c.loadCacheXml(generate(creation));
assertEquals("my_disk_store", c.getPdxDiskStore());
assertEquals(null, c.getPdxSerializer());
assertEquals(true, c.getPdxPersistent());
assertEquals(true, c.getPdxReadSerialized());
assertEquals(true, c.getPdxIgnoreUnreadFields());
}
{
closeCache();
CacheFactory cf = new CacheFactory();
cf.setPdxReadSerialized(false);
c = getCache(cf);
assertTrue(c instanceof GemFireCacheImpl);
c.loadCacheXml(generate(creation));
assertEquals("my_disk_store", c.getPdxDiskStore());
assertEquals(serializer, c.getPdxSerializer());
assertEquals(true, c.getPdxPersistent());
assertEquals(false, c.getPdxReadSerialized());
assertEquals(true, c.getPdxIgnoreUnreadFields());
}
}
use of org.apache.geode.internal.cache.GemFireCacheImpl in project geode by apache.
the class CacheXml66DUnitTest method testClientLOCAL_PERSISTENT_OVERFLOW.
@Test
public void testClientLOCAL_PERSISTENT_OVERFLOW() throws Exception {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation) cache.createRegion("cpolocal", "LOCAL_PERSISTENT_OVERFLOW");
testXml(cache);
GemFireCacheImpl c = (GemFireCacheImpl) getCache();
assertEquals(true, c.isClient());
Region r = c.getRegion("cpolocal");
assertNotNull(r);
RegionAttributes ra = r.getAttributes();
assertEquals(DataPolicy.PERSISTENT_REPLICATE, ra.getDataPolicy());
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals(null, ra.getPoolName());
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.GemFireCacheImpl in project geode by apache.
the class CacheXml66DUnitTest method testLOCAL_OVERFLOW.
@Test
public void testLOCAL_OVERFLOW() throws Exception {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation) cache.createRegion("localoverflow", "LOCAL_OVERFLOW");
testXml(cache);
GemFireCacheImpl c = (GemFireCacheImpl) getCache();
Region r = c.getRegion("localoverflow");
assertNotNull(r);
RegionAttributes ra = r.getAttributes();
assertEquals(DataPolicy.NORMAL, 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.GemFireCacheImpl in project geode by apache.
the class CacheXml66DUnitTest method testREPLICATE_OVERFLOW.
@Test
public void testREPLICATE_OVERFLOW() throws Exception {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation) cache.createRegion("replicateoverflow", "REPLICATE_OVERFLOW");
testXml(cache);
GemFireCacheImpl c = (GemFireCacheImpl) getCache();
Region r = c.getRegion("replicateoverflow");
assertNotNull(r);
RegionAttributes ra = r.getAttributes();
assertEquals(DataPolicy.REPLICATE, ra.getDataPolicy());
assertEquals(Scope.DISTRIBUTED_ACK, ra.getScope());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE, c.getResourceManager().getEvictionHeapPercentage(), 0);
}
Aggregations