diff --git a/src/main/java/org/springframework/data/gemfire/GemfireCacheUtils.java b/src/main/java/org/springframework/data/gemfire/GemfireCacheUtils.java
index 35ac0941..7dd143de 100644
--- a/src/main/java/org/springframework/data/gemfire/GemfireCacheUtils.java
+++ b/src/main/java/org/springframework/data/gemfire/GemfireCacheUtils.java
@@ -43,9 +43,6 @@ import com.gemstone.gemfire.NoSystemException;
import com.gemstone.gemfire.SystemConnectException;
import com.gemstone.gemfire.SystemIsRunningException;
import com.gemstone.gemfire.UnmodifiableException;
-import com.gemstone.gemfire.admin.AdminException;
-import com.gemstone.gemfire.admin.RegionNotFoundException;
-import com.gemstone.gemfire.admin.RuntimeAdminException;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.CacheExistsException;
import com.gemstone.gemfire.cache.CacheLoaderException;
@@ -58,7 +55,6 @@ import com.gemstone.gemfire.cache.DiskAccessException;
import com.gemstone.gemfire.cache.EntryDestroyedException;
import com.gemstone.gemfire.cache.EntryExistsException;
import com.gemstone.gemfire.cache.EntryNotFoundException;
-import com.gemstone.gemfire.cache.EntryNotFoundInRegion;
import com.gemstone.gemfire.cache.FailedSynchronizationException;
import com.gemstone.gemfire.cache.OperationAbortedException;
import com.gemstone.gemfire.cache.PartitionedRegionDistributionException;
@@ -90,18 +86,18 @@ public abstract class GemfireCacheUtils {
private static Class> CQ_EXCEPTION_CLASS;
- {
- Class> clz = null;
+ static {
+ Class> type = null;
try {
+ type = ClassUtils.resolveClassName("com.gemstone.gemfire.cache.query.CqInvalidException",
+ GemfireCacheUtils.class.getClassLoader());
- clz = ClassUtils.resolveClassName("com.gemstone.gemfire.cache.query.CqInvalidException",
- GemfireCacheUtils.class.getClassLoader());
-
- } catch (IllegalArgumentException iae) {
+ }
+ catch (IllegalArgumentException ignore) {
}
- CQ_EXCEPTION_CLASS = clz;
+ CQ_EXCEPTION_CLASS = type;
}
@@ -112,6 +108,7 @@ public abstract class GemfireCacheUtils {
* @param ex Gemfire unchecked exception
* @return new the corresponding DataAccessException instance
*/
+ @SuppressWarnings("deprecation")
public static DataAccessException convertGemfireAccessException(GemFireException ex) {
if (ex instanceof CacheException) {
if (ex instanceof CacheExistsException) {
@@ -179,7 +176,7 @@ public abstract class GemfireCacheUtils {
if (ex instanceof RegionDestroyedException) {
return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
}
- if (ex instanceof RegionNotFoundException) {
+ if (ex instanceof com.gemstone.gemfire.admin.RegionNotFoundException) {
return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
}
if (ex instanceof ResourceException) {
@@ -198,7 +195,7 @@ public abstract class GemfireCacheUtils {
if (ex instanceof CopyException) {
return new GemfireSystemException(ex);
}
- if (ex instanceof EntryNotFoundInRegion) {
+ if (ex instanceof com.gemstone.gemfire.cache.EntryNotFoundInRegion) {
return new DataRetrievalFailureException(ex.getMessage(), ex);
}
if (ex instanceof FunctionException) {
@@ -234,7 +231,7 @@ public abstract class GemfireCacheUtils {
if (ex instanceof NoSystemException) {
return new GemfireSystemException(ex);
}
- if (ex instanceof RuntimeAdminException) {
+ if (ex instanceof com.gemstone.gemfire.admin.RuntimeAdminException) {
return new GemfireSystemException(ex);
}
if (ex instanceof ServerConnectivityException) {
@@ -263,9 +260,6 @@ public abstract class GemfireCacheUtils {
* Dedicated method for converting exceptions changed in 6.5 that had their
* parent changed. This method exists to 'fool' the compiler type checks
* by loosening the type so the code compiles on both 6.5 (pre and current) branches.
- *
- * @param ex
- * @return
*/
static DataAccessException convertQueryExceptions(RuntimeException ex) {
if (ex instanceof IndexInvalidException) {
@@ -290,6 +284,7 @@ public abstract class GemfireCacheUtils {
* @param ex Gemfire unchecked exception
* @return new the corresponding DataAccessException instance
*/
+ @SuppressWarnings("deprecation")
public static DataAccessException convertGemfireAccessException(GemFireCheckedException ex) {
// query exceptions
if (ex instanceof QueryException) {
@@ -304,7 +299,7 @@ public abstract class GemfireCacheUtils {
return new DataAccessResourceFailureException(ex.getMessage(), ex);
}
// admin exception
- if (ex instanceof AdminException) {
+ if (ex instanceof com.gemstone.gemfire.admin.AdminException) {
return new GemfireSystemException(ex);
}
// fall back
@@ -337,9 +332,6 @@ public abstract class GemfireCacheUtils {
/**
* Package protected method for detecting CqInvalidException which has been removed in GemFire 6.5 GA.
- *
- * @param ex
- * @return
*/
static boolean isCqInvalidException(RuntimeException ex) {
return (CQ_EXCEPTION_CLASS != null && CQ_EXCEPTION_CLASS.isAssignableFrom(ex.getClass()));
@@ -356,4 +348,5 @@ public abstract class GemfireCacheUtils {
static DataAccessException convertCqInvalidException(RuntimeException ex) {
return new GemfireQueryException(ex);
}
-}
\ No newline at end of file
+
+}
diff --git a/src/main/java/org/springframework/data/gemfire/RegionAttributesFactoryBean.java b/src/main/java/org/springframework/data/gemfire/RegionAttributesFactoryBean.java
index 74854abe..4c3f5784 100644
--- a/src/main/java/org/springframework/data/gemfire/RegionAttributesFactoryBean.java
+++ b/src/main/java/org/springframework/data/gemfire/RegionAttributesFactoryBean.java
@@ -19,7 +19,6 @@ package org.springframework.data.gemfire;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
-import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.RegionAttributes;
/**
@@ -27,9 +26,15 @@ import com.gemstone.gemfire.cache.RegionAttributes;
* a XML 'factory-method' tag.
*
* @author Costin Leau
+ * @author John Blum
+ * @see org.springframework.beans.factory.FactoryBean
+ * @see org.springframework.beans.factory.InitializingBean
+ * @see com.gemstone.gemfire.cache.AttributesFactory
+ * @see com.gemstone.gemfire.cache.RegionAttributes
*/
-public class RegionAttributesFactoryBean extends AttributesFactory implements FactoryBean,
- InitializingBean {
+@SuppressWarnings("deprecation")
+public class RegionAttributesFactoryBean extends com.gemstone.gemfire.cache.AttributesFactory
+ implements FactoryBean, InitializingBean {
private RegionAttributes attributes;
diff --git a/src/main/java/org/springframework/data/gemfire/RegionFactoryBean.java b/src/main/java/org/springframework/data/gemfire/RegionFactoryBean.java
index 8a625552..9f9a9598 100644
--- a/src/main/java/org/springframework/data/gemfire/RegionFactoryBean.java
+++ b/src/main/java/org/springframework/data/gemfire/RegionFactoryBean.java
@@ -29,7 +29,6 @@ import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
-import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheListener;
import com.gemstone.gemfire.cache.CacheLoader;
@@ -66,7 +65,6 @@ public class RegionFactoryBean extends RegionLookupFactoryBean imple
protected final Log log = LogFactory.getLog(getClass());
- private boolean autoStartup = true;
private boolean close = true;
private boolean destroy = false;
private boolean running;
@@ -288,13 +286,13 @@ public class RegionFactoryBean extends RegionLookupFactoryBean imple
* @see com.gemstone.gemfire.cache.RegionAttributes#getDataPolicy
* @see com.gemstone.gemfire.cache.DataPolicy
*/
- @SuppressWarnings({ "deprecation", "unchecked"})
+ @SuppressWarnings({ "deprecation", "unchecked" })
DataPolicy getDataPolicy(final RegionFactory regionFactory) {
// NOTE cannot pass RegionAttributes.class as the "targetType" on the second invocation of getFieldValue(..)
// since the "regionAttributes" field is naively of the implementation class type rather than the interface
// type... so much for programming to interfaces.
- return ((RegionAttributes) getFieldValue(getFieldValue(regionFactory, "attrsFactory", AttributesFactory.class),
- "regionAttributes", null)).getDataPolicy();
+ return ((RegionAttributes) getFieldValue(getFieldValue(regionFactory, "attrsFactory",
+ com.gemstone.gemfire.cache.AttributesFactory.class), "regionAttributes", null)).getDataPolicy();
}
/*
@@ -415,7 +413,7 @@ public class RegionFactoryBean extends RegionLookupFactoryBean imple
*/
@SuppressWarnings("deprecation")
void validateRegionAttributes(final RegionAttributes regionAttributes) {
- AttributesFactory.validateAttributes(regionAttributes);
+ com.gemstone.gemfire.cache.AttributesFactory.validateAttributes(regionAttributes);
}
/**
@@ -725,7 +723,7 @@ public class RegionFactoryBean extends RegionLookupFactoryBean imple
*/
@Override
public boolean isAutoStartup() {
- return this.autoStartup;
+ return true;
}
/*
diff --git a/src/main/java/org/springframework/data/gemfire/SubRegionFactoryBean.java b/src/main/java/org/springframework/data/gemfire/SubRegionFactoryBean.java
index 95d0733b..1503a13e 100644
--- a/src/main/java/org/springframework/data/gemfire/SubRegionFactoryBean.java
+++ b/src/main/java/org/springframework/data/gemfire/SubRegionFactoryBean.java
@@ -23,7 +23,6 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
-import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.CacheListener;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
@@ -40,9 +39,9 @@ import com.gemstone.gemfire.cache.wan.GatewaySender;
* (e.g. ReplicatedRegionFactoryBean) instead.
*/
@Deprecated
-@SuppressWarnings("deprecation")
-public class SubRegionFactoryBean extends AttributesFactory implements FactoryBean>,
- InitializingBean {
+@SuppressWarnings({"deprecation", "unused"})
+public class SubRegionFactoryBean extends com.gemstone.gemfire.cache.AttributesFactory
+ implements FactoryBean>, InitializingBean {
protected final Log log = LogFactory.getLog(getClass());
@@ -56,7 +55,6 @@ public class SubRegionFactoryBean extends AttributesFactory implemen
private Region, ?> parentRegion;
private Region subRegion;
- @SuppressWarnings("unused")
private String name;
private String regionName;
@@ -125,8 +123,8 @@ public class SubRegionFactoryBean extends AttributesFactory implemen
/**
* Sets the cache listeners used for the region used by this factory. Used
- * only when a new region is created.Overrides the settings specified
- * through {@link #setAttributes(com.gemstone.gemfire.cache.RegionAttributes)}.
+ * only when a new region is created. Overrides the settings specified
+ * through {@link setAttributes(com.gemstone.gemfire.cache.RegionAttributes)}.
*
* @param cacheListeners the cacheListeners to set on a newly created region
*/
@@ -134,10 +132,6 @@ public class SubRegionFactoryBean extends AttributesFactory implemen
this.cacheListeners = cacheListeners;
}
- /**
- *
- * @param gatewaySenders
- */
public void setGatewaySenders(Object[] gatewaySenders) {
this.gatewaySenders = gatewaySenders;
}
@@ -145,7 +139,6 @@ public class SubRegionFactoryBean extends AttributesFactory implemen
/**
* Set to true if the subregion should already exist, e.g., specified by
* <lookup-region>
- * @param lookupOnly
*/
public void setLookupOnly(boolean lookupOnly) {
this.lookupOnly = lookupOnly;
@@ -153,7 +146,6 @@ public class SubRegionFactoryBean extends AttributesFactory implemen
/**
* Set the bean name - the same as the subregion full path
- * @param name
*/
public void setName(String name) {
this.name = name;
@@ -161,7 +153,6 @@ public class SubRegionFactoryBean extends AttributesFactory implemen
/**
* Set the simple name of the region
- * @param regionName
*/
public void setRegionName(String regionName) {
this.regionName = regionName;
@@ -169,7 +160,6 @@ public class SubRegionFactoryBean extends AttributesFactory implemen
/**
* Set the parent Region
- * @param parent
*/
public void setParent(Region, ?> parent) {
this.parentRegion = parent;
diff --git a/src/main/java/org/springframework/data/gemfire/client/PoolFactoryBean.java b/src/main/java/org/springframework/data/gemfire/client/PoolFactoryBean.java
index 7d4ae742..fa3e9e8a 100644
--- a/src/main/java/org/springframework/data/gemfire/client/PoolFactoryBean.java
+++ b/src/main/java/org/springframework/data/gemfire/client/PoolFactoryBean.java
@@ -52,6 +52,7 @@ import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
*
* @author Costin Leau
*/
+@SuppressWarnings("unused")
public class PoolFactoryBean implements FactoryBean, InitializingBean,
DisposableBean, BeanNameAware, BeanFactoryAware {
@@ -115,9 +116,10 @@ public class PoolFactoryBean implements FactoryBean, InitializingBean,
try {
ClientCacheFactoryBean clientCacheFactoryBean = beanFactory.getBean(ClientCacheFactoryBean.class);
properties = clientCacheFactoryBean.getProperties();
- } catch (Exception e) {
-
}
+ catch (Exception ignore) {
+ }
+
connectToTemporaryDs(properties);
}
@@ -393,10 +395,12 @@ public class PoolFactoryBean implements FactoryBean, InitializingBean,
* initialize a client-like Distributed System before initializing
* the pool
*/
+ @SuppressWarnings("deprecation")
static void connectToTemporaryDs(Properties properties) {
Properties props = properties != null? (Properties) properties.clone() : new Properties();
props.setProperty("mcast-port", "0");
props.setProperty("locators", "");
DistributedSystem.connect(props);
}
-}
\ No newline at end of file
+
+}
diff --git a/src/main/java/org/springframework/data/gemfire/config/DiskWriteAttributesFactoryBean.java b/src/main/java/org/springframework/data/gemfire/config/DiskWriteAttributesFactoryBean.java
index bf74fa7c..0470be76 100644
--- a/src/main/java/org/springframework/data/gemfire/config/DiskWriteAttributesFactoryBean.java
+++ b/src/main/java/org/springframework/data/gemfire/config/DiskWriteAttributesFactoryBean.java
@@ -19,9 +19,6 @@ package org.springframework.data.gemfire.config;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
-import com.gemstone.gemfire.cache.DiskWriteAttributes;
-import com.gemstone.gemfire.cache.DiskWriteAttributesFactory;
-
/**
* Simple utility class used for defining nested factory-method like definitions
* w/o polluting the container with useless beans.
@@ -30,11 +27,12 @@ import com.gemstone.gemfire.cache.DiskWriteAttributesFactory;
* @deprecated
*/
@Deprecated
-class DiskWriteAttributesFactoryBean implements FactoryBean, InitializingBean {
+@SuppressWarnings({ "deprecation", "unused" })
+class DiskWriteAttributesFactoryBean implements FactoryBean, InitializingBean {
- private DiskWriteAttributes attributes;
+ private com.gemstone.gemfire.cache.DiskWriteAttributes attributes;
- private DiskWriteAttributesFactory attrFactory;
+ private com.gemstone.gemfire.cache.DiskWriteAttributesFactory attrFactory;
@Override
public void afterPropertiesSet() {
@@ -42,13 +40,13 @@ class DiskWriteAttributesFactoryBean implements FactoryBean
}
@Override
- public DiskWriteAttributes getObject() throws Exception {
+ public com.gemstone.gemfire.cache.DiskWriteAttributes getObject() throws Exception {
return attributes;
}
@Override
public Class> getObjectType() {
- return (attributes != null ? attributes.getClass() : DiskWriteAttributes.class);
+ return (attributes != null ? attributes.getClass() : com.gemstone.gemfire.cache.DiskWriteAttributes.class);
}
@Override
@@ -56,7 +54,8 @@ class DiskWriteAttributesFactoryBean implements FactoryBean
return true;
}
- public void setDiskAttributesFactory(DiskWriteAttributesFactory dwaf) {
+ public void setDiskAttributesFactory(com.gemstone.gemfire.cache.DiskWriteAttributesFactory dwaf) {
this.attrFactory = dwaf;
}
+
}
diff --git a/src/main/java/org/springframework/data/gemfire/server/CacheServerFactoryBean.java b/src/main/java/org/springframework/data/gemfire/server/CacheServerFactoryBean.java
index 243e0da2..69cc90aa 100644
--- a/src/main/java/org/springframework/data/gemfire/server/CacheServerFactoryBean.java
+++ b/src/main/java/org/springframework/data/gemfire/server/CacheServerFactoryBean.java
@@ -39,8 +39,9 @@ import com.gemstone.gemfire.cache.server.ServerLoadProbe;
* @author Costin Leau
* @author John Blum
*/
+@SuppressWarnings("unused")
public class CacheServerFactoryBean implements FactoryBean, InitializingBean, DisposableBean,
- SmartLifecycle {
+ SmartLifecycle {
private boolean autoStartup = true;
private boolean notifyBySubscription = CacheServer.DEFAULT_NOTIFY_BY_SUBSCRIPTION;
@@ -68,7 +69,7 @@ public class CacheServerFactoryBean implements FactoryBean, Initial
private String hostNameForClients = CacheServer.DEFAULT_HOSTNAME_FOR_CLIENTS;
private String subscriptionDiskStore;
- private String[] serverGroups = CacheServer.DEFAULT_GROUPS;
+ private String[] serverGroups = {};
private SubscriptionEvictionPolicy subscriptionEvictionPolicy = SubscriptionEvictionPolicy.valueOf(
ClientSubscriptionConfig.DEFAULT_EVICTION_POLICY.toUpperCase());
@@ -85,6 +86,7 @@ public class CacheServerFactoryBean implements FactoryBean, Initial
return true;
}
+ @SuppressWarnings("deprecation")
public void afterPropertiesSet() throws IOException {
Assert.notNull(cache, "A GemFire Cache is required.");
diff --git a/src/main/java/org/springframework/data/gemfire/support/GemfireCache.java b/src/main/java/org/springframework/data/gemfire/support/GemfireCache.java
index 475f6f60..13d5d79e 100644
--- a/src/main/java/org/springframework/data/gemfire/support/GemfireCache.java
+++ b/src/main/java/org/springframework/data/gemfire/support/GemfireCache.java
@@ -23,10 +23,13 @@ import com.gemstone.gemfire.cache.GemFireCache;
import com.gemstone.gemfire.cache.Region;
/**
- * Spring Framework {@link Cache} implementation using a GemFire {@link Region} underneath.
- * Supports Gemfire 6.5 or higher.
- *
+ * Spring Framework {@link Cache} implementation backed by a GemFire {@link Region}.
+ *
+ * Supports GemFire 6.5 or higher.
+ *
* @author Costin Leau
+ * @author John Blum
+ *
*/
public class GemfireCache implements Cache {
@@ -64,7 +67,9 @@ public class GemfireCache implements Cache {
return (value == null ? null : new SimpleValueWrapper(value));
}
+ @SuppressWarnings("unchecked")
public void put(Object key, Object value) {
region.put(key, value);
}
-}
\ No newline at end of file
+
+}
diff --git a/src/test/java/org/springframework/data/gemfire/CacheServerIntegrationTest.java b/src/test/java/org/springframework/data/gemfire/CacheServerIntegrationTest.java
index 63676a10..1ceb7ba3 100644
--- a/src/test/java/org/springframework/data/gemfire/CacheServerIntegrationTest.java
+++ b/src/test/java/org/springframework/data/gemfire/CacheServerIntegrationTest.java
@@ -79,6 +79,7 @@ public class CacheServerIntegrationTest {
}
@Test
+ @SuppressWarnings("deprecation")
public void testCacheServerRunningWithSubscription() {
assertNotNull(cacheServer);
assertTrue(cacheServer.isRunning());
diff --git a/src/test/java/org/springframework/data/gemfire/SimpleObjectSizer.java b/src/test/java/org/springframework/data/gemfire/SimpleObjectSizer.java
index 850f00af..cd9da6ce 100644
--- a/src/test/java/org/springframework/data/gemfire/SimpleObjectSizer.java
+++ b/src/test/java/org/springframework/data/gemfire/SimpleObjectSizer.java
@@ -17,14 +17,13 @@
package org.springframework.data.gemfire;
import com.gemstone.gemfire.cache.util.ObjectSizer;
-import com.gemstone.gemfire.cache.util.ObjectSizerImpl;
/**
* @author Costin Leau
*/
public class SimpleObjectSizer implements ObjectSizer {
- private static final ObjectSizer sizer = new ObjectSizerImpl();
+ private static final ObjectSizer sizer = ObjectSizer.DEFAULT;
@Override
public int sizeof(Object o) {
diff --git a/src/test/java/org/springframework/data/gemfire/config/CacheServerNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/CacheServerNamespaceTest.java
index 2e389b7f..f89f3e8f 100644
--- a/src/test/java/org/springframework/data/gemfire/config/CacheServerNamespaceTest.java
+++ b/src/test/java/org/springframework/data/gemfire/config/CacheServerNamespaceTest.java
@@ -55,6 +55,7 @@ public class CacheServerNamespaceTest {
private ApplicationContext context;
@Test
+ @SuppressWarnings("deprecation")
public void testBasicCacheServer() throws Exception {
CacheServer cacheServer = context.getBean("advanced-config", CacheServer.class);
diff --git a/src/test/java/org/springframework/data/gemfire/config/ClientRegionNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/ClientRegionNamespaceTest.java
index 01d0366f..58db8dcd 100644
--- a/src/test/java/org/springframework/data/gemfire/config/ClientRegionNamespaceTest.java
+++ b/src/test/java/org/springframework/data/gemfire/config/ClientRegionNamespaceTest.java
@@ -114,8 +114,8 @@ public class ClientRegionNamespaceTest {
assertEquals(5, attrs.getEvictionAttributes().getMaximum());
}
- @SuppressWarnings("rawtypes")
@Test
+ @SuppressWarnings({ "deprecation", "rawtypes" })
public void testPersistent() throws Exception {
assertTrue(context.containsBean("persistent"));
Region region = context.getBean("persistent", Region.class);
diff --git a/src/test/java/org/springframework/data/gemfire/config/IndexNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/IndexNamespaceTest.java
index a607e97e..3655db2d 100644
--- a/src/test/java/org/springframework/data/gemfire/config/IndexNamespaceTest.java
+++ b/src/test/java/org/springframework/data/gemfire/config/IndexNamespaceTest.java
@@ -29,16 +29,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.query.Index;
-import com.gemstone.gemfire.cache.query.IndexType;
/**
- *
* @author Costin Leau
* @author David Turanski
*/
+@ContextConfiguration(locations="index-ns.xml", initializers=GemfireTestApplicationContextInitializer.class)
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations="index-ns.xml",
- initializers=GemfireTestApplicationContextInitializer.class)
+@SuppressWarnings("deprecation")
public class IndexNamespaceTest {
private final String name = "test-index";
@@ -49,6 +47,7 @@ public class IndexNamespaceTest {
@Before
public void setUp() throws Exception {
Cache cache = (Cache) context.getBean("gemfireCache");
+
if (cache.getRegion(name) == null) {
cache.createRegionFactory().create("test-index");
}
@@ -62,7 +61,7 @@ public class IndexNamespaceTest {
assertEquals("status", idx.getIndexedExpression());
assertEquals("simple", idx.getName());
assertEquals(name, idx.getRegion().getName());
- assertEquals(IndexType.FUNCTIONAL, idx.getType());
+ assertEquals(com.gemstone.gemfire.cache.query.IndexType.FUNCTIONAL, idx.getType());
}
@Test
@@ -73,6 +72,7 @@ public class IndexNamespaceTest {
assertEquals("tsi.name", idx.getIndexedExpression());
assertEquals("complex-index", idx.getName());
assertEquals(name, idx.getRegion().getName());
- assertEquals(IndexType.HASH, idx.getType());
+ assertEquals(com.gemstone.gemfire.cache.query.IndexType.HASH, idx.getType());
}
+
}
diff --git a/src/test/java/org/springframework/data/gemfire/config/LocalRegionNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/LocalRegionNamespaceTest.java
index 930211bd..3f3f2974 100644
--- a/src/test/java/org/springframework/data/gemfire/config/LocalRegionNamespaceTest.java
+++ b/src/test/java/org/springframework/data/gemfire/config/LocalRegionNamespaceTest.java
@@ -58,8 +58,8 @@ public class LocalRegionNamespaceTest {
assertTrue(context.containsBean("simple"));
}
- @SuppressWarnings("rawtypes")
@Test
+ @SuppressWarnings({ "deprecation", "rawtypes" })
public void testPublishingLocal() throws Exception {
assertTrue(context.containsBean("pub"));
RegionFactoryBean fb = context.getBean("&pub", RegionFactoryBean.class);
@@ -117,4 +117,4 @@ public class LocalRegionNamespaceTest {
RegionAttributes attrs = region.getAttributes();
assertTrue(attrs.getDataPolicy().withPersistence());
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/springframework/data/gemfire/config/PdxDiskStoreAwareBeanFactoryPostProcessorTest.java b/src/test/java/org/springframework/data/gemfire/config/PdxDiskStoreAwareBeanFactoryPostProcessorTest.java
index 88384710..8788f1ca 100644
--- a/src/test/java/org/springframework/data/gemfire/config/PdxDiskStoreAwareBeanFactoryPostProcessorTest.java
+++ b/src/test/java/org/springframework/data/gemfire/config/PdxDiskStoreAwareBeanFactoryPostProcessorTest.java
@@ -69,7 +69,7 @@ public class PdxDiskStoreAwareBeanFactoryPostProcessorTest {
return (array == null || array.length == 0);
}
- protected static boolean isBeanType(final BeanDefinition beanDefinition, final Class beanType) {
+ protected static boolean isBeanType(final BeanDefinition beanDefinition, final Class> beanType) {
return (beanDefinition instanceof AbstractBeanDefinition
&& ((AbstractBeanDefinition) beanDefinition).hasBeanClass()
&& beanType.isAssignableFrom(((AbstractBeanDefinition) beanDefinition).getBeanClass()));
diff --git a/src/test/java/org/springframework/data/gemfire/config/ReplicatedRegionNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/ReplicatedRegionNamespaceTest.java
index f362ad77..0469c1cc 100644
--- a/src/test/java/org/springframework/data/gemfire/config/ReplicatedRegionNamespaceTest.java
+++ b/src/test/java/org/springframework/data/gemfire/config/ReplicatedRegionNamespaceTest.java
@@ -56,13 +56,13 @@ public class ReplicatedRegionNamespaceTest {
public void testBasicReplica() throws Exception {
assertTrue(context.containsBean("simple"));
RegionFactoryBean fb = context.getBean("&simple", RegionFactoryBean.class);
- assertEquals(false ,(Boolean)TestUtils.readField("close", fb));
+ assertEquals(false, TestUtils.readField("close", fb));
RegionAttributes attrs = TestUtils.readField("attributes", fb);
assertFalse(attrs.getConcurrencyChecksEnabled());
}
- @SuppressWarnings("rawtypes")
@Test
+ @SuppressWarnings({ "deprecation", "rawtypes" })
public void testPublishingReplica() throws Exception {
assertTrue(context.containsBean("pub"));
RegionFactoryBean fb = context.getBean("&pub", RegionFactoryBean.class);
@@ -122,4 +122,4 @@ public class ReplicatedRegionNamespaceTest {
assertEquals(existing, context.getBean("lookup"));
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/springframework/data/gemfire/fork/CacheServerProcess.java b/src/test/java/org/springframework/data/gemfire/fork/CacheServerProcess.java
index 0fd566d8..b1434914 100644
--- a/src/test/java/org/springframework/data/gemfire/fork/CacheServerProcess.java
+++ b/src/test/java/org/springframework/data/gemfire/fork/CacheServerProcess.java
@@ -20,10 +20,8 @@ import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Properties;
-
import org.springframework.data.gemfire.ForkUtil;
-import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.DataPolicy;
@@ -31,11 +29,11 @@ import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.distributed.DistributedSystem;
/**
* @author Costin Leau
*/
+@SuppressWarnings("unchecked")
public class CacheServerProcess {
public static void main(String[] args) throws Exception {
@@ -75,4 +73,5 @@ public class CacheServerProcess {
System.out.println("Waiting for shutdown");
bufferedReader.readLine();
}
+
}
diff --git a/src/test/java/org/springframework/data/gemfire/function/FunctionArgumentResolverTest.java b/src/test/java/org/springframework/data/gemfire/function/FunctionArgumentResolverTest.java
index 17d767d4..a6c33660 100644
--- a/src/test/java/org/springframework/data/gemfire/function/FunctionArgumentResolverTest.java
+++ b/src/test/java/org/springframework/data/gemfire/function/FunctionArgumentResolverTest.java
@@ -262,6 +262,7 @@ public class FunctionArgumentResolverTest {
}
@Test
+ @SuppressWarnings("unchecked")
public void testMethodWithFunctionContextAndResultSender() throws NoSuchMethodException {
FunctionContext functionContext = mock(FunctionContext.class);
ResultSender resultSender = mock(ResultSender.class);
diff --git a/src/test/java/org/springframework/data/gemfire/mapping/RegionsTest.java b/src/test/java/org/springframework/data/gemfire/mapping/RegionsTest.java
index f49077ca..9cc9fe04 100644
--- a/src/test/java/org/springframework/data/gemfire/mapping/RegionsTest.java
+++ b/src/test/java/org/springframework/data/gemfire/mapping/RegionsTest.java
@@ -48,6 +48,7 @@ import com.gemstone.gemfire.cache.Region;
* @see org.springframework.data.gemfire.mapping.Regions
* @since 1.3.4
*/
+@SuppressWarnings("unchecked")
public class RegionsTest {
private MappingContext mockMappingContext;
@@ -74,7 +75,6 @@ public class RegionsTest {
}
@Before
- @SuppressWarnings("unchecked")
public void setup() {
mockMappingContext = mock(GemfireMappingContext.class, "GemfireMappingContext");
diff --git a/src/test/java/org/springframework/data/gemfire/support/GemfireCacheTest.java b/src/test/java/org/springframework/data/gemfire/support/GemfireCacheTest.java
index 01694b3c..5c16999d 100644
--- a/src/test/java/org/springframework/data/gemfire/support/GemfireCacheTest.java
+++ b/src/test/java/org/springframework/data/gemfire/support/GemfireCacheTest.java
@@ -20,7 +20,6 @@ import java.util.Properties;
import org.springframework.cache.Cache;
-import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.distributed.DistributedSystem;
@@ -36,6 +35,7 @@ public class GemfireCacheTest extends AbstractNativeCacheTest createNativeCache() throws Exception {
com.gemstone.gemfire.cache.Cache instance = null;
try {
@@ -49,9 +49,10 @@ public class GemfireCacheTest extends AbstractNativeCacheTest keys = Arrays.asList(new String[]{"key1","key2"});
+ List keys = Arrays.asList("key1", "key2");
Map results = region.getAll(keys);
assertEquals("{\"hello1\":\"world1\"}",results.get("key1"));
assertEquals("{\"hello2\":\"world2\"}",results.get("key2"));
}
@Test
- public void testObjectToJSon() throws JsonGenerationException, JsonMappingException, IOException {
+ public void testObjectToJSon() throws IOException {
Person dave = new Person(1L,"Dave","Turanski");
region.put("dave",dave);
String json = (String)region.get("dave");
diff --git a/src/test/java/org/springframework/data/gemfire/test/MockRegionFactory.java b/src/test/java/org/springframework/data/gemfire/test/MockRegionFactory.java
index 268f45e6..8e14e12c 100644
--- a/src/test/java/org/springframework/data/gemfire/test/MockRegionFactory.java
+++ b/src/test/java/org/springframework/data/gemfire/test/MockRegionFactory.java
@@ -24,13 +24,11 @@ import java.io.File;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.CacheListener;
import com.gemstone.gemfire.cache.CacheLoader;
import com.gemstone.gemfire.cache.CacheWriter;
import com.gemstone.gemfire.cache.CustomExpiry;
import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.DiskWriteAttributes;
import com.gemstone.gemfire.cache.EvictionAttributes;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.MembershipAttributes;
@@ -53,7 +51,7 @@ public class MockRegionFactory {
private static QueryService queryService = mock(QueryService.class);
private static RegionService regionService = mock(RegionService.class);
- private AttributesFactory attributesFactory;
+ private com.gemstone.gemfire.cache.AttributesFactory attributesFactory;
private final StubCache cache;
@@ -65,10 +63,10 @@ public class MockRegionFactory {
return createMockRegionFactory(null);
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({ "deprecation", "rawtypes", "unchecked" })
public RegionFactory createMockRegionFactory(RegionAttributes attributes) {
- attributesFactory = (attributes != null ? new AttributesFactory(attributes)
- : new AttributesFactory());
+ attributesFactory = (attributes != null ? new com.gemstone.gemfire.cache.AttributesFactory(attributes)
+ : new com.gemstone.gemfire.cache.AttributesFactory());
//Workaround for GemFire bug
if (attributes !=null) {
@@ -340,10 +338,12 @@ public class MockRegionFactory {
}
});
- when(regionFactory.setDiskWriteAttributes(any(DiskWriteAttributes.class))).thenAnswer(new Answer(){
+ when(regionFactory.setDiskWriteAttributes(any(com.gemstone.gemfire.cache.DiskWriteAttributes.class)))
+ .thenAnswer(new Answer(){
@Override
public RegionFactory answer(InvocationOnMock invocation) throws Throwable {
- DiskWriteAttributes val = (DiskWriteAttributes)invocation.getArguments()[0];
+ com.gemstone.gemfire.cache.DiskWriteAttributes val =
+ (com.gemstone.gemfire.cache.DiskWriteAttributes) invocation.getArguments()[0];
attributesFactory.setDiskWriteAttributes(val);
return regionFactory;
}
@@ -505,8 +505,7 @@ public class MockRegionFactory {
when(region.getAttributes()).thenAnswer(new Answer() {
@Override
public RegionAttributes answer(InvocationOnMock invocation) throws Throwable {
- RegionAttributes attributes = attributesFactory.create();
- return attributes;
+ return attributesFactory.create();
}
});
@@ -523,9 +522,7 @@ public class MockRegionFactory {
String subRegionPath = (parentRegionName.startsWith("/") ? parentRegionName+"/"+subRegionName
: "/"+parentRegionName+"/"+subRegionName);
- Region region = cache.getRegion(subRegionPath);
-
- return region;
+ return cache.getRegion(subRegionPath);
}
});
diff --git a/src/test/java/org/springframework/data/gemfire/test/StubCache.java b/src/test/java/org/springframework/data/gemfire/test/StubCache.java
index caab17ed..a5570565 100644
--- a/src/test/java/org/springframework/data/gemfire/test/StubCache.java
+++ b/src/test/java/org/springframework/data/gemfire/test/StubCache.java
@@ -1,6 +1,10 @@
package org.springframework.data.gemfire.test;
-import static org.mockito.Mockito.*;
-
+
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
@@ -10,7 +14,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
-
import javax.naming.Context;
import org.mockito.invocation.InvocationOnMock;
@@ -38,12 +41,10 @@ import com.gemstone.gemfire.cache.query.Index;
import com.gemstone.gemfire.cache.query.IndexExistsException;
import com.gemstone.gemfire.cache.query.IndexInvalidException;
import com.gemstone.gemfire.cache.query.IndexNameConflictException;
-import com.gemstone.gemfire.cache.query.IndexType;
import com.gemstone.gemfire.cache.query.QueryService;
import com.gemstone.gemfire.cache.query.RegionNotFoundException;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache.snapshot.CacheSnapshotService;
-import com.gemstone.gemfire.cache.util.BridgeServer;
import com.gemstone.gemfire.cache.util.Gateway;
import com.gemstone.gemfire.cache.util.GatewayConflictResolver;
import com.gemstone.gemfire.cache.util.GatewayHub;
@@ -58,6 +59,8 @@ import com.gemstone.gemfire.i18n.LogWriterI18n;
import com.gemstone.gemfire.pdx.PdxInstance;
import com.gemstone.gemfire.pdx.PdxInstanceFactory;
import com.gemstone.gemfire.pdx.PdxSerializer;
+
+@SuppressWarnings("deprecation")
public class StubCache implements Cache {
private Properties properties;
@@ -390,7 +393,7 @@ public class StubCache implements Cache {
*/
@Override
@Deprecated
- public BridgeServer addBridgeServer() {
+ public com.gemstone.gemfire.cache.util.BridgeServer addBridgeServer() {
throw new UnsupportedOperationException();
}
@@ -462,8 +465,7 @@ public class StubCache implements Cache {
@SuppressWarnings("unchecked")
@Override
public RegionFactory createRegionFactory() {
- RegionFactory regionFactory = new MockRegionFactory(this).createRegionFactory();
- return regionFactory;
+ return new MockRegionFactory(this).createRegionFactory();
}
/* (non-Javadoc)
@@ -472,8 +474,7 @@ public class StubCache implements Cache {
@SuppressWarnings("unchecked")
@Override
public RegionFactory createRegionFactory(RegionShortcut shortCut) {
- RegionFactory regionFactory = new MockRegionFactory(this).createRegionFactory();
- return regionFactory;
+ return new MockRegionFactory(this).createRegionFactory();
}
/* (non-Javadoc)
@@ -482,8 +483,7 @@ public class StubCache implements Cache {
@SuppressWarnings("unchecked")
@Override
public RegionFactory createRegionFactory(String arg0) {
- RegionFactory regionFactory = new MockRegionFactory(this).createRegionFactory();
- return regionFactory;
+ return new MockRegionFactory(this).createRegionFactory();
}
/* (non-Javadoc)
@@ -491,8 +491,7 @@ public class StubCache implements Cache {
*/
@Override
public RegionFactory createRegionFactory(RegionAttributes regionAttributes) {
- RegionFactory regionFactory = new MockRegionFactory(this).createMockRegionFactory(regionAttributes);
- return regionFactory;
+ return new MockRegionFactory(this).createMockRegionFactory(regionAttributes);
}
/* (non-Javadoc)
@@ -754,9 +753,6 @@ public class StubCache implements Cache {
this.searchTimeout = arg0;
}
- /**
- * @return
- */
DistributedSystem mockDistributedSystem() {
DistributedSystem ds = mock(DistributedSystem.class);
DistributedMember dm = mockDistributedMember();
@@ -777,10 +773,7 @@ public class StubCache implements Cache {
return dm;
}
- /**
- * @return
- */
- CacheServer mockCacheServer() {
+ CacheServer mockCacheServer() {
return new StubCacheServer();
}
@@ -814,7 +807,7 @@ public class StubCache implements Cache {
String indexName = (String)invocation.getArguments()[0];
String indexedExpression = (String)invocation.getArguments()[1];
String fromClause = (String)invocation.getArguments()[2];
- return mockIndex(indexName, IndexType.FUNCTIONAL, indexedExpression, fromClause, null);
+ return mockIndex(indexName, com.gemstone.gemfire.cache.query.IndexType.FUNCTIONAL, indexedExpression, fromClause, null);
}
});
when(qs.createIndex(anyString(), anyString(),anyString(),anyString())).thenAnswer(new Answer(){
@@ -824,7 +817,7 @@ public class StubCache implements Cache {
String indexedExpression = (String)invocation.getArguments()[1];
String fromClause = (String)invocation.getArguments()[2];
String imports = (String)invocation.getArguments()[3];
- return mockIndex(indexName, IndexType.FUNCTIONAL, indexedExpression, fromClause, imports);
+ return mockIndex(indexName, com.gemstone.gemfire.cache.query.IndexType.FUNCTIONAL, indexedExpression, fromClause, imports);
}
});
@@ -835,7 +828,7 @@ public class StubCache implements Cache {
String indexedExpression = (String)invocation.getArguments()[1];
String fromClause = (String)invocation.getArguments()[2];
- return mockIndex(indexName, IndexType.PRIMARY_KEY, indexedExpression, fromClause, null);
+ return mockIndex(indexName, com.gemstone.gemfire.cache.query.IndexType.PRIMARY_KEY, indexedExpression, fromClause, null);
}
});
@@ -846,7 +839,7 @@ public class StubCache implements Cache {
String indexedExpression = (String)invocation.getArguments()[1];
String fromClause = (String)invocation.getArguments()[2];
- return mockIndex(indexName, IndexType.HASH, indexedExpression, fromClause, null);
+ return mockIndex(indexName, com.gemstone.gemfire.cache.query.IndexType.HASH, indexedExpression, fromClause, null);
}
});
@@ -858,15 +851,16 @@ public class StubCache implements Cache {
String fromClause = (String)invocation.getArguments()[2];
String imports = (String)invocation.getArguments()[3];
- return mockIndex(indexName, IndexType.HASH, indexedExpression, fromClause, imports);
+ return mockIndex(indexName, com.gemstone.gemfire.cache.query.IndexType.HASH, indexedExpression, fromClause, imports);
}
});
return qs;
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
- Index mockIndex(String indexName, IndexType indexType,String indexedExpression, String fromClause, String imports){
+ @SuppressWarnings({ "rawtypes", "unchecked", "unused" })
+ Index mockIndex(String indexName, com.gemstone.gemfire.cache.query.IndexType indexType, String indexedExpression,
+ String fromClause, String imports){
Index idx = mock(Index.class);
when(idx.getFromClause()).thenReturn(fromClause);
when(idx.getIndexedExpression()).thenReturn(indexedExpression);
@@ -888,18 +882,8 @@ public class StubCache implements Cache {
return this.allRegions;
}
- GatewaySender mockGatewaySender(String id, int remoteId) {
- GatewaySender gwSender = mock(GatewaySender.class);
- when(gwSender.getId()).thenReturn(id);
- when(gwSender.getRemoteDSId()).thenReturn(remoteId);
- return gwSender;
- }
-
- /**
- * @param props
- */
public void setProperties(Properties props) {
this.properties = props;
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/springframework/data/gemfire/test/StubCacheServer.java b/src/test/java/org/springframework/data/gemfire/test/StubCacheServer.java
index 2d4039bc..14688f4e 100644
--- a/src/test/java/org/springframework/data/gemfire/test/StubCacheServer.java
+++ b/src/test/java/org/springframework/data/gemfire/test/StubCacheServer.java
@@ -26,6 +26,7 @@ import com.gemstone.gemfire.distributed.DistributedMember;
* @author David Turanski
* @author John Blum
*/
+@SuppressWarnings("deprecation")
public class StubCacheServer implements CacheServer {
private boolean isRunning;
diff --git a/src/test/java/org/springframework/data/gemfire/test/StubGatewaySenderFactory.java b/src/test/java/org/springframework/data/gemfire/test/StubGatewaySenderFactory.java
index 9d542c55..ea6e1b39 100644
--- a/src/test/java/org/springframework/data/gemfire/test/StubGatewaySenderFactory.java
+++ b/src/test/java/org/springframework/data/gemfire/test/StubGatewaySenderFactory.java
@@ -12,7 +12,6 @@
*/
package org.springframework.data.gemfire.test;
-import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -20,19 +19,20 @@ import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
-import com.gemstone.gemfire.cache.Region;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
import com.gemstone.gemfire.cache.util.Gateway.OrderPolicy;
import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
import com.gemstone.gemfire.cache.wan.GatewaySender;
import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
-import com.sun.org.apache.xpath.internal.operations.Bool;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
/**
+ * The StubGatewaySenderFactory class for testing purposes.
+ *
* @author David Turanski
- *
+ * @see com.gemstone.gemfire.cache.wan.GatewaySenderFactory
*/
public class StubGatewaySenderFactory implements GatewaySenderFactory {
@@ -210,4 +210,5 @@ public class StubGatewaySenderFactory implements GatewaySenderFactory {
// TODO Auto-generated method stub
return null;
}
+
}