SGF-479 - Remove lazy initialization option for configuring a GemFire cache.
(cherry picked from commit b052f0ac8dadb5e5e676d7b7d363e94733992c0e) Signed-off-by: John Blum <jblum@pivotal.io>
This commit is contained in:
@@ -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;
|
||||
@@ -25,13 +27,13 @@ import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
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;
|
||||
@@ -123,7 +125,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);
|
||||
@@ -413,52 +414,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 @SuppressWarnings("unchecked") protected <T extends GemFireCache> T fetchCache() {
|
||||
assertSame(ClassLoader.getSystemClassLoader(), getBeanClassLoader());
|
||||
return (T) 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
|
||||
@@ -571,7 +542,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);
|
||||
@@ -600,7 +570,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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -48,6 +48,7 @@ public class SubRegionTest extends RecreatingContextTest {
|
||||
|
||||
cacheFactoryBean.setBeanName("gemfireCache");
|
||||
cacheFactoryBean.setUseBeanFactoryLocator(false);
|
||||
cacheFactoryBean.afterPropertiesSet();
|
||||
|
||||
GemFireCache cache = cacheFactoryBean.getObject();
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,7 +37,6 @@ 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.GemfireProfileValueSource;
|
||||
import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer;
|
||||
import org.springframework.test.annotation.IfProfileValue;
|
||||
import org.springframework.test.annotation.ProfileValueSourceConfiguration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -55,7 +54,7 @@ import com.gemstone.gemfire.cache.util.TimestampedEntryEvent;
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ProfileValueSourceConfiguration(GemfireProfileValueSource.class)
|
||||
@ContextConfiguration(locations = "cache-ns.xml", initializers = GemfireTestApplicationContextInitializer.class)
|
||||
@ContextConfiguration(locations = "cache-ns.xml")
|
||||
@SuppressWarnings("unused")
|
||||
public class CacheNamespaceTest{
|
||||
|
||||
|
||||
@@ -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")));
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -113,6 +113,7 @@ public class StubCache implements Cache, ClientCache {
|
||||
|
||||
public StubCache(){
|
||||
rootRegions = new HashMap<String, Region>();
|
||||
resourceManager = new StubResourceManager();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user