From d540500f493fec8b7e474a7ebffe42beb23ddf54 Mon Sep 17 00:00:00 2001 From: John Blum Date: Mon, 7 Jul 2014 13:07:51 -0700 Subject: [PATCH] Fixes JIRA issue SGF-295 allowing all Eviction Policy Actions (LOCAL_DESTROY, OVERFLOW_TO_DISK) to be specified on Local Regions configured using the Spring Data GemFire XML namespace. This commit resolves the issue in the 1.4 XSD first in order to backport the fix to the SDG 1.4.2 release. --- .../gemfire/config/LocalRegionParser.java | 4 +- .../gemfire/config/spring-gemfire-1.4.xsd | 3 +- ...WithEvictionPolicyActionNamespaceTest.java | 97 +++++++++++++++++++ .../data/gemfire/test/MockRegionFactory.java | 2 +- ...ctionPolicyActionNamespaceTest-context.xml | 22 +++++ 5 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 src/test/java/org/springframework/data/gemfire/config/LocalRegionWithEvictionPolicyActionNamespaceTest.java create mode 100644 src/test/resources/org/springframework/data/gemfire/config/LocalRegionWithEvictionPolicyActionNamespaceTest-context.xml diff --git a/src/main/java/org/springframework/data/gemfire/config/LocalRegionParser.java b/src/main/java/org/springframework/data/gemfire/config/LocalRegionParser.java index e07b178b..4672475b 100644 --- a/src/main/java/org/springframework/data/gemfire/config/LocalRegionParser.java +++ b/src/main/java/org/springframework/data/gemfire/config/LocalRegionParser.java @@ -23,7 +23,7 @@ import org.springframework.data.gemfire.RegionAttributesFactoryBean; import org.w3c.dom.Element; /** - * Parser for <local-region;gt; bean definitions. + * Parser for <local-region> bean definitions. * * @author David Turanski * @author John Blum @@ -44,7 +44,7 @@ class LocalRegionParser extends AbstractRegionParser { BeanDefinitionBuilder regionAttributesBuilder = BeanDefinitionBuilder.genericBeanDefinition( RegionAttributesFactoryBean.class); - super.doParseCommonRegionConfiguration(element, parserContext, builder, regionAttributesBuilder, subRegion); + doParseCommonRegionConfiguration(element, parserContext, builder, regionAttributesBuilder, subRegion); builder.addPropertyValue("attributes", regionAttributesBuilder.getBeanDefinition()); } diff --git a/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.4.xsd b/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.4.xsd index 4853e9eb..e8129133 100644 --- a/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.4.xsd +++ b/src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.4.xsd @@ -1121,8 +1121,7 @@ Eviction policy for the replicated region. - + { } }); - when(region.getFullPath()).thenReturn(name); + when(region.getFullPath()).thenReturn(Region.SEPARATOR + name); when(region.getName()).thenReturn(name); when(region.getRegionService()).thenReturn(mockRegionService); diff --git a/src/test/resources/org/springframework/data/gemfire/config/LocalRegionWithEvictionPolicyActionNamespaceTest-context.xml b/src/test/resources/org/springframework/data/gemfire/config/LocalRegionWithEvictionPolicyActionNamespaceTest-context.xml new file mode 100644 index 00000000..3793725c --- /dev/null +++ b/src/test/resources/org/springframework/data/gemfire/config/LocalRegionWithEvictionPolicyActionNamespaceTest-context.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + +