Extend the STDG o.s.d.g.tests.integration.IntegrationTestsSupport abstract base class in all Integration-based Tests.
This applies to test classes in particular that bootstrap and configure Apache Geode in a Spring ApplicationContext using the JUnit4 SpringRunner class. Resolves gh-296.
This commit is contained in:
@@ -43,6 +43,7 @@ import org.springframework.core.Ordered;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.annotation.OrderUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.util.CollectionUtils;
|
||||
import org.springframework.data.gemfire.util.SpringUtils;
|
||||
import org.springframework.data.gemfire.util.StreamUtils;
|
||||
@@ -52,7 +53,7 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration Tests testing the bean ordering applied by the Spring {@link ApplicationContext}
|
||||
* Integration Tests asserting the bean ordering applied by the Spring {@link ApplicationContext}
|
||||
* or Spring {@link BeanFactory} when using the {@link Order} annotation or implementing the {@link Ordered} interface.
|
||||
*
|
||||
* @author John Blum
|
||||
@@ -60,6 +61,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.beans.factory.ListableBeanFactory
|
||||
* @see org.springframework.core.Ordered
|
||||
* @see org.springframework.core.annotation.Order
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.3.0
|
||||
@@ -67,7 +69,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ApplicationContextBeanOrderingIntegrationTests {
|
||||
public class ApplicationContextBeanOrderingIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
@@ -13,25 +13,28 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests to test the contract and functionality of Spring Data GemFire's Auto Region Lookup functionality.
|
||||
* Integration Tests for SDG Auto {@link Region} Lookup functionality.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @since 1.5.0
|
||||
@@ -39,19 +42,20 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class AutoRegionLookupIntegrationTests {
|
||||
public class AutoRegionLookupIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Test
|
||||
public void testAutoRegionLookup() {
|
||||
assertTrue(applicationContext.containsBean("SpringPartitionedRegion"));
|
||||
assertTrue(applicationContext.containsBean("SpringReplicateParent"));
|
||||
assertTrue(applicationContext.containsBean("/SpringReplicateParent/SpringReplicateChild"));
|
||||
assertTrue(applicationContext.containsBean("NativePartitionedRegion"));
|
||||
assertTrue(applicationContext.containsBean("NativeReplicateParent"));
|
||||
assertTrue(applicationContext.containsBean("/NativeReplicateParent/NativeReplicateChild"));
|
||||
assertTrue(applicationContext.containsBean("/NativeReplicateParent/NativeReplicateChild/NativeReplicateGrandchild"));
|
||||
|
||||
assertThat(this.applicationContext.containsBean("SpringPartitionedRegion")).isTrue();
|
||||
assertThat(this.applicationContext.containsBean("SpringReplicateParent")).isTrue();
|
||||
assertThat(this.applicationContext.containsBean("/SpringReplicateParent/SpringReplicateChild")).isTrue();
|
||||
assertThat(this.applicationContext.containsBean("NativePartitionedRegion")).isTrue();
|
||||
assertThat(this.applicationContext.containsBean("NativeReplicateParent")).isTrue();
|
||||
assertThat(this.applicationContext.containsBean("/NativeReplicateParent/NativeReplicateChild")).isTrue();
|
||||
assertThat(this.applicationContext.containsBean("/NativeReplicateParent/NativeReplicateChild/NativeReplicateGrandchild")).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,33 +13,32 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.geode.cache.DataPolicy;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.DataPolicy;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests to test the behavior of Spring Data GemFire's Auto Region Lookup functionality
|
||||
* when combined with Spring's component auto-wiring capabilities.
|
||||
* Integration Tests for SDG's Auto {@link Region} Lookup functionality when combined with Spring's component
|
||||
* auto-wiring capabilities.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @since 1.5.0
|
||||
@@ -47,10 +46,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class AutoRegionLookupWithAutowiringIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
private TestComponent testComponent;
|
||||
public class AutoRegionLookupWithAutowiringIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static void assertRegionMetaData(Region<?, ?> region, String expectedName, DataPolicy expectedDataPolicy) {
|
||||
assertRegionMetaData(region, expectedName, Region.SEPARATOR + expectedName, expectedDataPolicy);
|
||||
@@ -59,14 +55,24 @@ public class AutoRegionLookupWithAutowiringIntegrationTests {
|
||||
private static void assertRegionMetaData(Region<?, ?> region, String expectedName, String expectedFullPath,
|
||||
DataPolicy expectedDataPolicy) {
|
||||
|
||||
assertNotNull(String.format("Region (%1$s) was not properly configured and initialized!", expectedName), region);
|
||||
assertEquals(expectedName, region.getName());
|
||||
assertEquals(expectedFullPath, region.getFullPath());
|
||||
assertNotNull(String.format("Region (%1$s) must have RegionAttributes defined!", expectedName), region.getAttributes());
|
||||
assertEquals(expectedDataPolicy, region.getAttributes().getDataPolicy());
|
||||
assertFalse(region.getAttributes().getDataPolicy().withPersistence());
|
||||
assertThat(region)
|
||||
.describedAs(String.format("Region (%1$s) was not properly configured and initialized!", expectedName))
|
||||
.isNotNull();
|
||||
|
||||
assertThat(region.getName()).isEqualTo(expectedName);
|
||||
assertThat(region.getFullPath()).isEqualTo(expectedFullPath);
|
||||
|
||||
assertThat(region.getAttributes())
|
||||
.describedAs(String.format("Region (%1$s) must have RegionAttributes defined!", expectedName))
|
||||
.isNotNull();
|
||||
|
||||
assertThat(region.getAttributes().getDataPolicy()).isEqualTo(expectedDataPolicy);
|
||||
assertThat(region.getAttributes().getDataPolicy().withPersistence()).isFalse();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TestComponent testComponent;
|
||||
|
||||
@Test
|
||||
public void testAutowiredNativeRegions() {
|
||||
|
||||
|
||||
@@ -13,35 +13,36 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests to test the behavior of Spring Data GemFire's Auto Region Lookup behavior
|
||||
* with Spring component scanning functionality.
|
||||
* Integration Tests for SDG's Auto {@link Region} Lookup behavior with Spring component scanning functionality.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class AutoRegionLookupWithComponentScanningIntegrationTests {
|
||||
public class AutoRegionLookupWithComponentScanningIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
@@ -49,8 +50,10 @@ public class AutoRegionLookupWithComponentScanningIntegrationTests {
|
||||
@Test
|
||||
public void testAutowiredNativeRegions() {
|
||||
|
||||
assertTrue("The 'autoRegionLookupDao' Spring bean DAO was not properly configured an initialized!",
|
||||
this.applicationContext.containsBean("autoRegionLookupDao"));
|
||||
assertNotNull(this.applicationContext.getBean("autoRegionLookupDao", AutoRegionLookupDao.class));
|
||||
assertThat(this.applicationContext.containsBean("autoRegionLookupDao"))
|
||||
.describedAs("The 'autoRegionLookupDao' Spring bean DAO was not properly configured an initialized!")
|
||||
.isTrue();
|
||||
|
||||
assertThat(this.applicationContext.getBean("autoRegionLookupDao", AutoRegionLookupDao.class)).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,39 +13,41 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration test trying various basic configurations of GemFire through
|
||||
* Spring.
|
||||
*
|
||||
* Made abstract to avoid multiple caches running at the same time.
|
||||
* Integration Tests trying various basic configurations of Apache Geode caches with Spring.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(locations = "basic-cache.xml")
|
||||
public class CacheIntegrationTest {
|
||||
public class CacheIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
ApplicationContext applicationContext;
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
Cache cache;
|
||||
private Cache cache;
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
@@ -53,30 +55,30 @@ public class CacheIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicCache() throws Exception {
|
||||
cache = applicationContext.getBean("default-cache",Cache.class);
|
||||
public void testBasicCache() {
|
||||
this.cache = this.applicationContext.getBean("default-cache",Cache.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheWithProps() throws Exception {
|
||||
public void testCacheWithProps() {
|
||||
cache = applicationContext.getBean("cache-with-props", Cache.class);
|
||||
|
||||
// the name property seems to be ignored
|
||||
assertEquals("cache-with-props", cache.getDistributedSystem().getName());
|
||||
assertEquals("cache-with-props", cache.getName());
|
||||
assertThat(cache.getDistributedSystem().getName()).isEqualTo("cache-with-props");
|
||||
assertThat(cache.getName()).isEqualTo("cache-with-props");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNamedCache() throws Exception {
|
||||
public void testNamedCache() {
|
||||
|
||||
cache = applicationContext.getBean("named-cache", Cache.class);
|
||||
this.cache = this.applicationContext.getBean("named-cache", Cache.class);
|
||||
|
||||
assertEquals("named-cache", cache.getDistributedSystem().getName());
|
||||
assertEquals("named-cache", cache.getName());
|
||||
assertThat(cache.getDistributedSystem().getName()).isEqualTo("named-cache");
|
||||
assertThat(cache.getName()).isEqualTo("named-cache");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheWithXml() throws Exception {
|
||||
applicationContext.getBean("cache-with-xml", Cache.class);
|
||||
public void testCacheWithXml() {
|
||||
this.applicationContext.getBean("cache-with-xml", Cache.class);
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.data.gemfire.repository.sample.User;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.util.CacheUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -56,8 +57,10 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.query.SelectResults
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.GemfireTemplate
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.4.0
|
||||
@@ -65,7 +68,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class GemfireTemplateIntegrationTests {
|
||||
public class GemfireTemplateIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
protected static final String DEFAULT_GEMFIRE_LOG_LEVEL = "error";
|
||||
|
||||
|
||||
@@ -61,22 +61,24 @@ import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Integrations Tests for {@link GemfireTemplate} testing the proper function and behavior of executing (OQL) queries
|
||||
* from a cache client application using the {@link GemfireTemplate} to a cluster of GemFire servers that have
|
||||
* Integrations Tests for {@link GemfireTemplate} testing the proper function and behavior of executing OQL queries
|
||||
* from a cache client application using the {@link GemfireTemplate} to a cluster of Apache Geode servers that have
|
||||
* been grouped according to business function and data access in order to distribute the load.
|
||||
*
|
||||
* Each GemFire {@link Pool} is configured to target a specific server group. Each group of servers in the cluster
|
||||
* defines specific {@link Region Regions} to manage data independently and separately from other data that might
|
||||
* garner high frequency access.
|
||||
* Each Apache Geode {@link Pool} is configured to target a specific server group. Each group of servers in the cluster
|
||||
* defines specific {@link Region Regions} to manage data independently and separately from other data that might garner
|
||||
* high frequency access.
|
||||
*
|
||||
* Spring Data GemFire's {@link GemfireTemplate} should intelligently employ the right
|
||||
* Spring Data for Apache Geode's {@link GemfireTemplate} should intelligently employ the right
|
||||
* {@link org.apache.geode.cache.query.QueryService} configured with the {@link Region Region's} {@link Pool}
|
||||
* metadata when executing the query in order to ensure the right servers containing the {@link Region Region's}
|
||||
* with the data of interest are targeted.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.GemfireTemplate
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
|
||||
@@ -15,9 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.data.Offset.offset;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -51,18 +50,20 @@ import org.apache.geode.cache.asyncqueue.AsyncEventListener;
|
||||
import org.apache.geode.cache.util.CacheListenerAdapter;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Integration Tests for {@link LookupRegionFactoryBean} testing the contract and integrated functionality between
|
||||
* natively-defined GemFire/Geode cache {@link Region Regions} and SDG's {@link Region} lookup functionality
|
||||
* combined with {@link org.apache.geode.cache.RegionAttributes} {@link Region#getAttributesMutator() mutation}.
|
||||
* Integration Tests testing the contract and integratino between natively-defined cache {@link Region Regions}
|
||||
* and SDG's {@link Region} lookup functionality combined with {@link Region} attribute(s) mutation.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.LookupRegionFactoryBean
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.7.0
|
||||
@@ -70,50 +71,52 @@ import org.springframework.util.StringUtils;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class LookupRegionMutationIntegrationTest {
|
||||
public class LookupRegionMutationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Resource(name = "Example")
|
||||
private Region<?, ?> example;
|
||||
|
||||
private void assertCacheListeners(CacheListener<?, ?>[] cacheListeners, Collection<String> expectedCacheListenerNames) {
|
||||
private void assertCacheListeners(CacheListener<?, ?>[] cacheListeners,
|
||||
Collection<String> expectedCacheListenerNames) {
|
||||
|
||||
if (!expectedCacheListenerNames.isEmpty()) {
|
||||
assertNotNull("CacheListeners must not be null!", cacheListeners);
|
||||
assertEquals(expectedCacheListenerNames.size(), cacheListeners.length);
|
||||
assertTrue(toStrings(cacheListeners).containsAll(expectedCacheListenerNames));
|
||||
assertThat(cacheListeners).as("CacheListeners must not be null!").isNotNull();
|
||||
assertThat(cacheListeners.length).isEqualTo(expectedCacheListenerNames.size());
|
||||
assertThat(toStrings(cacheListeners).containsAll(expectedCacheListenerNames)).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
private void assertEvictionAttributes(EvictionAttributes evictionAttributes, EvictionAction expectedAction,
|
||||
EvictionAlgorithm expectedAlgorithm, int expectedMaximum) {
|
||||
|
||||
assertNotNull("EvictionAttributes must not be null!", evictionAttributes);
|
||||
assertEquals(expectedAction, evictionAttributes.getAction());
|
||||
assertEquals(expectedAlgorithm, evictionAttributes.getAlgorithm());
|
||||
assertEquals(expectedMaximum, evictionAttributes.getMaximum());
|
||||
assertThat(evictionAttributes).as("EvictionAttributes must not be null!").isNotNull();
|
||||
assertThat(evictionAttributes.getAction()).isEqualTo(expectedAction);
|
||||
assertThat(evictionAttributes.getAlgorithm()).isEqualTo(expectedAlgorithm);
|
||||
assertThat(evictionAttributes.getMaximum()).isEqualTo(expectedMaximum);
|
||||
}
|
||||
|
||||
private void assertExpirationAttributes(ExpirationAttributes expirationAttributes,
|
||||
|
||||
String description, int expectedTimeout, ExpirationAction expectedAction) {
|
||||
|
||||
assertNotNull(String.format("ExpirationAttributes for '%1$s' must not be null!", description), expirationAttributes);
|
||||
assertEquals(expectedAction, expirationAttributes.getAction());
|
||||
assertEquals(expectedTimeout, expirationAttributes.getTimeout());
|
||||
assertThat(expirationAttributes)
|
||||
.as(String.format("ExpirationAttributes for '%1$s' must not be null!", description)).isNotNull();
|
||||
assertThat(expirationAttributes.getAction()).isEqualTo(expectedAction);
|
||||
assertThat(expirationAttributes.getTimeout()).isEqualTo(expectedTimeout);
|
||||
}
|
||||
|
||||
private void assertGatewaySenders(Region<?, ?> region, List<String> expectedGatewaySenderIds) {
|
||||
|
||||
assertNotNull(region.getAttributes());
|
||||
assertNotNull(region.getAttributes().getGatewaySenderIds());
|
||||
assertEquals(expectedGatewaySenderIds.size(), region.getAttributes().getGatewaySenderIds().size());
|
||||
assertTrue(expectedGatewaySenderIds.containsAll(region.getAttributes().getGatewaySenderIds()));
|
||||
assertThat(region.getAttributes()).isNotNull();
|
||||
assertThat(region.getAttributes().getGatewaySenderIds()).isNotNull();
|
||||
assertThat(region.getAttributes().getGatewaySenderIds().size()).isEqualTo(expectedGatewaySenderIds.size());
|
||||
assertThat(expectedGatewaySenderIds.containsAll(region.getAttributes().getGatewaySenderIds())).isTrue();
|
||||
}
|
||||
|
||||
private void assertGemFireComponent(Object gemfireComponent, String expectedName) {
|
||||
|
||||
assertNotNull("The GemFire component must not be null!", gemfireComponent);
|
||||
assertEquals(expectedName, gemfireComponent.toString());
|
||||
assertThat(gemfireComponent).as("The GemFire component must not be null!").isNotNull();
|
||||
assertThat(gemfireComponent.toString()).isEqualTo(expectedName);
|
||||
}
|
||||
|
||||
private void assertRegionAttributes(Region<?, ?> region, String expectedName, DataPolicy expectedDataPolicy) {
|
||||
@@ -125,11 +128,11 @@ public class LookupRegionMutationIntegrationTest {
|
||||
private void assertRegionAttributes(Region<?, ?> region, String expectedName, String expectedFullPath,
|
||||
DataPolicy expectedDataPolicy) {
|
||||
|
||||
assertNotNull(String.format("'%1$s' Region was not properly initialized!", region));
|
||||
assertEquals(expectedName, region.getName());
|
||||
assertEquals(expectedFullPath, region.getFullPath());
|
||||
assertNotNull(region.getAttributes());
|
||||
assertEquals(expectedDataPolicy, region.getAttributes().getDataPolicy());
|
||||
assertThat(String.format("'%1$s' Region was not properly initialized!", region)).isNotNull();
|
||||
assertThat(region.getName()).isEqualTo(expectedName);
|
||||
assertThat(region.getFullPath()).isEqualTo(expectedFullPath);
|
||||
assertThat(region.getAttributes()).isNotNull();
|
||||
assertThat(region.getAttributes().getDataPolicy()).isEqualTo(expectedDataPolicy);
|
||||
}
|
||||
|
||||
private Collection<String> toStrings(Object[] objects) {
|
||||
@@ -150,8 +153,8 @@ public class LookupRegionMutationIntegrationTest {
|
||||
public void regionConfigurationIsCorrect() {
|
||||
|
||||
assertRegionAttributes(example, "Example", DataPolicy.NORMAL);
|
||||
assertEquals(13, example.getAttributes().getInitialCapacity());
|
||||
assertEquals(0.85f, example.getAttributes().getLoadFactor(), 0.0f);
|
||||
assertThat(example.getAttributes().getInitialCapacity()).isEqualTo(13);
|
||||
assertThat(example.getAttributes().getLoadFactor()).isCloseTo(0.85f, offset(0.0f));
|
||||
assertCacheListeners(example.getAttributes().getCacheListeners(), Arrays.asList("A", "B"));
|
||||
assertGemFireComponent(example.getAttributes().getCacheLoader(), "C");
|
||||
assertGemFireComponent(example.getAttributes().getCacheWriter(), "D");
|
||||
@@ -164,9 +167,9 @@ public class LookupRegionMutationIntegrationTest {
|
||||
assertExpirationAttributes(example.getAttributes().getEntryTimeToLive(), "Entry TTL",
|
||||
30, ExpirationAction.DESTROY);
|
||||
assertGemFireComponent(example.getAttributes().getCustomEntryIdleTimeout(), "E");
|
||||
assertNotNull(example.getAttributes().getAsyncEventQueueIds());
|
||||
assertEquals(1, example.getAttributes().getAsyncEventQueueIds().size());
|
||||
assertEquals("AEQ", example.getAttributes().getAsyncEventQueueIds().iterator().next());
|
||||
assertThat(example.getAttributes().getAsyncEventQueueIds()).isNotNull();
|
||||
assertThat(example.getAttributes().getAsyncEventQueueIds().size()).isEqualTo(1);
|
||||
assertThat(example.getAttributes().getAsyncEventQueueIds().iterator().next()).isEqualTo("AEQ");
|
||||
assertGatewaySenders(example, Collections.singletonList("GWS"));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright 2010-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration Tests testing the contract and functionality of Region lookups using SDG XML namespace configuration
|
||||
* metadata and Apache Geode native cache.xml.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.context.ApplicationContext
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @since 1.3.3
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration("lookupSubRegion.xml")
|
||||
@SuppressWarnings("unused")
|
||||
public class LookupSubRegionIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private void assertRegionExists(String expectedRegionName, String expectedRegionPath, Region<?, ?> region) {
|
||||
|
||||
assertThat(region)
|
||||
.describedAs("The Region with name (%1$s) at path (%2$s) was null!",expectedRegionName, expectedRegionPath)
|
||||
.isNotNull();
|
||||
|
||||
assertThat(region.getName())
|
||||
.describedAs("Expected Region name of %1$s; but was %2$s!", expectedRegionName, region.getName())
|
||||
.isEqualTo(expectedRegionName);
|
||||
|
||||
assertThat(region.getFullPath())
|
||||
.describedAs("Expected Region path of %1$s; but was %2$s!", expectedRegionPath, region.getFullPath())
|
||||
.isEqualTo(expectedRegionPath);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDirectLookup() {
|
||||
|
||||
Region<?, ?> accounts = applicationContext.getBean("/Customers/Accounts", Region.class);
|
||||
|
||||
assertRegionExists("Accounts", "/Customers/Accounts", accounts);
|
||||
assertThat(applicationContext.containsBean("Customers/Accounts")).isFalse();
|
||||
assertThat(applicationContext.containsBean("/Customers")).isFalse();
|
||||
assertThat(applicationContext.containsBean("Customers")).isFalse();
|
||||
|
||||
Region<?, ?> items = applicationContext.getBean("Customers/Accounts/Orders/Items", Region.class);
|
||||
|
||||
assertRegionExists("Items", "/Customers/Accounts/Orders/Items", items);
|
||||
assertThat(applicationContext.containsBean("/Customers/Accounts/Orders/Items")).isFalse();
|
||||
assertThat(applicationContext.containsBean("/Customers/Accounts/Orders")).isFalse();
|
||||
assertThat(applicationContext.containsBean("Customers/Accounts/Orders")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNestedLookup() {
|
||||
|
||||
Region<?, ?> parent = applicationContext.getBean("Parent", Region.class);
|
||||
|
||||
assertRegionExists("Parent", "/Parent", parent);
|
||||
assertThat(applicationContext.containsBean("/Parent")).isFalse();
|
||||
|
||||
Region<?, ?> child = applicationContext.getBean("/Parent/Child", Region.class);
|
||||
|
||||
assertRegionExists("Child", "/Parent/Child", child);
|
||||
assertThat(applicationContext.containsBean("Parent/Child")).isFalse();
|
||||
|
||||
Region<?, ?> grandchild = applicationContext.getBean("/Parent/Child/Grandchild", Region.class);
|
||||
|
||||
assertRegionExists("Grandchild", "/Parent/Child/Grandchild", grandchild);
|
||||
assertThat(applicationContext.containsBean("Parent/Child/Grandchild")).isFalse();
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
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.SpringRunner;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.context.ApplicationContext
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @since 1.3.3
|
||||
* @since 7.0.1 (GemFire)
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration("lookupSubRegion.xml")
|
||||
@SuppressWarnings("unused")
|
||||
public class LookupSubRegionTest {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private void assertRegionExists(final String expectedRegionName, final String expectedRegionPath, final Region region) {
|
||||
|
||||
assertNotNull(String.format("The Region with name (%1$s) at path (%2$s) was null!",
|
||||
expectedRegionName, expectedRegionPath), region);
|
||||
assertEquals(String.format("Expected Region name of %1$s; but was %2$s!", expectedRegionName, region.getName()),
|
||||
expectedRegionName, region.getName());
|
||||
assertEquals(String.format("Expected Region path of %1$s; but was %2$s!", expectedRegionPath, region.getFullPath()),
|
||||
expectedRegionPath, region.getFullPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDirectLookup() {
|
||||
|
||||
Region accounts = applicationContext.getBean("/Customers/Accounts", Region.class);
|
||||
|
||||
assertRegionExists("Accounts", "/Customers/Accounts", accounts);
|
||||
assertFalse(applicationContext.containsBean("Customers/Accounts"));
|
||||
assertFalse(applicationContext.containsBean("/Customers"));
|
||||
assertFalse(applicationContext.containsBean("Customers"));
|
||||
|
||||
Region items = applicationContext.getBean("Customers/Accounts/Orders/Items", Region.class);
|
||||
|
||||
assertRegionExists("Items", "/Customers/Accounts/Orders/Items", items);
|
||||
assertFalse(applicationContext.containsBean("/Customers/Accounts/Orders/Items"));
|
||||
assertFalse(applicationContext.containsBean("/Customers/Accounts/Orders"));
|
||||
assertFalse(applicationContext.containsBean("Customers/Accounts/Orders"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNestedLookup() {
|
||||
|
||||
Region parent = applicationContext.getBean("Parent", Region.class);
|
||||
|
||||
assertRegionExists("Parent", "/Parent", parent);
|
||||
assertFalse(applicationContext.containsBean("/Parent"));
|
||||
|
||||
Region child = applicationContext.getBean("/Parent/Child", Region.class);
|
||||
|
||||
assertRegionExists("Child", "/Parent/Child", child);
|
||||
assertFalse(applicationContext.containsBean("Parent/Child"));
|
||||
|
||||
Region grandchild = applicationContext.getBean("/Parent/Child/Grandchild", Region.class);
|
||||
|
||||
assertRegionExists("Grandchild", "/Parent/Child/Grandchild", grandchild);
|
||||
assertFalse(applicationContext.containsBean("Parent/Child/Grandchild"));
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.cache.config.EnableGemfireCaching;
|
||||
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;
|
||||
import org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -55,6 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.cache.config.EnableGemfireCaching
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.3.0
|
||||
@@ -62,9 +64,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class CacheErrorHandlerIntegrationTests {
|
||||
|
||||
private static final String GEMFIRE_LOG_LEVEL = "error";
|
||||
public class CacheErrorHandlerIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ClientCache clientCache;
|
||||
@@ -92,10 +92,10 @@ public class CacheErrorHandlerIntegrationTests {
|
||||
assertThat(this.cacheableService.processCacheableOperation("one")).isEqualTo("TEST");
|
||||
}
|
||||
|
||||
@ClientCacheApplication(logLevel = GEMFIRE_LOG_LEVEL)
|
||||
@ClientCacheApplication
|
||||
@EnableCachingDefinedRegions
|
||||
@EnableGemfireCaching
|
||||
static class GeodeClientConfiguration extends CachingConfigurerSupport {
|
||||
static class GeodeClientTestConfiguration extends CachingConfigurerSupport {
|
||||
|
||||
@Nullable @Override
|
||||
public CacheErrorHandler errorHandler() {
|
||||
|
||||
@@ -22,39 +22,42 @@ import javax.annotation.Resource;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.LocalRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.cache.GemfireCacheManager;
|
||||
import org.springframework.data.gemfire.config.annotation.PeerCacheApplication;
|
||||
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;
|
||||
import org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link EnableGemfireCaching} and {@link GemfireCachingConfiguration}.
|
||||
* Integration Tests for {@link EnableGemfireCaching} and {@link GemfireCachingConfiguration}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.cache.annotation.Cacheable
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
* @see org.springframework.data.gemfire.cache.config.EnableGemfireCaching
|
||||
* @see org.springframework.data.gemfire.cache.config.GemfireCachingConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.PeerCacheApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
public class EnableGemfireCachingIntegrationTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableGemfireCachingIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private CalculatorService calculator;
|
||||
@@ -130,8 +133,10 @@ public class EnableGemfireCachingIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@ClientCacheApplication
|
||||
@EnableCachingDefinedRegions
|
||||
@EnableGemfireCaching
|
||||
@PeerCacheApplication(name = "EnableGemfireCachingIntegrationTests", logLevel = "warning")
|
||||
@EnableGemFireMockObjects
|
||||
@SuppressWarnings("unused")
|
||||
static class TestConfiguration {
|
||||
|
||||
@@ -139,17 +144,5 @@ public class EnableGemfireCachingIntegrationTests {
|
||||
CalculatorService calculatorService() {
|
||||
return new CalculatorService();
|
||||
}
|
||||
|
||||
@Bean("Factorials")
|
||||
LocalRegionFactoryBean<Long, Long> factorialsRegion(GemFireCache gemfireCache) {
|
||||
|
||||
LocalRegionFactoryBean<Long, Long> factorials = new LocalRegionFactoryBean<>();
|
||||
|
||||
factorials.setCache(gemfireCache);
|
||||
factorials.setClose(false);
|
||||
factorials.setPersistent(false);
|
||||
|
||||
return factorials;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,10 @@ package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -36,26 +33,20 @@ import org.apache.geode.cache.query.QueryService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.fork.ServerProcess;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessExecutor;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.tests.util.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.tests.util.ThreadUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Integration Tests for testing {@link ClientCache} {@link Index Indexes}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.apache.geode.cache.query.Index
|
||||
* @see org.apache.geode.cache.query.QueryService
|
||||
* @see org.springframework.data.gemfire.IndexFactoryBean
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.5.2
|
||||
@@ -63,9 +54,7 @@ import org.springframework.util.Assert;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientCacheIndexingIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static ProcessWrapper serverProcess;
|
||||
public class ClientCacheIndexingIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ClientCache clientCache;
|
||||
@@ -74,51 +63,19 @@ public class ClientCacheIndexingIntegrationTests extends IntegrationTestsSupport
|
||||
private Index exampleIndex;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws IOException {
|
||||
|
||||
String serverName = "GemFireIndexingCacheServer";
|
||||
|
||||
File serverWorkingDirectory = new File(FileSystemUtils.WORKING_DIRECTORY, serverName.toLowerCase());
|
||||
|
||||
Assert.isTrue(serverWorkingDirectory.isDirectory() || serverWorkingDirectory.mkdirs(),
|
||||
String.format("Server working directory [%s] does not exist and could not be created", serverWorkingDirectory));
|
||||
public static void startGeodeServer() throws IOException {
|
||||
|
||||
List<String> arguments = new ArrayList<>();
|
||||
|
||||
arguments.add("-Dgemfire.name=" + serverName);
|
||||
arguments.add("/org/springframework/data/gemfire/client/ClientCacheIndexingTest-server-context.xml");
|
||||
arguments.add(String.format("-Dgemfire.name=%s",
|
||||
ClientCacheIndexingIntegrationTests.class.getSimpleName().contains("Server")));
|
||||
|
||||
serverProcess = ProcessExecutor.launch(serverWorkingDirectory, ServerProcess.class,
|
||||
arguments.toArray(new String[0]));
|
||||
arguments.add(getServerContextXmlFileLocation(ClientCacheIndexingIntegrationTests.class));
|
||||
|
||||
waitForServerStart(TimeUnit.SECONDS.toMillis(20));
|
||||
startGemFireServer(ServerProcess.class, arguments.toArray(new String[0]));
|
||||
}
|
||||
|
||||
private static void waitForServerStart(final long milliseconds) {
|
||||
|
||||
ThreadUtils.timedWait(milliseconds, TimeUnit.MILLISECONDS.toMillis(500), new ThreadUtils.Condition() {
|
||||
|
||||
private final File serverPidControlFile =
|
||||
new File(serverProcess.getWorkingDirectory(), ServerProcess.getServerProcessControlFilename());
|
||||
|
||||
@Override
|
||||
public boolean evaluate() {
|
||||
return !serverPidControlFile.isFile();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDown() {
|
||||
|
||||
serverProcess.shutdown();
|
||||
|
||||
if (Boolean.parseBoolean(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
org.springframework.util.FileSystemUtils.deleteRecursively(serverProcess.getWorkingDirectory());
|
||||
}
|
||||
}
|
||||
|
||||
protected Index getIndex(final GemFireCache gemfireCache, final String indexName) {
|
||||
private Index getIndex(GemFireCache gemfireCache, String indexName) {
|
||||
|
||||
QueryService queryService = gemfireCache instanceof ClientCache
|
||||
? ((ClientCache) gemfireCache).getLocalQueryService()
|
||||
@@ -137,7 +94,9 @@ public class ClientCacheIndexingIntegrationTests extends IntegrationTestsSupport
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testIndexByName() {
|
||||
|
||||
assertThat(clientCache).as("The GemFire ClientCache was not properly configured and initialized!").isNotNull();
|
||||
assertThat(clientCache)
|
||||
.describedAs("The GemFire ClientCache was not properly configured and initialized!")
|
||||
.isNotNull();
|
||||
|
||||
Index actualIndex = getIndex(clientCache, "ExampleIndex");
|
||||
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
*/
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -31,6 +29,7 @@ import org.apache.geode.cache.CacheLoaderException;
|
||||
import org.apache.geode.cache.LoaderHelper;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.data.gemfire.fork.ServerProcess;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -55,8 +54,9 @@ import org.springframework.util.Assert;
|
||||
public class ClientCachePoolIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void setupGemFireServer() throws Exception {
|
||||
startGemFireServer(ClientCachePoolIntegrationTests.class);
|
||||
public static void startGeodeServer() throws Exception {
|
||||
startGemFireServer(ServerProcess.class,
|
||||
getServerContextXmlFileLocation(ClientCachePoolIntegrationTests.class));
|
||||
}
|
||||
|
||||
@Resource(name = "Factorials")
|
||||
@@ -65,16 +65,16 @@ public class ClientCachePoolIntegrationTests extends ForkingClientServerIntegrat
|
||||
@Test
|
||||
public void computeFactorials() {
|
||||
|
||||
assertThat(factorials.get(0l), is(equalTo(1l)));
|
||||
assertThat(factorials.get(1l), is(equalTo(1l)));
|
||||
assertThat(factorials.get(2l), is(equalTo(2l)));
|
||||
assertThat(factorials.get(3l), is(equalTo(6l)));
|
||||
assertThat(factorials.get(4l), is(equalTo(24l)));
|
||||
assertThat(factorials.get(5l), is(equalTo(120l)));
|
||||
assertThat(factorials.get(6l), is(equalTo(720l)));
|
||||
assertThat(factorials.get(7l), is(equalTo(5040l)));
|
||||
assertThat(factorials.get(8l), is(equalTo(40320l)));
|
||||
assertThat(factorials.get(9l), is(equalTo(362880l)));
|
||||
assertThat(factorials.get(0l)).isEqualTo(1l);
|
||||
assertThat(factorials.get(1l)).isEqualTo(1l);
|
||||
assertThat(factorials.get(2l)).isEqualTo(2l);
|
||||
assertThat(factorials.get(3l)).isEqualTo(6l);
|
||||
assertThat(factorials.get(4l)).isEqualTo(24l);
|
||||
assertThat(factorials.get(5l)).isEqualTo(120l);
|
||||
assertThat(factorials.get(6l)).isEqualTo(720l);
|
||||
assertThat(factorials.get(7l)).isEqualTo(5040l);
|
||||
assertThat(factorials.get(8l)).isEqualTo(40320l);
|
||||
assertThat(factorials.get(9l)).isEqualTo(362880l);
|
||||
}
|
||||
|
||||
public static class FactorialsClassLoader implements CacheLoader<Long, Long> {
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -66,7 +64,7 @@ public class ClientCacheSecurityIntegrationTests extends ForkingClientServerInte
|
||||
|
||||
arguments.add(String.format("-Dgemfire.name=%1$s", ClientCacheSecurityIntegrationTests.class.getSimpleName().concat("Server")));
|
||||
arguments.add(String.format("-Djavax.net.ssl.keyStore=%1$s", System.getProperty("javax.net.ssl.keyStore")));
|
||||
arguments.add("/org/springframework/data/gemfire/client/ClientCacheSecurityTest-server-context.xml");
|
||||
arguments.add(getServerContextXmlFileLocation(ClientCacheSecurityIntegrationTests.class));
|
||||
|
||||
startGemFireServer(ServerProcess.class, arguments.toArray(new String[arguments.size()]));
|
||||
}
|
||||
@@ -86,7 +84,7 @@ public class ClientCacheSecurityIntegrationTests extends ForkingClientServerInte
|
||||
|
||||
@Test
|
||||
public void exampleRegionGet() {
|
||||
assertThat(String.valueOf(example.get("TestKey")), is(equalTo("TestValue")));
|
||||
assertThat(String.valueOf(example.get("TestKey"))).isEqualTo("TestValue");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -106,7 +104,8 @@ public class ClientCacheSecurityIntegrationTests extends ForkingClientServerInte
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String configLocation = "org/springframework/data/gemfire/client/ClientCacheSecurityTest-server-context.xml";
|
||||
String configLocation = args.length > 0 ? args[0]
|
||||
: "org/springframework/data/gemfire/client/ClientCacheSecurityIntegrationTests-server-context.xml";
|
||||
|
||||
ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext(configLocation);
|
||||
|
||||
|
||||
@@ -42,12 +42,14 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
/**
|
||||
* IntegrationTests with test cases testing the use of variable "locators" attribute
|
||||
* IntegrationTests with test cases testing the use of variable {@literal locators} attribute
|
||||
* on <gfe:pool/< in SDG XML namespace configuration metadata when connecting a client/server.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.fork.ServerProcess
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @since 1.6.3
|
||||
@@ -65,8 +67,7 @@ public class ClientCacheVariableLocatorsIntegrationTests extends ForkingClientSe
|
||||
arguments.add(String.format("-Dgemfire.name=%1$s",
|
||||
ClientCacheVariableLocatorsIntegrationTests.class.getSimpleName().concat("Server")));
|
||||
|
||||
arguments.add("/".concat(ClientCacheVariableLocatorsIntegrationTests.class.getName().replace(".", "/")
|
||||
.concat("-server-context.xml")));
|
||||
arguments.add(getServerContextXmlFileLocation(ClientCacheVariableLocatorsIntegrationTests.class));
|
||||
|
||||
startGemFireServer(ServerProcess.class, arguments.toArray(new String[arguments.size()]));
|
||||
}
|
||||
|
||||
@@ -42,11 +42,14 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
/**
|
||||
* Integration Tests with test cases testing the use of variable "servers" attribute on <gfe:pool/<
|
||||
* in SDG XML namespace configuration metadata when connecting a client/server.
|
||||
* Integration Tests with test cases testing the use of variable {@literal servers} attribute
|
||||
* on <gfe:pool/< in SDG XML namespace configuration metadata when connecting a client/server.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.fork.ServerProcess
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.6.3
|
||||
@@ -61,9 +64,10 @@ public class ClientCacheVariableServersIntegrationTests extends ForkingClientSer
|
||||
|
||||
List<String> arguments = new ArrayList<String>();
|
||||
|
||||
arguments.add(String.format("-Dgemfire.name=%1$s", ClientCacheVariableServersIntegrationTests.class.getSimpleName().concat("Server")));
|
||||
arguments.add("/".concat(ClientCacheVariableServersIntegrationTests.class.getName().replace(".", "/")
|
||||
.concat("-server-context.xml")));
|
||||
arguments.add(String.format("-Dgemfire.name=%1$s",
|
||||
ClientCacheVariableServersIntegrationTests.class.getSimpleName().concat("Server")));
|
||||
|
||||
arguments.add(getServerContextXmlFileLocation(ClientCacheVariableServersIntegrationTests.class));
|
||||
|
||||
startGemFireServer(ServerProcess.class, arguments.toArray(new String[arguments.size()]));
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@ public class ClientRegionIntegrationTests extends IntegrationTestsSupport {
|
||||
ClientRegionFactoryBean<Object, Object> exampleRegion = new ClientRegionFactoryBean<>();
|
||||
|
||||
exampleRegion.setCache(gemfireCache);
|
||||
exampleRegion.setClose(false);
|
||||
exampleRegion.setShortcut(ClientRegionShortcut.LOCAL);
|
||||
|
||||
return exampleRegion;
|
||||
|
||||
@@ -13,11 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -30,6 +28,7 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
import org.apache.geode.cache.CacheLoaderException;
|
||||
import org.apache.geode.cache.CacheWriter;
|
||||
import org.apache.geode.cache.CacheWriterException;
|
||||
import org.apache.geode.cache.EntryEvent;
|
||||
import org.apache.geode.cache.LoaderHelper;
|
||||
@@ -38,33 +37,34 @@ import org.apache.geode.cache.util.CacheWriterAdapter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Integration Tests testing the addition of {@link CacheLoader CacheLoaders} and {@link CacheWriter CacheWriters}
|
||||
* to a client, local {@link Region} cache.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.context.ApplicationContext
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @see org.apache.geode.cache.CacheLoader
|
||||
* @see org.apache.geode.cache.CacheWriter
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.context.ApplicationContext
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.3.3
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientRegionWithCacheLoaderWriterTest {
|
||||
public class ClientRegionWithCacheLoaderCacheWriterIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final int REGION_SIZE = 100;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Resource(name = "localAppDataRegion")
|
||||
private Region<Integer, Integer> localAppData;
|
||||
@@ -72,25 +72,26 @@ public class ClientRegionWithCacheLoaderWriterTest {
|
||||
@Test
|
||||
public void testCacheLoaderWriter() {
|
||||
|
||||
assertNotNull(localAppData);
|
||||
assertEquals(0, localAppData.size());
|
||||
assertThat(localAppData).isNotNull();
|
||||
assertThat(localAppData.size()).isEqualTo(0);
|
||||
|
||||
for (int key = 0; key < REGION_SIZE; key++) {
|
||||
assertEquals(key + 1, localAppData.get(key).intValue());
|
||||
assertThat(localAppData.get(key).intValue()).isEqualTo(key + 1);
|
||||
}
|
||||
|
||||
assertEquals(REGION_SIZE, localAppData.size());
|
||||
assertThat(localAppData.size()).isEqualTo(REGION_SIZE);
|
||||
|
||||
for (int key = 0; key < REGION_SIZE; key++) {
|
||||
assertEquals(key + 1, localAppData.put(key, REGION_SIZE - key).intValue());
|
||||
assertThat(localAppData.put(key, REGION_SIZE - key).intValue()).isEqualTo(key + 1);
|
||||
}
|
||||
|
||||
LocalAppDataCacheWriter localCacheWriter = context.getBean("localCacheWriter", LocalAppDataCacheWriter.class);
|
||||
LocalAppDataCacheWriter localCacheWriter = applicationContext
|
||||
.getBean("localCacheWriter", LocalAppDataCacheWriter.class);
|
||||
|
||||
assertNotNull(localCacheWriter);
|
||||
assertThat(localCacheWriter).isNotNull();
|
||||
|
||||
for (int key = 0; key < REGION_SIZE; key++) {
|
||||
assertEquals(REGION_SIZE - key, localCacheWriter.get(key).intValue());
|
||||
assertThat(localCacheWriter.get(key).intValue()).isEqualTo(REGION_SIZE - key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,8 +105,8 @@ public class ClientRegionWithCacheLoaderWriterTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
public void close() { }
|
||||
|
||||
}
|
||||
|
||||
public static class LocalAppDataCacheWriter extends CacheWriterAdapter<Integer, Integer> {
|
||||
@@ -113,13 +114,12 @@ public class ClientRegionWithCacheLoaderWriterTest {
|
||||
private static final Map<Integer, Integer> data = new ConcurrentHashMap<>(REGION_SIZE);
|
||||
|
||||
@Override
|
||||
public void beforeUpdate(final EntryEvent<Integer, Integer> event) throws CacheWriterException {
|
||||
public void beforeUpdate(EntryEvent<Integer, Integer> event) throws CacheWriterException {
|
||||
data.put(event.getKey(), event.getNewValue());
|
||||
}
|
||||
|
||||
public Integer get(final Integer key) {
|
||||
public Integer get(Integer key) {
|
||||
return data.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,7 +34,7 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration Tests testing {@link Region sub-Region} functionality from a cache client.
|
||||
* Integration Tests for client {@link Region sub-Region} configuration.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -51,7 +51,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
public class ClientSubRegionIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
public static void startGeodeServer() throws Exception {
|
||||
startGemFireServer(ServerProcess.class,
|
||||
getServerContextXmlFileLocation(ClientSubRegionIntegrationTests.class));
|
||||
}
|
||||
@@ -76,6 +76,7 @@ public class ClientSubRegionIntegrationTests extends ForkingClientServerIntegrat
|
||||
}
|
||||
|
||||
private void assertRegion(Region<?, ?> region, String name, String fullPath) {
|
||||
|
||||
assertThat(region).isNotNull();
|
||||
assertThat(region.getName()).isEqualTo(name);
|
||||
assertThat(region.getFullPath()).isEqualTo(fullPath);
|
||||
@@ -84,9 +85,11 @@ public class ClientSubRegionIntegrationTests extends ForkingClientServerIntegrat
|
||||
@Test
|
||||
public void gemFireSubRegionCreationConfigurationIsCorrect() {
|
||||
|
||||
assertThat(clientCache).describedAs("The Client Cache was not properly initialized!").isNotNull();
|
||||
assertThat(this.clientCache)
|
||||
.describedAs("The Client Cache was not properly initialized!")
|
||||
.isNotNull();
|
||||
|
||||
Region<?, ?> parent = clientCache.getRegion("Parent");
|
||||
Region<?, ?> parent = this.clientCache.getRegion("Parent");
|
||||
|
||||
assertRegion(parent, "Parent");
|
||||
|
||||
@@ -94,7 +97,7 @@ public class ClientSubRegionIntegrationTests extends ForkingClientServerIntegrat
|
||||
|
||||
assertRegion(child, "Child", "/Parent/Child");
|
||||
|
||||
Region<?, ?> clientCacheChild = clientCache.getRegion("/Parent/Child");
|
||||
Region<?, ?> clientCacheChild = this.clientCache.getRegion("/Parent/Child");
|
||||
|
||||
assertThat(child).isSameAs(clientCacheChild);
|
||||
}
|
||||
@@ -102,16 +105,16 @@ public class ClientSubRegionIntegrationTests extends ForkingClientServerIntegrat
|
||||
@Test
|
||||
public void springSubRegionCreationConfigurationIsCorrect() {
|
||||
|
||||
assertRegion(parent, "Parent");
|
||||
assertRegion(child, "Child", "/Parent/Child");
|
||||
assertRegion(this.parent, "Parent");
|
||||
assertRegion(this.child, "Child", "/Parent/Child");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void templateCreationConfigurationIsCorrect() {
|
||||
|
||||
assertThat(parentTemplate).isNotNull();
|
||||
assertThat(parentTemplate.getRegion()).isSameAs(parent);
|
||||
assertThat(childTemplate).isNotNull();
|
||||
assertThat(childTemplate.getRegion()).isSameAs(child);
|
||||
assertThat(this.parentTemplate).isNotNull();
|
||||
assertThat(this.parentTemplate.getRegion()).isSameAs(this.parent);
|
||||
assertThat(this.childTemplate).isNotNull();
|
||||
assertThat(this.childTemplate.getRegion()).isSameAs(this.child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.data.gemfire.GemfireUtils;
|
||||
import org.springframework.data.gemfire.fork.ServerProcess;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.util.ThreadUtils;
|
||||
import org.springframework.data.gemfire.util.DistributedSystemUtils;
|
||||
@@ -80,7 +81,7 @@ import org.springframework.util.Assert;
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("all")
|
||||
public class DurableClientCacheIntegrationTest extends ForkingClientServerIntegrationTestsSupport {
|
||||
public class DurableClientCacheIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static final boolean DEBUG = true;
|
||||
|
||||
@@ -90,19 +91,20 @@ public class DurableClientCacheIntegrationTest extends ForkingClientServerIntegr
|
||||
Collections.synchronizedList(new ArrayList<Integer>());
|
||||
|
||||
private static final String CACHE_SERVER_PORT =
|
||||
DurableClientCacheIntegrationTest.class.getName().concat(".cache-server-port");
|
||||
DurableClientCacheIntegrationTests.class.getName().concat(".cache-server-port");
|
||||
|
||||
private static final String CLIENT_CACHE_INTERESTS_RESULT_POLICY =
|
||||
DurableClientCacheIntegrationTest.class.getName().concat(".interests-result-policy");
|
||||
DurableClientCacheIntegrationTests.class.getName().concat(".interests-result-policy");
|
||||
|
||||
private static final String DURABLE_CLIENT_TIMEOUT =
|
||||
DurableClientCacheIntegrationTest.class.getName().concat(".durable-client-timeout");
|
||||
DurableClientCacheIntegrationTests.class.getName().concat(".durable-client-timeout");
|
||||
|
||||
private static final String SERVER_HOST = "localhost";
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws IOException {
|
||||
startGemFireServer(DurableClientCacheIntegrationTest.class);
|
||||
public static void startGeodeServer() throws IOException {
|
||||
startGemFireServer(ServerProcess.class,
|
||||
getServerContextXmlFileLocation(DurableClientCacheIntegrationTests.class));
|
||||
}
|
||||
|
||||
private static boolean isAfterDirtiesContext() {
|
||||
@@ -138,7 +140,7 @@ public class DurableClientCacheIntegrationTest extends ForkingClientServerIntegr
|
||||
assertThat(distributedSystemProperties).isNotNull();
|
||||
|
||||
assertThat(distributedSystemProperties.getProperty(DistributedSystemUtils.DURABLE_CLIENT_ID_PROPERTY_NAME))
|
||||
.isEqualTo(DurableClientCacheIntegrationTest.class.getSimpleName());
|
||||
.isEqualTo(DurableClientCacheIntegrationTests.class.getSimpleName());
|
||||
|
||||
assertThat(distributedSystemProperties.getProperty(DistributedSystemUtils.DURABLE_CLIENT_TIMEOUT_PROPERTY_NAME))
|
||||
.isEqualTo(valueBeforeAndAfterDirtiesContext("300", "600"));
|
||||
@@ -51,6 +51,7 @@ import org.springframework.util.FileSystemUtils;
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.client.GemfireDataSourcePostProcessor
|
||||
* @see org.springframework.data.gemfire.fork.ServerProcess
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
@@ -62,16 +63,16 @@ import org.springframework.util.FileSystemUtils;
|
||||
public class GemFireDataSourceIntegrationTest extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws IOException {
|
||||
public static void startGeodeServer() throws IOException {
|
||||
|
||||
List<String> arguments = new ArrayList<>();
|
||||
|
||||
arguments.add(String.format("-Dgemfire.name=%s", GemFireDataSourceIntegrationTest.class.getSimpleName().concat("Server")));
|
||||
arguments.add(GemFireDataSourceIntegrationTest.class.getName()
|
||||
.replace(".", "/").concat("-server-context.xml"));
|
||||
arguments.add(String.format("-Dgemfire.name=%s",
|
||||
GemFireDataSourceIntegrationTest.class.getSimpleName().concat("Server")));
|
||||
|
||||
arguments.add(getServerContextXmlFileLocation(GemFireDataSourceIntegrationTest.class));
|
||||
|
||||
startGemFireServer(ServerProcess.class, arguments.toArray(new String[0]));
|
||||
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
|
||||
@@ -42,6 +42,12 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.fork.ServerProcess
|
||||
* @see org.springframework.data.gemfire.client.GemfireDataSourcePostProcessor
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@@ -50,7 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
public class GemFireDataSourceIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
public static void startGeodeServer() throws Exception {
|
||||
startGemFireServer(ServerProcess.class,
|
||||
getServerContextXmlFileLocation(GemFireDataSourceIntegrationTests.class));
|
||||
}
|
||||
|
||||
@@ -60,7 +60,12 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.client.GemfireDataSourcePostProcessor
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.7.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@@ -102,12 +107,6 @@ public class GemFireDataSourceUsingNonSpringConfiguredGemFireServerIntegrationTe
|
||||
GemFireBasedServerProcess.getServerProcessControlFilename());
|
||||
}
|
||||
|
||||
private static void writeAsCacheXmlFileToDirectory(String classpathResource, File serverWorkingDirectory) throws IOException {
|
||||
|
||||
FileCopyUtils.copy(new ClassPathResource(classpathResource).getInputStream(),
|
||||
new FileOutputStream(new File(serverWorkingDirectory, "cache.xml")));
|
||||
}
|
||||
|
||||
private static String customClasspath() {
|
||||
|
||||
String[] classpathElements = ProcessExecutor.JAVA_CLASSPATH.split(File.pathSeparator);
|
||||
@@ -123,6 +122,12 @@ public class GemFireDataSourceUsingNonSpringConfiguredGemFireServerIntegrationTe
|
||||
return StringUtils.collectionToDelimitedString(customClasspath, File.pathSeparator);
|
||||
}
|
||||
|
||||
private static void writeAsCacheXmlFileToDirectory(String classpathResource, File serverWorkingDirectory) throws IOException {
|
||||
|
||||
FileCopyUtils.copy(new ClassPathResource(classpathResource).getInputStream(),
|
||||
new FileOutputStream(new File(serverWorkingDirectory, "cache.xml")));
|
||||
}
|
||||
|
||||
private static void waitForProcessStart(long milliseconds, ProcessWrapper process, String processControlFilename) {
|
||||
|
||||
ThreadUtils.timedWait(milliseconds, TimeUnit.MILLISECONDS.toMillis(500), new ThreadUtils.Condition() {
|
||||
@@ -139,6 +144,8 @@ public class GemFireDataSourceUsingNonSpringConfiguredGemFireServerIntegrationTe
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
|
||||
stop(gemfireServer);
|
||||
|
||||
if (Boolean.parseBoolean(System.getProperty("spring.gemfire.fork.clean", String.valueOf(true)))) {
|
||||
org.springframework.util.FileSystemUtils.deleteRecursively(gemfireServer.getWorkingDirectory());
|
||||
}
|
||||
|
||||
@@ -36,21 +36,27 @@ import org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
import org.springframework.data.gemfire.config.annotation.EnableEntityDefinedRegions;
|
||||
import org.springframework.data.gemfire.test.model.Gender;
|
||||
import org.springframework.data.gemfire.test.model.Person;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests testing the configuration of a {@link ClientRegionShortcut#LOCAL}
|
||||
* Integration Tests testing the configuration of a {@link ClientRegionShortcut#LOCAL}
|
||||
* {@link ClientCache} {@link Region}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.6.3
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class LocalOnlyClientCacheIntegrationTests {
|
||||
public class LocalOnlyClientCacheIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Resource(name = "People")
|
||||
private Region<Long, Person> people;
|
||||
@@ -81,9 +87,9 @@ public class LocalOnlyClientCacheIntegrationTests {
|
||||
assertThat(this.people).hasSize(1);
|
||||
}
|
||||
|
||||
@ClientCacheApplication(logLevel = "error")
|
||||
@ClientCacheApplication
|
||||
@EnableEntityDefinedRegions(basePackageClasses = Person.class,
|
||||
clientRegionShortcut = ClientRegionShortcut.LOCAL, strict = true)
|
||||
static class GemFireClientCacheConfiguration { }
|
||||
static class TestConfiguration { }
|
||||
|
||||
}
|
||||
|
||||
@@ -190,19 +190,25 @@ public class SpELExpressionConfiguredPoolsIntegrationTests extends IntegrationTe
|
||||
}
|
||||
|
||||
public static class AnotherServerPoolFactoryBean extends TestPoolFactoryBean {
|
||||
@Override ConnectionEndpointList getServerList() {
|
||||
|
||||
@Override
|
||||
ConnectionEndpointList getServerList() {
|
||||
return anotherServers;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LocatorPoolFactoryBean extends TestPoolFactoryBean {
|
||||
@Override ConnectionEndpointList getLocatorList() {
|
||||
|
||||
@Override
|
||||
ConnectionEndpointList getLocatorList() {
|
||||
return locators;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ServerPoolFactoryBean extends TestPoolFactoryBean {
|
||||
@Override ConnectionEndpointList getServerList() {
|
||||
|
||||
@Override
|
||||
ConnectionEndpointList getServerList() {
|
||||
return servers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.apache.geode.cache.GemFireCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.GemfireUtils;
|
||||
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -42,6 +43,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.client.support.ClientCacheFactoryCacheResolver
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.3.0
|
||||
@@ -49,7 +51,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientCacheFactoryCacheResolverIntegrationTests {
|
||||
public class ClientCacheFactoryCacheResolverIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private GemFireCache clientCache;
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.data.gemfire.client.PoolResolver;
|
||||
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;
|
||||
import org.springframework.data.gemfire.config.annotation.EnablePool;
|
||||
import org.springframework.data.gemfire.config.annotation.EnablePools;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -50,6 +51,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.apache.geode.cache.client.PoolManager
|
||||
* @see org.springframework.data.gemfire.client.PoolResolver
|
||||
* @see org.springframework.data.gemfire.client.support.PoolManagerPoolResolver
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.3.0
|
||||
@@ -57,7 +59,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class PoolManagerPoolResolverIntegrationTests {
|
||||
public class PoolManagerPoolResolverIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ClientCache clientCache;
|
||||
@@ -72,7 +74,7 @@ public class PoolManagerPoolResolverIntegrationTests {
|
||||
@Qualifier("SwimmingPool")
|
||||
private Pool swimmingPool;
|
||||
|
||||
private PoolResolver poolResolver = new PoolManagerPoolResolver();
|
||||
private final PoolResolver poolResolver = new PoolManagerPoolResolver();
|
||||
|
||||
@Resource(name = "RegionWithDefaultPool")
|
||||
private Region<?, ?> regionWithDefaultPool;
|
||||
@@ -129,7 +131,7 @@ public class PoolManagerPoolResolverIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void resolvePoolFromNullRegionIsNullSafeAndReturnsNull() {
|
||||
assertThat(this.poolResolver.resolve((Region) null)).isNull();
|
||||
assertThat(this.poolResolver.resolve((Region<?, ?>) null)).isNull();
|
||||
}
|
||||
|
||||
@ClientCacheApplication(name = "PoolManagerPoolResolverIntegrationTests")
|
||||
@@ -141,7 +143,7 @@ public class PoolManagerPoolResolverIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean("RegionWithDefaultPool")
|
||||
ClientRegionFactoryBean regionWithDefaultPool(ClientCache clientCache) {
|
||||
ClientRegionFactoryBean<Object, Object> regionWithDefaultPool(ClientCache clientCache) {
|
||||
|
||||
ClientRegionFactoryBean<Object, Object> clientRegion = new ClientRegionFactoryBean<>();
|
||||
|
||||
@@ -153,7 +155,7 @@ public class PoolManagerPoolResolverIntegrationTests {
|
||||
|
||||
@Bean("RegionWithSwimmingPool")
|
||||
@DependsOn("SwimmingPool")
|
||||
ClientRegionFactoryBean regionWithNamedPool(ClientCache clientCache) {
|
||||
ClientRegionFactoryBean<Object, Object> regionWithNamedPool(ClientCache clientCache) {
|
||||
|
||||
ClientRegionFactoryBean<Object, Object> clientRegion = new ClientRegionFactoryBean<>();
|
||||
|
||||
|
||||
@@ -42,8 +42,14 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* {@link org.apache.geode.security.SecurityManager}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.security.SecurityManager
|
||||
* @see org.springframework.data.gemfire.config.annotation.AbstractGeodeSecurityIntegrationTests
|
||||
* @since 1.0.0
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableSecurity
|
||||
* @see org.springframework.test.context.ActiveProfiles
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = AbstractGeodeSecurityIntegrationTests.GeodeClientConfiguration.class)
|
||||
@@ -54,7 +60,7 @@ public class ApacheGeodeSecurityManagerSecurityIntegrationTests extends Abstract
|
||||
"geode-security-manager-property-configuration";
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws IOException {
|
||||
public static void startGeodeServer() throws IOException {
|
||||
runGeodeServer(GEODE_SECURITY_MANAGER_PROPERTY_CONFIGURATION_PROFILE);
|
||||
}
|
||||
|
||||
@@ -62,8 +68,7 @@ public class ApacheGeodeSecurityManagerSecurityIntegrationTests extends Abstract
|
||||
@EnableSecurity(securityManagerClassName =
|
||||
"org.springframework.data.gemfire.config.annotation.ApacheGeodeSecurityManagerSecurityIntegrationTests$TestGeodeSecurityManager")
|
||||
@Profile(GEODE_SECURITY_MANAGER_PROPERTY_CONFIGURATION_PROFILE)
|
||||
public static class ApacheGeodeSecurityManagerConfiguration {
|
||||
}
|
||||
public static class ApacheGeodeSecurityManagerConfiguration { }
|
||||
|
||||
protected interface GeodeSecurityRepository {
|
||||
|
||||
|
||||
@@ -31,8 +31,12 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* Integration tests for Apache Geode Integrated Security using an Apache Shiro INI security configuration resource.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.config.annotation.AbstractGeodeSecurityIntegrationTests
|
||||
* @since 1.0.0
|
||||
* @see org.springframework.test.context.ActiveProfiles
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = AbstractGeodeSecurityIntegrationTests.GeodeClientConfiguration.class)
|
||||
@@ -42,7 +46,7 @@ public class ApacheShiroIniSecurityIntegrationTests extends AbstractGeodeSecurit
|
||||
protected static final String SHIRO_INI_CONFIGURATION_PROFILE = "shiro-ini-configuration";
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws IOException {
|
||||
public static void startGeodeServer() throws IOException {
|
||||
runGeodeServer(SHIRO_INI_CONFIGURATION_PROFILE);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,12 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* as a Spring managed bean in a Spring {@link org.springframework.context.ApplicationContext}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.shiro.realm.text.PropertiesRealm
|
||||
* @see org.springframework.data.gemfire.config.annotation.AbstractGeodeSecurityIntegrationTests
|
||||
* @since 1.0.0
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = AbstractGeodeSecurityIntegrationTests.GeodeClientConfiguration.class)
|
||||
@@ -48,7 +52,7 @@ public class ApacheShiroRealmSecurityIntegrationTests extends AbstractGeodeSecur
|
||||
protected static final String SHIRO_REALM_CONFIGURATION_PROFILE = "shiro-realm-configuration";
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws IOException {
|
||||
public static void startGeodeServer() throws IOException {
|
||||
runGeodeServer(SHIRO_REALM_CONFIGURATION_PROFILE);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.mockito.Mockito
|
||||
* @see org.apache.geode.cache.server.CacheServer
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.config.annotation.AddCacheServerConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.AddCacheServersConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.CacheServerConfigurer
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCacheServer
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCacheServers
|
||||
|
||||
@@ -51,6 +51,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.cache.annotation.Cacheable
|
||||
* @see org.springframework.data.gemfire.config.annotation.CachingDefinedRegionsConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
|
||||
@@ -24,19 +24,20 @@ import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.util.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -54,6 +55,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.cache.annotation.Cacheable
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions
|
||||
* @see org.springframework.data.gemfire.config.annotation.CachingDefinedRegionsConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @see <a href="https://jira.spring.io/browse/DATAGEODE-232">Add support for @CacheConfig in @EnableCachingDefinedRegions</a>
|
||||
@@ -62,9 +64,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class CachingDefinedRegionsUsesCacheConfigCacheNamesIntegrationTests {
|
||||
|
||||
private static final String LOG_LEVEL = "error";
|
||||
public class CachingDefinedRegionsUsesCacheConfigCacheNamesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ClientCache clientCache;
|
||||
@@ -117,7 +117,6 @@ public class CachingDefinedRegionsUsesCacheConfigCacheNamesIntegrationTests {
|
||||
assertThat(region).doesNotContainKey("0");
|
||||
assertThat(region).isEmpty();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -132,7 +131,6 @@ public class CachingDefinedRegionsUsesCacheConfigCacheNamesIntegrationTests {
|
||||
@Test
|
||||
public void cacheableMethodTwoCachesToCOnly() {
|
||||
|
||||
|
||||
assertThat(this.service.cacheableMethodTwo("3")).isEqualTo("TWO");
|
||||
|
||||
Collections.singletonList(this.c).forEach(region -> assertThat(region).containsKey("3"));
|
||||
@@ -142,14 +140,13 @@ public class CachingDefinedRegionsUsesCacheConfigCacheNamesIntegrationTests {
|
||||
@Test
|
||||
public void cacheableMethodThreeCachesToAAndD() {
|
||||
|
||||
|
||||
assertThat(this.service.cacheableMethodThree("4")).isEqualTo("THREE");
|
||||
|
||||
Arrays.asList(this.a, this.d).forEach(region -> assertThat(region).containsKey("4"));
|
||||
Arrays.asList(this.b, this.c).forEach(region -> assertThat(region).isEmpty());
|
||||
}
|
||||
|
||||
@ClientCacheApplication(name = "CachingDefinedRegionsUsesCacheConfigCacheNamesIntegrationTests", logLevel = LOG_LEVEL)
|
||||
@ClientCacheApplication
|
||||
@EnableCachingDefinedRegions(clientRegionShortcut = ClientRegionShortcut.LOCAL)
|
||||
static class TestConfiguration {
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -44,6 +45,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
* @see org.springframework.data.gemfire.client.ClientRegionFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.1.0
|
||||
@@ -51,19 +53,20 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientCacheApplicationIntegrationTests {
|
||||
public class ClientCacheApplicationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Resource(name = "Echo")
|
||||
private Region<String, String> echo;
|
||||
|
||||
@Test
|
||||
public void echoClientRegionEchoesKeysAsValues() {
|
||||
|
||||
assertThat(this.echo.get("hello")).isEqualTo("hello");
|
||||
assertThat(this.echo.get("test")).isEqualTo("test");
|
||||
assertThat(this.echo.get("good-bye")).isEqualTo("good-bye");
|
||||
}
|
||||
|
||||
@ClientCacheApplication(name = "ClientCacheApplicationIntegrationTests", logLevel = "error")
|
||||
@ClientCacheApplication
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean("Echo")
|
||||
|
||||
@@ -59,8 +59,6 @@ public class ClientCacheConfigurerIntegrationTests extends IntegrationTestsSuppo
|
||||
|
||||
private static final AtomicBoolean testClientCacheConfigurerThreeCalled = new AtomicBoolean(false);
|
||||
|
||||
private static final String GEMFIRE_LOG_LEVEL = "error";
|
||||
|
||||
@Autowired
|
||||
private ClientCache clientCache;
|
||||
|
||||
@@ -100,8 +98,8 @@ public class ClientCacheConfigurerIntegrationTests extends IntegrationTestsSuppo
|
||||
assertThat(testClientCacheConfigurerThreeCalled.get()).isTrue();
|
||||
}
|
||||
|
||||
@ClientCacheApplication
|
||||
@EnableGemFireMockObjects
|
||||
@ClientCacheApplication(logLevel = GEMFIRE_LOG_LEVEL)
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.apache.geode.cache.server.CacheServer
|
||||
* @see org.springframework.data.gemfire.config.annotation.CacheServerApplication
|
||||
@@ -57,13 +58,13 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @since 1.9.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = ClientServerCacheApplicationIntegrationTests.ClientTestConfiguration.class)
|
||||
@ContextConfiguration(classes = ClientServerCacheApplicationIntegrationTests.GeodeClientTestConfiguration.class)
|
||||
@SuppressWarnings("all")
|
||||
public class ClientServerCacheApplicationIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void setupGemFireServer() throws Exception {
|
||||
startGemFireServer(ServerTestConfiguration.class);
|
||||
public static void startGeodeServer() throws Exception {
|
||||
startGemFireServer(GeodeServerTestConfiguration.class);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@@ -79,7 +80,7 @@ public class ClientServerCacheApplicationIntegrationTests extends ForkingClientS
|
||||
}
|
||||
|
||||
@ClientCacheApplication
|
||||
static class ClientTestConfiguration {
|
||||
static class GeodeClientTestConfiguration {
|
||||
|
||||
@Bean(name = "Echo")
|
||||
ClientRegionFactoryBean<String, String> echoRegion(ClientCache gemfireCache) {
|
||||
@@ -95,10 +96,10 @@ public class ClientServerCacheApplicationIntegrationTests extends ForkingClientS
|
||||
}
|
||||
|
||||
@CacheServerApplication(name = "ClientServerCacheApplicationIntegrationTests")
|
||||
public static class ServerTestConfiguration {
|
||||
public static class GeodeServerTestConfiguration {
|
||||
|
||||
public static void main(String[] args) {
|
||||
runSpringApplication(ServerTestConfiguration.class, args);
|
||||
runSpringApplication(GeodeServerTestConfiguration.class, args);
|
||||
}
|
||||
|
||||
@Bean("Echo")
|
||||
|
||||
@@ -22,9 +22,7 @@ import static org.mockito.Mockito.spy;
|
||||
import static org.springframework.data.gemfire.config.annotation.ClusterConfigurationConfiguration.ClusterSchemaObjectInitializer;
|
||||
import static org.springframework.data.gemfire.config.annotation.ClusterConfigurationConfiguration.SchemaObjectContext;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -43,12 +41,12 @@ import org.springframework.data.gemfire.config.admin.remote.RestHttpGemfireAdmin
|
||||
import org.springframework.data.gemfire.config.support.RestTemplateConfigurer;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.util.ReflectionUtils;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.InterceptingClientHttpRequestFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
@@ -107,23 +105,6 @@ public class ClusterConfigurationWithClientHttpRequestInterceptorsIntegrationTes
|
||||
@Qualifier("testRestTemplateConfigurerTwo")
|
||||
private RestTemplateConfigurer restTemplateConfigurerTwo;
|
||||
|
||||
// TODO: Replace with STDG
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T getFieldValue(Object target, String fieldName) throws NoSuchFieldException {
|
||||
|
||||
Field field = ReflectionUtils.findField(target.getClass(), fieldName);
|
||||
|
||||
return Optional.ofNullable(field)
|
||||
.map(it -> {
|
||||
ReflectionUtils.makeAccessible(it);
|
||||
return field;
|
||||
})
|
||||
.map(it -> (T) ReflectionUtils.getField(it, target))
|
||||
.orElseThrow(() ->
|
||||
new NoSuchFieldException(String.format("Field with name [%s] was not found on Object of type [%s]",
|
||||
fieldName, target.getClass().getName())));
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setupIsCorrect() {
|
||||
|
||||
@@ -158,7 +139,7 @@ public class ClusterConfigurationWithClientHttpRequestInterceptorsIntegrationTes
|
||||
|
||||
RestHttpGemfireAdminTemplate template = schemaObjectContext.getGemfireAdminOperations();
|
||||
|
||||
this.theRestTemplate = getFieldValue(template, "restTemplate");
|
||||
this.theRestTemplate = ReflectionUtils.getFieldValue(template, "restTemplate");
|
||||
|
||||
assertThat(this.theRestTemplate).isNotNull();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.DiskStoreFactoryBean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -48,6 +49,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.config.annotation.DiskStoreConfigurer
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableDiskStore
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableDiskStores
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
@@ -56,7 +58,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class DiskStoreConfigurerIntegrationTests {
|
||||
public class DiskStoreConfigurerIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("configurerOne")
|
||||
@@ -67,6 +69,7 @@ public class DiskStoreConfigurerIntegrationTests {
|
||||
private TestDiskStoreConfigurer configurerTwo;
|
||||
|
||||
private void assertDiskStoreConfigurerCalled(TestDiskStoreConfigurer configurer, String... beanNames) {
|
||||
|
||||
assertThat(configurer).isNotNull();
|
||||
assertThat(configurer).hasSize(beanNames.length);
|
||||
assertThat(configurer).contains(beanNames);
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -36,20 +35,28 @@ import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* The EnableCachingDefinedRegionsIntegrationTests class...
|
||||
* Integration Tests for {@link EnableCachingDefinedRegions} and {@link CachingDefinedRegionsConfiguration}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.config.annotation.CachingDefinedRegionsConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableCachingDefinedRegionsIntegrationTests {
|
||||
public class EnableCachingDefinedRegionsIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -60,12 +60,10 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.context.annotation.Import
|
||||
* @see org.springframework.data.gemfire.IndexFactoryBean
|
||||
* @see org.springframework.data.gemfire.client.ClientRegionFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.admin.GemfireAdminOperations
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClusterConfigurationConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableClusterConfiguration
|
||||
* @see org.springframework.data.gemfire.process.ProcessWrapper
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
@@ -83,7 +81,7 @@ public class EnableClusterConfigurationIntegrationTests extends ForkingClientSer
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
startGemFireServer(ServerTestConfiguration.class);
|
||||
startGemFireServer(GeodeServerTestConfiguration.class);
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -112,11 +110,11 @@ public class EnableClusterConfigurationIntegrationTests extends ForkingClientSer
|
||||
|
||||
@Configuration
|
||||
@EnableClusterConfiguration
|
||||
@Import(ClientTestConfiguration.class)
|
||||
@Import(GeodeClientTestConfiguration.class)
|
||||
static class TestConfiguration { }
|
||||
|
||||
@ClientCacheApplication(subscriptionEnabled = true)
|
||||
static class ClientTestConfiguration {
|
||||
static class GeodeClientTestConfiguration {
|
||||
|
||||
@Bean
|
||||
ClientCacheConfigurer clientCachePoolPortConfigurer(
|
||||
@@ -178,12 +176,12 @@ public class EnableClusterConfigurationIntegrationTests extends ForkingClientSer
|
||||
}
|
||||
|
||||
@CacheServerApplication(name = "EnableClusterConfigurationIntegrationTests")
|
||||
static class ServerTestConfiguration {
|
||||
static class GeodeServerTestConfiguration {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
AnnotationConfigApplicationContext applicationContext =
|
||||
new AnnotationConfigApplicationContext(ServerTestConfiguration.class);
|
||||
new AnnotationConfigApplicationContext(GeodeServerTestConfiguration.class);
|
||||
|
||||
applicationContext.registerShutdownHook();
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
* @see org.springframework.core.env.ConfigurableEnvironment
|
||||
* @see org.springframework.core.env.PropertiesPropertySource
|
||||
* @see org.springframework.data.gemfire.config.admin.GemfireAdminOperations
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.http.client.ClientHttpRequestInterceptor
|
||||
* @see org.springframework.http.client.InterceptingClientHttpRequestFactory
|
||||
|
||||
@@ -54,6 +54,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClusterDefinedRegionsConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableClusterDefinedRegions
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
@@ -62,13 +63,13 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = EnableClusterDefinedRegionsIntegrationTests.ClientTestConfiguration.class)
|
||||
@ContextConfiguration(classes = EnableClusterDefinedRegionsIntegrationTests.GeodeClientTestConfiguration.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableClusterDefinedRegionsIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
startGemFireServer(ServerTestConfiguration.class);
|
||||
public static void startGeodeServer() throws Exception {
|
||||
startGemFireServer(GeodeServerTestConfiguration.class);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@@ -109,7 +110,7 @@ public class EnableClusterDefinedRegionsIntegrationTests extends ForkingClientSe
|
||||
|
||||
@ClientCacheApplication
|
||||
@EnableClusterDefinedRegions
|
||||
static class ClientTestConfiguration {
|
||||
static class GeodeClientTestConfiguration {
|
||||
|
||||
@Bean
|
||||
static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
|
||||
@@ -131,12 +132,12 @@ public class EnableClusterDefinedRegionsIntegrationTests extends ForkingClientSe
|
||||
}
|
||||
|
||||
@CacheServerApplication(name = "EnableClusterDefinedRegionsIntegrationTests")
|
||||
static class ServerTestConfiguration {
|
||||
static class GeodeServerTestConfiguration {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
AnnotationConfigApplicationContext applicationContext =
|
||||
new AnnotationConfigApplicationContext(ServerTestConfiguration.class);
|
||||
new AnnotationConfigApplicationContext(GeodeServerTestConfiguration.class);
|
||||
|
||||
applicationContext.registerShutdownHook();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class EnableContinuousQueriesConfigurationIntegrationTests extends Forkin
|
||||
|
||||
@BeforeClass
|
||||
public static void startGeodeServer() throws Exception {
|
||||
startGemFireServer(GemFireServerConfiguration.class);
|
||||
startGemFireServer(GeodeServerTestConfiguration.class);
|
||||
}
|
||||
|
||||
@Resource(name = "TemperatureReadings")
|
||||
@@ -120,7 +120,7 @@ public class EnableContinuousQueriesConfigurationIntegrationTests extends Forkin
|
||||
|
||||
@Configuration
|
||||
@EnableContinuousQueries
|
||||
@Import(GemFireClientConfiguration.class)
|
||||
@Import(GeodeClientConfiguration.class)
|
||||
static class TestConfiguration {
|
||||
|
||||
@ContinuousQuery(name = "BoilingTemperatures",
|
||||
@@ -137,7 +137,7 @@ public class EnableContinuousQueriesConfigurationIntegrationTests extends Forkin
|
||||
}
|
||||
|
||||
@ClientCacheApplication(logLevel = "error", subscriptionEnabled = true)
|
||||
static class GemFireClientConfiguration {
|
||||
static class GeodeClientConfiguration {
|
||||
|
||||
@Bean
|
||||
ClientCacheConfigurer clientCachePoolPortConfigurer(
|
||||
@@ -175,13 +175,13 @@ public class EnableContinuousQueriesConfigurationIntegrationTests extends Forkin
|
||||
}
|
||||
}
|
||||
|
||||
@CacheServerApplication(name = "EnableContinuousQueriesConfigurationIntegrationTests", logLevel = "error")
|
||||
static class GemFireServerConfiguration {
|
||||
@CacheServerApplication
|
||||
static class GeodeServerTestConfiguration {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
AnnotationConfigApplicationContext applicationContext =
|
||||
new AnnotationConfigApplicationContext(GemFireServerConfiguration.class);
|
||||
new AnnotationConfigApplicationContext(GeodeServerTestConfiguration.class);
|
||||
|
||||
applicationContext.registerShutdownHook();
|
||||
}
|
||||
|
||||
@@ -88,6 +88,6 @@ public class EnableEntityDefinedRegionsWithAssignableTypeFilterIntegrationTests
|
||||
excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = "Programmer"),
|
||||
includeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = User.class)
|
||||
)
|
||||
static class TestGeodeConfiguration { }
|
||||
static class TestConfiguration { }
|
||||
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see java.util.regex.Pattern
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.context.ApplicationContext
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableEntityDefinedRegions
|
||||
* @see org.springframework.data.gemfire.config.annotation.EntityDefinedRegionsConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
@@ -113,6 +114,6 @@ public class EnableEntityDefinedRegionsWithRegexFilterIntegrationTests extends I
|
||||
clientRegionShortcut = ClientRegionShortcut.LOCAL,
|
||||
includeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = ".*Programmer")
|
||||
)
|
||||
static class TestGeodeConfiguration { }
|
||||
static class TestConfiguration { }
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.data.gemfire.search.lucene.ProjectingLuceneOperations;
|
||||
import org.springframework.data.gemfire.search.lucene.ProjectingLuceneTemplate;
|
||||
import org.springframework.data.gemfire.test.model.Book;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -42,12 +43,18 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @since 1.0.0
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.search.lucene.ProjectingLuceneOperations
|
||||
* @see org.springframework.data.gemfire.search.lucene.ProjectingLuceneTemplate
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableLuceneIndexingConfigurationIntegrationTests {
|
||||
public class EnableLuceneIndexingConfigurationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ProjectingLuceneOperations luceneTemplate;
|
||||
@@ -86,7 +93,7 @@ public class EnableLuceneIndexingConfigurationIntegrationTests {
|
||||
"Star Wars VIII - The Last Jedi");
|
||||
}
|
||||
|
||||
@PeerCacheApplication(name = "EnableLuceneIndexingConfigurationIntegrationTests", logLevel = "error")
|
||||
@PeerCacheApplication
|
||||
@EnableEntityDefinedRegions(basePackageClasses = Book.class)
|
||||
@EnableIndexing
|
||||
static class TestConfiguration {
|
||||
|
||||
@@ -34,19 +34,21 @@ import org.springframework.data.gemfire.IndexType;
|
||||
import org.springframework.data.gemfire.mapping.annotation.Indexed;
|
||||
import org.springframework.data.gemfire.test.model.Book;
|
||||
import org.springframework.data.gemfire.test.model.Person;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link EnableIndexing} and the {@link Indexed} annotation.
|
||||
* Integration Tests for {@link EnableIndexing}, {@link IndexConfiguration} and the {@link Indexed} annotation.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.query.Index
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableIndexing
|
||||
* @see org.springframework.data.gemfire.config.annotation.IndexConfiguration
|
||||
* @see org.springframework.data.gemfire.mapping.annotation.Indexed
|
||||
* @see org.springframework.data.gemfire.test.model.Person
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.3
|
||||
@@ -54,7 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableOqlIndexingConfigurationIntegrationTests {
|
||||
public class EnableOqlIndexingConfigurationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Resource(name = "People")
|
||||
private Region<Long, Person> people;
|
||||
@@ -95,7 +97,7 @@ public class EnableOqlIndexingConfigurationIntegrationTests {
|
||||
"lastName", "/People", IndexType.FUNCTIONAL);
|
||||
}
|
||||
|
||||
@ClientCacheApplication(logLevel = "none")
|
||||
@ClientCacheApplication
|
||||
@EnableEntityDefinedRegions(
|
||||
basePackageClasses = Person.class,
|
||||
clientRegionShortcut = ClientRegionShortcut.LOCAL,
|
||||
|
||||
@@ -19,7 +19,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -57,7 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = EnableSslConfigurationIntegrationTests.ClientTestConfiguration.class)
|
||||
@ContextConfiguration(classes = EnableSslConfigurationIntegrationTests.GeodeClientTestConfiguration.class)
|
||||
@SuppressWarnings("all")
|
||||
public class EnableSslConfigurationIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@@ -69,26 +68,10 @@ public class EnableSslConfigurationIntegrationTests extends ForkingClientServerI
|
||||
private Region<String, String> echo;
|
||||
|
||||
@BeforeClass
|
||||
public static void setupGemFireServer() throws Exception {
|
||||
|
||||
String hostname = "localhost";
|
||||
|
||||
int availablePort = findAvailablePort();
|
||||
|
||||
gemfireServer = run(ServerTestConfiguration.class,
|
||||
public static void startGeodeServer() throws Exception {
|
||||
startGemFireServer(GeodeServerTestConfiguration.class,
|
||||
String.format("-Dgemfire.name=%s", asApplicationName(EnableSslConfigurationIntegrationTests.class)),
|
||||
String.format("-Djavax.net.ssl.keyStore=%s", System.getProperty("javax.net.ssl.keyStore")),
|
||||
String.format("-D%s=%d", GEMFIRE_CACHE_SERVER_PORT_PROPERTY, availablePort));
|
||||
|
||||
waitForServerToStart("localhost", availablePort);
|
||||
|
||||
System.setProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY, String.format("%s[%d]", hostname, availablePort));
|
||||
System.setProperty(GEMFIRE_POOL_SERVERS_PROPERTY, String.format("%s[%d]", hostname, availablePort));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownGemFireServer() {
|
||||
stop(gemfireServer);
|
||||
String.format("-Djavax.net.ssl.keyStore=%s", System.getProperty("javax.net.ssl.keyStore")));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -98,7 +81,7 @@ public class EnableSslConfigurationIntegrationTests extends ForkingClientServerI
|
||||
|
||||
@ClientCacheApplication(logLevel = LOG_LEVEL)
|
||||
@EnableSsl(keystorePassword = "s3cr3t", truststorePassword = "s3cr3t")
|
||||
static class ClientTestConfiguration {
|
||||
static class GeodeClientTestConfiguration {
|
||||
|
||||
@Bean
|
||||
ClientCacheConfigurer clientCacheSslConfigurer(
|
||||
@@ -125,12 +108,12 @@ public class EnableSslConfigurationIntegrationTests extends ForkingClientServerI
|
||||
|
||||
@CacheServerApplication(name = "EnableSslConfigurationIntegrationTests", logLevel = LOG_LEVEL)
|
||||
@EnableSsl(keystorePassword = "s3cr3t", truststorePassword = "s3cr3t")
|
||||
static class ServerTestConfiguration {
|
||||
static class GeodeServerTestConfiguration {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
AnnotationConfigApplicationContext applicationContext =
|
||||
new AnnotationConfigApplicationContext(ServerTestConfiguration.class);
|
||||
new AnnotationConfigApplicationContext(GeodeServerTestConfiguration.class);
|
||||
|
||||
applicationContext.registerShutdownHook();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.apache.geode.distributed.Locator;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.GemfireUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
@@ -46,14 +47,13 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.apache.geode.distributed.Locator
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorApplicationConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.2.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class LocatorApplicationIntegrationTests {
|
||||
|
||||
private static final String GEMFIRE_LOG_LEVEL = "error";
|
||||
public class LocatorApplicationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private Locator locator;
|
||||
@@ -101,7 +101,6 @@ public class LocatorApplicationIntegrationTests {
|
||||
@LocatorApplication(
|
||||
name = "LocatorApplicationIntegrationTests",
|
||||
bindAddress = "localhost",
|
||||
logLevel = GEMFIRE_LOG_LEVEL,
|
||||
port = 0
|
||||
)
|
||||
static class TestConfiguration { }
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -32,6 +31,7 @@ import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -40,28 +40,30 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.springframework.data.gemfire.config.annotation.PeerCacheApplication
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @since 1.9.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("all")
|
||||
public class PeerCacheApplicationIntegrationTests {
|
||||
public class PeerCacheApplicationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Resource(name = "Echo")
|
||||
private Region<String, String> echo;
|
||||
|
||||
@Test
|
||||
public void echoPartitionRegionEchoesKeysAsValues() {
|
||||
|
||||
assertThat(this.echo.get("hello")).isEqualTo("hello");
|
||||
assertThat(this.echo.get("test")).isEqualTo("test");
|
||||
assertThat(this.echo.get("good-bye")).isEqualTo("good-bye");
|
||||
}
|
||||
|
||||
@PeerCacheApplication(name = "PeerCacheApplicationIntegrationTests", logLevel="error")
|
||||
@PeerCacheApplication
|
||||
static class PeerCacheApplicationConfiguration {
|
||||
|
||||
@Bean("Echo")
|
||||
@@ -88,8 +90,8 @@ public class PeerCacheApplicationIntegrationTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
public void close() { }
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.apache.geode.cache.server.CacheServer
|
||||
* @see org.apache.geode.distributed.Locator
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
@@ -53,7 +54,6 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = PeerCacheApplicationWithAddedCacheServerIntegrationTests.TestPeerCacheConfiguration.class)
|
||||
@SuppressWarnings("unused")
|
||||
// TODO: Convert to Unit Test once STDG is used by SDG.
|
||||
public class PeerCacheApplicationWithAddedCacheServerIntegrationTests
|
||||
extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@@ -132,7 +132,7 @@ public class PeerCacheApplicationWithAddedCacheServerIntegrationTests
|
||||
}
|
||||
|
||||
@EnableCacheServer
|
||||
@PeerCacheApplication(name = "PeerCacheApplicationWithAddedCacheServerIntegrationTests")
|
||||
@PeerCacheApplication
|
||||
static class TestPeerCacheConfiguration { }
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -44,13 +45,14 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.CacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.PeerCacheApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.PeerCacheConfigurer
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class PeerCacheConfigurerIntegrationTests {
|
||||
public class PeerCacheConfigurerIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private Cache peerCache;
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.gemfire.client.PoolFactoryBean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -47,6 +48,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.config.annotation.PoolConfigurer
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnablePool
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnablePools
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.1.0
|
||||
@@ -54,7 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class PoolConfigurerIntegrationTests {
|
||||
public class PoolConfigurerIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("configurerOne")
|
||||
@@ -65,6 +67,7 @@ public class PoolConfigurerIntegrationTests {
|
||||
private TestPoolConfigurer configurerTwo;
|
||||
|
||||
protected void assertPoolConfigurerCalled(TestPoolConfigurer configurer, String... beanNames) {
|
||||
|
||||
assertThat(configurer).isNotNull();
|
||||
assertThat(configurer).hasSize(beanNames.length);
|
||||
assertThat(configurer).contains(beanNames);
|
||||
|
||||
@@ -92,6 +92,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.create\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionCreate",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -106,6 +107,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.create\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionCreateWithCallbackArgument",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -119,6 +121,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.get\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionGet",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -132,6 +135,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.getAll\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionGetAll",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -146,6 +150,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.getAll\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionGetAllWithCallbackArgument",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -159,6 +164,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.getEntry\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionGetEntry",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -172,6 +178,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.invalidate\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionInvalidate",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -185,6 +192,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.invalidate\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionInvalidateWithCallbackArgument",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -198,6 +206,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.keySet\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionKeySet",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -211,6 +220,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.keySetOnServer\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionKeySetOnServer",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -224,6 +234,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.localClear\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionLocalClear",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -237,6 +248,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.localDestroy\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionLocalDestroy",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -250,6 +262,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.localDestroy\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionLocalDestroyWithCallbackArgument",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -263,6 +276,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.localInvalidate\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionLocalInvalidate",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -276,6 +290,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.localInvalidate\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionLocalInvalidateWithCallbackArgument",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -289,6 +304,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.put\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionPut",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -302,6 +318,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.put\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionPutWithCallbackArgument",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -315,6 +332,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.putAll\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionPutAll",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -328,6 +346,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.putAll\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionPutAllWithCallbackArgument",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -341,6 +360,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.putIfAbsent\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionPutIfAbsent",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -354,6 +374,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.query\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionQuery",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -367,6 +388,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.remove\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionRemoveWithKey",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -380,6 +402,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.remove\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionRemoveWithKeyAndValue",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -393,6 +416,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.removeAll\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionRemoveAll",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -407,6 +431,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.removeAll\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionRemoveAllWithCallbackArgument",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -420,6 +445,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.replace\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionReplace",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -433,6 +459,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.replace\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionReplaceWithKeyOldValueNewValue",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -446,6 +473,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.selectValue\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionSelectValue",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -459,6 +487,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.size\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionSize",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -472,6 +501,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.sizeOnServer\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionSizeOnServer",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -485,6 +515,7 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
assertThat(logMessage)
|
||||
.containsPattern("Region data access call \\[org.apache.geode.cache.Region.*.values\\(..\\)\\] with stack trace");
|
||||
|
||||
assertThat(logMessage).contains(String.format("%s.logsRegionValues",
|
||||
RegionDataAccessTracingAspectUnitTests.class.getName()));
|
||||
}
|
||||
@@ -514,6 +545,5 @@ public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupp
|
||||
|
||||
return clientRegion;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.apache.geode.security.ResourcePermission;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.GemFireProperties;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -40,11 +41,12 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @author John Blum
|
||||
* @see java.util.Properties
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.distributed.Locator
|
||||
* @see org.apache.geode.distributed.DistributedSystem
|
||||
* @see org.apache.geode.distributed.Locator
|
||||
* @see org.springframework.data.gemfire.GemFireProperties
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableSecurity
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.3.0
|
||||
@@ -52,7 +54,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class SecureLocatorApplicationIntegrationTests {
|
||||
public class SecureLocatorApplicationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private Locator locator;
|
||||
|
||||
@@ -49,6 +49,7 @@ import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.config.annotation.PeerCacheApplication;
|
||||
import org.springframework.data.gemfire.test.model.Gender;
|
||||
import org.springframework.data.gemfire.test.model.Person;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -57,17 +58,20 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.IndexFactoryBean
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.query.Index
|
||||
* @see org.apache.geode.cache.query.QueryService
|
||||
* @see org.springframework.data.gemfire.IndexFactoryBean
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.7.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class DefinedIndexesIntegrationTests {
|
||||
public class DefinedIndexesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final List<String> definedIndexNames = new ArrayList<>(3);
|
||||
|
||||
@@ -121,8 +125,8 @@ public class DefinedIndexesIntegrationTests {
|
||||
assertThat(name).isEqualTo(queryService.getIndex(people, name.getName()));
|
||||
}
|
||||
|
||||
@PeerCacheApplication(logLevel = "error")
|
||||
static class DefinedIndexesConfiguration {
|
||||
@PeerCacheApplication
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
// TODO remove when the Annotation config model includes support
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.support;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -32,6 +31,7 @@ import org.apache.geode.cache.GemFireCache;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.DiskStoreFactoryBean;
|
||||
import org.springframework.data.gemfire.config.annotation.PeerCacheApplication;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.util.FileSystemUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -41,16 +41,17 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.DiskStore
|
||||
* @see org.springframework.data.gemfire.DiskStoreFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.support.DiskStoreDirectoryBeanPostProcessor
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
public class DiskStoreDirectoryBeanPostProcessorIntegrationTests {
|
||||
public class DiskStoreDirectoryBeanPostProcessorIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void testSuiteSetup() {
|
||||
|
||||
@@ -73,6 +73,7 @@ public class LuceneIndexRegionBeanFactoryPostProcessorIntegrationTests extends I
|
||||
.map(beanFactory -> beanFactory.getBeanDefinition(beanName))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void regionLuceneIndexAndDiskStoreBeanDependenciesAreCorrect() {
|
||||
|
||||
@@ -115,6 +116,7 @@ public class LuceneIndexRegionBeanFactoryPostProcessorIntegrationTests extends I
|
||||
|
||||
@Test
|
||||
public void gemfireBeanProcessingOrderIsCorrect() {
|
||||
|
||||
assertThat(beanNames.indexOf("BookTitleLuceneIndex")).isLessThan(beanNames.indexOf("Books"));
|
||||
assertThat(beanNames.indexOf("ContractDescriptionLuceneIndex")).isLessThan(beanNames.indexOf("Contracts"));
|
||||
}
|
||||
|
||||
@@ -35,27 +35,28 @@ import org.apache.geode.cache.wan.GatewayEventSubstitutionFilter;
|
||||
import org.apache.geode.cache.wan.GatewayQueueEvent;
|
||||
import org.apache.geode.cache.wan.GatewaySender;
|
||||
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* The AsyncEventQueueNamespaceTest class is a test suite of test cases testing the contract and functionality
|
||||
* of configuring a Pivotal GemFire or Apache Geode {@link AsyncEventQueue} using the SDG XML namespace.
|
||||
* Integration Tests testing the contract and functionality of an {@link AsyncEventQueue}
|
||||
* using SDG XML namespace configuration metadata.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.asyncqueue.AsyncEventQueue
|
||||
* @see org.springframework.data.gemfire.config.AsyncEventQueueParser
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.wan.AsyncEventQueueFactoryBean
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @see org.apache.geode.cache.asyncqueue.AsyncEventQueue
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("all")
|
||||
public class AsyncEventQueueNamespaceTest {
|
||||
public class AsyncEventQueueNamespaceIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Resource(name = "TestAsyncEventQueue")
|
||||
private AsyncEventQueue asyncEventQueue;
|
||||
@@ -34,11 +34,12 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.TestUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration Tests for {@link CacheParser}.
|
||||
* Integration Tests for {@link CacheParser} and {@link CacheFactoryBean}.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
@@ -46,12 +47,13 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.springframework.data.gemfire.CacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.xml.CacheParser
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
public class CacheNamespaceIntegrationTests {
|
||||
public class CacheNamespaceIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.data.gemfire.TestUtils;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -41,6 +42,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.xml.ClientCacheParser
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.6.3
|
||||
@@ -48,7 +50,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientCacheNamespaceIntegrationTests {
|
||||
public class ClientCacheNamespaceIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -33,8 +33,8 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration Tests with test cases testing the contract and functionality of using SDG's XML namespace configuration
|
||||
* metadata to configure {@link DiskStore DiskStores}.
|
||||
* Integration Tests testing the contract and functionality of using SDG's XML namespace configuration metadata to
|
||||
* configure {@link DiskStore DiskStores}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -46,7 +46,8 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(locations = "diskstore-ns.xml", initializers = GemFireMockObjectsApplicationContextInitializer.class)
|
||||
@ContextConfiguration(locations = "diskstore-ns.xml",
|
||||
initializers = GemFireMockObjectsApplicationContextInitializer.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class DiskStoreNamespaceIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration Tests for SDG Function XML namespace configuration metadata
|
||||
* Integration Tests for {@link Function} configuration, declaration and registration
|
||||
* using SDG XML namespace configuration metadata.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author David Turanski
|
||||
|
||||
@@ -33,15 +33,16 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration Tests with test cases testing the contract and functionality of GemFire 8 {@link GatewaySender}
|
||||
* and {@link GatewayReceiver} support.
|
||||
* Integration Tests testing GemFire 8 {@link GatewaySender} and {@link GatewayReceiver} configuration
|
||||
* using SDG XML namespace configuration metadata.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.wan.GatewayReceiver
|
||||
* @see org.apache.geode.cache.wan.GatewaySender
|
||||
* @see org.apache.geode.cache.wan.GatewayEventSubstitutionFilter
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer
|
||||
* @see org.springframework.data.gemfire.wan.GatewayReceiverFactoryBean
|
||||
* @see org.springframework.data.gemfire.wan.GatewaySenderFactoryBean
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
|
||||
@@ -27,22 +27,32 @@ import org.apache.geode.cache.DataPolicy;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.RegionAttributes;
|
||||
import org.apache.geode.cache.asyncqueue.AsyncEventListener;
|
||||
import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
|
||||
import org.apache.geode.cache.wan.GatewaySender;
|
||||
|
||||
import org.springframework.data.gemfire.support.AbstractFactoryBeanSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* The LookupRegionWithAsyncEventQueuesAndGatewaySendersIntegrationTests class...
|
||||
* Integration Tests for SDG lookup {@link Region} resolution configured with an {@link AsyncEventQueue}
|
||||
* and {@link GatewaySender} using SDG XML namespace configuration metadata.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.asyncqueue.AsyncEventQueue
|
||||
* @see org.apache.geode.cache.wan.GatewaySender
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class LookupRegionWithAsyncEventQueuesAndGatewaySendersIntegrationTests {
|
||||
public class LookupRegionWithAsyncEventQueuesAndGatewaySendersIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Resource(name = "Example")
|
||||
private Region<?, ?> example;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.xml;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -55,6 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -64,19 +64,21 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.lucene.LuceneIndex
|
||||
* @see org.apache.geode.cache.lucene.LuceneService
|
||||
* @see org.springframework.data.gemfire.config.xml.LuceneIndexParser
|
||||
* @see org.springframework.data.gemfire.config.xml.LuceneServiceParser
|
||||
* @see org.springframework.data.gemfire.search.lucene.LuceneIndexFactoryBean
|
||||
* @see org.springframework.data.gemfire.search.lucene.LuceneServiceFactoryBean
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.1.0
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class LuceneNamespaceUnitTests {
|
||||
public class LuceneNamespaceUnitTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final String[] EMPTY_STRING_ARRAY = {};
|
||||
|
||||
@@ -100,10 +102,10 @@ public class LuceneNamespaceUnitTests {
|
||||
private LuceneIndex luceneIndexFour;
|
||||
|
||||
@Autowired
|
||||
private LuceneSerializer luceneSerializer;
|
||||
private LuceneSerializer<?> luceneSerializer;
|
||||
|
||||
private static String[] asArray(List<String> list) {
|
||||
return list.toArray(new String[list.size()]);
|
||||
return list.toArray(new String[0]);
|
||||
}
|
||||
|
||||
private static String[] toStringArray(Object[] array) {
|
||||
@@ -207,7 +209,7 @@ public class LuceneNamespaceUnitTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public LuceneService getObject() throws Exception {
|
||||
|
||||
return Optional.ofNullable(this.luceneService).orElseGet(() -> {
|
||||
@@ -251,7 +253,7 @@ public class LuceneNamespaceUnitTests {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Answer<LuceneIndex> mockLuceneIndex(LuceneService mockLuceneService,
|
||||
Map<String, Analyzer> fieldAnalyzers, List<String> fieldNames,
|
||||
AtomicReference<LuceneSerializer> luceneSerializer) {
|
||||
@@ -313,6 +315,7 @@ public class LuceneNamespaceUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static class MockLuceneSerializerFactoryBean implements FactoryBean<LuceneSerializer> {
|
||||
|
||||
private LuceneSerializer luceneSerializer;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PoolNamespaceIntegrationTests extends IntegrationTestsSupport {
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
protected void assertConnectionEndpoint(ConnectionEndpointList connectionEndpoints,
|
||||
private void assertConnectionEndpoint(ConnectionEndpointList connectionEndpoints,
|
||||
String expectedHost, int expectedPort) {
|
||||
|
||||
assertThat(connectionEndpoints).isNotNull();
|
||||
@@ -67,7 +67,7 @@ public class PoolNamespaceIntegrationTests extends IntegrationTestsSupport {
|
||||
assertConnectionEndpoint(connectionEndpoints.get(0), expectedHost, expectedPort);
|
||||
}
|
||||
|
||||
protected void assertConnectionEndpoint(ConnectionEndpoint connectionEndpoint,
|
||||
private void assertConnectionEndpoint(ConnectionEndpoint connectionEndpoint,
|
||||
String expectedHost, int expectedPort) {
|
||||
|
||||
assertThat(connectionEndpoint).isNotNull();
|
||||
@@ -75,7 +75,7 @@ public class PoolNamespaceIntegrationTests extends IntegrationTestsSupport {
|
||||
assertThat(connectionEndpoint.getPort()).isEqualTo(expectedPort);
|
||||
}
|
||||
|
||||
protected void assertNoConnectionEndpoints(ConnectionEndpointList connectionEndpoints) {
|
||||
private void assertNoConnectionEndpoints(ConnectionEndpointList connectionEndpoints) {
|
||||
assertThat(connectionEndpoints).isNotNull();
|
||||
assertThat(connectionEndpoints.isEmpty()).isTrue();
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.gemfire.config.xml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -35,8 +34,8 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration Tests with test cases testing the use of Eviction configuration settings (EvictionAttributes)
|
||||
* in the SDG XML namespace configuration metadata.
|
||||
* Integration Tests for Apache Geode {@link Region} Eviction configuration settings ({@link EvictionAttributes})
|
||||
* using SDG XML namespace configuration metadata.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -74,65 +73,63 @@ public class RegionEvictionAttributesNamespaceIntegrationTests extends Integrati
|
||||
@Test
|
||||
public void testEntryCountRegionEvictionAttributes() {
|
||||
|
||||
assertNotNull(one);
|
||||
assertNotNull(one.getAttributes());
|
||||
assertEquals(DataPolicy.REPLICATE, one.getAttributes().getDataPolicy());
|
||||
assertNotNull(one.getAttributes().getEvictionAttributes());
|
||||
assertEquals(EvictionAction.OVERFLOW_TO_DISK, one.getAttributes().getEvictionAttributes().getAction());
|
||||
assertEquals(EvictionAlgorithm.LRU_ENTRY, one.getAttributes().getEvictionAttributes().getAlgorithm());
|
||||
assertEquals(4096, one.getAttributes().getEvictionAttributes().getMaximum());
|
||||
assertThat(one).isNotNull();
|
||||
assertThat(one.getAttributes()).isNotNull();
|
||||
assertThat(one.getAttributes().getDataPolicy()).isEqualTo(DataPolicy.REPLICATE);
|
||||
assertThat(one.getAttributes().getEvictionAttributes()).isNotNull();
|
||||
assertThat(one.getAttributes().getEvictionAttributes().getAction()).isEqualTo(EvictionAction.OVERFLOW_TO_DISK);
|
||||
assertThat(one.getAttributes().getEvictionAttributes().getAlgorithm()).isEqualTo(EvictionAlgorithm.LRU_ENTRY);
|
||||
assertThat(one.getAttributes().getEvictionAttributes().getMaximum()).isEqualTo(4096);
|
||||
|
||||
assertNotNull(two);
|
||||
assertNotNull(two.getAttributes());
|
||||
assertEquals(DataPolicy.PARTITION, two.getAttributes().getDataPolicy());
|
||||
assertNotNull(two.getAttributes().getEvictionAttributes());
|
||||
assertEquals(EvictionAction.LOCAL_DESTROY, two.getAttributes().getEvictionAttributes().getAction());
|
||||
assertEquals(EvictionAlgorithm.LRU_ENTRY, two.getAttributes().getEvictionAttributes().getAlgorithm());
|
||||
|
||||
assertEquals(EvictionAttributes.DEFAULT_ENTRIES_MAXIMUM,
|
||||
two.getAttributes().getEvictionAttributes().getMaximum());
|
||||
assertThat(two).isNotNull();
|
||||
assertThat(two.getAttributes()).isNotNull();
|
||||
assertThat(two.getAttributes().getDataPolicy()).isEqualTo(DataPolicy.PARTITION);
|
||||
assertThat(two.getAttributes().getEvictionAttributes()).isNotNull();
|
||||
assertThat(two.getAttributes().getEvictionAttributes().getAction()).isEqualTo(EvictionAction.LOCAL_DESTROY);
|
||||
assertThat(two.getAttributes().getEvictionAttributes().getAlgorithm()).isEqualTo(EvictionAlgorithm.LRU_ENTRY);
|
||||
assertThat(two.getAttributes().getEvictionAttributes().getMaximum()).isEqualTo(EvictionAttributes.DEFAULT_ENTRIES_MAXIMUM);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHeapPercentageRegionEvictionAttributes() {
|
||||
|
||||
assertNotNull(three);
|
||||
assertNotNull(three.getAttributes());
|
||||
assertEquals(DataPolicy.REPLICATE, three.getAttributes().getDataPolicy());
|
||||
assertNotNull(three.getAttributes().getEvictionAttributes());
|
||||
assertEquals(EvictionAction.OVERFLOW_TO_DISK, three.getAttributes().getEvictionAttributes().getAction());
|
||||
assertEquals(EvictionAlgorithm.LRU_HEAP, three.getAttributes().getEvictionAttributes().getAlgorithm());
|
||||
assertThat(three).isNotNull();
|
||||
assertThat(three.getAttributes()).isNotNull();
|
||||
assertThat(three.getAttributes().getDataPolicy()).isEqualTo(DataPolicy.REPLICATE);
|
||||
assertThat(three.getAttributes().getEvictionAttributes()).isNotNull();
|
||||
assertThat(three.getAttributes().getEvictionAttributes().getAction()).isEqualTo(EvictionAction.OVERFLOW_TO_DISK);
|
||||
assertThat(three.getAttributes().getEvictionAttributes().getAlgorithm()).isEqualTo(EvictionAlgorithm.LRU_HEAP);
|
||||
|
||||
assertNotNull(four);
|
||||
assertNotNull(four.getAttributes());
|
||||
assertEquals(DataPolicy.PARTITION, four.getAttributes().getDataPolicy());
|
||||
assertNotNull(four.getAttributes().getEvictionAttributes());
|
||||
assertEquals(EvictionAction.OVERFLOW_TO_DISK, four.getAttributes().getEvictionAttributes().getAction());
|
||||
assertEquals(EvictionAlgorithm.LRU_HEAP, three.getAttributes().getEvictionAttributes().getAlgorithm());
|
||||
assertEquals(0, four.getAttributes().getEvictionAttributes().getMaximum());
|
||||
assertThat(four).isNotNull();
|
||||
assertThat(four.getAttributes()).isNotNull();
|
||||
assertThat(four.getAttributes().getDataPolicy()).isEqualTo(DataPolicy.PARTITION);
|
||||
assertThat(four.getAttributes().getEvictionAttributes()).isNotNull();
|
||||
assertThat(four.getAttributes().getEvictionAttributes().getAction()).isEqualTo(EvictionAction.OVERFLOW_TO_DISK);
|
||||
assertThat(three.getAttributes().getEvictionAttributes().getAlgorithm()).isEqualTo(EvictionAlgorithm.LRU_HEAP);
|
||||
assertThat(four.getAttributes().getEvictionAttributes().getMaximum()).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMemorySizeRegionEvictionAttributes() {
|
||||
|
||||
assertNotNull(five);
|
||||
assertNotNull(five.getAttributes());
|
||||
assertEquals(DataPolicy.REPLICATE, five.getAttributes().getDataPolicy());
|
||||
assertNotNull(five.getAttributes().getEvictionAttributes());
|
||||
assertEquals(EvictionAction.OVERFLOW_TO_DISK, five.getAttributes().getEvictionAttributes().getAction());
|
||||
assertEquals(EvictionAlgorithm.LRU_MEMORY, five.getAttributes().getEvictionAttributes().getAlgorithm());
|
||||
assertEquals(128, five.getAttributes().getEvictionAttributes().getMaximum());
|
||||
assertThat(five).isNotNull();
|
||||
assertThat(five.getAttributes()).isNotNull();
|
||||
assertThat(five.getAttributes().getDataPolicy()).isEqualTo(DataPolicy.REPLICATE);
|
||||
assertThat(five.getAttributes().getEvictionAttributes()).isNotNull();
|
||||
assertThat(five.getAttributes().getEvictionAttributes().getAction()).isEqualTo(EvictionAction.OVERFLOW_TO_DISK);
|
||||
assertThat(five.getAttributes().getEvictionAttributes().getAlgorithm()).isEqualTo(EvictionAlgorithm.LRU_MEMORY);
|
||||
assertThat(five.getAttributes().getEvictionAttributes().getMaximum()).isEqualTo(128);
|
||||
|
||||
assertNotNull(six);
|
||||
assertNotNull(six.getAttributes());
|
||||
assertEquals(DataPolicy.PARTITION, six.getAttributes().getDataPolicy());
|
||||
assertNotNull(six.getAttributes().getEvictionAttributes());
|
||||
assertEquals(EvictionAction.OVERFLOW_TO_DISK, six.getAttributes().getEvictionAttributes().getAction());
|
||||
assertEquals(EvictionAlgorithm.LRU_MEMORY, six.getAttributes().getEvictionAttributes().getAlgorithm());
|
||||
assertThat(six).isNotNull();
|
||||
assertThat(six.getAttributes()).isNotNull();
|
||||
assertThat(six.getAttributes().getDataPolicy()).isEqualTo(DataPolicy.PARTITION);
|
||||
assertThat(six.getAttributes().getEvictionAttributes()).isNotNull();
|
||||
assertThat(six.getAttributes().getEvictionAttributes().getAction()).isEqualTo(EvictionAction.OVERFLOW_TO_DISK);
|
||||
assertThat(six.getAttributes().getEvictionAttributes().getAlgorithm()).isEqualTo(EvictionAlgorithm.LRU_MEMORY);
|
||||
|
||||
int expectedMaximum =
|
||||
Boolean.getBoolean("org.springframework.data.gemfire.test.GemfireTestRunner.nomock") ? 512 : 256;
|
||||
int expectedMaximum = Boolean.getBoolean("org.springframework.data.gemfire.test.GemfireTestRunner.nomock")
|
||||
? 512 : 256;
|
||||
|
||||
assertEquals(expectedMaximum, six.getAttributes().getEvictionAttributes().getMaximum());
|
||||
assertThat(six.getAttributes().getEvictionAttributes().getMaximum()).isEqualTo(expectedMaximum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,11 +34,12 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration Tests with test cases testing the contract and functionality of Region/SubRegion creation in a cache.
|
||||
* Integration Tests for {@link Region} and {@link Region sub-Region} creation in a cache.
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer
|
||||
|
||||
@@ -13,14 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.xml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assume.assumeNotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -45,60 +40,63 @@ import org.apache.geode.cache.util.CacheListenerAdapter;
|
||||
import org.apache.geode.cache.util.CacheWriterAdapter;
|
||||
import org.apache.geode.cache.util.ObjectSizer;
|
||||
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* The TemplateClientRegionNamespaceTest class is a test suite of test cases testing the contract and functionality
|
||||
* of Client Region Templates using Spring Data GemFire XML namespace configuration meta-data.
|
||||
* Integration Tests for client {@link Region} templates using SDG XML namespace configuration metadata.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@ContextConfiguration(initializers = GemFireMockObjectsApplicationContextInitializer.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class TemplateClientRegionNamespaceTest {
|
||||
public class TemplateClientRegionNamespaceIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Resource(name = "TemplateBasedClientRegion")
|
||||
private Region<Integer, Object> templateBasedClientRegion;
|
||||
|
||||
private void assertCacheListeners(Region<?, ?> region, String... expectedNames) {
|
||||
|
||||
assertNotNull(region);
|
||||
assertNotNull(region.getAttributes());
|
||||
assertNotNull(region.getAttributes().getCacheListeners());
|
||||
assertEquals(expectedNames.length, region.getAttributes().getCacheListeners().length);
|
||||
assertThat(region).isNotNull();
|
||||
assertThat(region.getAttributes()).isNotNull();
|
||||
assertThat(region.getAttributes().getCacheListeners()).isNotNull();
|
||||
assertThat(region.getAttributes().getCacheListeners().length).isEqualTo(expectedNames.length);
|
||||
|
||||
for (CacheListener cacheListener : region.getAttributes().getCacheListeners()) {
|
||||
assertTrue(cacheListener instanceof TestCacheListener);
|
||||
assertTrue(Arrays.asList(expectedNames).contains(cacheListener.toString()));
|
||||
for (CacheListener<?, ?> cacheListener : region.getAttributes().getCacheListeners()) {
|
||||
assertThat(cacheListener instanceof TestCacheListener).isTrue();
|
||||
assertThat(Arrays.asList(expectedNames).contains(cacheListener.toString())).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
private void assertCacheLoader(Region<?, ?> region, String expectedName) {
|
||||
assertNotNull(region);
|
||||
assertNotNull(region.getAttributes());
|
||||
assertTrue(region.getAttributes().getCacheLoader() instanceof TestCacheLoader);
|
||||
assertEquals(expectedName, region.getAttributes().getCacheLoader().toString());
|
||||
|
||||
assertThat(region).isNotNull();
|
||||
assertThat(region.getAttributes()).isNotNull();
|
||||
assertThat(region.getAttributes().getCacheLoader() instanceof TestCacheLoader).isTrue();
|
||||
assertThat(region.getAttributes().getCacheLoader().toString()).isEqualTo(expectedName);
|
||||
}
|
||||
|
||||
private void assertCacheWriter(Region<?, ?> region, String expectedName) {
|
||||
assertNotNull(region);
|
||||
assertNotNull(region.getAttributes());
|
||||
assertTrue(region.getAttributes().getCacheWriter() instanceof TestCacheWriter);
|
||||
assertEquals(expectedName, region.getAttributes().getCacheWriter().toString());
|
||||
|
||||
assertThat(region).isNotNull();
|
||||
assertThat(region.getAttributes()).isNotNull();
|
||||
assertThat(region.getAttributes().getCacheWriter() instanceof TestCacheWriter).isTrue();
|
||||
assertThat(region.getAttributes().getCacheWriter().toString()).isEqualTo(expectedName);
|
||||
}
|
||||
|
||||
private void assertDefaultEvictionAttributes(EvictionAttributes evictionAttributes) {
|
||||
|
||||
assumeNotNull(evictionAttributes);
|
||||
assertEvictionAttributes(evictionAttributes, EvictionAction.NONE, EvictionAlgorithm.NONE, 0, null);
|
||||
}
|
||||
@@ -106,51 +104,53 @@ public class TemplateClientRegionNamespaceTest {
|
||||
private void assertEvictionAttributes(EvictionAttributes evictionAttributes, EvictionAction expectedAction,
|
||||
EvictionAlgorithm expectedAlgorithm, int expectedMaximum, ObjectSizer expectedObjectSizer) {
|
||||
|
||||
assertNotNull("The 'EvictionAttributes' must not be null!", evictionAttributes);
|
||||
assertEquals(expectedAction, evictionAttributes.getAction());
|
||||
assertEquals(expectedAlgorithm, evictionAttributes.getAlgorithm());
|
||||
assertEquals(expectedMaximum, evictionAttributes.getMaximum());
|
||||
assertEquals(expectedObjectSizer, evictionAttributes.getObjectSizer());
|
||||
assertThat(evictionAttributes).describedAs("The 'EvictionAttributes' must not be null!").isNotNull();
|
||||
assertThat(evictionAttributes.getAction()).isEqualTo(expectedAction);
|
||||
assertThat(evictionAttributes.getAlgorithm()).isEqualTo(expectedAlgorithm);
|
||||
assertThat(evictionAttributes.getMaximum()).isEqualTo(expectedMaximum);
|
||||
assertThat(evictionAttributes.getObjectSizer()).isEqualTo(expectedObjectSizer);
|
||||
}
|
||||
|
||||
private void assertDefaultExpirationAttributes(ExpirationAttributes expirationAttributes) {
|
||||
|
||||
assumeNotNull(expirationAttributes);
|
||||
assertEquals(ExpirationAction.INVALIDATE, expirationAttributes.getAction());
|
||||
assertEquals(0, expirationAttributes.getTimeout());
|
||||
assertThat(expirationAttributes.getAction()).isEqualTo(ExpirationAction.INVALIDATE);
|
||||
assertThat(expirationAttributes.getTimeout()).isEqualTo(0);
|
||||
}
|
||||
|
||||
private void assertExpirationAttributes(ExpirationAttributes expirationAttributes, ExpirationAction expectedAction,
|
||||
int expectedTimeout) {
|
||||
|
||||
assertNotNull("The 'ExpirationAttributes' must not be null!", expirationAttributes);
|
||||
assertEquals(expectedAction, expirationAttributes.getAction());
|
||||
assertEquals(expectedTimeout, expirationAttributes.getTimeout());
|
||||
assertThat(expirationAttributes).as("The 'ExpirationAttributes' must not be null!").isNotNull();
|
||||
assertThat(expirationAttributes.getAction()).isEqualTo(expectedAction);
|
||||
assertThat(expirationAttributes.getTimeout()).isEqualTo(expectedTimeout);
|
||||
}
|
||||
|
||||
private void assertDefaultRegionAttributes(Region region) {
|
||||
private void assertDefaultRegionAttributes(Region<?, ?> region) {
|
||||
|
||||
assertNotNull("The Region must not be null!", region);
|
||||
assertNotNull(String.format("The Region (%1$s) must have 'RegionAttributes' defined!",
|
||||
region.getFullPath()), region.getAttributes());
|
||||
assertNull(region.getAttributes().getCompressor());
|
||||
assertNull(region.getAttributes().getCustomEntryIdleTimeout());
|
||||
assertNull(region.getAttributes().getCustomEntryTimeToLive());
|
||||
assertNull(region.getAttributes().getDiskStoreName());
|
||||
assertFalse(region.getAttributes().getMulticastEnabled());
|
||||
assertThat(region).describedAs("The Region must not be null!").isNotNull();
|
||||
assertThat(region.getAttributes())
|
||||
.describedAs("The Region (%1$s) must have 'RegionAttributes' defined!", region.getFullPath())
|
||||
.isNotNull();
|
||||
assertThat(region.getAttributes().getCompressor()).isNull();
|
||||
assertThat(region.getAttributes().getCustomEntryIdleTimeout()).isNull();
|
||||
assertThat(region.getAttributes().getCustomEntryTimeToLive()).isNull();
|
||||
assertThat(region.getAttributes().getDiskStoreName()).isNull();
|
||||
assertThat(region.getAttributes().getMulticastEnabled()).isFalse();
|
||||
assertDefaultExpirationAttributes(region.getAttributes().getRegionTimeToLive());
|
||||
assertDefaultExpirationAttributes(region.getAttributes().getRegionIdleTimeout());
|
||||
}
|
||||
|
||||
private static void assertEmpty(Object[] array) {
|
||||
assertTrue((array == null || array.length == 0));
|
||||
assertThat(array == null || array.length == 0).isTrue();
|
||||
}
|
||||
|
||||
private static void assertEmpty(Iterable<?> collection) {
|
||||
assertTrue(collection == null || !collection.iterator().hasNext());
|
||||
assertThat(collection == null || !collection.iterator().hasNext()).isTrue();
|
||||
}
|
||||
|
||||
private static void assertNullEmpty(String value) {
|
||||
assertFalse(StringUtils.hasText(value));
|
||||
assertThat(StringUtils.hasText(value)).isFalse();
|
||||
}
|
||||
|
||||
private static void assertRegionMetaData(Region<?, ?> region, String expectedRegionName) {
|
||||
@@ -159,12 +159,12 @@ public class TemplateClientRegionNamespaceTest {
|
||||
|
||||
private static void assertRegionMetaData(Region<?, ?> region, String expectedRegionName, String expectedRegionPath) {
|
||||
|
||||
assertNotNull(String.format("The '%1$s' Region was not properly configured and initialized!",
|
||||
expectedRegionName), region);
|
||||
assertEquals(expectedRegionName, region.getName());
|
||||
assertEquals(expectedRegionPath, region.getFullPath());
|
||||
assertNotNull(String.format("The '%1$s' Region must have RegionAttributes defined!",
|
||||
expectedRegionName), region.getAttributes());
|
||||
assertThat(region).as(String.format("The '%1$s' Region was not properly configured and initialized!",
|
||||
expectedRegionName)).isNotNull();
|
||||
assertThat(region.getName()).isEqualTo(expectedRegionName);
|
||||
assertThat(region.getFullPath()).isEqualTo(expectedRegionPath);
|
||||
assertThat(region.getAttributes()).as(String.format("The '%1$s' Region must have RegionAttributes defined!",
|
||||
expectedRegionName)).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -175,23 +175,23 @@ public class TemplateClientRegionNamespaceTest {
|
||||
assertCacheListeners(templateBasedClientRegion, "XYZ");
|
||||
assertCacheLoader(templateBasedClientRegion, "A");
|
||||
assertCacheWriter(templateBasedClientRegion, "B");
|
||||
assertFalse(templateBasedClientRegion.getAttributes().getCloningEnabled());
|
||||
assertFalse(templateBasedClientRegion.getAttributes().getConcurrencyChecksEnabled());
|
||||
assertEquals(16, templateBasedClientRegion.getAttributes().getConcurrencyLevel());
|
||||
assertEquals(DataPolicy.NORMAL, templateBasedClientRegion.getAttributes().getDataPolicy());
|
||||
assertFalse(templateBasedClientRegion.getAttributes().isDiskSynchronous());
|
||||
assertThat(templateBasedClientRegion.getAttributes().getCloningEnabled()).isFalse();
|
||||
assertThat(templateBasedClientRegion.getAttributes().getConcurrencyChecksEnabled()).isFalse();
|
||||
assertThat(templateBasedClientRegion.getAttributes().getConcurrencyLevel()).isEqualTo(16);
|
||||
assertThat(templateBasedClientRegion.getAttributes().getDataPolicy()).isEqualTo(DataPolicy.NORMAL);
|
||||
assertThat(templateBasedClientRegion.getAttributes().isDiskSynchronous()).isFalse();
|
||||
assertEvictionAttributes(templateBasedClientRegion.getAttributes().getEvictionAttributes(),
|
||||
EvictionAction.OVERFLOW_TO_DISK, EvictionAlgorithm.LRU_ENTRY, 1024, null);
|
||||
assertEquals(51, templateBasedClientRegion.getAttributes().getInitialCapacity());
|
||||
assertEquals(Integer.class, templateBasedClientRegion.getAttributes().getKeyConstraint());
|
||||
assertEquals("0.85", String.valueOf(templateBasedClientRegion.getAttributes().getLoadFactor()));
|
||||
assertEquals("ServerPool", templateBasedClientRegion.getAttributes().getPoolName());
|
||||
assertTrue(templateBasedClientRegion.getAttributes().getStatisticsEnabled());
|
||||
assertEquals(Object.class, templateBasedClientRegion.getAttributes().getValueConstraint());
|
||||
assertThat(templateBasedClientRegion.getAttributes().getInitialCapacity()).isEqualTo(51);
|
||||
assertThat(templateBasedClientRegion.getAttributes().getKeyConstraint()).isEqualTo(Integer.class);
|
||||
assertThat(String.valueOf(templateBasedClientRegion.getAttributes().getLoadFactor())).isEqualTo("0.85");
|
||||
assertThat(templateBasedClientRegion.getAttributes().getPoolName()).isEqualTo("ServerPool");
|
||||
assertThat(templateBasedClientRegion.getAttributes().getStatisticsEnabled()).isTrue();
|
||||
assertThat(templateBasedClientRegion.getAttributes().getValueConstraint()).isEqualTo(Object.class);
|
||||
templateBasedClientRegion.getInterestList();
|
||||
}
|
||||
|
||||
public static final class TestCacheListener extends CacheListenerAdapter {
|
||||
public static final class TestCacheListener extends CacheListenerAdapter<Object, Object> {
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -205,7 +205,7 @@ public class TemplateClientRegionNamespaceTest {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class TestCacheLoader implements CacheLoader {
|
||||
public static final class TestCacheLoader implements CacheLoader<Object, Object> {
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -227,7 +227,7 @@ public class TemplateClientRegionNamespaceTest {
|
||||
}
|
||||
}
|
||||
|
||||
public static final class TestCacheWriter extends CacheWriterAdapter {
|
||||
public static final class TestCacheWriter extends CacheWriterAdapter<Object, Object> {
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -29,8 +29,15 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration Tests for SDG Transaction Manager configuration in SDG XML namespace configuration metadata.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(locations = "/org/springframework/data/gemfire/config/xml/tx-ns.xml",
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.xml.support;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -30,11 +29,12 @@ import org.apache.geode.cache.client.Pool;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.GemfireUtils;
|
||||
import org.springframework.data.gemfire.function.annotation.OnRegion;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests to test the configuration of the {@link ClientCache} {@literal DEFAULT} {@link Pool},
|
||||
* Integration Tests testing the configuration of the {@link ClientCache} {@literal DEFAULT} {@link Pool},
|
||||
* client {@link Region Region's} using a configured {@link Pool} and a {@link Function} referring to
|
||||
* a client {@link Region} requiring the configured {@link Pool}.
|
||||
*
|
||||
@@ -43,12 +43,16 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.apache.geode.cache.client.Pool
|
||||
* @see org.springframework.data.gemfire.client.PoolFactoryBean
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class PoolAlreadyExistsIntegrationTests {
|
||||
public class PoolAlreadyExistsIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ClientCache clientCache;
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer;
|
||||
import org.springframework.expression.EvaluationException;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -46,10 +47,10 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.junit.Test
|
||||
* @see org.mockito.Mockito
|
||||
* @see org.apache.geode.cache.CustomExpiry
|
||||
* @see org.apache.geode.cache.ExpirationAction
|
||||
* @see org.apache.geode.cache.ExpirationAttributes
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.expiration.AnnotationBasedExpiration
|
||||
* @see org.springframework.data.gemfire.expiration.ExpirationAttributesFactoryBean
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
@@ -59,7 +60,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(initializers = GemFireMockObjectsApplicationContextInitializer.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class AnnotationBasedExpirationConfigurationIntegrationTest {
|
||||
public class AnnotationBasedExpirationConfigurationIntegrationTest extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("genericExpiration")
|
||||
|
||||
@@ -17,13 +17,10 @@ package org.springframework.data.gemfire.function;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -35,14 +32,10 @@ import org.apache.geode.cache.execute.FunctionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.fork.ServerProcess;
|
||||
import org.springframework.data.gemfire.function.sample.ExceptionThrowingFunctionExecution;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessExecutor;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.tests.util.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.tests.util.ThreadUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Integration Tests testing the proper behavior of SDG's {@link Function} annotation support when the {@link Function}
|
||||
@@ -56,8 +49,7 @@ import org.springframework.util.Assert;
|
||||
* @see org.springframework.data.gemfire.fork.ServerProcess
|
||||
* @see org.springframework.data.gemfire.function.annotation.GemfireFunction
|
||||
* @see org.springframework.data.gemfire.function.sample.ExceptionThrowingFunctionExecution
|
||||
* @see org.springframework.data.gemfire.process.ProcessExecutor
|
||||
* @see org.springframework.data.gemfire.process.ProcessWrapper
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.7.0
|
||||
@@ -65,7 +57,7 @@ import org.springframework.util.Assert;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ExceptionThrowingFunctionExecutionIntegrationTests extends IntegrationTestsSupport {
|
||||
public class ExceptionThrowingFunctionExecutionIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static ProcessWrapper gemfireServer;
|
||||
|
||||
@@ -73,51 +65,16 @@ public class ExceptionThrowingFunctionExecutionIntegrationTests extends Integrat
|
||||
private ExceptionThrowingFunctionExecution exceptionThrowingFunctionExecution;
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws IOException {
|
||||
|
||||
String serverName = ExceptionThrowingFunctionExecutionIntegrationTests.class.getSimpleName().concat("Server");
|
||||
|
||||
File serverWorkingDirectory = new File(FileSystemUtils.WORKING_DIRECTORY, serverName.toLowerCase());
|
||||
|
||||
Assert.isTrue(serverWorkingDirectory.isDirectory() || serverWorkingDirectory.mkdirs(),
|
||||
String.format("Failed to create working directory [%s]", serverWorkingDirectory));
|
||||
public static void startGeodeServer() throws IOException {
|
||||
|
||||
List<String> arguments = new ArrayList<>();
|
||||
|
||||
arguments.add("-Dgemfire.name=" + serverName);
|
||||
arguments.add("-Dgemfire.log-level=error");
|
||||
arguments.add(ExceptionThrowingFunctionExecutionIntegrationTests.class.getName()
|
||||
.replace(".", "/")
|
||||
.concat("-server-context.xml"));
|
||||
arguments.add(String.format("-Dgemfire.name=%s",
|
||||
ExceptionThrowingFunctionExecutionIntegrationTests.class.getSimpleName().concat("Server")));
|
||||
|
||||
gemfireServer = ProcessExecutor.launch(serverWorkingDirectory, ServerProcess.class,
|
||||
arguments.toArray(new String[0]));
|
||||
arguments.add(getServerContextXmlFileLocation(ExceptionThrowingFunctionExecutionIntegrationTests.class));
|
||||
|
||||
waitForServerStart(TimeUnit.SECONDS.toMillis(20));
|
||||
}
|
||||
|
||||
private static void waitForServerStart(final long milliseconds) {
|
||||
|
||||
ThreadUtils.timedWait(milliseconds, TimeUnit.MILLISECONDS.toMillis(500), new ThreadUtils.Condition() {
|
||||
|
||||
private final File serverPidControlFile = new File(gemfireServer.getWorkingDirectory(),
|
||||
ServerProcess.getServerProcessControlFilename());
|
||||
|
||||
@Override
|
||||
public boolean evaluate() {
|
||||
return !serverPidControlFile.isFile();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
|
||||
gemfireServer.shutdown();
|
||||
|
||||
if (Boolean.parseBoolean(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
org.springframework.util.FileSystemUtils.deleteRecursively(gemfireServer.getWorkingDirectory());
|
||||
}
|
||||
startGemFireServer(ServerProcess.class, arguments.toArray(new String[0]));
|
||||
}
|
||||
|
||||
@Test(expected = FunctionException.class)
|
||||
|
||||
@@ -13,24 +13,24 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.function;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.execute.Function;
|
||||
import org.apache.geode.cache.execute.FunctionService;
|
||||
import org.apache.geode.security.ResourcePermission;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.gemfire.function.annotation.GemfireFunction;
|
||||
import org.springframework.data.gemfire.function.config.EnableGemfireFunctions;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -44,21 +44,23 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.function.annotation.GemfireFunction
|
||||
* @see org.springframework.data.gemfire.function.config.EnableGemfireFunctions
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings({ "unchecked", "unused" })
|
||||
public class FunctionWithRequiredPermissionsRegistrationIntegrationTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class FunctionWithRequiredPermissionsRegistrationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Test
|
||||
public void functionsRegisteredWithRequiredPermissionsSuccessfully() {
|
||||
|
||||
Function function = FunctionService.getFunction("testFunctionWithRequiredPermissions");
|
||||
Function<?> function = FunctionService.getFunction("testFunctionWithRequiredPermissions");
|
||||
|
||||
assertThat(function).isNotNull();
|
||||
|
||||
assertThat(function.getRequiredPermissions("test")).containsExactly(
|
||||
new ResourcePermission(ResourcePermission.Resource.CLUSTER, ResourcePermission.Operation.MANAGE),
|
||||
new ResourcePermission(ResourcePermission.Resource.DATA, ResourcePermission.Operation.READ, "Example")
|
||||
|
||||
@@ -35,16 +35,17 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.data.gemfire.function.execution.GemfireOnServerFunctionTemplate;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
*
|
||||
* @author John Blum
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = { TestClientCacheConfig.class })
|
||||
public class FunctionExecutionClientCacheTests {
|
||||
@ContextConfiguration(classes = ClientCacheTestConfiguration.class)
|
||||
public class FunctionExecutionClientCacheTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
ApplicationContext applicationContext;
|
||||
@@ -79,7 +80,7 @@ public class FunctionExecutionClientCacheTests {
|
||||
@ImportResource("/org/springframework/data/gemfire/function/config/FunctionExecutionCacheClientTests-context.xml")
|
||||
@EnableGemfireFunctionExecutions(basePackages = "org.springframework.data.gemfire.function.config.three")
|
||||
@SuppressWarnings("unused")
|
||||
class TestClientCacheConfig {
|
||||
class ClientCacheTestConfiguration {
|
||||
|
||||
@Bean
|
||||
MyResultCollector myResultCollector() {
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.springframework.data.gemfire.function.config;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -25,7 +26,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(initializers = GemFireMockObjectsApplicationContextInitializer.class)
|
||||
public class FunctionsWithClientCacheTests {
|
||||
public class FunctionsWithClientCacheTests extends IntegrationTestsSupport {
|
||||
|
||||
@Test
|
||||
public void doNothing() {
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.data.gemfire.TestUtils;
|
||||
import org.springframework.data.gemfire.function.config.two.TestOnRegionFunction;
|
||||
import org.springframework.data.gemfire.function.execution.GemfireOnRegionFunctionTemplate;
|
||||
import org.springframework.data.gemfire.function.execution.OnRegionFunctionProxyFactoryBean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -36,7 +37,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(initializers = GemFireMockObjectsApplicationContextInitializer.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class XmlConfiguredFunctionExecutionIntegrationTests {
|
||||
public class XmlConfiguredFunctionExecutionIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.fork.CqCacheServerProcess;
|
||||
import org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -44,14 +45,14 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.fork.CqCacheServerProcess
|
||||
* @see org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@ContextConfiguration(initializers = GemFireMockObjectsApplicationContextInitializer.class)
|
||||
@SuppressWarnings("unused")
|
||||
// TODO change this test to use mocks!!
|
||||
public class ContainerXmlSetupIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
public class ContainerXmlConfigurationIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
@@ -75,7 +76,7 @@ public class ContainerXmlSetupIntegrationTests extends ForkingClientServerIntegr
|
||||
ClientCache cache = applicationContext.getBean(ClientCache.class);
|
||||
Pool pool = applicationContext.getBean(Pool.class);
|
||||
|
||||
assertThat(cache.getName()).isEqualTo("ContainerXmlSetupIntegrationTests");
|
||||
assertThat(cache.getName()).isEqualTo("ContainerXmlConfigurationIntegrationTests");
|
||||
assertThat(pool.getName()).isEqualTo("client");
|
||||
|
||||
CqQuery[] cacheCqs = cache.getQueryService().getCqs();
|
||||
@@ -35,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -49,11 +50,15 @@ import example.app.model.ComplexType;
|
||||
* @see org.apache.geode.pdx.PdxSerializer
|
||||
* @see org.apache.geode.pdx.PdxWriter
|
||||
* @see org.springframework.data.gemfire.mapping.MappingPdxSerializer
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.5.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
public class TypeMappingPdxSerializerIntegrationTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class TypeMappingPdxSerializerIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private MappingPdxSerializer pdxSerializer;
|
||||
@@ -78,13 +83,11 @@ public class TypeMappingPdxSerializerIntegrationTests {
|
||||
this.pdxSerializer.toData(complexType, mockPdxWriter);
|
||||
|
||||
verify(mockPdxWriter, times(1)).writeField(eq("id"), eq(2L), eq(Long.class));
|
||||
verify(mockPdxWriter, times(1))
|
||||
.writeField(eq("decimalValue"), eq(new BigDecimal(123)), eq(BigDecimal.class));
|
||||
verify(mockPdxWriter, times(1))
|
||||
.writeField(eq("integerValue"), eq(new BigInteger("987")), eq(BigInteger.class));
|
||||
verify(mockPdxWriter, times(1))
|
||||
.writeField(eq("name"), eq("TEST"), eq(String.class));
|
||||
verify(mockPdxWriter, times(1)).writeField(eq("decimalValue"), eq(new BigDecimal(123)), eq(BigDecimal.class));
|
||||
verify(mockPdxWriter, times(1)).writeField(eq("integerValue"), eq(new BigInteger("987")), eq(BigInteger.class));
|
||||
verify(mockPdxWriter, times(1)).writeField(eq("name"), eq("TEST"), eq(String.class));
|
||||
verify(mockPdxWriter, times(1)).markIdentityField(eq("id"));
|
||||
|
||||
verifyNoMoreInteractions(mockPdxWriter);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.repository.query;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -23,13 +22,13 @@ import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
@@ -40,21 +39,28 @@ import org.springframework.data.gemfire.repository.sample.PersonRepository;
|
||||
import org.springframework.data.gemfire.repository.sample.User;
|
||||
import org.springframework.data.gemfire.repository.sample.UserRepository;
|
||||
import org.springframework.data.gemfire.repository.support.GemfireRepositoryFactoryBean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.repository.query.QueryMethod;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* The QueryPostProcessorIntegrationTests class...
|
||||
* Integration Tests for {@link QueryPostProcessor}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.springframework.data.gemfire.repository.query.QueryPostProcessor
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class QueryPostProcessorIntegrationTests {
|
||||
public class QueryPostProcessorIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final AtomicLong idSequence = new AtomicLong(0L);
|
||||
|
||||
@@ -212,6 +218,7 @@ public class QueryPostProcessorIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
static class RecordingQueryPostProcessor implements QueryPostProcessor<Repository, String> {
|
||||
|
||||
List<String> queries = new CopyOnWriteArrayList<>();
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;
|
||||
import org.springframework.data.gemfire.config.annotation.EnableEntityDefinedRegions;
|
||||
import org.springframework.data.gemfire.repository.config.EnableGemfireRepositories;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.util.ArrayUtils;
|
||||
import org.springframework.data.gemfire.util.CollectionUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -45,8 +46,10 @@ import example.app.repo.UserRepository;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.repository.GemfireRepository
|
||||
* @see org.springframework.data.gemfire.repository.config.EnableGemfireRepositories
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @see <a href="https://github.com/spring-projects/spring-data-geode/issues/483">Fix bug with SDG Repository derived queries using the IN operator with numeric values.</a>
|
||||
@@ -55,11 +58,11 @@ import example.app.repo.UserRepository;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class RepositoryQueryUsingInOperatorIntegrationTests {
|
||||
public class RepositoryQueryUsingInOperatorIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final AtomicBoolean initialized = new AtomicBoolean(false);
|
||||
|
||||
private List<User> users = Arrays.asList(
|
||||
private final List<User> users = Arrays.asList(
|
||||
User.as("jonDoe").identifiedBy(1),
|
||||
User.as("janeDoe").identifiedBy(2),
|
||||
User.as("cookieDoe").identifiedBy(3),
|
||||
@@ -144,9 +147,9 @@ public class RepositoryQueryUsingInOperatorIntegrationTests {
|
||||
assertThat(usersByName).containsExactly(findUsersByNames("jonDoe", "sourDoe"));
|
||||
}
|
||||
|
||||
@ClientCacheApplication(name = "RepositoryQueryUsingInOperatorIntegrationTests")
|
||||
@ClientCacheApplication
|
||||
@EnableEntityDefinedRegions(basePackageClasses = User.class, clientRegionShortcut = ClientRegionShortcut.LOCAL)
|
||||
@EnableGemfireRepositories(basePackageClasses = UserRepository.class)
|
||||
static class TestGeodeConfiguration { }
|
||||
static class TestConfiguration { }
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.repository.sample;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -23,23 +22,26 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* The AlgorithmRepositoryIntegrationTests 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.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.repository.GemfireRepository
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @since 1.4.0
|
||||
@@ -47,16 +49,17 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class AlgorithmRepositoryTest {
|
||||
public class AlgorithmRepositoryIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private AlgorithmRepository algorithmRepo;
|
||||
|
||||
@Resource(name = "Algorithms")
|
||||
private Region algorithmsRegion;
|
||||
private Region<?, ?> algorithmsRegion;
|
||||
|
||||
@Test
|
||||
public void algorithmsRepositoryFunctionsCorrectly() {
|
||||
|
||||
assertNotNull("A reference to the AlgorithmRepository was not properly configured!", algorithmRepo);
|
||||
assertNotNull("A reference to the 'Algorithms' GemFire Cache Region was not properly configured!",
|
||||
algorithmsRegion);
|
||||
@@ -92,9 +95,8 @@ public class AlgorithmRepositoryTest {
|
||||
}
|
||||
}
|
||||
|
||||
protected static final class BinarySearch extends AbstractAlgorithm {
|
||||
}
|
||||
protected static final class BinarySearch extends AbstractAlgorithm { }
|
||||
|
||||
protected static final class HeapSort extends AbstractAlgorithm { }
|
||||
|
||||
protected static final class HeapSort extends AbstractAlgorithm {
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.repository.sample;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -24,17 +23,20 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration test testing the functionality behind PR #55 involving persisting application domain object/entities
|
||||
* to multiple Regions in a GemFire Cache.
|
||||
* Integration Tests testing the functionality behind PR #55 involving persisting application domain object/entities
|
||||
* to multiple Regions in an Apache Geode cache.
|
||||
*
|
||||
* @author Stuart Williams
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.repository.GemfireRepository
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @link https://github.com/spring-projects/spring-data-gemfire/pull/55
|
||||
@@ -43,7 +45,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class AnimalRepositoryTest {
|
||||
public class AnimalRepositoryIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private CatRepository catRepo;
|
||||
@@ -52,14 +54,18 @@ public class AnimalRepositoryTest {
|
||||
private DogRepository dogRepo;
|
||||
|
||||
protected static Animal newAnimal(long id, String name) {
|
||||
|
||||
Animal animal = new Animal();
|
||||
|
||||
animal.setId(id);
|
||||
animal.setName(name);
|
||||
|
||||
return animal;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void entityStoredInMultipleRegionsIsSuccessful() {
|
||||
|
||||
Animal felix = newAnimal(1, "Felix");
|
||||
Animal leo = newAnimal(2, "Leo");
|
||||
Animal cerberus = newAnimal(3, "Cerberus");
|
||||
@@ -40,6 +40,7 @@ import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;
|
||||
import org.springframework.data.gemfire.mapping.GemfireMappingContext;
|
||||
import org.springframework.data.gemfire.repository.support.GemfireRepositoryFactoryBean;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -55,6 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @see org.springframework.data.gemfire.repository.support.GemfireRepositoryFactoryBean
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.repository.Repository
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
@@ -63,7 +65,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class RepositoryDataAccessOnRegionUsingCacheLoaderIntegrationTests {
|
||||
public class RepositoryDataAccessOnRegionUsingCacheLoaderIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private PersonRepository personRepository;
|
||||
@@ -106,7 +108,7 @@ public class RepositoryDataAccessOnRegionUsingCacheLoaderIntegrationTests {
|
||||
assertThat(people).isEmpty();
|
||||
}
|
||||
|
||||
@ClientCacheApplication(name = "RepositoryDataAccessOnRegionUsingCacheLoaderIntegrationTests")
|
||||
@ClientCacheApplication
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean("simple")
|
||||
|
||||
@@ -13,14 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.repository.sample;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -30,28 +25,30 @@ import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.repository.Wrapper;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests testing the use of GemFire Repositories on GemFire Cache Subregions.
|
||||
* Integration Tests testing the use of GemFire Repositories on GemFire Cache Subregions.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.data.gemfire.repository.GemfireRepository
|
||||
* @see org.springframework.data.gemfire.repository.Wrapper
|
||||
* @see org.springframework.data.gemfire.repository.sample.Programmer
|
||||
* @see org.springframework.data.gemfire.repository.sample.ProgrammerRepository
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @link https://jira.springsource.org/browse/SGF-251
|
||||
* @link https://jira.springsource.org/browse/SGF-252
|
||||
@@ -60,7 +57,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration("subregionRepository.xml")
|
||||
@SuppressWarnings("unused")
|
||||
public class SubRegionRepositoryIntegrationTest {
|
||||
public class SubRegionRepositoryIntegrationTest extends IntegrationTestsSupport {
|
||||
|
||||
private static final Map<String, RootUser> ADMIN_USER_DATA = new HashMap<>(5, 0.90f);
|
||||
|
||||
@@ -112,38 +109,39 @@ public class SubRegionRepositoryIntegrationTest {
|
||||
@Autowired
|
||||
private RootUserRepository adminUserRepo;
|
||||
|
||||
protected static RootUser createAdminUser(final String username) {
|
||||
private static RootUser createAdminUser(String username) {
|
||||
RootUser user = new RootUser(username);
|
||||
ADMIN_USER_DATA.put(username, user);
|
||||
return user;
|
||||
}
|
||||
|
||||
protected static GuestUser createGuestUser(final String username) {
|
||||
private static GuestUser createGuestUser(String username) {
|
||||
GuestUser user = new GuestUser(username);
|
||||
GUEST_USER_DATA.put(username, user);
|
||||
return user;
|
||||
}
|
||||
|
||||
protected static RootUser getAdminUser(final String username) {
|
||||
private static RootUser getAdminUser(String username) {
|
||||
List<RootUser> users = getAdminUsers(username);
|
||||
return (users.isEmpty() ? null : users.get(0));
|
||||
}
|
||||
|
||||
protected static List<RootUser> getAdminUsers(final String... usernames) {
|
||||
private static List<RootUser> getAdminUsers(String... usernames) {
|
||||
return getUsers(ADMIN_USER_DATA, usernames);
|
||||
}
|
||||
|
||||
protected static GuestUser getGuestUser(final String username) {
|
||||
private static GuestUser getGuestUser(String username) {
|
||||
List<GuestUser> users = getGuestUsers(username);
|
||||
return (users.isEmpty() ? null : users.get(0));
|
||||
}
|
||||
|
||||
protected static List<GuestUser> getGuestUsers(final String... usernames) {
|
||||
private static List<GuestUser> getGuestUsers(String... usernames) {
|
||||
return getUsers(GUEST_USER_DATA, usernames);
|
||||
}
|
||||
|
||||
protected static <T extends User> List<T> getUsers(final Map<String, T> userData, final String... usernames) {
|
||||
List<T> users = new ArrayList<T>(usernames.length);
|
||||
private static <T extends User> List<T> getUsers(Map<String, T> userData, String... usernames) {
|
||||
|
||||
List<T> users = new ArrayList<>(usernames.length);
|
||||
|
||||
for (String username : usernames) {
|
||||
T user = userData.get(username);
|
||||
@@ -158,15 +156,16 @@ public class SubRegionRepositoryIntegrationTest {
|
||||
return users;
|
||||
}
|
||||
|
||||
protected static Programmer createProgrammer(final String username, final String programmingLanguage) {
|
||||
private static Programmer createProgrammer(String username, String programmingLanguage) {
|
||||
Programmer programmer = new Programmer(username);
|
||||
programmer.setProgrammingLanguage(programmingLanguage);
|
||||
PROGRAMMER_USER_DATA.put(username, programmer);
|
||||
return programmer;
|
||||
}
|
||||
|
||||
protected static List<Programmer> getProgrammers(final String... usernames) {
|
||||
List<Programmer> programmers = new ArrayList<Programmer>(usernames.length);
|
||||
private static List<Programmer> getProgrammers(String... usernames) {
|
||||
|
||||
List<Programmer> programmers = new ArrayList<>(usernames.length);
|
||||
|
||||
for (String username : usernames) {
|
||||
Programmer programmer = PROGRAMMER_USER_DATA.get(username);
|
||||
@@ -183,46 +182,48 @@ public class SubRegionRepositoryIntegrationTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
assertNotNull("The /Users/Programmers Subregion was null!", programmers);
|
||||
|
||||
assertThat(programmers).as("The /Users/Programmers Subregion was null!").isNotNull();
|
||||
|
||||
if (programmers.isEmpty()) {
|
||||
programmers.putAll(PROGRAMMER_USER_DATA);
|
||||
}
|
||||
|
||||
assertEquals(PROGRAMMER_USER_DATA.size(), programmers.size());
|
||||
assertNotNull("The /Local/Admins/Users Subregion was null!", adminUsers);
|
||||
assertThat(programmers.size()).isEqualTo(PROGRAMMER_USER_DATA.size());
|
||||
assertThat(adminUsers).as("The /Local/Admins/Users Subregion was null!").isNotNull();
|
||||
|
||||
if (adminUsers.isEmpty()) {
|
||||
adminUsers.putAll(ADMIN_USER_DATA);
|
||||
}
|
||||
|
||||
assertEquals(ADMIN_USER_DATA.size(), adminUsers.size());
|
||||
assertNotNull("The /Local/Guest/Users Subregion was null!", guestUsers);
|
||||
assertThat(adminUsers.size()).isEqualTo(ADMIN_USER_DATA.size());
|
||||
assertThat(guestUsers).as("The /Local/Guest/Users Subregion was null!").isNotNull();
|
||||
|
||||
if (guestUsers.isEmpty()) {
|
||||
guestUsers.putAll(GUEST_USER_DATA);
|
||||
}
|
||||
|
||||
assertEquals(GUEST_USER_DATA.size(), guestUsers.size());
|
||||
assertThat(guestUsers.size()).isEqualTo(GUEST_USER_DATA.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubregionRepositoryInteractions() {
|
||||
|
||||
assertThat(programmersRepo.findById("JamesGosling").orElse(null)).isEqualTo(PROGRAMMER_USER_DATA.get("JamesGosling"));
|
||||
|
||||
List<Programmer> javaProgrammers = programmersRepo.findDistinctByProgrammingLanguageOrderByUsernameAsc("Java");
|
||||
|
||||
assertNotNull(javaProgrammers);
|
||||
assertFalse(javaProgrammers.isEmpty());
|
||||
assertEquals(2, javaProgrammers.size());
|
||||
assertEquals(javaProgrammers, getProgrammers("JamesGosling", "JoshuaBloch"));
|
||||
assertThat(javaProgrammers).isNotNull();
|
||||
assertThat(javaProgrammers.isEmpty()).isFalse();
|
||||
assertThat(javaProgrammers.size()).isEqualTo(2);
|
||||
assertThat(getProgrammers("JamesGosling", "JoshuaBloch")).isEqualTo(javaProgrammers);
|
||||
|
||||
List<Programmer> groovyProgrammers = programmersRepo.findDistinctByProgrammingLanguageLikeOrderByUsernameAsc("Groovy");
|
||||
|
||||
assertNotNull(groovyProgrammers);
|
||||
assertFalse(groovyProgrammers.isEmpty());
|
||||
assertEquals(1, groovyProgrammers.size());
|
||||
assertEquals(groovyProgrammers, getProgrammers("JamesStrachan"));
|
||||
assertThat(groovyProgrammers).isNotNull();
|
||||
assertThat(groovyProgrammers.isEmpty()).isFalse();
|
||||
assertThat(groovyProgrammers.size()).isEqualTo(1);
|
||||
assertThat(getProgrammers("JamesStrachan")).isEqualTo(groovyProgrammers);
|
||||
|
||||
programmersRepo.save(new Wrapper<>(createProgrammer("RodJohnson", "Java"), "RodJohnson"));
|
||||
programmersRepo.save(new Wrapper<>(createProgrammer("GuillaumeLaforge", "Groovy"), "GuillaumeLaforge"));
|
||||
@@ -230,49 +231,51 @@ public class SubRegionRepositoryIntegrationTest {
|
||||
|
||||
javaProgrammers = programmersRepo.findDistinctByProgrammingLanguageOrderByUsernameAsc("Java");
|
||||
|
||||
assertNotNull(javaProgrammers);
|
||||
assertFalse(javaProgrammers.isEmpty());
|
||||
assertEquals(3, javaProgrammers.size());
|
||||
assertEquals(javaProgrammers, getProgrammers("JamesGosling", "JoshuaBloch", "RodJohnson"));
|
||||
assertThat(javaProgrammers).isNotNull();
|
||||
assertThat(javaProgrammers.isEmpty()).isFalse();
|
||||
assertThat(javaProgrammers.size()).isEqualTo(3);
|
||||
assertThat(getProgrammers("JamesGosling", "JoshuaBloch", "RodJohnson")).isEqualTo(javaProgrammers);
|
||||
|
||||
groovyProgrammers = programmersRepo.findDistinctByProgrammingLanguageLikeOrderByUsernameAsc("Groovy");
|
||||
|
||||
assertNotNull(groovyProgrammers);
|
||||
assertFalse(groovyProgrammers.isEmpty());
|
||||
assertEquals(3, groovyProgrammers.size());
|
||||
assertEquals(groovyProgrammers, getProgrammers("GraemeRocher", "GuillaumeLaforge", "JamesStrachan"));
|
||||
assertThat(groovyProgrammers).isNotNull();
|
||||
assertThat(groovyProgrammers.isEmpty()).isFalse();
|
||||
assertThat(groovyProgrammers.size()).isEqualTo(3);
|
||||
assertThat(getProgrammers("GraemeRocher", "GuillaumeLaforge", "JamesStrachan")).isEqualTo(groovyProgrammers);
|
||||
|
||||
List<Programmer> javaLikeProgrammers = programmersRepo.findDistinctByProgrammingLanguageLikeOrderByUsernameAsc("Java%");
|
||||
|
||||
assertNotNull(javaLikeProgrammers);
|
||||
assertFalse(javaLikeProgrammers.isEmpty());
|
||||
assertEquals(4, javaLikeProgrammers.size());
|
||||
assertEquals(javaLikeProgrammers, getProgrammers("BrendanEich", "JamesGosling", "JoshuaBloch", "RodJohnson"));
|
||||
assertThat(javaLikeProgrammers).isNotNull();
|
||||
assertThat(javaLikeProgrammers.isEmpty()).isFalse();
|
||||
assertThat(javaLikeProgrammers.size()).isEqualTo(4);
|
||||
assertThat(getProgrammers("BrendanEich", "JamesGosling", "JoshuaBloch", "RodJohnson"))
|
||||
.isEqualTo(javaLikeProgrammers);
|
||||
|
||||
List<Programmer> pseudoCodeProgrammers = programmersRepo.findDistinctByProgrammingLanguageLikeOrderByUsernameAsc("PseudoCode");
|
||||
|
||||
assertNotNull(pseudoCodeProgrammers);
|
||||
assertTrue(pseudoCodeProgrammers.isEmpty());
|
||||
assertThat(pseudoCodeProgrammers).isNotNull();
|
||||
assertThat(pseudoCodeProgrammers.isEmpty()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIdenticallyNamedSubregionDataAccess() {
|
||||
|
||||
assertThat(adminUserRepo.findById("supertool").orElse(null)).isEqualTo(getAdminUser("supertool"));
|
||||
assertThat(guestUserRepo.findById("joeblow").orElse(null)).isEqualTo(getGuestUser("joeblow"));
|
||||
|
||||
List<RootUser> rootUsers = adminUserRepo.findDistinctByUsername("zeus");
|
||||
|
||||
assertNotNull(rootUsers);
|
||||
assertFalse(rootUsers.isEmpty());
|
||||
assertEquals(1, rootUsers.size());
|
||||
assertThat(rootUsers).isNotNull();
|
||||
assertThat(rootUsers.isEmpty()).isFalse();
|
||||
assertThat(rootUsers.size()).isEqualTo(1);
|
||||
|
||||
assertEquals(getAdminUser("zeus"), rootUsers.get(0));
|
||||
assertThat(rootUsers.get(0)).isEqualTo(getAdminUser("zeus"));
|
||||
|
||||
List<GuestUser> guestUsers = guestUserRepo.findDistinctByUsername("bubba");
|
||||
|
||||
assertNotNull(guestUsers);
|
||||
assertFalse(guestUsers.isEmpty());
|
||||
assertEquals(1, guestUsers.size());
|
||||
assertEquals(getGuestUser("bubba"), guestUsers.get(0));
|
||||
assertThat(guestUsers).isNotNull();
|
||||
assertThat(guestUsers.isEmpty()).isFalse();
|
||||
assertThat(guestUsers.size()).isEqualTo(1);
|
||||
assertThat(guestUsers.get(0)).isEqualTo(getGuestUser("bubba"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.gemfire.repository.sample;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
@@ -34,16 +31,17 @@ import org.junit.runner.RunWith;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* The RepositoryQueriesTest class is a test suite of test cases testing the GemFire Query capability of Spring Data
|
||||
* GemFire Repositories.
|
||||
* Integration Tests for Apache Geode OQL query capabilities provided by Spring Data for Apache Geode Repositories.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.3.3
|
||||
@@ -51,7 +49,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration("userRepositoryQueriesIntegrationTest.xml")
|
||||
@SuppressWarnings("unused")
|
||||
public class UserRepositoryQueriesIntegrationTest {
|
||||
public class UserRepositoryQueriesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Resource(name = "Users")
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -62,7 +60,7 @@ public class UserRepositoryQueriesIntegrationTest {
|
||||
|
||||
private static void assertQueryResults(Iterable<User> actualUsers, String... expectedUsernames) {
|
||||
|
||||
assertNotNull("The query did not return any results!", actualUsers);
|
||||
assertThat(actualUsers).as("The query did not return any results!").isNotNull();
|
||||
|
||||
List<String> actualUsernames = new ArrayList<>(expectedUsernames.length);
|
||||
|
||||
@@ -70,8 +68,8 @@ public class UserRepositoryQueriesIntegrationTest {
|
||||
actualUsernames.add(actualUser.getUsername());
|
||||
}
|
||||
|
||||
assertEquals(expectedUsernames.length, actualUsernames.size());
|
||||
assertTrue(actualUsernames.containsAll(Arrays.asList(expectedUsernames)));
|
||||
assertThat(actualUsernames.size()).isEqualTo(expectedUsernames.length);
|
||||
assertThat(actualUsernames.containsAll(Arrays.asList(expectedUsernames))).isTrue();
|
||||
}
|
||||
|
||||
private static User createUser(String username) {
|
||||
@@ -98,9 +96,10 @@ public class UserRepositoryQueriesIntegrationTest {
|
||||
}
|
||||
|
||||
@Before
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setup() {
|
||||
|
||||
assertNotNull("The 'Users' GemFire Cache Region cannot be null!", users);
|
||||
assertThat(users).describedAs("The 'Users' GemFire Cache Region cannot be null!").isNotNull();
|
||||
|
||||
if (users.isEmpty()) {
|
||||
userRepository.save(createUser("blumj", true));
|
||||
@@ -113,8 +112,8 @@ public class UserRepositoryQueriesIntegrationTest {
|
||||
userRepository.save(createUser("doep", false));
|
||||
userRepository.save(createUser("doec", false));
|
||||
|
||||
assertFalse(users.isEmpty());
|
||||
assertEquals(9, users.size());
|
||||
assertThat(users.isEmpty()).isFalse();
|
||||
assertThat(users.size()).isEqualTo(9);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,15 +138,15 @@ public class UserRepositoryQueriesIntegrationTest {
|
||||
|
||||
Integer count = userRepository.countUsersByUsernameLike("doe%");
|
||||
|
||||
assertEquals(3, toIntValue(count));
|
||||
assertThat(toIntValue(count)).isEqualTo(3);
|
||||
|
||||
count = userRepository.countUsersByUsernameLike("handy%");
|
||||
|
||||
assertEquals(2, toIntValue(count));
|
||||
assertThat(toIntValue(count)).isEqualTo(2);
|
||||
|
||||
count = userRepository.countUsersByUsernameLike("smith%");
|
||||
|
||||
assertNotNull(count);
|
||||
assertEquals(0, toIntValue(count));
|
||||
assertThat(count).isNotNull();
|
||||
assertThat(toIntValue(count)).isEqualTo(0);
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,7 @@ import org.springframework.data.gemfire.config.annotation.PeerCacheApplication;
|
||||
import org.springframework.data.gemfire.mapping.GemfireMappingContext;
|
||||
import org.springframework.data.gemfire.mapping.GemfirePersistentEntity;
|
||||
import org.springframework.data.gemfire.repository.sample.Person;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.repository.core.EntityInformation;
|
||||
import org.springframework.data.repository.core.support.PersistentEntityInformation;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -62,15 +63,14 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.LocalRegionFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.PeerCacheApplication
|
||||
* @see org.springframework.data.gemfire.repository.support.SimpleGemfireRepository
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class SimpleGemfireRepositoryIntegrationTests {
|
||||
|
||||
static final String GEMFIRE_LOG_LEVEL = "warning";
|
||||
public class SimpleGemfireRepositoryIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private GemfireTemplate template;
|
||||
@@ -130,8 +130,9 @@ public class SimpleGemfireRepositoryIntegrationTests {
|
||||
this.repository.deleteAllById(Arrays.asList(1L, 2L));
|
||||
|
||||
assertThat(this.repository.count()).isEqualTo(3L);
|
||||
assertThat(this.repository.findAll()) //
|
||||
.extracting(Person::getFirstname) //
|
||||
|
||||
assertThat(this.repository.findAll())
|
||||
.extracting(Person::getFirstname)
|
||||
.containsExactlyInAnyOrder("Cookie", "Pie", "Sour");
|
||||
}
|
||||
|
||||
@@ -226,8 +227,8 @@ public class SimpleGemfireRepositoryIntegrationTests {
|
||||
|
||||
assertThat(this.template.put(oliverGierke.getId(), oliverGierke)).isNull();
|
||||
|
||||
SelectResults<Person> people = this.template.find("SELECT * FROM /People p WHERE p.firstname = $1",
|
||||
oliverGierke.getFirstname());
|
||||
SelectResults<Person> people =
|
||||
this.template.find("SELECT * FROM /People p WHERE p.firstname = $1", oliverGierke.getFirstname());
|
||||
|
||||
assertThat(people.size()).isEqualTo(1);
|
||||
assertThat(people.iterator().next()).isEqualTo(oliverGierke);
|
||||
@@ -278,7 +279,7 @@ public class SimpleGemfireRepositoryIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@PeerCacheApplication(name = "SimpleGemfireRepositoryIntegrationTests", logLevel = GEMFIRE_LOG_LEVEL)
|
||||
@PeerCacheApplication
|
||||
static class SimpleGemfireRepositoryConfiguration {
|
||||
|
||||
@Bean(name = "People")
|
||||
@@ -287,7 +288,6 @@ public class SimpleGemfireRepositoryIntegrationTests {
|
||||
LocalRegionFactoryBean<Object, Object> peopleRegion = new LocalRegionFactoryBean<>();
|
||||
|
||||
peopleRegion.setCache(gemfireCache);
|
||||
peopleRegion.setClose(false);
|
||||
peopleRegion.setPersistent(false);
|
||||
|
||||
return peopleRegion;
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.data.gemfire.mapping.GemfireMappingContext;
|
||||
import org.springframework.data.gemfire.mapping.GemfirePersistentEntity;
|
||||
import org.springframework.data.gemfire.repository.GemfireRepository;
|
||||
import org.springframework.data.gemfire.repository.sample.Customer;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.repository.core.EntityInformation;
|
||||
import org.springframework.data.repository.core.support.PersistentEntityInformation;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -64,7 +65,7 @@ import org.springframework.transaction.support.TransactionTemplate;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class SimpleGemfireRepositoryTransactionalIntegrationTest {
|
||||
public class SimpleGemfireRepositoryTransactionalIntegrationTest extends IntegrationTestsSupport {
|
||||
|
||||
// TODO add additional test cases for SimpleGemfireRepository (Region operations) in the presence of Transactions!!!
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.context.event.EventListener;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.config.annotation.PeerCacheApplication;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.util.SpringUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -61,6 +62,9 @@ import lombok.RequiredArgsConstructor;
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.lucene.LuceneIndex
|
||||
* @see org.springframework.data.gemfire.config.annotation.PeerCacheApplication
|
||||
* @see org.springframework.data.gemfire.search.lucene.LuceneIndexFactoryBean
|
||||
* @see org.springframework.data.gemfire.search.lucene.LuceneOperations
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.1.0
|
||||
@@ -68,12 +72,10 @@ import lombok.RequiredArgsConstructor;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class LuceneOperationsIntegrationTests {
|
||||
public class LuceneOperationsIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final AtomicLong IDENTIFIER = new AtomicLong(0L);
|
||||
|
||||
protected static final String GEMFIRE_LOG_LEVEL = "none";
|
||||
|
||||
private static final Person jonDoe = Person.newPerson(LocalDate.of(1969, Month.JULY, 4), "Jon", "Doe").with("Master of Science");
|
||||
private static final Person janeDoe = Person.newPerson(LocalDate.of(1969, Month.AUGUST, 16), "Jane", "Doe").with("Doctor of Astrophysics");
|
||||
private static final Person cookieDoe = Person.newPerson(LocalDate.of(1991, Month.APRIL, 2), "Cookie", "Doe").with("Bachelor of Physics");
|
||||
@@ -120,8 +122,8 @@ public class LuceneOperationsIntegrationTests {
|
||||
assertThat(asNames(masterDoes)).containsAll(asNames(asUsers(jonDoe, pieDoe)));
|
||||
}
|
||||
|
||||
@PeerCacheApplication
|
||||
@SuppressWarnings("unused")
|
||||
@PeerCacheApplication(name = "LuceneOperationsIntegrationTests", logLevel = GEMFIRE_LOG_LEVEL)
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean(name = "People")
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.serialization;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -29,24 +28,32 @@ import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.geode.DataSerializable;
|
||||
import org.apache.geode.Instantiator;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.DataSerializable;
|
||||
import org.apache.geode.Instantiator;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
*
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.Instantiator
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration("simple-config.xml")
|
||||
@SuppressWarnings("unused")
|
||||
public class WiringInstantiatorTest {
|
||||
public class WiringInstantiatorTest extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
@@ -55,7 +62,6 @@ public class WiringInstantiatorTest {
|
||||
private WiringInstantiator instantiator;
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class AnnotatedBean implements DataSerializable {
|
||||
|
||||
@Autowired
|
||||
@@ -73,7 +79,6 @@ public class WiringInstantiatorTest {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class TemplateWiringBean implements DataSerializable {
|
||||
|
||||
Beans beans;
|
||||
@@ -89,7 +94,6 @@ public class WiringInstantiatorTest {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class TypeA implements DataSerializable {
|
||||
|
||||
public void fromData(DataInput arg0) { }
|
||||
@@ -98,7 +102,6 @@ public class WiringInstantiatorTest {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public static class TypeB implements DataSerializable {
|
||||
|
||||
public void fromData(DataInput arg0) { }
|
||||
|
||||
@@ -38,11 +38,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.GemfireOperations;
|
||||
import org.springframework.data.gemfire.repository.sample.Person;
|
||||
import org.springframework.data.gemfire.test.support.MapBuilder;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration test to test SDG support for storing and reading JSON data to/from a {@link Region}
|
||||
* Integration Tests testings SDG support for storing and reading JSON data to/from a {@link Region}
|
||||
* by (un)marshalling JSON data using Jackson.
|
||||
*
|
||||
* @author David Turanski
|
||||
@@ -56,8 +57,8 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings({ "unused" })
|
||||
public class JSONRegionAdviceIntegrationTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class JSONRegionAdviceIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
// TODO figure out why auto-proxying the Region for JSON support prevents the GemfireTemplate from being "auto-wired",
|
||||
// as a GemfireTemplate rather than GemfireOperations, resulting in a NoSuchBeanDefinitionException thrown by the
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.apache.geode.cache.GemFireCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.GemfireUtils;
|
||||
import org.springframework.data.gemfire.config.annotation.PeerCacheApplication;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -42,6 +43,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.springframework.data.gemfire.config.annotation.PeerCacheApplication
|
||||
* @see org.springframework.data.gemfire.support.CacheFactoryCacheResolver
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.3.0
|
||||
@@ -49,7 +51,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class CacheFactoryCacheResolverIntegrationTests {
|
||||
public class CacheFactoryCacheResolverIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private GemFireCache peerCache;
|
||||
|
||||
@@ -57,6 +57,7 @@ public class GemfireBeanFactoryLocatorAnnotationConfigIntegrationTests extends I
|
||||
|
||||
@Test
|
||||
public void beanFactoryContainsTestBeanFactoryLocatorBean() {
|
||||
|
||||
assertThat(beanFactory.containsBean("testBeanFactoryLocator")).isTrue();
|
||||
|
||||
GemfireBeanFactoryLocator testBeanFactoryLocator = beanFactory.getBean("testBeanFactoryLocator",
|
||||
@@ -73,6 +74,7 @@ public class GemfireBeanFactoryLocatorAnnotationConfigIntegrationTests extends I
|
||||
|
||||
@Test
|
||||
public void registeredBeanFactoriesIsCorrect() {
|
||||
|
||||
Set<String> beanNames = asSet("gemfireCache", "testBeanFactoryLocator", "aliasOne", "aliasTwo");
|
||||
|
||||
assertThat(GemfireBeanFactoryLocator.BEAN_FACTORIES).hasSameSizeAs(beanNames);
|
||||
@@ -83,8 +85,8 @@ public class GemfireBeanFactoryLocatorAnnotationConfigIntegrationTests extends I
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@PeerCacheApplication(useBeanFactoryLocator = true)
|
||||
@SuppressWarnings("unused")
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.support;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -27,6 +26,7 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -37,13 +37,14 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.beans.factory.BeanFactory
|
||||
* @see org.springframework.data.gemfire.support.GemfireBeanFactoryLocator
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
public class GemfireBeanFactoryLocatorIntegrationTests {
|
||||
public class GemfireBeanFactoryLocatorIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
@SuppressWarnings("unused")
|
||||
@@ -51,6 +52,7 @@ public class GemfireBeanFactoryLocatorIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void beanFactoryContainsGemfireBeanFactoryLocatorBean() {
|
||||
|
||||
assertThat(beanFactory.containsBean(GemfireBeanFactoryLocator.class.getName())).isTrue();
|
||||
|
||||
GemfireBeanFactoryLocator gemfireBeanFactoryLocator =
|
||||
@@ -69,6 +71,7 @@ public class GemfireBeanFactoryLocatorIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void beanFactoryContainsTestBeanFactoryLocatorBean() {
|
||||
|
||||
assertThat(beanFactory.containsBean("testBeanFactoryLocator")).isTrue();
|
||||
|
||||
GemfireBeanFactoryLocator testBeanFactoryLocator = beanFactory.getBean("testBeanFactoryLocator",
|
||||
@@ -85,6 +88,7 @@ public class GemfireBeanFactoryLocatorIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void registeredBeanFactoriesIsCorrect() {
|
||||
|
||||
Set<String> beanNames = asSet("gemfire-cache", "gemfireCache", "testBeanFactoryLocator", "aliasOne", "aliasTwo",
|
||||
GemfireBeanFactoryLocator.class.getName());
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ public class GemfireBeanFactoryLocatorJavaConfigIntegrationTests extends Integra
|
||||
|
||||
@Test
|
||||
public void beanFactoryContainsTestBeanFactoryLocatorBean() {
|
||||
|
||||
assertThat(beanFactory.containsBean("testBeanFactoryLocator")).isTrue();
|
||||
|
||||
GemfireBeanFactoryLocator testBeanFactoryLocator = beanFactory.getBean("testBeanFactoryLocator",
|
||||
@@ -76,6 +77,7 @@ public class GemfireBeanFactoryLocatorJavaConfigIntegrationTests extends Integra
|
||||
|
||||
@Test
|
||||
public void registeredBeanFactoriesIsCorrect() {
|
||||
|
||||
Set<String> beanNames = asSet("gemfireCache", "testBeanFactoryLocator", "aliasOne", "aliasTwo");
|
||||
|
||||
assertThat(GemfireBeanFactoryLocator.BEAN_FACTORIES).hasSameSizeAs(beanNames);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.support;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -31,6 +30,7 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.gemfire.function.sample.HelloFunctionExecution;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -43,6 +43,9 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.execute.Function
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.7.0
|
||||
@@ -50,7 +53,7 @@ import org.springframework.util.StringUtils;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class LazyWiringDeclarableSupportFunctionBasedIntegrationTests {
|
||||
public class LazyWiringDeclarableSupportFunctionBasedIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private Cache gemfireCache;
|
||||
@@ -83,7 +86,7 @@ public class LazyWiringDeclarableSupportFunctionBasedIntegrationTests {
|
||||
assertThat(helloFunctionExecution.hello(null)).isEqualTo("Hello Everyone!");
|
||||
}
|
||||
|
||||
protected static abstract class FunctionAdaptor extends LazyWiringDeclarableSupport implements Function {
|
||||
protected static abstract class FunctionAdaptor<T> extends LazyWiringDeclarableSupport implements Function<T> {
|
||||
|
||||
private final String id;
|
||||
|
||||
@@ -114,7 +117,7 @@ public class LazyWiringDeclarableSupportFunctionBasedIntegrationTests {
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public static class HelloGemFireFunction extends FunctionAdaptor {
|
||||
public static class HelloGemFireFunction extends FunctionAdaptor<Object> {
|
||||
|
||||
protected static final String ADDRESS_TO_PARAMETER = "hello.address.to";
|
||||
protected static final String DEFAULT_ADDRESS_TO = "World";
|
||||
@@ -139,17 +142,18 @@ public class LazyWiringDeclarableSupportFunctionBasedIntegrationTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPostInit(final Properties parameters) {
|
||||
protected void doPostInit(Properties parameters) {
|
||||
addressTo = parameters.getProperty(ADDRESS_TO_PARAMETER, getDefaultAddressTo());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final FunctionContext context) {
|
||||
public void execute(FunctionContext context) {
|
||||
context.getResultSender().lastResult(formatHelloGreeting(addressTo(context)));
|
||||
}
|
||||
|
||||
// precedence is... 1. Caller 2. GemFire 3. Spring
|
||||
protected String addressTo(FunctionContext context) {
|
||||
|
||||
Object arguments = context.getArguments();
|
||||
String addressTo = null;
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ import org.springframework.util.Assert;
|
||||
* Integration Tests for {@link LazyWiringDeclarableSupport}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.util.Properties
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.context.ApplicationContext
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.core.annotation.Order;
|
||||
import org.springframework.data.gemfire.CacheResolver;
|
||||
import org.springframework.data.gemfire.support.SmartCacheResolverFactoryBean.CacheResolverProxy;
|
||||
import org.springframework.data.gemfire.support.SmartCacheResolverFactoryBean.CompositionStrategy;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -59,6 +60,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.core.annotation.Order
|
||||
* @see org.springframework.data.gemfire.CacheResolver
|
||||
* @see org.springframework.data.gemfire.support.SmartCacheResolverFactoryBean
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.3.0
|
||||
@@ -66,7 +68,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
public class SmartCacheResolverFactoryBeanIntegrationTests {
|
||||
public class SmartCacheResolverFactoryBeanIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user