SGF-194 Rewrote Subregion parsing in AbstractRegionParser

This commit is contained in:
David Turanski
2013-10-01 08:45:08 -04:00
parent 283b3723eb
commit 651f89662c
6 changed files with 91 additions and 89 deletions

View File

@@ -47,12 +47,21 @@ public class SubRegionNamespaceTest {
@Autowired
private ApplicationContext context;
@SuppressWarnings("rawtypes")
@Test
public void testNestedRegionsCreated() {
Cache cache = context.getBean(Cache.class);
assertNotNull(cache.getRegion("parent"));
assertNotNull(cache.getRegion("/parent/child"));
assertNotNull(cache.getRegion("/parent/child/grandchild"));
}
@SuppressWarnings("rawtypes")
@Test
public void testNestedReplicatedRegions() {
Region parent = context.getBean("parent", Region.class);
Region parent = null;
parent = context.getBean("parent", Region.class);
Cache cache = context.getBean(Cache.class);
Region child = context.getBean("/parent/child", Region.class);
Region grandchild = context.getBean("/parent/child/grandchild", Region.class);
assertNotNull(child);
@@ -70,15 +79,13 @@ public class SubRegionNamespaceTest {
Cache cache = context.getBean(Cache.class);
Region parent = context.getBean("replicatedParent", Region.class);
parent.createSubregion("lookupChild", new AttributesFactory().create());
Region child = context.getBean("/replicatedParent/lookupChild", Region.class);
Region grandchild = context.getBean("/replicatedParent/lookupChild/partitionedGrandchild", Region.class);
Region child = context.getBean("/replicatedParent/replicatedChild", Region.class);
Region grandchild = context.getBean("/replicatedParent/replicatedChild/partitionedGrandchild", Region.class);
assertNotNull(child);
assertEquals("/replicatedParent/lookupChild", child.getFullPath());
assertSame(child, parent.getSubregion("lookupChild"));
assertEquals("/replicatedParent/replicatedChild", child.getFullPath());
assertEquals("/replicatedParent/lookupChild/partitionedGrandchild", grandchild.getFullPath());
assertEquals("/replicatedParent/replicatedChild/partitionedGrandchild", grandchild.getFullPath());
assertSame(grandchild, child.getSubregion("partitionedGrandchild"));
}

View File

@@ -6,22 +6,22 @@
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd" default-lazy-init="true">
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd" >
<gfe:cache />
<gfe:replicated-region id="parent">
<gfe:replicated-region name="child">
<gfe:replicated-region name="grandchild"/>
<gfe:replicated-region name="grandchild"/>
</gfe:replicated-region>
</gfe:replicated-region>
<gfe:replicated-region id="replicatedParent">
<gfe:lookup-region name="lookupChild">
<gfe:replicated-region name="replicatedChild">
<gfe:partitioned-region name="partitionedGrandchild"/>
</gfe:lookup-region>
</gfe:replicated-region>
</gfe:replicated-region>
<gfe:replicated-region id="parentWithSiblings">
<gfe:replicated-region name="child1">
<gfe:replicated-region name="grandChild11"/>
@@ -29,7 +29,7 @@
</gfe:replicated-region>
<gfe:replicated-region name="child2"/>
</gfe:replicated-region>
<gfe:replicated-region id="complexNested">
<gfe:cache-listener ref="c-listener"/>
<gfe:replicated-region name="child1">
@@ -42,9 +42,9 @@
<gfe:cache-writer ref="c-writer"/>
</gfe:replicated-region>
</gfe:replicated-region>
<bean id="c-listener" class="org.springframework.data.gemfire.SimpleCacheListener"/>
<bean id="c-loader" class="org.springframework.data.gemfire.SimpleCacheLoader"/>
<bean id="c-writer" class="org.springframework.data.gemfire.SimpleCacheWriter"/>
</beans>