SGF-479 - Remove lazy initialization option for configuring a GemFire cache.

This commit is contained in:
John Blum
2016-03-09 20:19:39 -08:00
parent 6bf5ceeaf6
commit b052f0ac8d
35 changed files with 145 additions and 261 deletions

View File

@@ -16,7 +16,9 @@
package org.springframework.data.gemfire;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -26,13 +28,13 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.same;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import java.io.InputStream;
@@ -124,7 +126,6 @@ public class CacheFactoryBeanTest {
cacheFactoryBean.setEvictionHeapPercentage(0.75f);
cacheFactoryBean.setGatewayConflictResolver(mockGatewayConflictResolver);
cacheFactoryBean.setJndiDataSources(null);
cacheFactoryBean.setLazyInitialize(false);
cacheFactoryBean.setLockLease(15000);
cacheFactoryBean.setLockTimeout(5000);
cacheFactoryBean.setMessageSyncInterval(20000);
@@ -420,52 +421,22 @@ public class CacheFactoryBeanTest {
}
@Test
@SuppressWarnings("unchecked")
public void getObject() throws Exception {
final ClassLoader expectedThreadContextClassLoader = Thread.currentThread().getContextClassLoader();
final Cache mockCache = mock(Cache.class, "GemFireCache");
DistributedMember mockDistributedMember = mock(DistributedMember.class, "GemFireDistributedMember");
DistributedSystem mockDistributedSystem = mock(DistributedSystem.class, "GemFireDistributedSystem");
when(mockCache.getDistributedSystem()).thenReturn(mockDistributedSystem);
when(mockDistributedSystem.getDistributedMember()).thenReturn(mockDistributedMember);
when(mockDistributedSystem.getName()).thenReturn("MockDistributedSystem");
when(mockDistributedMember.getId()).thenReturn("MockDistributedMember");
when(mockDistributedMember.getGroups()).thenReturn(Collections.<String>emptyList());
when(mockDistributedMember.getRoles()).thenReturn(Collections.<Role>emptySet());
when(mockDistributedMember.getHost()).thenReturn("skullbox");
when(mockDistributedMember.getProcessId()).thenReturn(67890);
final Cache mockCache = mock(Cache.class);
CacheFactoryBean cacheFactoryBean = new CacheFactoryBean() {
@Override protected GemFireCache fetchCache() {
assertSame(ClassLoader.getSystemClassLoader(), getBeanClassLoader());
return mockCache;
@Override public void afterPropertiesSet() throws Exception {
this.cache = mockCache;
}
};
cacheFactoryBean.setBeanClassLoader(ClassLoader.getSystemClassLoader());
cacheFactoryBean.setBeanName("MockGemFireCache");
cacheFactoryBean.setCopyOnRead(true);
cacheFactoryBean.setLockLease(15000);
cacheFactoryBean.setLockTimeout(5000);
cacheFactoryBean.setSearchTimeout(15000);
cacheFactoryBean.setUseBeanFactoryLocator(false);
assertThat(cacheFactoryBean.getObject(), is(nullValue()));
GemFireCache actualCache = cacheFactoryBean.getObject();
cacheFactoryBean.afterPropertiesSet();
assertSame(mockCache, actualCache);
assertSame(expectedThreadContextClassLoader, Thread.currentThread().getContextClassLoader());
assertThat(cacheFactoryBean.getObject(), is(equalTo(mockCache)));
verify(mockCache, never()).loadCacheXml(any(InputStream.class));
verify(mockCache, times(1)).setCopyOnRead(eq(true));
verify(mockCache, never()).setGatewayConflictResolver(any(GatewayConflictResolver.class));
verify(mockCache, times(1)).setLockLease(eq(15000));
verify(mockCache, times(1)).setLockTimeout(eq(5000));
verify(mockCache, never()).setMessageSyncInterval(anyInt());
verify(mockCache, times(1)).setSearchTimeout(eq(15000));
verify(mockCache, never()).getResourceManager();
verify(mockCache, never()).getCacheTransactionManager();
verifyZeroInteractions(mockCache);
}
@Test
@@ -578,7 +549,6 @@ public class CacheFactoryBeanTest {
cacheFactoryBean.setBeanName("TestCache");
cacheFactoryBean.setCacheXml(mockCacheXml);
cacheFactoryBean.setProperties(gemfireProperties);
cacheFactoryBean.setLazyInitialize(false);
cacheFactoryBean.setUseBeanFactoryLocator(false);
cacheFactoryBean.setClose(false);
cacheFactoryBean.setCopyOnRead(true);
@@ -607,7 +577,6 @@ public class CacheFactoryBeanTest {
assertEquals("TestCache", cacheFactoryBean.getBeanName());
assertSame(mockCacheXml, cacheFactoryBean.getCacheXml());
assertSame(gemfireProperties, cacheFactoryBean.getProperties());
assertFalse(cacheFactoryBean.isLazyInitialize());
assertTrue(Boolean.FALSE.equals(TestUtils.readField("useBeanFactoryLocator", cacheFactoryBean)));
assertTrue(Boolean.FALSE.equals(TestUtils.readField("close", cacheFactoryBean)));
assertTrue(cacheFactoryBean.getCopyOnRead());

View File

@@ -22,12 +22,10 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.gemfire.fork.SpringCacheServerProcess;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.Region;
@@ -48,13 +46,6 @@ import com.gemstone.gemfire.cache.Scope;
*/
public class RegionLookupIntegrationTests {
@BeforeClass
@SuppressWarnings("deprecation")
public static void testSuiteSetup() {
ForkUtil.startCacheServer(SpringCacheServerProcess.class.getName() + " "
+ "/org/springframework/data/gemfire/RegionLookupIntegrationTests-server-context.xml");
}
protected void assertNoRegionLookup(final String configLocation) {
ConfigurableApplicationContext applicationContext = null;
@@ -251,7 +242,7 @@ public class RegionLookupIntegrationTests {
assertEquals("/NativeClientRegion", nativeClientRegion.getFullPath());
assertNotNull(nativeClientRegion.getAttributes());
assertFalse(nativeClientRegion.getAttributes().getCloningEnabled());
assertEquals(DataPolicy.EMPTY, nativeClientRegion.getAttributes().getDataPolicy());
assertEquals(DataPolicy.NORMAL, nativeClientRegion.getAttributes().getDataPolicy());
Region nativeClientChildRegion = applicationContext.getBean("/NativeClientParentRegion/NativeClientChildRegion",
Region.class);
@@ -260,7 +251,7 @@ public class RegionLookupIntegrationTests {
assertEquals("NativeClientChildRegion", nativeClientChildRegion.getName());
assertEquals("/NativeClientParentRegion/NativeClientChildRegion", nativeClientChildRegion.getFullPath());
assertNotNull(nativeClientChildRegion.getAttributes());
assertEquals(DataPolicy.EMPTY, nativeClientChildRegion.getAttributes().getDataPolicy());
assertEquals(DataPolicy.NORMAL, nativeClientChildRegion.getAttributes().getDataPolicy());
}
finally {
closeApplicationContext(applicationContext);

View File

@@ -48,6 +48,7 @@ public class SubRegionTest extends RecreatingContextTest {
cacheFactoryBean.setBeanName("gemfireCache");
cacheFactoryBean.setUseBeanFactoryLocator(false);
cacheFactoryBean.afterPropertiesSet();
GemFireCache cache = cacheFactoryBean.getObject();

View File

@@ -16,12 +16,9 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.gemfire.ForkUtil;
import org.springframework.data.gemfire.fork.SpringCacheServerProcess;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.Region;
@@ -32,12 +29,6 @@ import com.gemstone.gemfire.cache.Region;
*/
public class MultipleClientCacheTest {
@BeforeClass
public static void startUp() throws Exception {
ForkUtil.startCacheServer(String.format("%1$s %2$s", SpringCacheServerProcess.class.getName(),
"/org/springframework/data/gemfire/client/datasource-server.xml"));
}
@Test
public void testMultipleCaches() {
String configLocation = "/org/springframework/data/gemfire/client/client-cache-no-close.xml";

View File

@@ -33,9 +33,8 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* The LazyInitializedClientCacheIntegrationTest class is a test suite of test cases testing the proper behavior a
* lazy initialized ClientCache by the SDG ClientCacheFactoryBean when the ClientCache instance is "looked up"
* in fetchCache() to ascertain whether the client is durable and readyForEvents needs to be signaled or not.
* The SpringJavaConfiguredClientCacheIntegrationTest class is a test suite of test cases testing
* the proper configuration of a GemFire ClientCache instance using Spring Java-based configuration meta-data.
*
* @author John Blum
* @see org.junit.Test
@@ -46,12 +45,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
* @see com.gemstone.gemfire.cache.client.ClientCache
* @link https://jira.spring.io/browse/SGF-441
* @since 1.0.0
* @since 1.8.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = LazyInitializedClientCacheIntegrationTest.GemFireConfiguration.class)
@ContextConfiguration(classes = SpringJavaConfiguredClientCacheIntegrationTest.GemFireConfiguration.class)
@SuppressWarnings("unused")
public class LazyInitializedClientCacheIntegrationTest {
public class SpringJavaConfiguredClientCacheIntegrationTest {
@Resource(name = "&clientCache")
private ClientCacheFactoryBean clientCacheFactoryBean;
@@ -63,7 +62,6 @@ public class LazyInitializedClientCacheIntegrationTest {
public void clientCacheFactoryBeanConfiguration() {
assertThat(clientCacheFactoryBean, is(notNullValue()));
assertThat(clientCacheFactoryBean.getBeanName(), is(equalTo("clientCache")));
assertThat(clientCacheFactoryBean.isLazyInitialize(), is(equalTo(true)));
assertThat(clientCacheFactoryBean.getProperties(), is(equalTo(gemfireProperties)));
}
@@ -73,7 +71,7 @@ public class LazyInitializedClientCacheIntegrationTest {
@Bean
public Properties gemfireProperties() {
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("name", LazyInitializedClientCacheIntegrationTest.class.getSimpleName());
gemfireProperties.setProperty("name", SpringJavaConfiguredClientCacheIntegrationTest.class.getSimpleName());
gemfireProperties.setProperty("mcast-port", "0");
gemfireProperties.setProperty("log-level", "warning");
return gemfireProperties;
@@ -84,7 +82,6 @@ public class LazyInitializedClientCacheIntegrationTest {
ClientCacheFactoryBean clientCacheFactoryBean = new ClientCacheFactoryBean();
clientCacheFactoryBean.setUseBeanFactoryLocator(false);
clientCacheFactoryBean.setProperties(gemfireProperties());
clientCacheFactoryBean.setLazyInitialize(true);
return clientCacheFactoryBean;
}
}

View File

@@ -1,46 +0,0 @@
/*
* Copyright 2010-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.gemfire.config;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.data.gemfire.CacheFactoryBean;
import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Costin Leau
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="/org/springframework/data/gemfire/config/cache-eager-init.xml",
initializers=GemfireTestApplicationContextInitializer.class)
public class CacheEagerInitTest{
@Autowired ApplicationContext ctx;
@Test
public void testEagerInit() throws Exception {
CacheFactoryBean cfb = (CacheFactoryBean) ctx.getBean("&gemfireCache");
cfb.afterPropertiesSet();
assertTrue(!cfb.isLazyInitialize());
}
}

View File

@@ -36,7 +36,6 @@ import org.springframework.data.gemfire.CacheFactoryBean;
import org.springframework.data.gemfire.GemfireBeanFactoryLocator;
import org.springframework.data.gemfire.TestUtils;
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.util.ReflectionTestUtils;
@@ -51,7 +50,7 @@ import com.gemstone.gemfire.cache.util.TimestampedEntryEvent;
* @author John Blum
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "cache-ns.xml", initializers = GemfireTestApplicationContextInitializer.class)
@ContextConfiguration(locations = "cache-ns.xml")
@SuppressWarnings("unused")
public class CacheNamespaceTest{

View File

@@ -28,7 +28,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.gemfire.TestUtils;
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -47,7 +46,7 @@ import com.gemstone.gemfire.pdx.PdxSerializer;
* @since 1.6.3
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(initializers = GemfireTestApplicationContextInitializer.class)
@ContextConfiguration
@SuppressWarnings("unused")
public class ClientCacheNamespaceTest {
@@ -62,9 +61,8 @@ public class ClientCacheNamespaceTest {
@Test
public void clientCacheFactoryBeanConfiguration() throws Exception {
assertThat(clientCacheFactoryBean.getCacheXml().toString(), containsString("path/to/bogus/cache.xml"));
assertThat(clientCacheFactoryBean.getCacheXml().toString(), containsString("empty-client-cache.xml"));
assertThat(clientCacheFactoryBean.getProperties(), is(equalTo(gemfireProperties)));
assertThat(clientCacheFactoryBean.isLazyInitialize(), is(true));
assertThat(clientCacheFactoryBean.getCopyOnRead(), is(true));
assertThat(clientCacheFactoryBean.getCriticalHeapPercentage(), is(equalTo(0.85f)));
assertThat(clientCacheFactoryBean.getDurableClientId(), is(equalTo("TestDurableClientId")));

View File

@@ -29,7 +29,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.data.gemfire.CacheFactoryBean;
import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -48,8 +47,7 @@ import com.gemstone.gemfire.internal.datasource.ConfigProperty;
* @since 1.4.0
* @since 7.0.1 (GemFire)
*/
@ContextConfiguration(locations = "jndi-binding-with-property-placeholders-ns.xml",
initializers = GemfireTestApplicationContextInitializer.class)
@ContextConfiguration(locations = "jndi-binding-with-property-placeholders-ns.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class JndiBindingsPropertyPlaceholderTest {
@@ -88,7 +86,7 @@ public class JndiBindingsPropertyPlaceholderTest {
assertNotNull(attributes);
assertFalse(attributes.isEmpty());
assertEquals("testDataSource", attributes.get("jndi-name"));
assertEquals("XAPoolDataSource", attributes.get("type"));
assertEquals("XAPooledDataSource", attributes.get("type"));
assertEquals("60", attributes.get("blocking-timeout-seconds"));
assertEquals("org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource", attributes.get("conn-pooled-datasource-class"));
assertEquals("jdbc:derby:testDataStore;create=true", attributes.get("connection-url"));

View File

@@ -10,6 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package org.springframework.data.gemfire.test;
import java.util.Properties;
@@ -34,7 +35,6 @@ public class MockCacheFactoryBean extends CacheFactoryBean {
this();
if (cacheFactoryBean != null) {
this.beanFactoryLocator = cacheFactoryBean.getBeanFactoryLocator();
this.lazyInitialize = cacheFactoryBean.isLazyInitialize();
this.beanClassLoader = cacheFactoryBean.getBeanClassLoader();
this.beanFactory = cacheFactoryBean.getBeanFactory();
this.beanName = cacheFactoryBean.getBeanName();
@@ -68,6 +68,7 @@ public class MockCacheFactoryBean extends CacheFactoryBean {
}
@Override
@SuppressWarnings("unchecked")
protected GemFireCache fetchCache() {
((StubCache) cache).setProperties(getProperties());
return cache;

View File

@@ -117,6 +117,7 @@ public class StubCache implements Cache, ClientCache {
public StubCache(){
allRegions = new HashMap<String,Region>();
gatewayHubs = new ArrayList<GatewayHub>();
resourceManager = new StubResourceManager();
}
/* (non-Javadoc)

View File

@@ -0,0 +1,68 @@
/*
* Copyright 2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.springframework.data.gemfire.test;
import java.util.Collections;
import java.util.Set;
import com.gemstone.gemfire.cache.control.RebalanceFactory;
import com.gemstone.gemfire.cache.control.RebalanceOperation;
import com.gemstone.gemfire.cache.control.ResourceManager;
/**
* The StubResourceManager class...
*
* @author John Blum
* @since 1.0.0
*/
public class StubResourceManager implements ResourceManager {
private float criticalHeapPercentage;
private float evictionHeapPercentage;
@Override
public void setCriticalHeapPercentage(final float heapPercentage) {
this.criticalHeapPercentage = heapPercentage;
}
@Override
public float getCriticalHeapPercentage() {
return criticalHeapPercentage;
}
@Override
public void setEvictionHeapPercentage(final float heapPercentage) {
this.evictionHeapPercentage = heapPercentage;
}
@Override
public float getEvictionHeapPercentage() {
return this.evictionHeapPercentage;
}
@Override
public RebalanceFactory createRebalanceFactory() {
throw new UnsupportedOperationException("Not Implemented");
}
@Override
public Set<RebalanceOperation> getRebalanceOperations() {
return Collections.emptySet();
}
}

View File

@@ -2,10 +2,10 @@
<!DOCTYPE client-cache PUBLIC "-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN"
"http://www.gemstone.com/dtd/cache7_0.dtd">
<client-cache>
<region name="NativeClientRegion" refid="PROXY">
<region name="NativeClientRegion" refid="LOCAL">
<region-attributes cloning-enabled="false"/>
</region>
<region name="NativeClientParentRegion" refid="PROXY">
<region name="NativeClientChildRegion" refid="PROXY"/>
<region name="NativeClientParentRegion" refid="LOCAL">
<region name="NativeClientChildRegion" refid="LOCAL"/>
</region>
</client-cache>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE cache PUBLIC "-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN"
"http://www.gemstone.com/dtd/cache8_0.dtd">
<cache>
</cache>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE client-cache PUBLIC "-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN"
"http://www.gemstone.com/dtd/cache8_0.dtd">
<client-cache>
</client-cache>

View File

@@ -27,8 +27,8 @@
<prop key="groups">HelloGroup</prop>
</util:properties>
<gfe:cache cache-xml-location="lazy-wiring-declarable-support-function-cache.xml"
properties-ref="gemfireProperties" lazy-init="false" use-bean-factory-locator="true"/>
<gfe:cache cache-xml-location="lazy-wiring-declarable-support-function-cache.xml" properties-ref="gemfireProperties"
use-bean-factory-locator="true"/>
<gfe-data:function-executions base-package="org.springframework.data.gemfire.function.sample">
<gfe-data:include-filter type="assignable" expression="org.springframework.data.gemfire.function.sample.HelloFunctionExecution"/>

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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/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">springGemFireRegionLookupsTestServer</prop>
<prop key="mcast-port">0</prop>
<prop key="log-level">warning</prop>
</util:properties>
<gfe:cache properties-ref="gemfireProperties"/>
<gfe:cache-server auto-startup="true" port="54321" max-connections="1"/>
<gfe:replicated-region id="NativeClientRegion" persistent="false"/>
<gfe:replicated-region id="NativeClientParentRegion" persistent="false">
<gfe:replicated-region name="NativeClientChildRegion" persistent="false"/>
</gfe:replicated-region>
</beans>

View File

@@ -16,6 +16,6 @@
</util:properties>
<gfe:cache properties-ref="gemfireProperties" use-bean-factory-locator="false"
enable-auto-reconnect="false" lazy-init="false"/>
enable-auto-reconnect="false"/>
</beans>

View File

@@ -16,6 +16,6 @@
</util:properties>
<gfe:cache properties-ref="gemfireProperties" use-bean-factory-locator="false"
enable-auto-reconnect="true" lazy-init="false"/>
enable-auto-reconnect="true"/>
</beans>

View File

@@ -16,8 +16,8 @@
<prop key="locators">localhost[20668]</prop>
</util:properties>
<gfe:cache properties-ref="gemfireProperties" use-bean-factory-locator="false"
use-cluster-configuration="true" cache-xml-location="/clusterconfig-cache.xml" lazy-init="false"/>
<gfe:cache cache-xml-location="/clusterconfig-cache.xml" properties-ref="gemfireProperties"
use-bean-factory-locator="false" use-cluster-configuration="true"/>
<gfe:lookup-region id="ClusterConfigRegion"/>

View File

@@ -16,8 +16,8 @@
<prop key="locators">localhost[20668]</prop>
</util:properties>
<gfe:cache properties-ref="gemfireProperties" use-bean-factory-locator="false"
use-cluster-configuration="false" cache-xml-location="/clusterconfig-cache.xml" lazy-init="false"/>
<gfe:cache cache-xml-location="/clusterconfig-cache.xml" properties-ref="gemfireProperties"
use-bean-factory-locator="false" use-cluster-configuration="false"/>
<!-- Should throw an Exception! -->
<gfe:lookup-region id="ClusterConfigRegion"/>

View File

@@ -21,10 +21,11 @@
<prop key="log-level">config</prop>
</util:properties>
<gfe:pool locators="${gemfire.cache.client.locator.host-and-port}"/>
<gfe:client-cache properties-ref="gemfireProperties" pool-name="locatorPool"/>
<gfe:client-cache properties-ref="gemfireProperties"/>
<gfe:pool id="locatorPool" locators="${gemfire.cache.client.locator.host-and-port}"/>
<gfe:client-region id="Example" shortcut="PROXY" key-constraint="java.lang.String" value-constraint="java.lang.Integer"/>
<gfe:client-region id="Example" pool-name="locatorPool" shortcut="PROXY"
key-constraint="java.lang.String" value-constraint="java.lang.Integer"/>
</beans>

View File

@@ -23,12 +23,13 @@
<prop key="log-level">warning</prop>
</util:properties>
<gfe:pool servers="${gemfire.cache.client.server.hosts-and-ports}">
<gfe:client-cache properties-ref="gemfireProperties" pool-name="serverPool"/>
<gfe:pool id="serverPool" servers="${gemfire.cache.client.server.hosts-and-ports}">
<gfe:server host="${gemfire.cache.client.server.host.3}" port="${gemfire.cache.client.server.port.3}"/>
</gfe:pool>
<gfe:client-cache properties-ref="gemfireProperties"/>
<gfe:client-region id="Example" shortcut="PROXY" key-constraint="java.lang.String" value-constraint="java.lang.Integer"/>
<gfe:client-region id="Example" pool-name="serverPool" shortcut="PROXY"
key-constraint="java.lang.String" value-constraint="java.lang.Integer"/>
</beans>

View File

@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
">
<gfe:pool keep-alive="true">
<gfe:server host="localhost" port="40404"/>
</gfe:pool>
<gfe:client-cache close="false" use-bean-factory-locator="false"/>
<util:properties id="gemfireProperties">
<prop key="log-level">warning</prop>
</util:properties>
<gfe:client-region id="r1" data-policy="EMPTY" ignore-if-exists="true"/>
<gfe:client-cache properties-ref="gemfireProperties" close="false"/>
<gfe:client-region id="r1" shortcut="LOCAL" ignore-if-exists="true"/>
</beans>

View File

@@ -9,6 +9,8 @@
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
">
<bean class="org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor"/>
<util:properties id="gemfireProperties">
<prop key="name">ClientCacheNamespaceTest</prop>
<prop key="mcast-port">0</prop>
@@ -21,7 +23,7 @@
<bean id="reflectionPdxSerializer" class="com.gemstone.gemfire.pdx.ReflectionBasedAutoSerializer"/>
<gfe:client-cache cache-xml-location="/path/to/bogus/cache.xml" properties-ref="gemfireProperties" lazy-init="true"
<gfe:client-cache cache-xml-location="empty-client-cache.xml" properties-ref="gemfireProperties"
durable-client-id="TestDurableClientId" durable-client-timeout="600"
copy-on-read="true" critical-heap-percentage="0.85" eviction-heap-percentage="0.65"
pdx-serializer-ref="reflectionPdxSerializer" pdx-ignore-unread-fields="true" pdx-persistent="false"

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
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/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">CacheEagerInitConfig</prop>
<prop key="mcast-port">0</prop>
<prop key="log-level">warning</prop>
</util:properties>
<gfe:cache properties-ref="gemfireProperties" lazy-init="false"/>
</beans>

View File

@@ -9,8 +9,7 @@
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">
<!-- all beans are lazy to allow the same config to be used between multiple tests -->
<!-- as there can be only one GemFire cache per VM -->
<bean class="org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor"/>
<util:properties id="gemfireProperties">
<prop key="disable-tcp">false</prop>

View File

@@ -19,7 +19,7 @@
<util:properties id="jndi-binding-settings">
<prop key="jndi.binding.name">testDataSource</prop>
<prop key="jndi.binding.type">XAPoolDataSource</prop>
<prop key="jndi.binding.type">XAPooledDataSource</prop>
<prop key="jndi.binding.blocking.timeout.seconds">60</prop>
<prop key="jndi.binding.conn.pooled.datasource.class">org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource</prop>
<prop key="jndi.binding.connection.url">jdbc:derby:testDataStore;create=true</prop>
@@ -42,7 +42,7 @@
<context:property-placeholder properties-ref="jndi-binding-settings"/>
<gfe:cache properties-ref="gemfireProperties" lazy-init="true">
<gfe:cache properties-ref="gemfireProperties">
<gfe:jndi-binding jndi-name="${jndi.binding.name}"
type="${jndi.binding.type}"
blocking-timeout-seconds="${jndi.binding.blocking.timeout.seconds}"

View File

@@ -10,23 +10,14 @@
">
<util:properties id="gemfireProperties">
<prop key="name">springGemFireNoClientRegionLookupTest</prop>
<prop key="mcast-port">0</prop>
<prop key="log-level">warning</prop>
</util:properties>
<gfe:pool min-connections="1" max-connections="1">
<gfe:server host="localhost" port="54321"/>
</gfe:pool>
<gfe:client-cache cache-xml-location="/clientcache-with-regions.xml" properties-ref="gemfireProperties"/>
<gfe:client-region id="NativeClientRegion" ignore-if-exists="true"
cloning-enabled="true"
persistent="false"
shortcut="LOCAL"/>
<gfe:client-region id="NativeClientRegion" ignore-if-exists="true" cloning-enabled="true" persistent="false" shortcut="LOCAL"/>
<gfe:client-region id="NativeClientParentRegion" ignore-if-exists="true">
<gfe:client-region id="NativeClientParentRegion" ignore-if-exists="true" shortcut="LOCAL">
<gfe:client-region name="NativeClientChildRegion" ignore-if-exists="true" shortcut="LOCAL"/>
</gfe:client-region>

View File

@@ -25,7 +25,7 @@
<prop key="log-level">warning</prop>
</util:properties>
<gfe:cache properties-ref="gemfireProperties" lazy-init="false"/>
<gfe:cache properties-ref="gemfireProperties"/>
<gfe:cache-server auto-startup="true" bind-address="${server.bind-address}" port="${server.port}"
host-name-for-clients="${server.hostname-for-clients}" max-connections="${server.max-connections}"/>

View File

@@ -10,17 +10,11 @@
">
<util:properties id="gemfireProperties">
<prop key="name">springGemFireNoClientRegionLookupTest</prop>
<prop key="mcast-port">0</prop>
<prop key="log-level">warning</prop>
</util:properties>
<gfe:pool min-connections="1" max-connections="1">
<gfe:server host="localhost" port="54321"/>
</gfe:pool>
<gfe:client-cache cache-xml-location="/clientcache-with-regions.xml" properties-ref="gemfireProperties"/>
<gfe:client-region id="NativeClientRegion" persistent="false" shortcut="PROXY"/>
<gfe:client-region id="NativeClientRegion" shortcut="LOCAL"/>
</beans>

View File

@@ -10,19 +10,13 @@
">
<util:properties id="gemfireProperties">
<prop key="name">springGemFireNoClientSubRegionLookupTest</prop>
<prop key="mcast-port">0</prop>
<prop key="log-level">warning</prop>
</util:properties>
<gfe:pool min-connections="1" max-connections="1">
<gfe:server host="localhost" port="54321"/>
</gfe:pool>
<gfe:client-cache cache-xml-location="/clientcache-with-regions.xml" properties-ref="gemfireProperties"/>
<gfe:lookup-region id="NativeClientParentRegion">
<gfe:client-region name="NativeClientChildRegion" persistent="false" shortcut="PROXY"/>
<gfe:client-region name="NativeClientChildRegion" shortcut="LOCAL"/>
</gfe:lookup-region>
</beans>