From 11101a3d7293bcfdaa53be015f6ddb86ca63b161 Mon Sep 17 00:00:00 2001 From: David Turanski Date: Tue, 6 Aug 2013 13:15:35 -0400 Subject: [PATCH] SGF-176 enhanced namespace schema and ClientCacheParser to process additional attributes --- .../gemfire/config/ClientRegionParser.java | 9 +- .../gemfire/config/spring-gemfire-1.3.xsd | 374 +++++++++--------- .../config/ClientRegionNamespaceTest.java | 21 +- .../data/gemfire/config/client-ns.xml | 10 +- 4 files changed, 203 insertions(+), 211 deletions(-) diff --git a/src/main/java/org/springframework/data/gemfire/config/ClientRegionParser.java b/src/main/java/org/springframework/data/gemfire/config/ClientRegionParser.java index 264632f9..620d2692 100644 --- a/src/main/java/org/springframework/data/gemfire/config/ClientRegionParser.java +++ b/src/main/java/org/springframework/data/gemfire/config/ClientRegionParser.java @@ -91,13 +91,18 @@ class ClientRegionParser extends AliasReplacingBeanDefinitionParser { boolean overwriteDataPolicy = false; overwriteDataPolicy |= ParsingUtils.parseEviction(parserContext, element, attrBuilder); - + ParsingUtils.parseStatistics(element, attrBuilder); + ParsingUtils.parseExpiration(parserContext, element, attrBuilder); + ParsingUtils.parseEviction(parserContext, element, attrBuilder); + ParsingUtils.parseOptionalRegionAttributes(parserContext, element, attrBuilder); + if (!frozenDataPolicy && overwriteDataPolicy) { builder.addPropertyValue("dataPolicy", DataPolicy.NORMAL); } - // add partition/overflow settings as attributes builder.addPropertyValue("attributes", attrBuilder.getBeanDefinition()); + + ManagedList interests = new ManagedList(); diff --git a/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.3.xsd b/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.3.xsd index d5c00893..20f6821a 100755 --- a/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.3.xsd +++ b/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.3.xsd @@ -486,70 +486,69 @@ use inner bean declarations. - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -586,6 +585,24 @@ Note this attribute only applies if a disk store is configured for this region. ]]> + + + + + + + + + + @@ -653,35 +670,7 @@ The fully qualified class name of the expected value type ]]> - - - - - - - - - - - - - - - - - - - - - + @@ -742,89 +731,100 @@ arbitrarily pick one. - + - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + - - + - + + + + + + + + + + + + - + - + @@ -956,14 +956,15 @@ up to date copy of the data. - + - + @@ -1131,7 +1132,7 @@ The name of the region definition. - + @@ -1218,14 +1219,15 @@ Specifies the number of buckets to allocate to the fixed partition - + - + @@ -1882,8 +1884,7 @@ The name of the pool definition (by default "gemfirePool").]]> - + - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + diff --git a/src/test/java/org/springframework/data/gemfire/config/ClientRegionNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/ClientRegionNamespaceTest.java index afbbd371..39f87ccd 100644 --- a/src/test/java/org/springframework/data/gemfire/config/ClientRegionNamespaceTest.java +++ b/src/test/java/org/springframework/data/gemfire/config/ClientRegionNamespaceTest.java @@ -93,7 +93,7 @@ public class ClientRegionNamespaceTest { assertEquals(DataPolicy.EMPTY, TestUtils.readField("dataPolicy", fb)); } - // @Test + @Test @SuppressWarnings("rawtypes") public void testComplexClient() throws Exception { assertTrue(context.containsBean("complex")); @@ -102,21 +102,10 @@ public class ClientRegionNamespaceTest { assertFalse(ObjectUtils.isEmpty(listeners)); assertEquals(2, listeners.length); assertSame(listeners[0], context.getBean("c-listener")); - Interest[] ints = TestUtils.readField("interests", fb); - assertEquals(2, ints.length); - - // key interest - Interest keyInt = ints[0]; - assertTrue((Boolean) TestUtils.readField("durable", keyInt)); - assertEquals(InterestResultPolicy.KEYS, TestUtils.readField("policy", keyInt)); - // assertEquals(Object.class, TestUtils.readField("key", - // keyInt).getClass()); - - // regex interest - RegexInterest regexInt = (RegexInterest) ints[1]; - assertFalse((Boolean) TestUtils.readField("durable", regexInt)); - assertEquals(InterestResultPolicy.KEYS_VALUES, TestUtils.readField("key", regexInt)); - assertEquals(".*", TestUtils.readField("key", regexInt)); + RegionAttributes attrs = TestUtils.readField("attributes", fb); + assertEquals(500, attrs.getEntryTimeToLive().getTimeout()); + assertEquals(0.5f,attrs.getLoadFactor(),0.001); + assertEquals(5, attrs.getEvictionAttributes().getMaximum()); } @SuppressWarnings("rawtypes") diff --git a/src/test/resources/org/springframework/data/gemfire/config/client-ns.xml b/src/test/resources/org/springframework/data/gemfire/config/client-ns.xml index 42ffc613..870dc8e5 100644 --- a/src/test/resources/org/springframework/data/gemfire/config/client-ns.xml +++ b/src/test/resources/org/springframework/data/gemfire/config/client-ns.xml @@ -11,19 +11,17 @@ - + - + - - - - + +