SGF-289 - Enumeration restrictions (xsd:enumeration) should be avoided in the XML schema.

Removed the XSD enumeration restriction on the 'type' attribute of the 'evictionType' XSD complex-type definition in the SDG XML namespace schema, which is used by the 'eviction' sub-elements in the LOCAL, PARTITION and REPLICATE Region element schema types.  In addition, created the ExpirationAttributesFactoryBean class in the org.springframework.data.gemfire package which serves as a Spring FactoryBean and builder for constructing GemFire EvictionAttributes used in Region configuration.  Updated tests to assert and validate the use of property placeholders on both the Eviction 'type' and Expiration 'action' attributes in the Spring Data GemFire XML namespace configuration meta-data.
This commit is contained in:
John Blum
2015-01-19 18:16:06 -08:00
parent 844c630614
commit 3f72ab8928
9 changed files with 278 additions and 54 deletions

View File

@@ -1,14 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
">
<util:properties id="evictionProperties">
<prop key="eviction.type">heap_percentage</prop>
</util:properties>
<context:property-placeholder properties-ref="evictionProperties"/>
<util:properties id="gemfireProperties">
<prop key="name">RegionEvictionAttributesNamespaceTest</prop>
<prop key="mcast-port">0</prop>
@@ -26,11 +34,11 @@
</gfe:partitioned-region>
<gfe:replicated-region id="Three">
<gfe:eviction type="HEAP_PERCENTAGE" action="OVERFLOW_TO_DISK"/>
<gfe:eviction type="${eviction.type}" action="OVERFLOW_TO_DISK"/>
</gfe:replicated-region>
<gfe:partitioned-region id="Four">
<gfe:eviction type="HEAP_PERCENTAGE" action="OVERFLOW_TO_DISK"/>
<gfe:eviction type="${eviction.type}" action="OVERFLOW_TO_DISK"/>
</gfe:partitioned-region>
<gfe:replicated-region id="Five">

View File

@@ -1,15 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
">
<util:properties id="expirationProperties">
<prop key="expiration.action">Destroy</prop>
</util:properties>
<context:property-placeholder properties-ref="expirationProperties"/>
<util:properties id="gemfireProperties">
<prop key="name">RegionExpirationAttributesNamespaceTest</prop>
<prop key="mcast-port">0</prop>
@@ -19,20 +27,20 @@
<gfe:cache properties-ref="gemfireProperties"/>
<gfe:replicated-region id="ReplicateExample" persistent="false">
<gfe:entry-ttl timeout="600" action="DESTROY"/>
<gfe:entry-ttl timeout="600" action="${expiration.action}"/>
<gfe:entry-tti timeout="300" action="INVALIDATE"/>
</gfe:replicated-region>
<!--
NOTE GemFire will switch the Region's DataPolicy when Entry Expiration Action settings
are "LOCAL_[DESTROY|INVAlIDATE]" based or the Eviction Action is "LOCAL_[DESTROY|INVALIDATE]".
are "LOCAL_[DESTROY|INVALIDATE]" based or the Eviction Action is "LOCAL_[DESTROY|INVALIDATE]".
-->
<gfe:replicated-region id="PreloadedExample" persistent="false">
<gfe:entry-ttl timeout="120" action="LOCAL_DESTROY"/>
</gfe:replicated-region>
<gfe:partitioned-region id="PartitionExample" persistent="false">
<gfe:entry-ttl timeout="300" action="DESTROY"/>
<gfe:entry-ttl timeout="300" action="${expiration.action}"/>
<gfe:custom-entry-tti>
<bean class="org.springframework.data.gemfire.config.RegionExpirationAttributesNamespaceTest$TestCustomExpiry"
p:name="PartitionCustomExpiry" p:timeout="120" p:action="#{T(com.gemstone.gemfire.cache.ExpirationAction).INVALIDATE}"/>