Search in sources :

Example 36 with RegionCreation

use of org.apache.geode.internal.cache.xmlcache.RegionCreation in project geode by apache.

the class CacheXml66DUnitTest method testPARTITION_REDUNDANT_PERSISTENT_OVERFLOW.

@Test
public void testPARTITION_REDUNDANT_PERSISTENT_OVERFLOW() throws Exception {
    CacheCreation cache = new CacheCreation();
    ResourceManagerCreation rmc = new ResourceManagerCreation();
    // test bug 42130
    rmc.setEvictionHeapPercentage(0.0f);
    cache.setResourceManagerCreation(rmc);
    RegionCreation root = (RegionCreation) cache.createRegion("prpartitionoverflow", "PARTITION_REDUNDANT_PERSISTENT_OVERFLOW");
    testXml(cache);
    GemFireCacheImpl c = (GemFireCacheImpl) getCache();
    Region r = c.getRegion("prpartitionoverflow");
    assertNotNull(r);
    RegionAttributes ra = r.getAttributes();
    assertEquals(DataPolicy.PERSISTENT_PARTITION, ra.getDataPolicy());
    assertNotNull(ra.getPartitionAttributes());
    assertEquals(1, ra.getPartitionAttributes().getRedundantCopies());
    assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
    assertEquals(0.0f, c.getResourceManager().getEvictionHeapPercentage(), 0);
}
Also used : RegionAttributes(org.apache.geode.cache.RegionAttributes) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) LocalRegion(org.apache.geode.internal.cache.LocalRegion) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) DistributedRegion(org.apache.geode.internal.cache.DistributedRegion) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) ResourceManagerCreation(org.apache.geode.internal.cache.xmlcache.ResourceManagerCreation) RegionCreation(org.apache.geode.internal.cache.xmlcache.RegionCreation) Test(org.junit.Test)

Example 37 with RegionCreation

use of org.apache.geode.internal.cache.xmlcache.RegionCreation in project geode by apache.

the class CacheXml66DUnitTest method testPARTITION_OVERFLOW.

@Test
public void testPARTITION_OVERFLOW() throws Exception {
    CacheCreation cache = new CacheCreation();
    ResourceManagerCreation rmc = new ResourceManagerCreation();
    rmc.setEvictionHeapPercentage(55.0f);
    rmc.setCriticalHeapPercentage(80.0f);
    cache.setResourceManagerCreation(rmc);
    RegionCreation root = (RegionCreation) cache.createRegion("partitionoverflow", "PARTITION_OVERFLOW");
    testXml(cache);
    GemFireCacheImpl c = (GemFireCacheImpl) getCache();
    Region r = c.getRegion("partitionoverflow");
    assertNotNull(r);
    RegionAttributes ra = r.getAttributes();
    assertEquals(DataPolicy.PARTITION, ra.getDataPolicy());
    assertNotNull(ra.getPartitionAttributes());
    assertEquals(0, ra.getPartitionAttributes().getRedundantCopies());
    assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
    assertEquals(55.0f, c.getResourceManager().getEvictionHeapPercentage(), 0);
    assertEquals(80.0f, c.getResourceManager().getCriticalHeapPercentage(), 0);
}
Also used : RegionAttributes(org.apache.geode.cache.RegionAttributes) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) LocalRegion(org.apache.geode.internal.cache.LocalRegion) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) DistributedRegion(org.apache.geode.internal.cache.DistributedRegion) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) ResourceManagerCreation(org.apache.geode.internal.cache.xmlcache.ResourceManagerCreation) RegionCreation(org.apache.geode.internal.cache.xmlcache.RegionCreation) Test(org.junit.Test)

Example 38 with RegionCreation

use of org.apache.geode.internal.cache.xmlcache.RegionCreation in project geode by apache.

the class CacheXml66DUnitTest method testNestedRegions.

/**
   * Tests nested regions
   */
@Test
public void testNestedRegions() 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.setMirrorType(MirrorType.KEYS_VALUES);
        attrs.setInitialCapacity(142);
        attrs.setLoadFactor(42.42f);
        attrs.setStatisticsEnabled(false);
        root.createSubregion("one", attrs);
    }
    {
        attrs = new RegionAttributesCreation(cache);
        attrs.setScope(Scope.DISTRIBUTED_ACK);
        attrs.setMirrorType(MirrorType.KEYS);
        attrs.setInitialCapacity(242);
        Region region = root.createSubregion("two", attrs);
        {
            attrs = new RegionAttributesCreation(cache);
            attrs.setScope(Scope.GLOBAL);
            attrs.setLoadFactor(43.43f);
            region.createSubregion("three", attrs);
        }
    }
    testXml(cache);
}
Also used : RegionAttributesCreation(org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation) LocalRegion(org.apache.geode.internal.cache.LocalRegion) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) DistributedRegion(org.apache.geode.internal.cache.DistributedRegion) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) RegionCreation(org.apache.geode.internal.cache.xmlcache.RegionCreation) Test(org.junit.Test)

Example 39 with RegionCreation

use of org.apache.geode.internal.cache.xmlcache.RegionCreation in project geode by apache.

the class CacheXml66DUnitTest method testDiskWriteAttributes.

/**
   * Tests {@code DiskWriteAttributes}
   */
@Test
public void testDiskWriteAttributes() throws Exception {
    CacheCreation cache = new CacheCreation();
    // Set properties for Asynch writes
    RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
    RegionCreation root = (RegionCreation) cache.createRegion("root", attrs);
    {
        attrs = new RegionAttributesCreation(cache);
        DiskWriteAttributesFactory dwaf = new DiskWriteAttributesFactory();
        dwaf.setSynchronous(true);
        attrs.setDiskWriteAttributes(dwaf.create());
        root.createSubregion("sync", attrs);
    }
    {
        attrs = new RegionAttributesCreation(cache);
        DiskWriteAttributesFactory dwaf = new DiskWriteAttributesFactory();
        dwaf.setTimeInterval(123L);
        dwaf.setBytesThreshold(456L);
        attrs.setDiskWriteAttributes(dwaf.create());
        root.createSubregion("async", attrs);
    }
    testXml(cache);
}
Also used : RegionAttributesCreation(org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation) DiskWriteAttributesFactory(org.apache.geode.cache.DiskWriteAttributesFactory) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) RegionCreation(org.apache.geode.internal.cache.xmlcache.RegionCreation) Test(org.junit.Test)

Example 40 with RegionCreation

use of org.apache.geode.internal.cache.xmlcache.RegionCreation in project geode by apache.

the class CacheXml66DUnitTest method testPARTITION_PROXY.

@Test
public void testPARTITION_PROXY() throws Exception {
    CacheCreation cache = new CacheCreation();
    RegionCreation root = (RegionCreation) cache.createRegion("partitionProxy", "PARTITION_PROXY");
    testXml(cache);
    GemFireCacheImpl c = (GemFireCacheImpl) getCache();
    Region r = c.getRegion("partitionProxy");
    assertNotNull(r);
    RegionAttributes ra = r.getAttributes();
    assertEquals(DataPolicy.PARTITION, ra.getDataPolicy());
    assertNotNull(ra.getPartitionAttributes());
    assertEquals(0, ra.getPartitionAttributes().getRedundantCopies());
    assertEquals(0, ra.getPartitionAttributes().getLocalMaxMemory());
}
Also used : RegionAttributes(org.apache.geode.cache.RegionAttributes) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) LocalRegion(org.apache.geode.internal.cache.LocalRegion) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) DistributedRegion(org.apache.geode.internal.cache.DistributedRegion) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) RegionCreation(org.apache.geode.internal.cache.xmlcache.RegionCreation) Test(org.junit.Test)

Aggregations

RegionCreation (org.apache.geode.internal.cache.xmlcache.RegionCreation)47 Test (org.junit.Test)44 ClientCacheCreation (org.apache.geode.internal.cache.xmlcache.ClientCacheCreation)42 Region (org.apache.geode.cache.Region)35 RegionAttributes (org.apache.geode.cache.RegionAttributes)35 DistributedRegion (org.apache.geode.internal.cache.DistributedRegion)35 LocalRegion (org.apache.geode.internal.cache.LocalRegion)35 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)35 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)35 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)32 RegionAttributesCreation (org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation)11 DiskWriteAttributesFactory (org.apache.geode.cache.DiskWriteAttributesFactory)6 DiskStore (org.apache.geode.cache.DiskStore)4 DiskStoreFactory (org.apache.geode.cache.DiskStoreFactory)4 File (java.io.File)3 AttributesFactory (org.apache.geode.cache.AttributesFactory)3 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)3 ResourceManagerCreation (org.apache.geode.internal.cache.xmlcache.ResourceManagerCreation)3 HashMap (java.util.HashMap)2 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)2