Implements SGF-204 changing the default behavior or Region lookups.
This commit is contained in:
@@ -40,6 +40,8 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
private Boolean lookupEnabled = Boolean.TRUE;
|
||||
|
||||
private GemFireCache cache;
|
||||
|
||||
private Region<?, ?> parent;
|
||||
@@ -59,11 +61,13 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
|
||||
synchronized (cache) {
|
||||
//region = (getParent() != null ? getParent().getSubregion(regionName) : cache.getRegion(regionName));
|
||||
if (getParent() != null) {
|
||||
region = getParent().getSubregion(regionName);
|
||||
}
|
||||
else {
|
||||
region = cache.getRegion(regionName);
|
||||
if (isLookupEnabled()) {
|
||||
if (getParent() != null) {
|
||||
region = getParent().getSubregion(regionName);
|
||||
}
|
||||
else {
|
||||
region = cache.getRegion(regionName);
|
||||
}
|
||||
}
|
||||
|
||||
if (region != null) {
|
||||
@@ -166,6 +170,18 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
this.regionName = regionName;
|
||||
}
|
||||
|
||||
private boolean isLookupEnabled() {
|
||||
return Boolean.TRUE.equals(getLookupEnabled());
|
||||
}
|
||||
|
||||
public Boolean getLookupEnabled() {
|
||||
return lookupEnabled;
|
||||
}
|
||||
|
||||
public void setLookupEnabled(Boolean lookupEnabled) {
|
||||
this.lookupEnabled = lookupEnabled;
|
||||
}
|
||||
|
||||
protected Region<K, V> getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
@@ -75,8 +75,6 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
|
||||
private Interest<K>[] interests;
|
||||
|
||||
private Region<?, ?> parent;
|
||||
|
||||
private RegionAttributes<K, V> attributes;
|
||||
|
||||
private Resource snapshot;
|
||||
@@ -91,6 +89,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Region<K, V> lookupFallback(GemFireCache cache, String regionName) throws Exception {
|
||||
Assert.isTrue(cache instanceof ClientCache, String.format("Unable to create regions from %1$s", cache));
|
||||
|
||||
@@ -145,13 +144,13 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
factory.setDiskStoreName(diskStoreName);
|
||||
}
|
||||
|
||||
Region<K, V> clientRegion = (this.parent != null ? factory.createSubregion(parent, regionName)
|
||||
Region<K, V> clientRegion = (getParent() != null ? factory.createSubregion(getParent(), regionName)
|
||||
: factory.create(regionName));
|
||||
|
||||
if (log.isInfoEnabled()) {
|
||||
if (parent != null) {
|
||||
if (getParent() != null) {
|
||||
log.info(String.format("Created new Client Cache sub-Region [%1$s] under parent Region [%2$s].",
|
||||
regionName, parent.getName()));
|
||||
regionName, getParent().getName()));
|
||||
}
|
||||
else {
|
||||
log.info(String.format("Created new Client Cache Region [%1$s].", regionName));
|
||||
@@ -237,15 +236,13 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
* @see com.gemstone.gemfire.cache.DataPolicy
|
||||
*/
|
||||
protected void assertDataPolicyAndPersistentAttributeAreCompatible(final DataPolicy resolvedDataPolicy) {
|
||||
final boolean persistentNotSpecified = (this.persistent == null);
|
||||
|
||||
if (resolvedDataPolicy.withPersistence()) {
|
||||
Assert.isTrue(persistentNotSpecified || isPersistent(), String.format(
|
||||
Assert.isTrue(isPersistentUnspecified() || isPersistent(), String.format(
|
||||
"Data Policy '%1$s' is invalid when persistent is false.", resolvedDataPolicy));
|
||||
}
|
||||
else {
|
||||
// NOTE otherwise, the Data Policy is without persistence, so...
|
||||
Assert.isTrue(persistentNotSpecified || isNotPersistent(), String.format(
|
||||
Assert.isTrue(isPersistentUnspecified() || isNotPersistent(), String.format(
|
||||
"Data Policy '%1$s' is invalid when persistent is true.", resolvedDataPolicy));
|
||||
}
|
||||
}
|
||||
@@ -380,7 +377,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
/**
|
||||
* Sets the pool used by this client.
|
||||
*
|
||||
* @param pool
|
||||
* @param pool the GemFire client pool.
|
||||
*/
|
||||
public void setPool(Pool pool) {
|
||||
Assert.notNull(pool, "pool cannot be null");
|
||||
@@ -390,7 +387,7 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
/**
|
||||
* Sets the pool name used by this client.
|
||||
*
|
||||
* @param poolName
|
||||
* @param poolName a String specify the name of the GemFire client pool.
|
||||
*/
|
||||
public void setPoolName(String poolName) {
|
||||
Assert.hasText(poolName, "pool name is required");
|
||||
@@ -474,7 +471,8 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
|
||||
/**
|
||||
* Sets the name of disk store to use for overflow and persistence
|
||||
* @param diskStoreName
|
||||
* <p/>
|
||||
* @param diskStoreName a String specifying the 'name' of the client Region Disk Store.
|
||||
*/
|
||||
public void setDiskStoreName(String diskStoreName) {
|
||||
this.diskStoreName = diskStoreName;
|
||||
@@ -494,8 +492,8 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
setDataPolicy(resolvedDataPolicy);
|
||||
}
|
||||
|
||||
public void setParent(Region<?, ?> parent) {
|
||||
this.parent = parent;
|
||||
protected boolean isPersistentUnspecified() {
|
||||
return (persistent == null);
|
||||
}
|
||||
|
||||
protected boolean isPersistent() {
|
||||
|
||||
@@ -78,6 +78,7 @@ abstract class AbstractRegionParser extends AbstractSingleBeanDefinitionParser {
|
||||
}
|
||||
|
||||
ParsingUtils.setPropertyValue(element, builder, "name");
|
||||
ParsingUtils.setPropertyValue(element, builder, "ignore-if-exists", "lookupEnabled");
|
||||
ParsingUtils.setPropertyValue(element, builder, "data-policy");
|
||||
ParsingUtils.setPropertyValue(element, builder, "persistent");
|
||||
ParsingUtils.setPropertyValue(element, builder, "shortcut");
|
||||
|
||||
@@ -59,8 +59,9 @@ class ClientRegionParser extends AbstractRegionParser {
|
||||
ParsingUtils.setPropertyValue(element, builder, "destroy");
|
||||
}
|
||||
|
||||
ParsingUtils.setPropertyValue(element, builder, "data-policy", "dataPolicyName");
|
||||
ParsingUtils.setPropertyValue(element, builder, "name");
|
||||
ParsingUtils.setPropertyValue(element, builder, "data-policy", "dataPolicyName");
|
||||
ParsingUtils.setPropertyValue(element, builder, "ignore-if-exists", "lookupEnabled");
|
||||
ParsingUtils.setPropertyValue(element, builder, "persistent");
|
||||
ParsingUtils.setPropertyValue(element, builder, "pool-name");
|
||||
ParsingUtils.setPropertyValue(element, builder, "shortcut");
|
||||
|
||||
@@ -548,6 +548,29 @@ CustomExpiry Time to idle (or idle timeout) configuration for the region entries
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="ignore-if-exists" type="xsd:string" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the Region bean definition should perform a "lookup" first, using any existing Region already defined
|
||||
with the same name in the Cache (thus, reverting to pre-1.4.0 behavior, e.g. 1.3.x), before attempting to create
|
||||
the Region
|
||||
|
||||
The default is false, meaning the default behavior is always attempt to "create" the Region first.
|
||||
|
||||
Prior to 1.4.0, the default behavior was to perform a "lookup" first and then try to "create" the Region.
|
||||
This functionality is useful in situations where multiple Spring context configuration files exists and 1 or more
|
||||
define the same Region with the same semantics, such that the application dynamically loads configuration files,
|
||||
or creates new Spring contexts as needed and application components (e.g. application DAOs) have runtime dependencies
|
||||
on those Regions.
|
||||
|
||||
WARNING...
|
||||
|
||||
It is recommended that this feature be used carefully as the first bean definition to create the Region wins.
|
||||
So if there are multiple, conflicting bean definitions (with difference semantics for evictions/expiration, etc)
|
||||
for the "same" Region (by name), then this can cause confusion or have unexpected consequences for the application.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="persistent" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
|
||||
@@ -81,7 +81,6 @@ public class RegionFactoryBeanTest extends AbstractRegionFactoryBeanTest {
|
||||
@SuppressWarnings("rawtypes")
|
||||
private RegionFactoryBeanConfig defaultConfig() {
|
||||
return new RegionFactoryBeanConfig(new RegionFactoryBean(), "default") {
|
||||
|
||||
@Override
|
||||
public void verify() {
|
||||
Region region = regionFactoryBean.getRegion();
|
||||
@@ -92,13 +91,11 @@ public class RegionFactoryBeanTest extends AbstractRegionFactoryBeanTest {
|
||||
public void configureRegionFactoryBean() {
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private RegionFactoryBeanConfig persistentConfig() {
|
||||
return new RegionFactoryBeanConfig(new RegionFactoryBean(), "persistent") {
|
||||
|
||||
@Override
|
||||
public void verify() {
|
||||
Region region = regionFactoryBean.getRegion();
|
||||
@@ -115,7 +112,6 @@ public class RegionFactoryBeanTest extends AbstractRegionFactoryBeanTest {
|
||||
@SuppressWarnings({ "deprecation", "rawtypes" })
|
||||
private RegionFactoryBeanConfig invalidPersistentConfig() {
|
||||
return new RegionFactoryBeanConfig(new RegionFactoryBean(), "invalid-persistence") {
|
||||
|
||||
@Override
|
||||
public void configureRegionFactoryBean() {
|
||||
regionFactoryBean.setDataPolicy("persistent_replicate");
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
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;
|
||||
import com.gemstone.gemfire.cache.RegionExistsException;
|
||||
import com.gemstone.gemfire.cache.Scope;
|
||||
|
||||
/**
|
||||
* The RegionLookupIntegrationTests class is a test suite of test cases testing the lookup functionality for various
|
||||
* peer Region types.
|
||||
* <p/>
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.data.gemfire.fork.SpringCacheServerProcess
|
||||
* @see com.gemstone.gemfire.cache.Region
|
||||
* @since 1.4.0
|
||||
* @link https://jira.spring.io/browse/SGF-204
|
||||
*/
|
||||
public class RegionLookupIntegrationTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void preTestSuiteSetup() {
|
||||
ForkUtil.startCacheServer(SpringCacheServerProcess.class.getName() + " "
|
||||
+ "/org/springframework/data/gemfire/RegionLookupIntegrationTests-server-context.xml");
|
||||
}
|
||||
|
||||
protected void assertNoRegionLookup(final String configLocation) {
|
||||
ConfigurableApplicationContext applicationContext = null;
|
||||
|
||||
try {
|
||||
applicationContext = createApplicationContext(configLocation);
|
||||
fail("Spring ApplicationContext should have thrown a BeanCreationException caused by a RegionExistsException!");
|
||||
}
|
||||
catch (BeanCreationException expected) {
|
||||
//expected.printStackTrace(System.err);
|
||||
assertTrue(expected.getMessage(), expected.getCause() instanceof RegionExistsException);
|
||||
throw (RegionExistsException) expected.getCause();
|
||||
}
|
||||
finally {
|
||||
closeApplicationContext(applicationContext);
|
||||
}
|
||||
}
|
||||
|
||||
protected void closeApplicationContext(final ConfigurableApplicationContext applicationContext) {
|
||||
if (applicationContext != null) {
|
||||
applicationContext.close();
|
||||
}
|
||||
}
|
||||
|
||||
protected ConfigurableApplicationContext createApplicationContext(final String configLocation) {
|
||||
return new ClassPathXmlApplicationContext(configLocation);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllowRegionBeanDefinitionOverrides() {
|
||||
ConfigurableApplicationContext applicationContext = null;
|
||||
|
||||
try {
|
||||
applicationContext = createApplicationContext(
|
||||
"/org/springframework/data/gemfire/allowRegionBeanDefinitionOverridesTest.xml");
|
||||
|
||||
assertNotNull(applicationContext);
|
||||
assertTrue(applicationContext.containsBean("regionOne"));
|
||||
|
||||
Region appDataRegion = applicationContext.getBean("regionOne", Region.class);
|
||||
|
||||
assertNotNull(appDataRegion);
|
||||
assertEquals("AppDataRegion", appDataRegion.getName());
|
||||
assertEquals("/AppDataRegion", appDataRegion.getFullPath());
|
||||
assertNotNull(appDataRegion.getAttributes());
|
||||
assertEquals(DataPolicy.PERSISTENT_REPLICATE, appDataRegion.getAttributes().getDataPolicy());
|
||||
assertFalse(appDataRegion.getAttributes().getMulticastEnabled());
|
||||
assertEquals(Scope.DISTRIBUTED_ACK, appDataRegion.getAttributes().getScope());
|
||||
assertEquals(101, appDataRegion.getAttributes().getInitialCapacity());
|
||||
assertEquals(new Float(0.85f), new Float(appDataRegion.getAttributes().getLoadFactor()));
|
||||
assertTrue(appDataRegion.getAttributes().getCloningEnabled());
|
||||
assertTrue(appDataRegion.getAttributes().getConcurrencyChecksEnabled());
|
||||
assertEquals(Integer.class, appDataRegion.getAttributes().getKeyConstraint());
|
||||
assertEquals(String.class, appDataRegion.getAttributes().getValueConstraint());
|
||||
}
|
||||
finally {
|
||||
closeApplicationContext(applicationContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = RegionExistsException.class)
|
||||
public void testNoDuplicateRegionDefinitions() {
|
||||
assertNoRegionLookup("/org/springframework/data/gemfire/noDuplicateRegionDefinitionsTest.xml");
|
||||
}
|
||||
|
||||
@Test(expected = RegionExistsException.class)
|
||||
public void testNoClientRegionLookups() {
|
||||
assertNoRegionLookup("/org/springframework/data/gemfire/noClientRegionLookupTest.xml");
|
||||
}
|
||||
|
||||
@Test(expected = RegionExistsException.class)
|
||||
public void testNoClientSubRegionLookups() {
|
||||
assertNoRegionLookup("/org/springframework/data/gemfire/noClientSubRegionLookupTest.xml");
|
||||
}
|
||||
|
||||
@Test(expected = RegionExistsException.class)
|
||||
public void testNoLocalRegionLookups() {
|
||||
assertNoRegionLookup("/org/springframework/data/gemfire/noLocalRegionLookupTest.xml");
|
||||
}
|
||||
|
||||
@Test(expected = RegionExistsException.class)
|
||||
public void testNoPartitionRegionLookups() {
|
||||
assertNoRegionLookup("/org/springframework/data/gemfire/noPartitionRegionLookupTest.xml");
|
||||
}
|
||||
|
||||
@Test(expected = RegionExistsException.class)
|
||||
public void testNoReplicateRegionLookups() {
|
||||
assertNoRegionLookup("/org/springframework/data/gemfire/noReplicateRegionLookupTest.xml");
|
||||
}
|
||||
|
||||
@Test(expected = RegionExistsException.class)
|
||||
public void testNoSubRegionLookups() {
|
||||
assertNoRegionLookup("/org/springframework/data/gemfire/noSubRegionLookupTest.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnableRegionLookups() {
|
||||
ConfigurableApplicationContext applicationContext = null;
|
||||
|
||||
try {
|
||||
applicationContext = createApplicationContext("/org/springframework/data/gemfire/enableRegionLookupsTest.xml");
|
||||
|
||||
assertNotNull(applicationContext);
|
||||
assertTrue(applicationContext.containsBean("NativeLocalRegion"));
|
||||
assertTrue(applicationContext.containsBean("NativePartitionRegion"));
|
||||
assertTrue(applicationContext.containsBean("NativeReplicateRegion"));
|
||||
assertTrue(applicationContext.containsBean("NativeParentRegion"));
|
||||
assertTrue(applicationContext.containsBean("/NativeParentRegion/NativeChildRegion"));
|
||||
assertTrue(applicationContext.containsBean("SpringReplicateRegion"));
|
||||
|
||||
Region nativeLocalRegion = applicationContext.getBean("NativeLocalRegion", Region.class);
|
||||
|
||||
assertNotNull(nativeLocalRegion);
|
||||
assertEquals("NativeLocalRegion", nativeLocalRegion.getName());
|
||||
assertEquals("/NativeLocalRegion", nativeLocalRegion.getFullPath());
|
||||
assertNotNull(nativeLocalRegion.getAttributes());
|
||||
assertEquals(DataPolicy.NORMAL, nativeLocalRegion.getAttributes().getDataPolicy());
|
||||
assertFalse(nativeLocalRegion.getAttributes().getCloningEnabled());
|
||||
assertFalse(nativeLocalRegion.getAttributes().getConcurrencyChecksEnabled());
|
||||
assertEquals(80, nativeLocalRegion.getAttributes().getConcurrencyLevel());
|
||||
assertEquals(101, nativeLocalRegion.getAttributes().getInitialCapacity());
|
||||
assertEquals(Integer.class, nativeLocalRegion.getAttributes().getKeyConstraint());
|
||||
assertEquals(new Float(0.95f), new Float(nativeLocalRegion.getAttributes().getLoadFactor()));
|
||||
assertEquals(String.class, nativeLocalRegion.getAttributes().getValueConstraint());
|
||||
|
||||
Region nativePartitionRegion = applicationContext.getBean("NativePartitionRegion", Region.class);
|
||||
|
||||
assertNotNull(nativePartitionRegion);
|
||||
assertEquals("NativePartitionRegion", nativePartitionRegion.getName());
|
||||
assertEquals("/NativePartitionRegion", nativePartitionRegion.getFullPath());
|
||||
assertNotNull(nativePartitionRegion.getAttributes());
|
||||
assertEquals(DataPolicy.PERSISTENT_PARTITION, nativePartitionRegion.getAttributes().getDataPolicy());
|
||||
assertTrue(nativePartitionRegion.getAttributes().getCloningEnabled());
|
||||
assertTrue(nativePartitionRegion.getAttributes().getConcurrencyChecksEnabled());
|
||||
assertEquals(40, nativePartitionRegion.getAttributes().getConcurrencyLevel());
|
||||
assertEquals(51, nativePartitionRegion.getAttributes().getInitialCapacity());
|
||||
assertEquals(Integer.class, nativePartitionRegion.getAttributes().getKeyConstraint());
|
||||
assertEquals(new Float(0.85f), new Float(nativePartitionRegion.getAttributes().getLoadFactor()));
|
||||
assertFalse(nativePartitionRegion.getAttributes().getMulticastEnabled());
|
||||
assertEquals(String.class, nativePartitionRegion.getAttributes().getValueConstraint());
|
||||
|
||||
Region nativeReplicateRegion = applicationContext.getBean("NativeReplicateRegion", Region.class);
|
||||
|
||||
assertNotNull(nativeReplicateRegion);
|
||||
assertEquals("NativeReplicateRegion", nativeReplicateRegion.getName());
|
||||
assertEquals("/NativeReplicateRegion", nativeReplicateRegion.getFullPath());
|
||||
assertNotNull(nativeReplicateRegion.getAttributes());
|
||||
assertEquals(DataPolicy.PERSISTENT_REPLICATE, nativeReplicateRegion.getAttributes().getDataPolicy());
|
||||
assertFalse(nativeReplicateRegion.getAttributes().getCloningEnabled());
|
||||
assertTrue(nativeReplicateRegion.getAttributes().getConcurrencyChecksEnabled());
|
||||
assertEquals(23, nativeReplicateRegion.getAttributes().getInitialCapacity());
|
||||
assertEquals(new Float(0.75f), new Float(nativeReplicateRegion.getAttributes().getLoadFactor()));
|
||||
assertEquals(Integer.class, nativeReplicateRegion.getAttributes().getKeyConstraint());
|
||||
assertFalse(nativeReplicateRegion.getAttributes().getMulticastEnabled());
|
||||
assertEquals(Scope.DISTRIBUTED_NO_ACK, nativeReplicateRegion.getAttributes().getScope());
|
||||
assertEquals(String.class, nativeReplicateRegion.getAttributes().getValueConstraint());
|
||||
|
||||
Region nativeChildRegion = applicationContext.getBean("/NativeParentRegion/NativeChildRegion", Region.class);
|
||||
|
||||
assertNotNull(nativeChildRegion);
|
||||
assertEquals("NativeChildRegion", nativeChildRegion.getName());
|
||||
assertEquals("/NativeParentRegion/NativeChildRegion", nativeChildRegion.getFullPath());
|
||||
assertNotNull(nativeChildRegion.getAttributes());
|
||||
assertEquals(DataPolicy.REPLICATE, nativeChildRegion.getAttributes().getDataPolicy());
|
||||
|
||||
Region springReplicateRegion = applicationContext.getBean("SpringReplicateRegion", Region.class);
|
||||
|
||||
assertNotNull(springReplicateRegion);
|
||||
assertEquals("SpringReplicateRegion", springReplicateRegion.getName());
|
||||
assertEquals("/SpringReplicateRegion", springReplicateRegion.getFullPath());
|
||||
assertNotNull(springReplicateRegion.getAttributes());
|
||||
assertEquals(DataPolicy.REPLICATE, springReplicateRegion.getAttributes().getDataPolicy());
|
||||
}
|
||||
finally {
|
||||
closeApplicationContext(applicationContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnableClientRegionLookups() {
|
||||
ConfigurableApplicationContext applicationContext = null;
|
||||
|
||||
try {
|
||||
applicationContext = createApplicationContext("/org/springframework/data/gemfire/enableClientRegionLookupsTest.xml");
|
||||
|
||||
assertNotNull(applicationContext);
|
||||
assertTrue(applicationContext.containsBean("NativeClientRegion"));
|
||||
assertTrue(applicationContext.containsBean("NativeClientParentRegion"));
|
||||
assertTrue(applicationContext.containsBean("/NativeClientParentRegion/NativeClientChildRegion"));
|
||||
|
||||
Region nativeClientRegion = applicationContext.getBean("NativeClientRegion", Region.class);
|
||||
|
||||
assertNotNull(nativeClientRegion);
|
||||
assertEquals("NativeClientRegion", nativeClientRegion.getName());
|
||||
assertEquals("/NativeClientRegion", nativeClientRegion.getFullPath());
|
||||
assertNotNull(nativeClientRegion.getAttributes());
|
||||
assertFalse(nativeClientRegion.getAttributes().getCloningEnabled());
|
||||
assertEquals(DataPolicy.EMPTY, nativeClientRegion.getAttributes().getDataPolicy());
|
||||
|
||||
Region nativeClientChildRegion = applicationContext.getBean("/NativeClientParentRegion/NativeClientChildRegion",
|
||||
Region.class);
|
||||
|
||||
assertNotNull(nativeClientChildRegion);
|
||||
assertEquals("NativeClientChildRegion", nativeClientChildRegion.getName());
|
||||
assertEquals("/NativeClientParentRegion/NativeClientChildRegion", nativeClientChildRegion.getFullPath());
|
||||
assertNotNull(nativeClientChildRegion.getAttributes());
|
||||
assertEquals(DataPolicy.EMPTY, nativeClientChildRegion.getAttributes().getDataPolicy());
|
||||
}
|
||||
finally {
|
||||
closeApplicationContext(applicationContext);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,13 +21,13 @@ import static org.junit.Assert.assertSame;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.gemstone.gemfire.cache.GemFireCache;
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
* @author John Blum
|
||||
*/
|
||||
public class SubRegionTest extends RecreatingContextTest {
|
||||
@Override
|
||||
@@ -44,25 +44,41 @@ public class SubRegionTest extends RecreatingContextTest {
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private void testBasic() throws Exception {
|
||||
CacheFactoryBean cfb = new CacheFactoryBean();
|
||||
cfb.setBeanName("gemfireCache");
|
||||
cfb.setUseBeanFactoryLocator(false);
|
||||
GemFireCache cache = cfb.getObject();
|
||||
RegionFactoryBean rfb = new ReplicatedRegionFactoryBean();
|
||||
rfb.setCache(cache);
|
||||
rfb.setName("parent");
|
||||
rfb.afterPropertiesSet();
|
||||
Region parent = rfb.getObject();
|
||||
CacheFactoryBean cacheFactoryBean = new CacheFactoryBean();
|
||||
|
||||
SubRegionFactoryBean srfb = new SubRegionFactoryBean();
|
||||
srfb.setParent(parent);
|
||||
srfb.setName("/parent/child");
|
||||
srfb.setRegionName("child");
|
||||
srfb.afterPropertiesSet();
|
||||
Region child = srfb.getObject();
|
||||
cacheFactoryBean.setBeanName("gemfireCache");
|
||||
cacheFactoryBean.setUseBeanFactoryLocator(false);
|
||||
|
||||
assertNotNull(parent.getSubregion("child"));
|
||||
assertSame(child, parent.getSubregion("child"));
|
||||
Cache cache = cacheFactoryBean.getObject();
|
||||
|
||||
assertNotNull(cache);
|
||||
|
||||
RegionFactoryBean regionFactory = new ReplicatedRegionFactoryBean();
|
||||
|
||||
regionFactory.setCache(cache);
|
||||
regionFactory.setName("Outer");
|
||||
regionFactory.afterPropertiesSet();
|
||||
|
||||
Region outer = regionFactory.getObject();
|
||||
|
||||
assertNotNull(outer);
|
||||
assertEquals("Outer", outer.getName());
|
||||
assertEquals("/Outer", outer.getFullPath());
|
||||
assertSame(outer, cache.getRegion("/Outer"));
|
||||
|
||||
RegionFactoryBean subRegionFactory = new RegionFactoryBean();
|
||||
|
||||
subRegionFactory.setCache(cache);
|
||||
subRegionFactory.setParent(outer);
|
||||
subRegionFactory.setName("/Outer/Inner");
|
||||
subRegionFactory.setRegionName("Inner");
|
||||
subRegionFactory.afterPropertiesSet();
|
||||
|
||||
Region inner = subRegionFactory.getObject();
|
||||
|
||||
assertNotNull(inner);
|
||||
assertSame(inner, outer.getSubregion("Inner"));
|
||||
assertSame(inner, cache.getRegion("/Outer/Inner"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
||||
@@ -81,12 +81,14 @@ public class ClientRegionFactoryBeanTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testSetDataPolicyName() throws Exception {
|
||||
factoryBean.setDataPolicyName("NORMAL");
|
||||
assertEquals(DataPolicy.NORMAL, TestUtils.readField("dataPolicy", factoryBean));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testSetDataPolicyNameWithInvalidName() throws Exception {
|
||||
try {
|
||||
factoryBean.setDataPolicyName("INVALID");
|
||||
@@ -100,6 +102,17 @@ public class ClientRegionFactoryBeanTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsPersistentUnspecified() {
|
||||
assertTrue(factoryBean.isPersistentUnspecified());
|
||||
factoryBean.setPersistent(true);
|
||||
assertTrue(factoryBean.isPersistent());
|
||||
assertFalse(factoryBean.isPersistentUnspecified());
|
||||
factoryBean.setPersistent(false);
|
||||
assertTrue(factoryBean.isNotPersistent());
|
||||
assertFalse(factoryBean.isPersistentUnspecified());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsPersistent() {
|
||||
assertFalse(factoryBean.isPersistent());
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -28,30 +28,33 @@ import com.gemstone.gemfire.cache.Region;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
*/
|
||||
public class MultipleClientCacheTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void startUp() throws Exception {
|
||||
ForkUtil.startCacheServer(SpringCacheServerProcess.class.getName() + " "
|
||||
+ "/org/springframework/data/gemfire/client/datasource-server.xml");
|
||||
ForkUtil.startCacheServer(String.format("%1$s %2$s", SpringCacheServerProcess.class.getName(),
|
||||
"/org/springframework/data/gemfire/client/datasource-server.xml"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleCaches() {
|
||||
String resourcePath = "/org/springframework/data/gemfire/client/client-cache-no-close.xml";
|
||||
String configLocation = "/org/springframework/data/gemfire/client/client-cache-no-close.xml";
|
||||
|
||||
ConfigurableApplicationContext context1 = new ClassPathXmlApplicationContext(resourcePath);
|
||||
ConfigurableApplicationContext context2 = new ClassPathXmlApplicationContext(resourcePath);
|
||||
ConfigurableApplicationContext context1 = new ClassPathXmlApplicationContext(configLocation);
|
||||
ConfigurableApplicationContext context2 = new ClassPathXmlApplicationContext(configLocation);
|
||||
|
||||
Cache cache1 = context1.getBean(Cache.class);
|
||||
Cache cache2 = context2.getBean(Cache.class);
|
||||
|
||||
assertNotNull(cache1);
|
||||
assertSame(cache1, cache2);
|
||||
|
||||
Region region1 = context1.getBean(Region.class);
|
||||
Region region2 = context2.getBean(Region.class);
|
||||
|
||||
assertNotNull(region1);
|
||||
assertSame(region1, region2);
|
||||
assertFalse(cache1.isClosed());
|
||||
assertFalse(region1.isDestroyed());
|
||||
@@ -62,10 +65,4 @@ public class MultipleClientCacheTest {
|
||||
assertFalse("region was destroyed", region1.isDestroyed());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void cleanUp() throws InterruptedException {
|
||||
Thread.sleep(3000);
|
||||
ForkUtil.sendSignal();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
*/
|
||||
package org.springframework.data.gemfire.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -25,24 +25,35 @@ import com.gemstone.gemfire.cache.Region;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
*
|
||||
* @author John Blum
|
||||
*/
|
||||
|
||||
public class MultipleCacheTest {
|
||||
|
||||
@Test
|
||||
public void testMultipleCaches() {
|
||||
String resourcePath = "/org/springframework/data/gemfire/config/MultipleCacheTest-context.xml";
|
||||
|
||||
ConfigurableApplicationContext ctx1 = new ClassPathXmlApplicationContext(resourcePath);
|
||||
ConfigurableApplicationContext ctx2 = new ClassPathXmlApplicationContext(resourcePath);
|
||||
Region region1 = ctx1.getBean(Region.class);
|
||||
Cache cache1 = ctx1.getBean(Cache.class);
|
||||
Region region2 = ctx2.getBean(Region.class);
|
||||
Cache cache2 = ctx2.getBean(Cache.class);
|
||||
assertSame(region1,region2);
|
||||
assertSame(cache1,cache2);
|
||||
ctx1.close();
|
||||
String configLocation = "/org/springframework/data/gemfire/config/MultipleCacheTest-context.xml";
|
||||
|
||||
ConfigurableApplicationContext context1 = new ClassPathXmlApplicationContext(configLocation);
|
||||
ConfigurableApplicationContext context2 = new ClassPathXmlApplicationContext(configLocation);
|
||||
|
||||
Cache cache1 = context1.getBean(Cache.class);
|
||||
Cache cache2 = context2.getBean(Cache.class);
|
||||
|
||||
assertNotNull(cache1);
|
||||
assertSame(cache1, cache2);
|
||||
|
||||
Region region1 = context1.getBean(Region.class);
|
||||
Region region2 = context2.getBean(Region.class);
|
||||
|
||||
assertNotNull(region1);
|
||||
assertSame(region1, region2);
|
||||
assertFalse(cache1.isClosed());
|
||||
assertFalse("region was destroyed" ,region1.isDestroyed());
|
||||
assertFalse(region1.isDestroyed());
|
||||
|
||||
context1.close();
|
||||
|
||||
assertFalse(cache1.isClosed());
|
||||
assertFalse("region was destroyed", region1.isDestroyed());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
44
src/test/resources/cache-with-regions.xml
Normal file
44
src/test/resources/cache-with-regions.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE cache PUBLIC "-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN"
|
||||
"http://www.gemstone.com/dtd/cache7_0.dtd">
|
||||
<cache>
|
||||
<region name="NativeLocalRegion" refid="LOCAL">
|
||||
<region-attributes cloning-enabled="false"
|
||||
concurrency-checks-enabled="false"
|
||||
concurrency-level="80"
|
||||
initial-capacity="101"
|
||||
load-factor="0.95">
|
||||
<key-constraint>java.lang.Integer</key-constraint>
|
||||
<value-constraint>java.lang.String</value-constraint>
|
||||
</region-attributes>
|
||||
</region>
|
||||
<region name="NativePartitionRegion">
|
||||
<region-attributes data-policy="persistent-partition"
|
||||
cloning-enabled="true"
|
||||
concurrency-checks-enabled="true"
|
||||
concurrency-level="40"
|
||||
initial-capacity="51"
|
||||
load-factor="0.85"
|
||||
multicast-enabled="false">
|
||||
<key-constraint>java.lang.Integer</key-constraint>
|
||||
<value-constraint>java.lang.String</value-constraint>
|
||||
</region-attributes>
|
||||
</region>
|
||||
<region name="NativeReplicateRegion">
|
||||
<region-attributes data-policy="persistent-replicate"
|
||||
cloning-enabled="false"
|
||||
concurrency-checks-enabled="true"
|
||||
concurrency-level="20"
|
||||
initial-capacity="23"
|
||||
load-factor="0.75"
|
||||
multicast-enabled="false"
|
||||
scope="distributed-no-ack">
|
||||
<key-constraint>java.lang.Integer</key-constraint>
|
||||
<value-constraint>java.lang.String</value-constraint>
|
||||
</region-attributes>
|
||||
</region>
|
||||
<region name="NativeParentRegion" refid="REPLICATE">
|
||||
<region name="NativeChildRegion" refid="REPLICATE">
|
||||
</region>
|
||||
</region>
|
||||
</cache>
|
||||
14
src/test/resources/clientcache-with-regions.xml
Normal file
14
src/test/resources/clientcache-with-regions.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE client-cache PUBLIC "-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN"
|
||||
"http://www.gemstone.com/dtd/cache7_0.dtd">
|
||||
<client-cache>
|
||||
<pool name="DEFAULT" min-connections="0">
|
||||
<server host="localhost" port="54321"/>
|
||||
</pool>
|
||||
<region name="NativeClientRegion" refid="PROXY">
|
||||
<region-attributes cloning-enabled="false"/>
|
||||
</region>
|
||||
<region name="NativeClientParentRegion" refid="PROXY">
|
||||
<region name="NativeClientChildRegion" refid="PROXY"/>
|
||||
</region>
|
||||
</client-cache>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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-3.2.xsd
|
||||
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire-1.3.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
|
||||
">
|
||||
|
||||
<util:properties id="peerCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireRegionLookupsTestServer</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:cache properties-ref="peerCacheConfigurationSettings"/>
|
||||
|
||||
<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>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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-3.2.xsd
|
||||
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire-1.3.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
|
||||
">
|
||||
|
||||
<util:properties id="peerCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireRegionBeanDefinitionOverridesAllowedTest</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:cache properties-ref="peerCacheConfigurationSettings" use-bean-factory-locator="false"/>
|
||||
|
||||
<gfe:replicated-region id="regionOne" name="AppDataRegion" persistent="false"
|
||||
multicast-enabled="true" scope="distributed-no-ack"
|
||||
initial-capacity="51" load-factor="0.90"
|
||||
cloning-enabled="false" concurrency-checks-enabled="false"
|
||||
key-constraint="java.lang.String" value-constraint="java.lang.Integer"/>
|
||||
|
||||
<gfe:replicated-region id="regionOne" name="AppDataRegion" persistent="true"
|
||||
multicast-enabled="false" scope="distributed-ack"
|
||||
initial-capacity="101" load-factor="0.85"
|
||||
cloning-enabled="true" concurrency-checks-enabled="true"
|
||||
key-constraint="java.lang.Integer" value-constraint="java.lang.String"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,13 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:gfe="http://www.springframework.org/schema/gemfire"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
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
|
||||
">
|
||||
|
||||
<gfe:client-cache close="false" use-bean-factory-locator="false"/>
|
||||
<gfe:pool keep-alive="true">
|
||||
<gfe:server host="localhost" port="40404"/>
|
||||
</gfe:pool>
|
||||
<gfe:client-region id="r1" data-policy="EMPTY"/>
|
||||
|
||||
<gfe:client-cache close="false" use-bean-factory-locator="false"/>
|
||||
|
||||
<gfe:client-region id="r1" data-policy="EMPTY" ignore-if-exists="true"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
default-lazy-init="true"
|
||||
xmlns:gfe="http://www.springframework.org/schema/gemfire"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire-1.3.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
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
|
||||
">
|
||||
|
||||
<gfe:cache close="false" use-bean-factory-locator="false"/>
|
||||
|
||||
<gfe:replicated-region id="region" ignore-if-exists="true"/>
|
||||
|
||||
<gfe:cache use-bean-factory-locator="false" close="false"/>
|
||||
<gfe:replicated-region id="region"/>
|
||||
</beans>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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="clientCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireNoClientRegionLookupTest</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</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="clientCacheConfigurationSettings"/>
|
||||
|
||||
<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 name="NativeClientChildRegion" ignore-if-exists="true" shortcut="LOCAL"/>
|
||||
</gfe:client-region>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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="peerCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireEnableRegionLookupsTest</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:cache cache-xml-location="/cache-with-regions.xml" properties-ref="peerCacheConfigurationSettings"/>
|
||||
|
||||
<gfe:local-region id="NativeLocalRegion" ignore-if-exists="true"
|
||||
cloning-enabled="true"
|
||||
concurrency-checks-enabled="true"
|
||||
concurrency-level="5"
|
||||
initial-capacity="7"
|
||||
key-constraint="java.lang.String"
|
||||
load-factor="0.50"
|
||||
persistent="true"
|
||||
value-constraint="java.util.Date"/>
|
||||
|
||||
<gfe:partitioned-region id="NativePartitionRegion" ignore-if-exists="true"
|
||||
cloning-enabled="false"
|
||||
concurrency-checks-enabled="false"
|
||||
initial-capacity="11"
|
||||
key-constraint="java.lang.String"
|
||||
load-factor="0.50"
|
||||
multicast-enabled="true"
|
||||
persistent="false"
|
||||
value-constraint="java.util.Date"/>
|
||||
|
||||
<gfe:replicated-region id="NativeReplicateRegion" ignore-if-exists="true"
|
||||
cloning-enabled="true"
|
||||
concurrency-checks-enabled="false"
|
||||
concurrency-level="15"
|
||||
initial-capacity="21"
|
||||
key-constraint="java.lang.String"
|
||||
load-factor="0.25"
|
||||
multicast-enabled="true"
|
||||
persistent="false"
|
||||
scope="distributed-ack"
|
||||
value-constraint="java.util.Date"/>
|
||||
|
||||
<gfe:replicated-region id="NativeParentRegion" ignore-if-exists="true">
|
||||
<gfe:replicated-region name="NativeChildRegion" ignore-if-exists="true" persistent="true"/>
|
||||
</gfe:replicated-region>
|
||||
|
||||
<gfe:replicated-region id="regionOne" name="SpringReplicateRegion" persistent="false"/>
|
||||
|
||||
<gfe:replicated-region id="regionTwo" name="SpringReplicateRegion" ignore-if-exists="true" persistent="true"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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="clientCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireNoClientRegionLookupTest</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</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="clientCacheConfigurationSettings"/>
|
||||
|
||||
<gfe:client-region id="NativeClientRegion" persistent="false" shortcut="PROXY"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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="clientCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireNoClientSubRegionLookupTest</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</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="clientCacheConfigurationSettings"/>
|
||||
|
||||
<gfe:lookup-region id="NativeClientParentRegion">
|
||||
<gfe:client-region name="NativeClientChildRegion" persistent="false" shortcut="PROXY"/>
|
||||
</gfe:lookup-region>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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="peerCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireNoDuplicateRegionDefinitionsTest</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:cache properties-ref="peerCacheConfigurationSettings"/>
|
||||
|
||||
<gfe:replicated-region id="regionOne" name="AppDataRegion" persistent="false"/>
|
||||
|
||||
<gfe:replicated-region id="regionTwo" name="AppDataRegion" persistent="false"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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="peerCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireNoLocalRegionLookupTest</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:cache cache-xml-location="/cache-with-regions.xml" properties-ref="peerCacheConfigurationSettings"/>
|
||||
|
||||
<gfe:local-region id="NativeLocalRegion" persistent="false"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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="peerCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireNoPartitionRegionLookupTest</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:cache cache-xml-location="/cache-with-regions.xml" properties-ref="peerCacheConfigurationSettings"/>
|
||||
|
||||
<gfe:partitioned-region id="NativePartitionRegion" persistent="false"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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="peerCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireNoReplicateRegionLookupTest</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:cache cache-xml-location="/cache-with-regions.xml" properties-ref="peerCacheConfigurationSettings"/>
|
||||
|
||||
<gfe:replicated-region id="NativeReplicateRegion" persistent="false"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?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="peerCacheConfigurationSettings">
|
||||
<prop key="name">springGemFireNoSubRegionLookupTest</prop>
|
||||
<prop key="log-level">config</prop>
|
||||
<prop key="mcast-port">0</prop>
|
||||
</util:properties>
|
||||
|
||||
<gfe:cache cache-xml-location="/cache-with-regions.xml" properties-ref="peerCacheConfigurationSettings"/>
|
||||
|
||||
<gfe:lookup-region id="NativeParentRegion">
|
||||
<gfe:replicated-region name="NativeChildRegion" persistent="true"/>
|
||||
</gfe:lookup-region>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user