SGF-327 - Avoid setting null values with GemFire's Cache Region put(key, value) operation when GemFire is used as the caching provider in Spring's Cache Abstraction (@Cacheable).

This commit is contained in:
John Blum
2014-09-18 16:18:42 -07:00
parent 697afdbd64
commit acdd0c85bf
4 changed files with 240 additions and 7 deletions

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cache="http://www.springframework.org/schema/cache"
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/cache http://www.springframework.org/schema/cache/spring-cache.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="gemfireProperties">
<prop key="name">SpringGemFireCachingIntegrationTest</prop>
<prop key="mcast-port">0</prop>
<prop key="log-level">warning</prop>
</util:properties>
<gfe:cache properties-ref="gemfireProperties"/>
<gfe:region-template id="Template" initial-capacity="51" load-factor="0.75"/>
<cache:annotation-driven/>
<bean id="cacheManager" class="org.springframework.data.gemfire.support.GemfireCacheManager" p:cache-ref="gemfireCache"/>
<context:annotation-config/>
<util:map id="NamedNumbersMap" map-class="java.util.concurrent.ConcurrentHashMap"
key-type="java.lang.String" value-type="java.lang.Integer">
<entry key="zero" value="0"/>
<entry key="one" value="1"/>
<entry key="two" value="2"/>
<entry key="three" value="3"/>
<entry key="four" value="4"/>
<entry key="five" value="5"/>
<entry key="size" value="6"/>
<entry key="seven" value="7"/>
<entry key="eight" value="8"/>
<entry key="nine" value="9"/>
</util:map>
<bean id="namedNumbersRepo" class="org.springframework.data.gemfire.support.CachingWithGemFireIntegrationTest$NamedNumbersInMemoryRepository">
<property name="namedNumbers" ref="NamedNumbersMap"/>
</bean>
<bean id="namedNumbersService" class="org.springframework.data.gemfire.support.CachingWithGemFireIntegrationTest$NamedNumbersService">
<property name="namedNumbersRepo" ref="namedNumbersRepo"/>
</bean>
<beans profile="replica">
<gfe:replicated-region id="NamedNumbersRegion" persistent="false" key-constraint="java.lang.String"
value-constraint="java.lang.Integer" template="Template"/>
</beans>
<beans profile="partition">
<gfe:partitioned-region id="NamedNumbersRegion" persistent="false" key-constraint="java.lang.String"
value-constraint="java.lang.Integer" template="Template"/>
</beans>
<beans profile="local">
<gfe:partitioned-region id="NamedNumbersRegion" persistent="false" key-constraint="java.lang.String"
value-constraint="java.lang.Integer" template="Template"/>
</beans>
</beans>