Merge branch 'sgf268' of github.com:jxblum/spring-data-gemfire into jxblum-pr64

This commit is contained in:
John Blum
2014-04-21 11:50:19 -07:00
140 changed files with 463 additions and 424 deletions

View File

@@ -35,7 +35,7 @@ import com.gemstone.gemfire.cache.server.CacheServer;
/**
* The CacheServerIntegrationTest class is a test suite of test cases testing the functionality of GemFire Cache Servers
* configured using the Spring Data GemFire XML namespace.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.server.CacheServerFactoryBean
@@ -79,6 +79,7 @@ public class CacheServerIntegrationTest {
}
@Test
@SuppressWarnings("deprecation")
public void testCacheServerRunningWithSubscription() {
assertNotNull(cacheServer);
assertTrue(cacheServer.isRunning());

View File

@@ -25,7 +25,7 @@ import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
/**
* The ClientRegionShortcutConverterTest class is a test suite of test cases testing the contract and functionality
* of the ClientRegionShortcutConverter class
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.ClientRegionShortcutConverter

View File

@@ -30,7 +30,7 @@ import com.gemstone.gemfire.cache.Region;
/**
* The ColocatedRegionIntegrationTest class is a test suite class containing test cases for JIRA issue SGF-195,
* concerning colocated Regions in GemFire.
* <p/>
*
* @author John Blum
* @link https://jira.springsource.org/browse/SGF-195
* @see org.junit.Test

View File

@@ -35,7 +35,7 @@ import com.gemstone.gemfire.cache.DiskStore;
* The DiskStoreBeanUsingPropertyPlaceholdersIntegrationTest class is a test suite of integration tests testing the use
* of Spring PropertyPlaceholders to configure and initialize a Disk Store bean's properties using property placeholders
* in the SDG XML namespace &lt;disk-store&gt; bean definition attributes.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith

View File

@@ -24,7 +24,7 @@ import org.junit.Test;
/**
* The DiskStoreFactoryBeanTest class is a test suite of test cases testing the contract and functionality of the
* DiskStoreFactoryBean class.
* <p/>
*
*
* @author John Blum
* @see org.junit.Test

View File

@@ -26,7 +26,7 @@ import com.gemstone.gemfire.internal.GemFireVersion;
/**
* The GemfireUtilsTest class is a test suite of test cases testing the contract and functionality of the GemfireUtils
* abstract utility class.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.GemfireUtils

View File

@@ -26,7 +26,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* The InvalidRegionDataPolicyShortcutsIntegrationTest class is a test suite of test cases testing and setting up
* some invalid, or illegal uses of the Region data-policy and/or shortcut XML namespace attributes.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @since 1.4.0

View File

@@ -39,7 +39,7 @@ import org.springframework.util.Assert;
* The LazyWiringDeclarableSupportIntegrationTest class is a test suite of integration test cases testing
* a LazyWiringDeclarableSupport object/component's wiring configuration and initialization in
* a Spring container context.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith

View File

@@ -38,7 +38,7 @@ import org.springframework.data.gemfire.support.SpringContextBootstrappingInitia
* of the LazyWiringDeclarableSupport class. This test class focuses on testing isolated units of functionality
* in the Declarable class directly, mocking any dependencies as appropriate, in order for the class to uphold
* it's contract.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.mockito.Mockito

View File

@@ -34,7 +34,7 @@ import com.gemstone.gemfire.cache.RegionShortcut;
/**
* The PartitionedRegionFactoryBeanTest class is a test suite of test cases testing the component functionality
* and correct behavior of the PartitionedRegionFactoryBean class.
* <p/>
*
*
* @author David Turanski
* @author John Blum

View File

@@ -32,7 +32,7 @@ import com.gemstone.gemfire.cache.Region;
/**
* The LookupSubRegionTest class is a test suite of test cases testing the contract and functionality of Region lookups
* using Spring Data GemFire configuration and GemFire native cache.xml.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.context.ApplicationContext

View File

@@ -29,7 +29,7 @@ import com.gemstone.gemfire.cache.PartitionResolver;
/**
* The PartitionAttributesFactoryBeanTest class is test suite of test cases testing the contract and functionality of
* the PartitionAttributesFactoryBean class.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.PartitionAttributesFactoryBean

View File

@@ -30,7 +30,7 @@ import com.gemstone.gemfire.cache.RegionFactory;
/**
* The PartitionedRegionFactoryBeanTest class is a test suite of test cases testing the component functionality
* and correct behavior of the PartitionedRegionFactoryBean class.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.mockito.Mockito

View File

@@ -38,7 +38,7 @@ import com.gemstone.gemfire.cache.Region;
/**
* The PdxDiskStoreTest class is a test suite containing tests to reproduce the issue in JIRA SGF-197.
* <p/>
*
* @author John Blum
* @link https://jira.springsource.org/browse/SGF-197
* @see org.junit.Test
@@ -130,6 +130,7 @@ public class PdxDiskStoreIntegrationTest {
}
}
@SuppressWarnings("unused")
public static class KeyHolder<T extends Serializable> extends AbstractHolderSupport {
private T key;
@@ -178,6 +179,7 @@ public class PdxDiskStoreIntegrationTest {
}
}
@SuppressWarnings("unused")
public static class ValueHolder<T extends Serializable> extends AbstractHolderSupport {
private T value;

View File

@@ -36,7 +36,7 @@ import com.gemstone.gemfire.cache.Region;
/**
* The RegionShortcutsIntegrationTest class is a test suite of test cases testing the use of RegionShortcuts in the
* Spring Data GemFire XML Namespace!
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith

View File

@@ -55,7 +55,7 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
/**
* The RegionFactoryBeanTest class is a test suite of test cases testing the contract and functionality of the
* RegionFactoryBean class.
* <p/>
*
* @author David Turanski
* @author John Blum
* @see org.springframework.data.gemfire.RegionFactoryBean

View File

@@ -37,7 +37,7 @@ 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

View File

@@ -25,7 +25,7 @@ import com.gemstone.gemfire.cache.RegionShortcut;
/**
* The RegionShortcutConverterTest class is a test suite of test cases testing the contract and functionality of the
* RegionShortcutConverter class
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.RegionShortcutConverter

View File

@@ -30,7 +30,7 @@ import com.gemstone.gemfire.cache.RegionFactory;
/**
* The ReplicatedRegionFactoryBeanTest class is a test suite of test cases testing the component functionality
* and correct behavior of the ReplicatedRegionFactoryBean class.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.mockito.Mockito

View File

@@ -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) {

View File

@@ -47,7 +47,7 @@ import com.gemstone.gemfire.cache.SubscriptionAttributes;
* The SubRegionIntegrationTest class is a test suite of test cases testing the functionality of SubRegions in GemFire
* configured with Spring Data GemFire's XML namespace configuration meta-data. This test class tests a complex
* SubRegion configuration in order to ensure functional completeness.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith
@@ -58,6 +58,7 @@ import com.gemstone.gemfire.cache.SubscriptionAttributes;
*/
@ContextConfiguration("complex-subregion.xml")
@RunWith(SpringJUnit4ClassRunner.class)
@SuppressWarnings("unused")
public class SubRegionIntegrationTest {
@Autowired

View File

@@ -46,7 +46,7 @@ import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
/**
* The ClientRegionWithCacheLoaderWriterTest class is a test suite of test cases testing the addition of CacheLoaders
* and CacheWriters to a client, local Region inside a GemFire Cache.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith

View File

@@ -38,14 +38,13 @@ import com.gemstone.gemfire.cache.client.ClientCache;
/**
* The ClientSubRegionTest class is a test suite of test cases testing SubRegion functionality from a client
* GemFire Cache.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith
* @see org.springframework.test.context.ContextConfiguration
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
* @since 1.4.0
* @since 7.0.1 (GemFire)
*/
@ContextConfiguration("clientcache-with-subregion-config.xml")
@RunWith(SpringJUnit4ClassRunner.class)

View File

@@ -35,7 +35,7 @@ import org.w3c.dom.Node;
/**
* The AbstractRegionParserTest class is a test suite of test cases testing the contract and functionality of the
* AbstractRegionParser class.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.mockito.Mockito

View File

@@ -35,7 +35,7 @@ import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
/**
* The CacheServerNamespaceTest class is a test suite of test cases testing the functionality of the SDG XML namespace
* when configuring a GemFire Cache Servers and Client Subscription.
* <p/>
*
* @author Costin Leau
* @author David Turanski
* @author John Blum
@@ -49,12 +49,14 @@ import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
*/
@ContextConfiguration(locations="server-ns.xml", initializers=GemfireTestApplicationContextInitializer.class)
@RunWith(SpringJUnit4ClassRunner.class)
@SuppressWarnings("unused")
public class CacheServerNamespaceTest {
@Autowired
private ApplicationContext context;
@Test
@SuppressWarnings("deprecation")
public void testBasicCacheServer() throws Exception {
CacheServer cacheServer = context.getBean("advanced-config", CacheServer.class);

View File

@@ -35,7 +35,7 @@ import com.gemstone.gemfire.pdx.PdxSerializer;
/**
* The CacheUsingPdxNamespaceTest class is a test suite of test case testing the Spring Data GemFire XML namespace
* when PDX is configured in GemFire.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith

View File

@@ -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);

View File

@@ -25,7 +25,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* The ClientRegionUsingDataPolicyAndShortcutTest class is a test suite of test case testing a client Region
* bean definition with both data-policy and shortcut specified.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @since 1.3.3

View File

@@ -34,7 +34,7 @@ import com.gemstone.gemfire.internal.cache.lru.MemLRUCapacityController;
/**
* The EvictionAttributesFactoryBeanTest class is a test suite of test cases testing the contract and functionality
* of the EvictionAttributesFactoryBean class used to create Region Eviction configuration settings.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.config.EvictionAttributesFactoryBean

View File

@@ -37,7 +37,6 @@ import org.springframework.data.gemfire.TestUtils;
import org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor;
import org.springframework.data.gemfire.wan.GatewaySenderFactoryBean;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.asyncqueue.AsyncEvent;
import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
@@ -51,14 +50,15 @@ import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
/**
* This test is only valid for GF 7.0 and above
* <p/>
*
* @author David Turanski
* @author John Blum
*/
@SuppressWarnings("unused")
public class GemfireV7GatewayNamespaceTest extends RecreatingContextTest {
/* (non-Javadoc)
/*
* (non-Javadoc)
* @see org.springframework.data.gemfire.RecreatingContextTest#location()
*/
@Override

View File

@@ -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());
}
}

View File

@@ -38,7 +38,7 @@ import com.gemstone.gemfire.internal.datasource.ConfigProperty;
/**
* The JndiBindingsPropertyPlaceholderTest class is a test suite of test cases testing the configuration of a GemFire
* Cache JNDI DataSource using property placeholders.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.context.ApplicationContext

View File

@@ -22,7 +22,6 @@ 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.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -31,7 +30,7 @@ import com.gemstone.gemfire.internal.datasource.GemFireBasicDataSource;
/**
* This test requires a real cache
* <p/>
*
* @author David Turanski
* @author John Blum
*/

View File

@@ -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());
}
}
}

View File

@@ -49,7 +49,7 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion;
/**
* The PdxDiskStoreAwareBeanFactoryPostProcessorTest class is a test suite of test cases testing the functionality
* of the PdxDiskStoreAwareBeanFactoryPostProcessor class.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.mockito.Mockito
@@ -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()));

View File

@@ -36,7 +36,7 @@ import com.gemstone.gemfire.internal.cache.lru.LRUCapacityController;
/**
* The RegionEvictionAttributesNamespaceTest class is a test suite of test cases testing the use of Eviction settings
* (EvictionAttributes) in the SDG XML namespace.
* <p/>
*
* @author John Blum
* @since 1.3.4
*/

View File

@@ -33,14 +33,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* Spring container BeanDefinition representing a GemFire Region having SubRegions. This test suite is meant to
* ensure the correct behavior of and provide regression coverage for, JIRA issue SGF-178, "parent attribute causes
* endless loop in hashCode".
* <p/>
*
* The 'parent' attribute was added to the parent Region's BeanDefinition, referring to the parent Region's
* BeanDefinition itself, before it recurses to parse the SubRegion elements, which is then used by the
* AbstractRegionParser.doParseInternal method to set the parent property of the SubRegion's BeanDefinition.
* <p/>
*
* Calling hashCode on a parent Region's BeanDefinition that has a parent 'attribute' referring to the parent Region's
* BeanDefinition itself, causes infinite recursion and an eventual StackOverflowError.
* <p/>
*
* <code>
* java.lang.StackOverflowError
* at java.util.LinkedHashMap$LinkedHashIterator.<init>(LinkedHashMap.java:345)
@@ -68,10 +68,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* at org.springframework.core.AttributeAccessorSupport.hashCode(AttributeAccessorSupport.java:99)
* at org.springframework.beans.factory.support.AbstractBeanDefinition.hashCode(AbstractBeanDefinition.java:1052)
* </code>
* <p/>
*
* This also causes problems for tools like Spring Tool Suite, which use the BeanDefinitions from the Spring container
* context as meta-data in the IDE.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith

View File

@@ -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"));
}
}
}

View File

@@ -37,7 +37,7 @@ import com.gemstone.gemfire.cache.Region;
/**
* The SubRegionNamespaceTest class is a test suite of test cases testing the contract and functionality of
* Region/SubRegion creation in a GemFire Cache.
* <p/>
*
* @author David Turanski
* @author John Blum
* @see org.junit.Test

View File

@@ -36,7 +36,7 @@ import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
/**
* The SubRegionSubElementNamespaceTest class...
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.test.context.ContextConfiguration

View File

@@ -28,7 +28,7 @@ import org.xml.sax.SAXParseException;
/**
* The SubRegionWithInvalidDataPolicyTest class is a test suite of test cases testing the data-policy and persistent
* attributes settings are consistent for GemFire SubRegion bean definitions.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner

View File

@@ -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();
}
}

View File

@@ -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);

View File

@@ -41,13 +41,14 @@ import com.gemstone.gemfire.cache.Region;
/**
* The RegionsTest class is a test suite of test cases testing the contract and functionality of the Regions class.
* <p/>
*
* @author John J. Blum
* @see org.junit.Test
* @see org.mockito.Mockito
* @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");

View File

@@ -35,7 +35,7 @@ import org.springframework.data.mapping.context.MappingContext;
* The DefaultGemfireEntityInformationTest class is a test suite of test cases testing the contract and functionality
* of the DefaultGemfireEntityInformation class used to extract entity information during persistence/mapping operations
* during data access to the underlying data store (GemFire).
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.repository.query.DefaultGemfireEntityInformation

View File

@@ -21,7 +21,7 @@ import org.springframework.data.gemfire.mapping.Region;
/**
* The Algorithm interface define abstract data type modeling a computer algorithm.
* <p/>
*
* @author John Blum
* @see org.springframework.data.annotation.Id
* @see org.springframework.data.gemfire.mapping.Region

View File

@@ -21,7 +21,7 @@ import org.springframework.data.gemfire.repository.GemfireRepository;
/**
* The AlgorithmRepository class is a Data Access Object (DAO) for accessing and persistent data/state about Algorithms
* to a GemFire Cache/Region.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.repository.GemfireRepository
* @since 1.4.0

View File

@@ -35,7 +35,7 @@ import com.gemstone.gemfire.cache.Region;
* The AlgorithmRepositoryTest class is a test suite of test cases testing the contract and functionality of GemFire's
* Repository extension when using a plain old Java interface for defining the application domain object/entity type,
* rather than a Java class, that is the subject of the persistence operations.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith

View File

@@ -28,13 +28,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* The AnimalRepositoryTest class is a test suite of test cases testing the functionality behind PR #55 involving
* persisting application domain object/entities to multiple Regions in GemFire's Cache.
* <p/>
*
* @author Stuart Williams
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith
* @see org.springframework.test.context.ContextConfiguration
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
* @since 1.4.0
* @link https://github.com/spring-projects/spring-data-gemfire/pull/55
*/
@ContextConfiguration("AnimalRepositoryTest-context.xml")

View File

@@ -20,11 +20,11 @@ import org.springframework.data.gemfire.mapping.Region;
/**
* The GuestUser class represents an authorized restricted user of a service or computer system, etc.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.mapping.Region
* @see org.springframework.data.gemfire.repository.sample.User
* @since 1.3.4
* @since 1.4.0
*/
@Region("/Local/Guest/Users")
@SuppressWarnings("unused")

View File

@@ -22,11 +22,11 @@ import org.springframework.data.gemfire.repository.GemfireRepository;
/**
* The GuestUserRepository class is a DAO for accessing and persisting GuestUsers.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.repository.GemfireRepository
* @see org.springframework.data.gemfire.repository.sample.GuestUser
* @since 1.3.4
* @since 1.4.0
*/
@SuppressWarnings("unused")
public interface GuestUserRepository extends GemfireRepository<GuestUser, String> {

View File

@@ -30,7 +30,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* The IncompatibleRegionKeyEntityIdAnimalRepositoryTest class is a test suite of test cases testing the functionality
* behind PR #55 involving persisting application domain object/entities to multiple Regions in GemFire's Cache.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.context.ConfigurableApplicationContext

View File

@@ -22,7 +22,7 @@ import org.springframework.util.ObjectUtils;
/**
* The Plant class is a very simple ADT modeling a plant for SDG Repository testing purposes.
* <p/>
*
* @author John Blum
* @see org.springframework.data.annotation.Id
* @see org.springframework.data.gemfire.mapping.Region

View File

@@ -22,7 +22,7 @@ import org.springframework.data.gemfire.repository.Query;
/**
* The PlantRepository class is a Repository extension for accessing and storing Plants.
* Note, this Spring GemFire Repository extension incorrectly maps Plants to the Plants Region on purpose
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.repository.GemfireRepository
* @see org.springframework.data.gemfire.repository.Query

View File

@@ -29,7 +29,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* The PlantRepositoryTest class is a test suite of test cases testing the functionality behind PR #55 involving
* persisting application domain object/entities to multiple Regions in GemFire's Cache.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.context.ConfigurableApplicationContext

View File

@@ -21,11 +21,11 @@ import org.springframework.util.StringUtils;
/**
* The Programmer class is a User representing/modeling a software engineer/developer.
* <p/>
*
* @author John J. Blum
* @see org.springframework.data.gemfire.mapping.Region
* @see org.springframework.data.gemfire.repository.sample.User
* @since 1.3.4
* @since 1.4.0
*/
@Region("Programmers")
@SuppressWarnings("unused")

View File

@@ -23,11 +23,11 @@ import org.springframework.data.gemfire.repository.GemfireRepository;
/**
* The ProgrammerRepository class is a Data Access Object (DAO) for Programmer domain objects supporting basic CRUD
* and Query operations.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.repository.GemfireRepository
* @see org.springframework.data.gemfire.repository.sample.Programmer
* @since 1.3.4
* @since 1.4.0
*/
@SuppressWarnings("unused")
public interface ProgrammerRepository extends GemfireRepository<Programmer, String> {

View File

@@ -23,7 +23,7 @@ import org.springframework.data.gemfire.repository.Query;
/**
* The RabbitRepository class is a Spring Data GemFire Repository extension for accessing and persistent Rabbits
* from/to an underlying data store (GemFire).
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.mapping.Region
* @see org.springframework.data.gemfire.repository.GemfireRepository

View File

@@ -20,11 +20,11 @@ import org.springframework.data.gemfire.mapping.Region;
/**
* The RootUser class represents an authorized administrative user of a service or computer system, etc.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.mapping.Region
* @see org.springframework.data.gemfire.repository.sample.User
* @since 1.3.4
* @since 1.4.0
*/
@Region("/Local/Admin/Users")
@SuppressWarnings("unused")

View File

@@ -22,11 +22,11 @@ import org.springframework.data.gemfire.repository.GemfireRepository;
/**
* The RootUserRepository class is a DAO for accessing and persisting RootUsers.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.repository.GemfireRepository
* @see org.springframework.data.gemfire.repository.sample.RootUser
* @since 1.3.4
* @since 1.4.0
*/
@SuppressWarnings("unused")
public interface RootUserRepository extends GemfireRepository<RootUser, String> {

View File

@@ -41,7 +41,7 @@ import com.gemstone.gemfire.cache.Region;
/**
* The SubRegionRepositoryTest class is a test suite of test cases testing the use of GemFire Repositories on GemFire
* Cache Subregions.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith
@@ -53,7 +53,7 @@ import com.gemstone.gemfire.cache.Region;
* @see com.gemstone.gemfire.cache.Region
* @link https://jira.springsource.org/browse/SGF-251
* @link https://jira.springsource.org/browse/SGF-252
* @since 1.0.0
* @since 1.4.0
*/
@ContextConfiguration("subregionRepository.xml")
@RunWith(SpringJUnit4ClassRunner.class)

View File

@@ -25,12 +25,12 @@ import org.springframework.util.ObjectUtils;
/**
* The User class represents an authorized user of a service or computer system, etc.
* <p/>
*
* @author John Blum
* @see java.lang.Comparable
* @see org.springframework.data.annotation.Id
* @see org.springframework.data.gemfire.mapping.Region
* @since 1.3.4
* @since 1.4.0
*/
@Region("Users")
@SuppressWarnings("unused")

View File

@@ -22,12 +22,12 @@ import org.springframework.data.gemfire.repository.GemfireRepository;
/**
* The UserRepository class is a DAO for accessing and persisting Users.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.repository.GemfireRepository
* @see org.springframework.data.gemfire.repository.Query
* @see org.springframework.data.gemfire.repository.sample.User
* @since 1.3.4
* @since 1.4.0
*/
@SuppressWarnings("unused")
public interface UserRepository extends GemfireRepository<User, String> {

View File

@@ -39,14 +39,13 @@ import com.gemstone.gemfire.cache.Region;
/**
* The RepositoryQueriesTest class is a test suite of test cases testing the GemFire Query capability of Spring Data
* GemFire Repositories.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith
* @see org.springframework.test.context.ContextConfiguration
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
* @since 1.3.3 (Spring Data GemFire)
* @since 7.0.1 (GemFire)
* @since 1.3.3
*/
@ContextConfiguration("userRepositoryQueriesIntegrationTest.xml")
@RunWith(SpringJUnit4ClassRunner.class)

View File

@@ -15,8 +15,8 @@
*/
package org.springframework.data.gemfire.repository.support;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
@@ -26,32 +26,39 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.gemfire.mapping.GemfireMappingContext;
import org.springframework.data.gemfire.repository.sample.Person;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.Repository;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionAttributes;
/**
* Unit tests for {@link GemfireRepositoryFactory}.
*
*
* @author Oliver Gierke
* @author John Blum
* @see org.springframework.data.gemfire.repository.support.GemfireRepositoryFactory
*/
@RunWith(MockitoJUnitRunner.class)
@SuppressWarnings("unused")
public class GemfireRepositoryFactoryUnitTests {
@Mock
Region<?, ?> region;
private Region<?, ?> region;
@Mock
@SuppressWarnings("rawtypes")
RegionAttributes attributes;
private RegionAttributes attributes;
/**
* @see SGF-112
* @link https://jira.spring.io/browse/SGF-112
*/
@Test
@Test(expected = IllegalStateException.class)
@SuppressWarnings("unchecked")
public void rejectsInterfacesExtendingPagingAndSortingRepository() {
@@ -67,12 +74,23 @@ public class GemfireRepositoryFactoryUnitTests {
try {
factory.getRepository(SampleInterface.class);
} catch (IllegalStateException e) {
assertThat(e.getMessage(), Matchers.startsWith("Pagination is not supported by Gemfire repositories!"));
//factory.getRepository(SamplePagingInterface.class);
//factory.getRepository(SampleSortingInterface.class);
} catch (IllegalStateException expected) {
assertThat(expected.getMessage(), Matchers.startsWith("Pagination is not supported by Gemfire repositories!"));
throw expected;
}
}
interface SampleInterface extends PagingAndSortingRepository<Person, Long> {
}
interface SamplePagingInterface extends Repository<Person, Long> {
Page<Person> findAll(Pageable pageable);
}
interface SampleSortingInterface extends Repository<Person, Long> {
Iterable<Person> findAll(Sort sort);
}
}

View File

@@ -28,7 +28,7 @@ import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
/**
* The ClientRegionShortcutWrapperTest class is a test suite of test cases testing the contract and functionality of the
* ClientRegionShortcutWrapper enum class type.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.support.ClientRegionShortcutWrapper

View File

@@ -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<Region<Object, Obj
}
@Override
@SuppressWarnings({"deprecation", "unchecked" })
protected Region<Object, Object> createNativeCache() throws Exception {
com.gemstone.gemfire.cache.Cache instance = null;
try {
@@ -49,9 +49,10 @@ public class GemfireCacheTest extends AbstractNativeCacheTest<Region<Object, Obj
}
Region reg = instance.getRegion(CACHE_NAME);
if (reg == null) {
reg = instance.createRegion(CACHE_NAME, new AttributesFactory().create());
reg = instance.createRegion(CACHE_NAME, new com.gemstone.gemfire.cache.AttributesFactory().create());
}
return reg;
}
}

View File

@@ -19,11 +19,8 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -38,11 +35,12 @@ import com.gemstone.gemfire.cache.query.SelectResults;
/**
* @author David Turanski
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@SuppressWarnings("unchecked")
public class JSONRegionAdviceTest {
@SuppressWarnings("rawtypes")
@Resource(name="someRegion")
private Region region;
@@ -75,14 +73,14 @@ public class JSONRegionAdviceTest {
map.put("key1", "{\"hello1\":\"world1\"}");
map.put("key2", "{\"hello2\":\"world2\"}");
region.putAll(map);
List<String> keys = Arrays.asList(new String[]{"key1","key2"});
List<String> keys = Arrays.asList("key1", "key2");
Map<String,String> 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");

View File

@@ -28,7 +28,7 @@ import com.gemstone.gemfire.cache.RegionShortcut;
/**
* The RegionShortcutWrapperTest class is a test suite of test cases testing the contract and functionality of the
* RegionShortcutWrapper enum class type.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.data.gemfire.support.RegionShortcutWrapper

View File

@@ -54,7 +54,7 @@ import com.gemstone.gemfire.cache.Region;
/**
* The SpringContextBootstrappingInitializerTest class is a test suite of test cases testing the integrated
* functionality of the SpringContextBootstrappingInitializer class.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.context.ConfigurableApplicationContext
@@ -64,8 +64,7 @@ import com.gemstone.gemfire.cache.Region;
* @see com.gemstone.gemfire.cache.CacheFactory
* @see com.gemstone.gemfire.cache.CacheLoader
* @see com.gemstone.gemfire.cache.Region
* @since 1.3.4 (Spring Data GemFire)
* @since 7.0.1 (GemFire)
* @since 1.4.0
*/
@SuppressWarnings("unused")
public class SpringContextBootstrappingInitializerIntegrationTest {

View File

@@ -43,14 +43,14 @@ import org.springframework.util.ObjectUtils;
* and functionality of the SpringContextBootstrappingInitializer class. This test class focuses on testing isolated
* units of functionality in the Initializer class directly, mocking any dependencies as appropriate, in order for the
* class to uphold it's contract.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.mockito.Mockito
* @see org.springframework.context.ConfigurableApplicationContext
* @see org.springframework.data.gemfire.support.SpringContextBootstrappingInitializer
* @see org.springframework.data.gemfire.support.SpringContextBootstrappingInitializerIntegrationTest
* @since 1.3.4
* @since 1.4.0
*/
@SuppressWarnings("unused")
public class SpringContextBootstrappingInitializerTest {

View File

@@ -25,12 +25,12 @@ import org.springframework.util.Assert;
/**
* The TestUserDao class is an implementation of the UserDao Data Access Object (DAO) interface for performing
* data access and persistence operations on Users.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.repository.sample.User
* @see org.springframework.data.gemfire.support.sample.UserDao
* @see org.springframework.stereotype.Repository
* @since 1.3.4
* @since 1.4.0
*/
@Repository("userDao")
@SuppressWarnings("unused")

View File

@@ -23,12 +23,12 @@ import org.springframework.util.Assert;
/**
* The TestUserService class is an implementation of the UserService service interface for performing service operations
* on Users.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.repository.sample.User
* @see org.springframework.data.gemfire.support.sample.UserService
* @see org.springframework.stereotype.Service
* @since 1.3.4
* @since 1.4.0
*/
@Service("userService")
@SuppressWarnings("unused")

View File

@@ -24,13 +24,13 @@ import org.springframework.context.annotation.ImportResource;
import org.springframework.data.gemfire.support.SpringContextBootstrappingInitializerIntegrationTest;
/**
* The UserApplicationConfiguration class is a configuration component for confguring the user's application.
* <p/>
* The UserApplicationConfiguration class is a configuration component for configuring the user's application.
*
* @author John Blum
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.Configuration
* @see org.springframework.context.annotation.ImportResource
* @since 1.3.4
* @since 1.4.0
*/
@Configuration
@ImportResource({ "classpath:org/springframework/data/gemfire/support/sample/initializer-gemfire-context.xml" })

View File

@@ -18,10 +18,10 @@ package org.springframework.data.gemfire.support.sample;
/**
* The UserDao interface is a contract for implementing objects containing data access functionality for Users.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.repository.sample.User
* @since 1.3.4
* @since 1.4.0
*/
public interface UserDao {
}

View File

@@ -18,10 +18,10 @@ package org.springframework.data.gemfire.support.sample;
/**
* The UserService interface is a contract for implementing objects to service Users.
* <p/>
*
* @author John Blum
* @see org.springframework.data.gemfire.repository.sample.User
* @since 1.3.4
* @since 1.4.0
*/
public interface UserService {
}

View File

@@ -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<K,V> {
private static QueryService queryService = mock(QueryService.class);
private static RegionService regionService = mock(RegionService.class);
private AttributesFactory<K,V> attributesFactory;
private com.gemstone.gemfire.cache.AttributesFactory<K,V> attributesFactory;
private final StubCache cache;
@@ -65,10 +63,10 @@ public class MockRegionFactory<K,V> {
return createMockRegionFactory(null);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings({ "deprecation", "rawtypes", "unchecked" })
public RegionFactory<K, V> createMockRegionFactory(RegionAttributes<K,V> attributes) {
attributesFactory = (attributes != null ? new AttributesFactory<K,V>(attributes)
: new AttributesFactory<K,V>());
attributesFactory = (attributes != null ? new com.gemstone.gemfire.cache.AttributesFactory<K,V>(attributes)
: new com.gemstone.gemfire.cache.AttributesFactory<K,V>());
//Workaround for GemFire bug
if (attributes !=null) {
@@ -340,10 +338,12 @@ public class MockRegionFactory<K,V> {
}
});
when(regionFactory.setDiskWriteAttributes(any(DiskWriteAttributes.class))).thenAnswer(new Answer<RegionFactory>(){
when(regionFactory.setDiskWriteAttributes(any(com.gemstone.gemfire.cache.DiskWriteAttributes.class)))
.thenAnswer(new Answer<RegionFactory>(){
@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<K,V> {
when(region.getAttributes()).thenAnswer(new Answer<RegionAttributes>() {
@Override
public RegionAttributes answer(InvocationOnMock invocation) throws Throwable {
RegionAttributes attributes = attributesFactory.create();
return attributes;
return attributesFactory.create();
}
});
@@ -523,9 +522,7 @@ public class MockRegionFactory<K,V> {
String subRegionPath = (parentRegionName.startsWith("/") ? parentRegionName+"/"+subRegionName
: "/"+parentRegionName+"/"+subRegionName);
Region region = cache.getRegion(subRegionPath);
return region;
return cache.getRegion(subRegionPath);
}
});

View File

@@ -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 <K, V> RegionFactory<K, V> createRegionFactory() {
RegionFactory<K, V> regionFactory = new MockRegionFactory<K,V>(this).createRegionFactory();
return regionFactory;
return new MockRegionFactory<K,V>(this).createRegionFactory();
}
/* (non-Javadoc)
@@ -472,8 +474,7 @@ public class StubCache implements Cache {
@SuppressWarnings("unchecked")
@Override
public <K, V> RegionFactory<K, V> createRegionFactory(RegionShortcut shortCut) {
RegionFactory<K, V> regionFactory = new MockRegionFactory<K,V>(this).createRegionFactory();
return regionFactory;
return new MockRegionFactory<K,V>(this).createRegionFactory();
}
/* (non-Javadoc)
@@ -482,8 +483,7 @@ public class StubCache implements Cache {
@SuppressWarnings("unchecked")
@Override
public <K, V> RegionFactory<K, V> createRegionFactory(String arg0) {
RegionFactory<K, V> regionFactory = new MockRegionFactory<K,V>(this).createRegionFactory();
return regionFactory;
return new MockRegionFactory<K,V>(this).createRegionFactory();
}
/* (non-Javadoc)
@@ -491,8 +491,7 @@ public class StubCache implements Cache {
*/
@Override
public <K, V> RegionFactory<K, V> createRegionFactory(RegionAttributes<K, V> regionAttributes) {
RegionFactory<K, V> regionFactory = new MockRegionFactory<K,V>(this).createMockRegionFactory(regionAttributes);
return regionFactory;
return new MockRegionFactory<K,V>(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<Index>(){
@@ -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;
}
}
}

View File

@@ -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;

View File

@@ -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;
/**
* @author David Turanski
* 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;
}
}

View File

@@ -19,12 +19,15 @@ package org.springframework.data.gemfire.test.support;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;
import javax.sql.DataSource;
/**
* The DataSourceAdapter class is an implementation of the DataSource interface with unsupported operations by default.
* <p/>
*
* @author John Blum
* @see java.sql.Connection
* @see javax.sql.DataSource
* @since 1.3.4
*/
@@ -63,6 +66,11 @@ public abstract class DataSourceAdapter implements DataSource {
throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE);
}
//@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE);
}
@Override
public boolean isWrapperFor(final Class<?> iface) throws SQLException {
throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_EXCEPTION_MESSAGE);

View File

@@ -39,7 +39,7 @@ import com.gemstone.gemfire.cache.util.Gateway;
/**
* The AsyncEventQueueFactoryBeanTest class is a test suite of test cases testing the contract and functionality
* of the AsyncEventQueueFactoryBean class.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.mockito.Mockito

View File

@@ -41,7 +41,7 @@ import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
* The AsyncEvenntQueueWithListenerTest class is a test suite of test cases testing the circular references between
* an Async Event Queue and a registered AsyncEventListener that refers back to the Async Event Queue on which the
* listener registered.
* <p/>
*
* @author John Blum
* @see org.junit.Test
* @see org.junit.runner.RunWith
@@ -103,7 +103,7 @@ public class AsyncEventQueueWithListenerIntegrationTest {
/**
* The QueueAsyncEventListener class is an implementation of the AsyncEventListener interface that contains
* a reference to the AsyncEventQueue upon which it is registered.
* <p/>
*
* @see com.gemstone.gemfire.cache.asyncqueue.AsyncEvent
* @see com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener
* @see com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue

View File

@@ -35,7 +35,7 @@ import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
/**
* The GatewaySenderFactoryBeanTest class is a test suite of test cases testing the contract and functionality of the
* GatewaySenderFactoryBean class.
* <p/>
*
* @author John Blum
* @see com.gemstone.gemfire.cache.Cache
* @see com.gemstone.gemfire.cache.wan.GatewaySender