Search in sources :

Example 16 with RegionCreation

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());
}
Also used : RegionAttributes(org.apache.geode.cache.RegionAttributes) ClientCacheCreation(org.apache.geode.internal.cache.xmlcache.ClientCacheCreation) 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) RegionCreation(org.apache.geode.internal.cache.xmlcache.RegionCreation) Test(org.junit.Test)

Example 17 with RegionCreation

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);
}
Also used : RegionAttributesCreation(org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation) 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 18 with RegionCreation

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

the class CacheXml66DUnitTest method testLOCAL_PERSISTENT.

@Test
public void testLOCAL_PERSISTENT() throws Exception {
    CacheCreation cache = new CacheCreation();
    RegionCreation root = (RegionCreation) cache.createRegion("plocal", "LOCAL_PERSISTENT");
    testXml(cache);
    GemFireCacheImpl c = (GemFireCacheImpl) getCache();
    Region r = c.getRegion("plocal");
    assertNotNull(r);
    RegionAttributes ra = r.getAttributes();
    assertEquals(DataPolicy.PERSISTENT_REPLICATE, ra.getDataPolicy());
    assertEquals(Scope.LOCAL, ra.getScope());
}
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)

Example 19 with RegionCreation

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

the class LuceneIndexXmlParserJUnitTest method setUp.

@Before
public void setUp() {
    this.parser = new LuceneXmlParser();
    CacheCreation cache = Mockito.mock(CacheCreation.class);
    RegionCreation regionCreation = Mockito.mock(RegionCreation.class);
    RegionAttributesCreation rac = Mockito.mock(RegionAttributesCreation.class);
    Mockito.when(regionCreation.getFullPath()).thenReturn("/region");
    Mockito.when(regionCreation.getAttributes()).thenReturn(rac);
    Mockito.when(regionCreation.getExtensionPoint()).thenReturn(new SimpleExtensionPoint(this.rc, this.rc));
    this.rc = regionCreation;
    this.stack = new Stack<Object>();
    stack.push(cache);
    stack.push(rc);
    this.parser.setStack(stack);
}
Also used : SimpleExtensionPoint(org.apache.geode.internal.cache.extension.SimpleExtensionPoint) RegionAttributesCreation(org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) RegionCreation(org.apache.geode.internal.cache.xmlcache.RegionCreation) Before(org.junit.Before)

Example 20 with RegionCreation

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

the class LuceneXmlParser method startIndex.

private void startIndex(Attributes atts) {
    if (!(stack.peek() instanceof RegionCreation)) {
        throw new CacheXmlException("lucene <index> elements must occur within <region> elements");
    }
    final RegionCreation region = (RegionCreation) stack.peek();
    String name = atts.getValue(NAME);
    LuceneIndexCreation indexCreation = new LuceneIndexCreation();
    indexCreation.setName(name);
    indexCreation.setRegion(region);
    region.getExtensionPoint().addExtension(indexCreation);
    stack.push(indexCreation);
}
Also used : CacheXmlException(org.apache.geode.cache.CacheXmlException) RegionCreation(org.apache.geode.internal.cache.xmlcache.RegionCreation)

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