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);
}
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());
}
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);
}
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);
}
Aggregations