Remove old SDG test framework classes.
Refactor and cleanup test classes in the SDG test suite using the old SDG test framework to now use STDG. Resolves gh-296.
This commit is contained in:
@@ -31,10 +31,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.geode.cache.DataPolicy;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.Scope;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
@@ -44,25 +40,29 @@ import org.junit.rules.TestRule;
|
||||
import org.junit.rules.TestWatcher;
|
||||
import org.junit.runner.Description;
|
||||
|
||||
import org.apache.geode.cache.DataPolicy;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.Scope;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.BeanInitializationException;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.data.gemfire.fork.LocatorProcess;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.test.support.FileUtils;
|
||||
import org.springframework.data.gemfire.test.support.ThreadUtils;
|
||||
import org.springframework.data.gemfire.test.support.ThrowableUtils;
|
||||
import org.springframework.data.gemfire.test.support.ZipUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.tests.util.FileUtils;
|
||||
import org.springframework.data.gemfire.tests.util.ThreadUtils;
|
||||
import org.springframework.data.gemfire.tests.util.ThrowableUtils;
|
||||
import org.springframework.data.gemfire.tests.util.ZipUtils;
|
||||
import org.springframework.data.gemfire.util.ArrayUtils;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Test suite of test cases testing the integration of Spring Data for Apache Geode with Apache Geode's
|
||||
* new shared, persistent, cluster configuration service.
|
||||
* Integration Tests testing the integration of Spring Data for Apache Geode with Apache Geode's new shared, persistent,
|
||||
* cluster configuration service.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -70,16 +70,15 @@ import org.springframework.util.StringUtils;
|
||||
* @see org.springframework.context.support.ClassPathXmlApplicationContext
|
||||
* @see org.springframework.core.io.ClassPathResource
|
||||
* @see org.springframework.data.gemfire.fork.LocatorProcess
|
||||
* @see org.springframework.data.gemfire.process.ProcessExecutor
|
||||
* @see org.springframework.data.gemfire.process.ProcessWrapper
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegrationTestsSupport {
|
||||
public class CacheClusterConfigurationIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static File locatorWorkingDirectory;
|
||||
|
||||
private static List<String> locatorProcessOutput = Collections.synchronizedList(new ArrayList<>());
|
||||
private static final List<String> locatorProcessOutput = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
private static ProcessWrapper locatorProcess;
|
||||
|
||||
@@ -101,7 +100,7 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
|
||||
@Override
|
||||
protected void finished(Description description) {
|
||||
|
||||
if (Boolean.valueOf(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
if (Boolean.parseBoolean(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
try {
|
||||
FileUtils.write(new File(locatorWorkingDirectory.getParent(),
|
||||
String.format("%s-clusterconfiglocator.log", description.getMethodName())),
|
||||
@@ -171,12 +170,13 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
|
||||
|
||||
private static void waitForLocatorStart(final long milliseconds) {
|
||||
|
||||
ThreadUtils.timedWait(milliseconds, 500, new ThreadUtils.WaitCondition() {
|
||||
ThreadUtils.timedWait(milliseconds, 500, new ThreadUtils.Condition() {
|
||||
|
||||
File pidControlFile = new File(locatorWorkingDirectory, LocatorProcess.getLocatorProcessControlFilename());
|
||||
final File pidControlFile = new File(locatorWorkingDirectory,
|
||||
LocatorProcess.getLocatorProcessControlFilename());
|
||||
|
||||
@Override
|
||||
public boolean waiting() {
|
||||
public boolean evaluate() {
|
||||
return !pidControlFile.isFile();
|
||||
}
|
||||
});
|
||||
@@ -189,7 +189,7 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
|
||||
|
||||
System.clearProperty("spring.data.gemfire.locator.port");
|
||||
|
||||
if (Boolean.valueOf(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
if (Boolean.parseBoolean(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
FileSystemUtils.deleteRecursively(locatorWorkingDirectory);
|
||||
}
|
||||
|
||||
@@ -200,11 +200,11 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
|
||||
Arrays.stream(logFiles).forEach(File::delete);
|
||||
}
|
||||
|
||||
private Region assertRegion(Region actualRegion, String expectedRegionName) {
|
||||
private Region<?, ?> assertRegion(Region<?, ?> actualRegion, String expectedRegionName) {
|
||||
return assertRegion(actualRegion, expectedRegionName, Region.SEPARATOR+expectedRegionName);
|
||||
}
|
||||
|
||||
private Region assertRegion(Region actualRegion, String expectedRegionName, String expectedRegionFullPath) {
|
||||
private Region<?, ?> assertRegion(Region<?, ?> actualRegion, String expectedRegionName, String expectedRegionFullPath) {
|
||||
|
||||
assertNotNull(String.format("The [%s] was not properly configured and initialized!",
|
||||
expectedRegionName), actualRegion);
|
||||
@@ -214,7 +214,7 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
|
||||
return actualRegion;
|
||||
}
|
||||
|
||||
private Region assertRegionAttributes(Region actualRegion, DataPolicy expectedDataPolicy, Scope expectedScope) {
|
||||
private Region<?, ?> assertRegionAttributes(Region<?, ?> actualRegion, DataPolicy expectedDataPolicy, Scope expectedScope) {
|
||||
|
||||
assertNotNull(actualRegion);
|
||||
assertNotNull(actualRegion.getAttributes());
|
||||
@@ -231,7 +231,7 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
|
||||
return baseLocation.concat(File.separator).concat(configLocation);
|
||||
}
|
||||
|
||||
private Region getRegion(ConfigurableApplicationContext applicationContext, String regionBeanName) {
|
||||
private Region<?, ?> getRegion(ConfigurableApplicationContext applicationContext, String regionBeanName) {
|
||||
return applicationContext.getBean(regionBeanName, Region.class);
|
||||
}
|
||||
|
||||
@@ -268,7 +268,6 @@ public class CacheClusterConfigurationIntegrationTest extends ClientServerIntegr
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("all")
|
||||
public void localConfigurationTest() {
|
||||
|
||||
try {
|
||||
@@ -1,80 +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.assertNotNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.geode.cache.DiskStore;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* The DiskStoreBeanUsingPropertyPlaceholdersIntegrationTest class is a test suite of integration tests testing the use
|
||||
* of Spring PropertyPlaceholders to configure and initialize a Disk Store bean's properties using property placeholders
|
||||
* in the SDG XML namespace <disk-store> bean definition attributes.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.data.gemfire.DiskStoreFactoryBean
|
||||
* @see org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @see org.apache.geode.cache.DiskStore
|
||||
* @link https://jira.springsource.org/browse/SGF-249
|
||||
* @since 1.3.4
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(locations = "diskstore-using-propertyplaceholders-config.xml",
|
||||
initializers = GemfireTestApplicationContextInitializer.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class DiskStoreBeanUsingPropertyPlaceholdersIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private DiskStore testDataStore;
|
||||
|
||||
@Resource(name="diskStoreConfiguration")
|
||||
private Map<String, Object> diskStoreConfiguration;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Object getExpectedValue(final String propertyPlaceholderName) {
|
||||
return diskStoreConfiguration.get(propertyPlaceholderName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDiskStoreBeanWithPropertyPlaceholderConfiguration() {
|
||||
assertNotNull("The Disk Store was not configured and initialized!", testDataStore);
|
||||
assertEquals(getExpectedValue("allowForceCompaction"), testDataStore.getAllowForceCompaction());
|
||||
assertEquals(getExpectedValue("autoCompact"), testDataStore.getAutoCompact());
|
||||
assertEquals(getExpectedValue("compactionThreshold"), testDataStore.getCompactionThreshold());
|
||||
assertEquals(getExpectedValue("maxOplogSize"), testDataStore.getMaxOplogSize());
|
||||
assertEquals("TestDataStore", testDataStore.getName());
|
||||
assertEquals(getExpectedValue("queueSize"), testDataStore.getQueueSize());
|
||||
assertEquals(getExpectedValue("timeInterval"), testDataStore.getTimeInterval());
|
||||
assertEquals(getExpectedValue("writeBufferSize"), testDataStore.getWriteBufferSize());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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 java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.DiskStore;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Integration Tests testing the use of Spring PropertyPlaceholders to configure and initialize a {@link DiskStore} bean
|
||||
* properties using property placeholders in the SDG XML namespace <disk-store> bean definition attributes.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.DiskStore
|
||||
* @see org.springframework.data.gemfire.DiskStoreFactoryBean
|
||||
* @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
|
||||
* @link https://jira.springsource.org/browse/SGF-249
|
||||
* @since 1.3.4
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(locations = "diskstore-using-propertyplaceholders-config.xml",
|
||||
initializers = GemFireMockObjectsApplicationContextInitializer.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class DiskStoreBeanUsingPropertyPlaceholdersIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private DiskStore testDataStore;
|
||||
|
||||
@Resource(name="diskStoreConfiguration")
|
||||
private Map<String, Object> diskStoreConfiguration;
|
||||
|
||||
private Object getExpectedValue(final String propertyPlaceholderName) {
|
||||
return this.diskStoreConfiguration.get(propertyPlaceholderName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDiskStoreBeanWithPropertyPlaceholderConfiguration() {
|
||||
|
||||
assertThat(testDataStore).describedAs("The Disk Store was not configured and initialized!").isNotNull();
|
||||
assertThat(testDataStore.getAllowForceCompaction()).isEqualTo(getExpectedValue("allowForceCompaction"));
|
||||
assertThat(testDataStore.getAutoCompact()).isEqualTo(getExpectedValue("autoCompact"));
|
||||
assertThat(testDataStore.getCompactionThreshold()).isEqualTo(getExpectedValue("compactionThreshold"));
|
||||
assertThat(testDataStore.getMaxOplogSize()).isEqualTo(getExpectedValue("maxOplogSize"));
|
||||
assertThat(testDataStore.getName()).isEqualTo("TestDataStore");
|
||||
assertThat(testDataStore.getQueueSize()).isEqualTo(getExpectedValue("queueSize"));
|
||||
assertThat(testDataStore.getTimeInterval()).isEqualTo(getExpectedValue("timeInterval"));
|
||||
assertThat(testDataStore.getWriteBufferSize()).isEqualTo(getExpectedValue("writeBufferSize"));
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -27,36 +26,36 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.data.gemfire.fork.CqCacheServerProcess;
|
||||
import org.springframework.data.gemfire.fork.FunctionCacheServerProcess;
|
||||
import org.springframework.data.gemfire.test.support.IOUtils;
|
||||
import org.springframework.data.gemfire.test.support.ThreadUtils;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessExecutor;
|
||||
import org.springframework.data.gemfire.tests.util.IOUtils;
|
||||
import org.springframework.data.gemfire.tests.util.ThreadUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Utility class used to fork Java, JVM processes.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
* @deprecated ForkUtils has serious design flaws; please use ProcessExecutor instead
|
||||
* @deprecated {@link ForkUtil} has serious design flaws; please use {@link ProcessExecutor} from STDG instead
|
||||
*/
|
||||
@Deprecated
|
||||
public class ForkUtil {
|
||||
|
||||
private static final long TIMEOUT = 30000L;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
private static final Logger logger = LoggerFactory.getLogger(ForkUtil.class);
|
||||
|
||||
private static OutputStream processStandardInStream;
|
||||
|
||||
private static String JAVA_CLASSPATH = System.getProperty("java.class.path");
|
||||
private static String JAVA_HOME = System.getProperty("java.home");
|
||||
private static String JAVA_EXE = JAVA_HOME.concat(File.separator).concat("bin").concat(File.separator).concat("java");
|
||||
private static String TEMP_DIRECTORY = System.getProperty("java.io.tmpdir");
|
||||
private static final String JAVA_CLASSPATH = System.getProperty("java.class.path");
|
||||
private static final String JAVA_HOME = System.getProperty("java.home");
|
||||
private static final String JAVA_EXE = JAVA_HOME.concat(File.separator).concat("bin").concat(File.separator).concat("java");
|
||||
private static final String TEMP_DIRECTORY = System.getProperty("java.io.tmpdir");
|
||||
|
||||
private static List<String> buildJavaCommand(String arguments) {
|
||||
return buildJavaCommand(arguments.split("\\s+"));
|
||||
@@ -136,7 +135,9 @@ public class ForkUtil {
|
||||
}
|
||||
|
||||
private static void registerShutdownHook(AtomicBoolean runCondition, Process javaProcess) {
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
|
||||
runCondition.set(false);
|
||||
processStandardInStream = null;
|
||||
|
||||
@@ -167,6 +168,7 @@ public class ForkUtil {
|
||||
}
|
||||
|
||||
protected static OutputStream startGemFireProcess(String args, String processName) {
|
||||
|
||||
String className = args.split(" ")[0];
|
||||
|
||||
if (controlFileExists(className)) {
|
||||
@@ -189,6 +191,7 @@ public class ForkUtil {
|
||||
}
|
||||
|
||||
public static void sendSignal() {
|
||||
|
||||
try {
|
||||
processStandardInStream.write("\n".getBytes());
|
||||
processStandardInStream.flush();
|
||||
|
||||
@@ -47,11 +47,11 @@ import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.client.PoolFactoryBean;
|
||||
import org.springframework.data.gemfire.mapping.annotation.Region;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.server.CacheServerFactoryBean;
|
||||
import org.springframework.data.gemfire.support.ConnectionEndpoint;
|
||||
import org.springframework.data.gemfire.support.ConnectionEndpointList;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.util.PropertiesBuilder;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -78,6 +78,7 @@ import lombok.RequiredArgsConstructor;
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.data.gemfire.GemfireTemplate
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @see <a href="https://jira.spring.io/browse/SGF-555">Repository queries on client Regions associated with a Pool configured with a specified server group can lead to a RegionNotFoundException.</a>
|
||||
@@ -88,7 +89,7 @@ import lombok.RequiredArgsConstructor;
|
||||
GemfireTemplateQueriesOnGroupedPooledClientCacheRegionsIntegrationTests.GemFireClientCacheConfiguration.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class GemfireTemplateQueriesOnGroupedPooledClientCacheRegionsIntegrationTests
|
||||
extends ClientServerIntegrationTestsSupport{
|
||||
extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static ProcessWrapper serverOne;
|
||||
private static ProcessWrapper serverTwo;
|
||||
|
||||
@@ -48,7 +48,7 @@ import org.apache.geode.cache.query.QueryService;
|
||||
import org.apache.geode.cache.query.SelectResults;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.data.gemfire.test.support.AbstractUnitAndIntegrationTestsWithMockSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
|
||||
/**
|
||||
* Unit Tests for {@link GemfireTemplate}
|
||||
@@ -66,11 +66,11 @@ import org.springframework.data.gemfire.test.support.AbstractUnitAndIntegrationT
|
||||
* @see org.apache.geode.cache.query.QueryService
|
||||
* @see org.apache.geode.cache.query.SelectResults
|
||||
* @see org.springframework.data.gemfire.GemfireTemplate
|
||||
* @see org.springframework.data.gemfire.test.support.AbstractUnitAndIntegrationTestsWithMockSupport
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class GemfireTemplateUnitTests extends AbstractUnitAndIntegrationTestsWithMockSupport {
|
||||
public class GemfireTemplateUnitTests extends IntegrationTestsSupport {
|
||||
|
||||
private GemfireTemplate template;
|
||||
|
||||
|
||||
@@ -13,33 +13,33 @@
|
||||
* 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.assertNotNull;
|
||||
import static org.springframework.data.gemfire.test.support.FileSystemUtils.FileExtensionFilter.newFileExtensionFilter;
|
||||
import static org.springframework.data.gemfire.tests.util.FileSystemUtils.FileExtensionFilter.newFileExtensionFilter;
|
||||
|
||||
import java.io.FileFilter;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.CacheFactory;
|
||||
import org.apache.geode.cache.DataPolicy;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.Scope;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.data.gemfire.test.support.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.tests.util.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.util.CacheUtils;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GenericRegionFactoryBean}.
|
||||
* Unit Tests for {@link GenericRegionFactoryBean}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.GenericRegionFactoryBean
|
||||
* @since 1.7.0
|
||||
*/
|
||||
@@ -64,14 +64,16 @@ public class GenericRegionFactoryBeanTest {
|
||||
.set("log-level", "error")
|
||||
.create();
|
||||
|
||||
PeerRegionFactoryBean<Object, Object> defaultRegionFactory = new GenericRegionFactoryBean<Object, Object>();
|
||||
PeerRegionFactoryBean<Object, Object> defaultRegionFactory = new GenericRegionFactoryBean<>();
|
||||
|
||||
defaultRegionFactory.setCache(gemfireCache);
|
||||
defaultRegionFactory.setName("DefaultRegion");
|
||||
defaultRegionFactory.afterPropertiesSet();
|
||||
|
||||
defaultRegion = defaultRegionFactory.getObject();
|
||||
|
||||
PeerRegionFactoryBean<Object, Object> emptyRegionFactory = new GenericRegionFactoryBean<Object, Object>();
|
||||
PeerRegionFactoryBean<Object, Object> emptyRegionFactory = new GenericRegionFactoryBean<>();
|
||||
|
||||
emptyRegionFactory.setCache(gemfireCache);
|
||||
emptyRegionFactory.setDataPolicy(DataPolicy.EMPTY);
|
||||
emptyRegionFactory.setName("EmptyRegion");
|
||||
@@ -80,7 +82,8 @@ public class GenericRegionFactoryBeanTest {
|
||||
|
||||
emptyRegion = emptyRegionFactory.getObject();
|
||||
|
||||
PeerRegionFactoryBean<Object, Object> localRegionFactory = new GenericRegionFactoryBean<Object, Object>();
|
||||
PeerRegionFactoryBean<Object, Object> localRegionFactory = new GenericRegionFactoryBean<>();
|
||||
|
||||
localRegionFactory.setCache(gemfireCache);
|
||||
localRegionFactory.setDataPolicy(DataPolicy.NORMAL);
|
||||
localRegionFactory.setName("LocalRegion");
|
||||
@@ -89,7 +92,8 @@ public class GenericRegionFactoryBeanTest {
|
||||
|
||||
localRegion = localRegionFactory.getObject();
|
||||
|
||||
PeerRegionFactoryBean<Object, Object> normalRegionFactory = new GenericRegionFactoryBean<Object, Object>();
|
||||
PeerRegionFactoryBean<Object, Object> normalRegionFactory = new GenericRegionFactoryBean<>();
|
||||
|
||||
normalRegionFactory.setCache(gemfireCache);
|
||||
normalRegionFactory.setDataPolicy(DataPolicy.NORMAL);
|
||||
normalRegionFactory.setName("NormalRegion");
|
||||
@@ -98,7 +102,8 @@ public class GenericRegionFactoryBeanTest {
|
||||
|
||||
normalRegion = normalRegionFactory.getObject();
|
||||
|
||||
PeerRegionFactoryBean<Object, Object> persistentPartitionRegionFactory = new GenericRegionFactoryBean<Object, Object>();
|
||||
PeerRegionFactoryBean<Object, Object> persistentPartitionRegionFactory = new GenericRegionFactoryBean<>();
|
||||
|
||||
persistentPartitionRegionFactory.setCache(gemfireCache);
|
||||
persistentPartitionRegionFactory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
|
||||
persistentPartitionRegionFactory.setName("PersistentPartitionRegion");
|
||||
@@ -107,7 +112,8 @@ public class GenericRegionFactoryBeanTest {
|
||||
|
||||
persistentPartitionRegion = persistentPartitionRegionFactory.getObject();
|
||||
|
||||
PeerRegionFactoryBean<Object, Object> preloadedRegionFactory = new GenericRegionFactoryBean<Object, Object>();
|
||||
PeerRegionFactoryBean<Object, Object> preloadedRegionFactory = new GenericRegionFactoryBean<>();
|
||||
|
||||
preloadedRegionFactory.setCache(gemfireCache);
|
||||
preloadedRegionFactory.setDataPolicy(DataPolicy.PRELOADED);
|
||||
preloadedRegionFactory.setName("PreloadedRegion");
|
||||
@@ -115,7 +121,8 @@ public class GenericRegionFactoryBeanTest {
|
||||
|
||||
preloadedRegion = preloadedRegionFactory.getObject();
|
||||
|
||||
PeerRegionFactoryBean<Object, Object> replicateRegionFactory = new GenericRegionFactoryBean<Object, Object>();
|
||||
PeerRegionFactoryBean<Object, Object> replicateRegionFactory = new GenericRegionFactoryBean<>();
|
||||
|
||||
replicateRegionFactory.setCache(gemfireCache);
|
||||
replicateRegionFactory.setDataPolicy(DataPolicy.REPLICATE);
|
||||
replicateRegionFactory.setName("ReplicateRegion");
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -21,20 +20,24 @@ import org.junit.Before;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
|
||||
/**
|
||||
* The RecreatingSpringApplicationContextTest class is an abstract base class that creates the app context after each method.
|
||||
* Abstract base test class that creates the Spring {@link ConfigurableApplicationContext} after each method (test case).
|
||||
* Used to properly destroy the beans defined inside Spring.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author John Blum
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
*/
|
||||
public abstract class RecreatingSpringApplicationContextTest {
|
||||
public abstract class RecreatingSpringApplicationContextTest extends IntegrationTestsSupport {
|
||||
|
||||
protected GenericXmlApplicationContext applicationContext;
|
||||
|
||||
@Before
|
||||
public void createContext() {
|
||||
|
||||
applicationContext = configureContext(new GenericXmlApplicationContext());
|
||||
applicationContext.load(location());
|
||||
applicationContext.registerShutdownHook();
|
||||
@@ -53,5 +56,4 @@ public abstract class RecreatingSpringApplicationContextTest {
|
||||
applicationContext.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* 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;
|
||||
@@ -24,6 +23,9 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.DataPolicy;
|
||||
import org.apache.geode.cache.EvictionAction;
|
||||
@@ -37,31 +39,31 @@ import org.apache.geode.cache.ResumptionAction;
|
||||
import org.apache.geode.cache.Scope;
|
||||
import org.apache.geode.cache.SubscriptionAttributes;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.test.GemfireTestApplicationContextInitializer;
|
||||
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.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* The SubRegionIntegrationTest class is a test suite of test cases testing the functionality of SubRegions in GemFire
|
||||
* configured with Spring Data GemFire's XML namespace configuration meta-data. This test class tests a complex
|
||||
* SubRegion configuration in order to ensure functional completeness.
|
||||
* Integration Tests for Apache Geode sub-Regions defined in Spring configuration metadata,
|
||||
* i.e. Spring Data Geode's XML namespace configuration metadata.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @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
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @since 1.4.0
|
||||
* @since 7.0.1 (GemFire)
|
||||
*/
|
||||
@ContextConfiguration(value = "complex-subregion.xml", initializers = GemfireTestApplicationContextInitializer.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class SubRegionIntegrationTest {
|
||||
@ContextConfiguration(value = "complex-subregion.xml",
|
||||
initializers = GemFireMockObjectsApplicationContextInitializer.class)
|
||||
@SuppressWarnings({ "rawtypes", "unused" })
|
||||
public class SubRegionIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
@@ -140,5 +142,4 @@ public class SubRegionIntegrationTest {
|
||||
assertNotNull(subscriptionAttributes);
|
||||
assertEquals(InterestPolicy.CACHE_CONTENT, subscriptionAttributes.getInterestPolicy());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,7 +47,7 @@ import org.springframework.data.gemfire.LocalRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.mapping.GemfireMappingContext;
|
||||
import org.springframework.data.gemfire.mapping.annotation.Region;
|
||||
import org.springframework.data.gemfire.repository.support.GemfireRepositoryFactoryBean;
|
||||
import org.springframework.data.gemfire.test.support.IdentifierSequence;
|
||||
import org.springframework.data.gemfire.tests.support.IdentifierSequence;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
@@ -14,11 +14,9 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.cache;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -27,9 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import edu.umd.cs.mtc.MultithreadedTestCase;
|
||||
import edu.umd.cs.mtc.TestFramework;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.apache.geode.cache.CacheFactory;
|
||||
import org.apache.geode.cache.Region;
|
||||
@@ -47,21 +43,18 @@ import org.springframework.data.gemfire.test.support.AbstractNativeCacheTests;
|
||||
* @see org.junit.Test
|
||||
* @see edu.umd.cs.mtc.MultithreadedTestCase
|
||||
* @see edu.umd.cs.mtc.TestFramework
|
||||
* @see org.springframework.cache.Cache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.cache.Cache
|
||||
*/
|
||||
public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Region<Object, Object>> {
|
||||
|
||||
@Rule
|
||||
public ExpectedException exception = ExpectedException.none();
|
||||
|
||||
@Override
|
||||
protected Cache newCache(Region<Object, Object> nativeCache) {
|
||||
return new GemfireCache(nativeCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Region<Object, Object> newNativeCache() throws Exception {
|
||||
protected Region<Object, Object> newNativeCache() {
|
||||
|
||||
Properties gemfireProperties = new Properties();
|
||||
|
||||
@@ -70,11 +63,11 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
|
||||
org.apache.geode.cache.Cache cache = GemfireUtils.getCache();
|
||||
|
||||
cache = (cache != null ? cache : new CacheFactory(gemfireProperties).create());
|
||||
cache = cache != null ? cache : new CacheFactory(gemfireProperties).create();
|
||||
|
||||
Region<Object, Object> region = cache.getRegion(CACHE_NAME);
|
||||
|
||||
region = (region != null ? region : cache.createRegionFactory().create(CACHE_NAME));
|
||||
region = region != null ? region : cache.createRegionFactory().create(CACHE_NAME);
|
||||
|
||||
return region;
|
||||
}
|
||||
@@ -84,6 +77,7 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
*/
|
||||
@Test
|
||||
public void findsTypedValue() throws Exception {
|
||||
|
||||
Cache cache = newCache();
|
||||
|
||||
cache.put("key", "value");
|
||||
@@ -96,6 +90,7 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
*/
|
||||
@Test
|
||||
public void skipTypeChecksIfTargetTypeIsNull() throws Exception {
|
||||
|
||||
Cache cache = newCache();
|
||||
|
||||
cache.put("key", 1);
|
||||
@@ -106,22 +101,30 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/SGF-317">Improve GemfireCache implementation to be able to build on Spring 4.1</a>
|
||||
*/
|
||||
@Test
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void throwsIllegalStateExceptionIfTypedAccessDoesNotFindMatchingType() throws Exception {
|
||||
|
||||
Cache cache = newCache();
|
||||
|
||||
cache.put("key", "value");
|
||||
try {
|
||||
cache.put("key", "value");
|
||||
}
|
||||
catch (IllegalStateException expected) {
|
||||
|
||||
exception.expect(IllegalStateException.class);
|
||||
exception.expectMessage(Integer.class.getName());
|
||||
exception.expectMessage(String.format("Cached value [value] is not an instance of type [%s]",
|
||||
Integer.class.getName()));
|
||||
assertThat(expected).hasMessageContaining("Cached value [value] is not an instance of type [%s]",
|
||||
Integer.class.getName());
|
||||
assertThat(expected.getCause()).hasNoCause();
|
||||
|
||||
cache.get("key", Integer.class);
|
||||
throw expected;
|
||||
}
|
||||
finally {
|
||||
cache.get("key", Integer.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cacheGetWithValueLoaderFindsValue() throws Exception {
|
||||
|
||||
GemfireCache cache = newCache();
|
||||
|
||||
cache.put("key", "value");
|
||||
@@ -133,6 +136,7 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void cacheGetWithValueLoaderUsesValueLoaderReturnsValue() throws Exception {
|
||||
|
||||
GemfireCache cache = newCache();
|
||||
|
||||
TestValueLoader<String> valueLoader = new TestValueLoader<String>("test");
|
||||
@@ -143,8 +147,8 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void cacheGetWithValueLoaderUsesValueLoaderReturnsNull() throws Exception {
|
||||
|
||||
GemfireCache cache = newCache();
|
||||
|
||||
assertThat(cache.get("key", TestValueLoader.NULL_VALUE)).isNull();
|
||||
@@ -152,20 +156,24 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
assertThat(cache.getNativeCache().containsKey("key")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("all")
|
||||
@Test(expected = Cache.ValueRetrievalException.class)
|
||||
public void cacheGetWithValueLoaderUsesValueLoaderAndThrowsException() throws Exception {
|
||||
|
||||
GemfireCache cache = newCache();
|
||||
|
||||
try {
|
||||
TestValueLoader<Exception> exceptionThrowingValueLoader = new TestValueLoader<Exception>(
|
||||
new IllegalStateException("test"));
|
||||
|
||||
exception.expect(Cache.ValueRetrievalException.class);
|
||||
exception.expectCause(is(IllegalStateException.class));
|
||||
TestValueLoader<Exception> exceptionThrowingValueLoader =
|
||||
new TestValueLoader<>(new IllegalStateException("test"));
|
||||
|
||||
cache.get("key", exceptionThrowingValueLoader);
|
||||
}
|
||||
catch (Cache.ValueRetrievalException expected) {
|
||||
|
||||
assertThat(expected).hasCauseInstanceOf(IllegalStateException.class);
|
||||
|
||||
throw expected;
|
||||
}
|
||||
finally {
|
||||
assertThat(cache.getNativeCache().containsKey("key")).isFalse();
|
||||
}
|
||||
@@ -185,12 +193,15 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
|
||||
@Override
|
||||
public void initialize(){
|
||||
|
||||
super.initialize();
|
||||
|
||||
cache = newCacheHandlesCheckedException();
|
||||
this.cache = newCacheHandlesCheckedException();
|
||||
|
||||
cacheLoader = new TestValueLoader<String>("test") {
|
||||
@Override public String call() throws Exception {
|
||||
this.cacheLoader = new TestValueLoader<String>("test") {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
waitForTick(2);
|
||||
return super.call();
|
||||
}
|
||||
@@ -198,15 +209,17 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
}
|
||||
|
||||
<T extends Cache> T newCacheHandlesCheckedException() {
|
||||
|
||||
try {
|
||||
return newCache();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException("Failed to create Cache", e);
|
||||
catch (Exception cause) {
|
||||
throw new RuntimeException("Failed to create Cache", cause);
|
||||
}
|
||||
}
|
||||
|
||||
public void thread1() {
|
||||
|
||||
assertTick(0);
|
||||
|
||||
Thread.currentThread().setName("Cache Loader Thread");
|
||||
@@ -219,6 +232,7 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
}
|
||||
|
||||
public void thread2() {
|
||||
|
||||
waitForTick(1);
|
||||
|
||||
Thread.currentThread().setName("Cache Reader Thread");
|
||||
@@ -237,7 +251,7 @@ public class GemfireCacheIntegrationTests extends AbstractNativeCacheTests<Regio
|
||||
|
||||
protected static final TestValueLoader<Object> NULL_VALUE = new TestValueLoader<Object>();
|
||||
|
||||
private AtomicBoolean called = new AtomicBoolean(false);
|
||||
private final AtomicBoolean called = new AtomicBoolean(false);
|
||||
|
||||
private final T value;
|
||||
|
||||
|
||||
@@ -13,12 +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.junit.Assert.assertSame;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -39,33 +36,34 @@ 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.process.ProcessExecutor;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.test.support.ThreadUtils;
|
||||
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.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Integration tests for testing {@link ClientCache} {@link Index Indexes}.
|
||||
* Integration Tests for testing {@link ClientCache} {@link Index Indexes}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.data.gemfire.IndexFactoryBean
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @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.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.5.2
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientCacheIndexingTest {
|
||||
public class ClientCacheIndexingIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static ProcessWrapper serverProcess;
|
||||
|
||||
@@ -98,13 +96,13 @@ public class ClientCacheIndexingTest {
|
||||
|
||||
private static void waitForServerStart(final long milliseconds) {
|
||||
|
||||
ThreadUtils.timedWait(milliseconds, TimeUnit.MILLISECONDS.toMillis(500), new ThreadUtils.WaitCondition() {
|
||||
ThreadUtils.timedWait(milliseconds, TimeUnit.MILLISECONDS.toMillis(500), new ThreadUtils.Condition() {
|
||||
|
||||
private File serverPidControlFile =
|
||||
private final File serverPidControlFile =
|
||||
new File(serverProcess.getWorkingDirectory(), ServerProcess.getServerProcessControlFilename());
|
||||
|
||||
@Override
|
||||
public boolean waiting() {
|
||||
public boolean evaluate() {
|
||||
return !serverPidControlFile.isFile();
|
||||
}
|
||||
});
|
||||
@@ -115,7 +113,7 @@ public class ClientCacheIndexingTest {
|
||||
|
||||
serverProcess.shutdown();
|
||||
|
||||
if (Boolean.valueOf(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
if (Boolean.parseBoolean(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
org.springframework.util.FileSystemUtils.deleteRecursively(serverProcess.getWorkingDirectory());
|
||||
}
|
||||
}
|
||||
@@ -139,13 +137,13 @@ public class ClientCacheIndexingTest {
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testIndexByName() {
|
||||
|
||||
assertNotNull("The GemFire ClientCache was not properly configured and initialized!", clientCache);
|
||||
assertThat(clientCache).as("The GemFire ClientCache was not properly configured and initialized!").isNotNull();
|
||||
|
||||
Index actualIndex = getIndex(clientCache, "ExampleIndex");
|
||||
|
||||
assertNotNull(actualIndex);
|
||||
assertEquals("ExampleIndex", actualIndex.getName());
|
||||
assertEquals(IndexType.HASH, actualIndex.getType());
|
||||
assertSame(exampleIndex, actualIndex);
|
||||
assertThat(actualIndex).isNotNull();
|
||||
assertThat(actualIndex.getName()).isEqualTo("ExampleIndex");
|
||||
assertThat(actualIndex.getType()).isEqualTo(IndexType.HASH);
|
||||
assertThat(actualIndex).isSameAs(exampleIndex);
|
||||
}
|
||||
}
|
||||
@@ -28,25 +28,28 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.test.support.IOUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.util.IOUtils;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link org.apache.geode.cache.client.ClientCache}.
|
||||
* Integration Tests for {@link org.apache.geode.cache.client.ClientCache}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @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.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
|
||||
* @see EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
*/
|
||||
public class ClientCacheIntegrationTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientCacheIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext newApplicationContext(Class<?>... annotatedClasses) {
|
||||
return new AnnotationConfigApplicationContext(annotatedClasses);
|
||||
@@ -83,7 +86,6 @@ public class ClientCacheIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void multipleClientCachesAreTheSame() {
|
||||
|
||||
ConfigurableApplicationContext applicationContextOne = newApplicationContext(MultiClientCacheConfiguration.class);
|
||||
@@ -95,8 +97,8 @@ public class ClientCacheIntegrationTests {
|
||||
assertThat(clientCacheOne).isNotNull();
|
||||
assertThat(clientCacheTwo).isSameAs(clientCacheOne);
|
||||
|
||||
Region regionOne = applicationContextOne.getBean(Region.class);
|
||||
Region regionTwo = applicationContextTwo.getBean(Region.class);
|
||||
Region<?, ?> regionOne = applicationContextOne.getBean(Region.class);
|
||||
Region<?, ?> regionTwo = applicationContextTwo.getBean(Region.class);
|
||||
|
||||
assertThat(regionOne).isNotNull();
|
||||
assertThat(regionTwo).isSameAs(regionTwo);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
@@ -23,7 +22,6 @@ import static org.junit.Assert.assertThat;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -33,33 +31,32 @@ import org.apache.geode.cache.CacheLoaderException;
|
||||
import org.apache.geode.cache.LoaderHelper;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.AbstractGemFireClientServerIntegrationTest;
|
||||
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 {@link ClientCache} {@link Pool Pools}.
|
||||
* Integration Tests for {@link ClientCache} {@link Pool Pools}.
|
||||
*
|
||||
* @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.client.Pool
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("all")
|
||||
public class ClientCachePoolTests extends AbstractGemFireClientServerIntegrationTest {
|
||||
|
||||
private static ProcessWrapper gemfireServerProcess;
|
||||
public class ClientCachePoolIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void setupGemFireServer() throws Exception {
|
||||
gemfireServerProcess = startGemFireServer(ClientCachePoolTests.class);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownGemFireServer() {
|
||||
stopGemFireServer(gemfireServerProcess);
|
||||
startGemFireServer(ClientCachePoolIntegrationTests.class);
|
||||
}
|
||||
|
||||
@Resource(name = "Factorials")
|
||||
@@ -19,11 +19,9 @@ import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -40,13 +38,11 @@ import org.apache.geode.cache.Region;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.data.gemfire.fork.ServerProcess;
|
||||
import org.springframework.data.gemfire.process.ProcessExecutor;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.test.support.ThreadUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
/**
|
||||
* Integration Tests to test SSL configuration between a Pivotal GemFire or Apache Geode client and server
|
||||
@@ -61,56 +57,33 @@ import org.springframework.util.Assert;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("all")
|
||||
public class ClientCacheSecurityTest {
|
||||
|
||||
private static ProcessWrapper serverProcess;
|
||||
|
||||
@Resource(name = "Example")
|
||||
private Region<String, String> example;
|
||||
public class ClientCacheSecurityIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws IOException {
|
||||
|
||||
String serverName = "GemFireSecurityCacheServer";
|
||||
|
||||
File serverWorkingDirectory = new File(FileSystemUtils.WORKING_DIRECTORY, serverName.toLowerCase());
|
||||
|
||||
Assert.isTrue(serverWorkingDirectory.isDirectory() || serverWorkingDirectory.mkdirs());
|
||||
public static void startGeodeServer() throws IOException {
|
||||
|
||||
List<String> arguments = new ArrayList<String>();
|
||||
|
||||
arguments.add(String.format("-Dgemfire.name=%1$s", serverName));
|
||||
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");
|
||||
|
||||
serverProcess = ProcessExecutor.launch(serverWorkingDirectory, ServerProcess.class,
|
||||
arguments.toArray(new String[arguments.size()]));
|
||||
|
||||
waitForServerStart(TimeUnit.SECONDS.toMillis(20));
|
||||
}
|
||||
|
||||
private static void waitForServerStart(final long milliseconds) {
|
||||
|
||||
ThreadUtils.timedWait(milliseconds, TimeUnit.MILLISECONDS.toMillis(500), new ThreadUtils.WaitCondition() {
|
||||
private File serverPidControlFile = new File(serverProcess.getWorkingDirectory(),
|
||||
ServerProcess.getServerProcessControlFilename());
|
||||
|
||||
@Override public boolean waiting() {
|
||||
return !serverPidControlFile.isFile();
|
||||
}
|
||||
});
|
||||
startGemFireServer(ServerProcess.class, arguments.toArray(new String[arguments.size()]));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDown() {
|
||||
|
||||
serverProcess.shutdown();
|
||||
|
||||
if (Boolean.valueOf(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
org.springframework.util.FileSystemUtils.deleteRecursively(serverProcess.getWorkingDirectory());
|
||||
getGemFireServerProcess()
|
||||
.map(ProcessWrapper::getWorkingDirectory)
|
||||
.ifPresent(workingDirectory -> FileSystemUtils.deleteRecursively(workingDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
@Resource(name = "Example")
|
||||
private Region<String, String> example;
|
||||
|
||||
@Test
|
||||
public void exampleRegionGet() {
|
||||
assertThat(String.valueOf(example.get("TestKey")), is(equalTo("TestValue")));
|
||||
@@ -126,6 +99,7 @@ public class ClientCacheSecurityTest {
|
||||
|
||||
@Override
|
||||
public void close() { }
|
||||
|
||||
}
|
||||
|
||||
public static class SslGemFireServer {
|
||||
@@ -13,18 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
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.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -40,17 +35,15 @@ import org.apache.geode.cache.LoaderHelper;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.data.gemfire.fork.ServerProcess;
|
||||
import org.springframework.data.gemfire.process.ProcessExecutor;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.test.support.ThreadUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
/**
|
||||
* The ClientCacheVariableServersTest class is a test suite of test cases testing the use of variable "servers"
|
||||
* attribute on <gfe:pool/< in Spring (Data GemFire) configuration meta-data when connecting a client/server.
|
||||
* IntegrationTests with test cases testing the use of variable "locators" attribute
|
||||
* on <gfe:pool/< in SDG XML namespace configuration metadata when connecting a client/server.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -59,61 +52,44 @@ import org.springframework.util.Assert;
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @since 1.6.3
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("all")
|
||||
public class ClientCacheVariableServersTest {
|
||||
|
||||
private static ProcessWrapper serverProcess;
|
||||
|
||||
@Resource(name = "Example")
|
||||
private Region<String, Integer> example;
|
||||
public class ClientCacheVariableLocatorsIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws IOException {
|
||||
String serverName = ClientCacheVariableServersTest.class.getSimpleName().concat("Server");
|
||||
|
||||
File serverWorkingDirectory = new File(FileSystemUtils.WORKING_DIRECTORY, serverName.toLowerCase());
|
||||
|
||||
Assert.isTrue(serverWorkingDirectory.isDirectory() || serverWorkingDirectory.mkdirs());
|
||||
public static void startGeodeServer() throws IOException {
|
||||
|
||||
List<String> arguments = new ArrayList<String>();
|
||||
|
||||
arguments.add(String.format("-Dgemfire.name=%1$s", serverName));
|
||||
arguments.add("/".concat(ClientCacheVariableServersTest.class.getName().replace(".", "/")
|
||||
arguments.add(String.format("-Dgemfire.name=%1$s",
|
||||
ClientCacheVariableLocatorsIntegrationTests.class.getSimpleName().concat("Server")));
|
||||
|
||||
arguments.add("/".concat(ClientCacheVariableLocatorsIntegrationTests.class.getName().replace(".", "/")
|
||||
.concat("-server-context.xml")));
|
||||
|
||||
serverProcess = ProcessExecutor.launch(serverWorkingDirectory, ServerProcess.class,
|
||||
arguments.toArray(new String[arguments.size()]));
|
||||
|
||||
waitForServerToStart(TimeUnit.SECONDS.toMillis(20));
|
||||
}
|
||||
|
||||
private static void waitForServerToStart(final long milliseconds) {
|
||||
ThreadUtils.timedWait(milliseconds, TimeUnit.MILLISECONDS.toMillis(500), new ThreadUtils.WaitCondition() {
|
||||
private File serverPidControlFile = new File(serverProcess.getWorkingDirectory(),
|
||||
ServerProcess.getServerProcessControlFilename());
|
||||
|
||||
@Override public boolean waiting() {
|
||||
return !serverPidControlFile.isFile();
|
||||
}
|
||||
});
|
||||
startGemFireServer(ServerProcess.class, arguments.toArray(new String[arguments.size()]));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDown() {
|
||||
serverProcess.shutdown();
|
||||
|
||||
if (Boolean.valueOf(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
org.springframework.util.FileSystemUtils.deleteRecursively(serverProcess.getWorkingDirectory());
|
||||
getGemFireServerProcess()
|
||||
.map(ProcessWrapper::getWorkingDirectory)
|
||||
.ifPresent(workingDirectory -> FileSystemUtils.deleteRecursively(workingDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
@Resource(name = "Example")
|
||||
private Region<String, Integer> example;
|
||||
|
||||
@Test
|
||||
public void clientServerConnectionSuccessful() {
|
||||
assertThat(example.get("one"), is(equalTo(1)));
|
||||
assertThat(example.get("two"), is(equalTo(2)));
|
||||
assertThat(example.get("three"), is(equalTo(3)));
|
||||
|
||||
assertThat(example.get("one")).isEqualTo(1);
|
||||
assertThat(example.get("two")).isEqualTo(2);
|
||||
assertThat(example.get("three")).isEqualTo(3);
|
||||
}
|
||||
|
||||
public static class CacheMissCounterCacheLoader implements CacheLoader<String, Integer> {
|
||||
@@ -130,5 +106,4 @@ public class ClientCacheVariableServersTest {
|
||||
cacheMissCounter.set(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,135 +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.client;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
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.process.ProcessExecutor;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.test.support.ThreadUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* The ClientCacheVariableLocatorsTest class is a test suite of test cases testing the use of variable "locators"
|
||||
* attribute on <gfe:pool/< in Spring (Data GemFire) configuration meta-data when connecting a client/server.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @since 1.6.3
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("all")
|
||||
public class ClientCacheVariableLocatorsTest {
|
||||
|
||||
private static ProcessWrapper serverProcess;
|
||||
|
||||
@Resource(name = "Example")
|
||||
private Region<String, Integer> example;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws IOException {
|
||||
|
||||
String serverName = ClientCacheVariableServersTest.class.getSimpleName().concat("Server");
|
||||
|
||||
File serverWorkingDirectory = new File(FileSystemUtils.WORKING_DIRECTORY, serverName.toLowerCase());
|
||||
|
||||
Assert.isTrue(serverWorkingDirectory.isDirectory() || serverWorkingDirectory.mkdirs());
|
||||
|
||||
List<String> arguments = new ArrayList<String>();
|
||||
|
||||
arguments.add(String.format("-Dgemfire.name=%1$s", serverName));
|
||||
arguments.add("/".concat(ClientCacheVariableLocatorsTest.class.getName().replace(".", "/")
|
||||
.concat("-server-context.xml")));
|
||||
|
||||
serverProcess = ProcessExecutor.launch(serverWorkingDirectory, ServerProcess.class,
|
||||
arguments.toArray(new String[arguments.size()]));
|
||||
|
||||
waitForServerToStart(TimeUnit.SECONDS.toMillis(20));
|
||||
}
|
||||
|
||||
private static void waitForServerToStart(final long milliseconds) {
|
||||
ThreadUtils.timedWait(milliseconds, TimeUnit.MILLISECONDS.toMillis(500), new ThreadUtils.WaitCondition() {
|
||||
private File serverPidControlFile = new File(serverProcess.getWorkingDirectory(),
|
||||
ServerProcess.getServerProcessControlFilename());
|
||||
|
||||
@Override public boolean waiting() {
|
||||
return !serverPidControlFile.isFile();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDown() {
|
||||
serverProcess.shutdown();
|
||||
|
||||
if (Boolean.valueOf(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
org.springframework.util.FileSystemUtils.deleteRecursively(serverProcess.getWorkingDirectory());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clientServerConnectionSuccessful() {
|
||||
assertThat(example.get("one"), is(equalTo(1)));
|
||||
assertThat(example.get("two"), is(equalTo(2)));
|
||||
assertThat(example.get("three"), is(equalTo(3)));
|
||||
}
|
||||
|
||||
public static class CacheMissCounterCacheLoader implements CacheLoader<String, Integer> {
|
||||
|
||||
private static final AtomicInteger cacheMissCounter = new AtomicInteger(0);
|
||||
|
||||
@Override
|
||||
public Integer load(final LoaderHelper<String, Integer> helper) throws CacheLoaderException {
|
||||
return cacheMissCounter.incrementAndGet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
cacheMissCounter.set(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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.client;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
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.data.gemfire.tests.process.ProcessWrapper;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
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.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.6.3
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("all")
|
||||
public class ClientCacheVariableServersIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void startGeodeServer() throws IOException {
|
||||
|
||||
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")));
|
||||
|
||||
startGemFireServer(ServerProcess.class, arguments.toArray(new String[arguments.size()]));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDown() {
|
||||
|
||||
if (Boolean.parseBoolean(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
getGemFireServerProcess()
|
||||
.map(ProcessWrapper::getWorkingDirectory)
|
||||
.ifPresent(workingDirectory -> FileSystemUtils.deleteRecursively(workingDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
@Resource(name = "Example")
|
||||
private Region<String, Integer> example;
|
||||
|
||||
@Test
|
||||
public void clientServerConnectionSuccessful() {
|
||||
|
||||
assertThat(example.get("one")).isEqualTo(1);
|
||||
assertThat(example.get("two")).isEqualTo(2);
|
||||
assertThat(example.get("three")).isEqualTo(3);
|
||||
}
|
||||
|
||||
public static class CacheMissCounterCacheLoader implements CacheLoader<String, Integer> {
|
||||
|
||||
private static final AtomicInteger cacheMissCounter = new AtomicInteger(0);
|
||||
|
||||
@Override
|
||||
public Integer load(final LoaderHelper<String, Integer> helper) throws CacheLoaderException {
|
||||
return cacheMissCounter.incrementAndGet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
cacheMissCounter.set(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -29,23 +28,29 @@ import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests for client {@link Region Regions} created with SDG's {@link ClientRegionFactoryBean}.
|
||||
* Integration Tests for client {@link Region Regions} created with SDG's {@link ClientRegionFactoryBean}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.client.ClientRegionFactoryBean
|
||||
* @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 ClientRegionIntegrationTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientRegionIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Resource(name = "Example")
|
||||
private Region<Object, Object> example;
|
||||
|
||||
@@ -13,14 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
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;
|
||||
@@ -31,18 +29,18 @@ import org.apache.geode.cache.client.ClientCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.gemfire.GemfireTemplate;
|
||||
import org.springframework.data.gemfire.fork.ServerProcess;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration test testing {@link Region sub-Region} functionality from a GemFire cache client.
|
||||
* Integration Tests testing {@link Region sub-Region} functionality from a cache client.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.4.0
|
||||
@@ -50,9 +48,13 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientSubRegionIntegrationTests extends ClientServerIntegrationTestsSupport {
|
||||
public class ClientSubRegionIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static ProcessWrapper gemfireServer;
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
startGemFireServer(ServerProcess.class,
|
||||
getServerContextXmlFileLocation(ClientSubRegionIntegrationTests.class));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ClientCache clientCache;
|
||||
@@ -64,64 +66,49 @@ public class ClientSubRegionIntegrationTests extends ClientServerIntegrationTest
|
||||
private GemfireTemplate childTemplate;
|
||||
|
||||
@Resource(name = "Parent")
|
||||
private Region parent;
|
||||
private Region<?, ?> parent;
|
||||
|
||||
@Resource(name = "/Parent/Child")
|
||||
private Region child;
|
||||
private Region<?, ?> child;
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
int availablePort = findAvailablePort();
|
||||
|
||||
gemfireServer = run(ServerProcess.class,
|
||||
String.format("-D%s=%d", GEMFIRE_CACHE_SERVER_PORT_PROPERTY, availablePort),
|
||||
getServerContextXmlFileLocation(ClientSubRegionIntegrationTests.class));
|
||||
|
||||
waitForServerToStart(DEFAULT_HOSTNAME, availablePort);
|
||||
|
||||
System.setProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY, String.valueOf(availablePort));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
System.clearProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY);
|
||||
stop(gemfireServer);
|
||||
}
|
||||
|
||||
protected void assertRegion(Region<?, ?> region, String name) {
|
||||
private void assertRegion(Region<?, ?> region, String name) {
|
||||
assertRegion(region, name, String.format("%1$s%2$s", Region.SEPARATOR, name));
|
||||
}
|
||||
|
||||
protected void assertRegion(Region<?, ?> region, String name, String fullPath) {
|
||||
private void assertRegion(Region<?, ?> region, String name, String fullPath) {
|
||||
assertThat(region).isNotNull();
|
||||
assertThat(region.getName()).isEqualTo(name);
|
||||
assertThat(region.getFullPath()).isEqualTo(fullPath);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gemFireSubRegionCreationConfigurationIsCorrect() {
|
||||
|
||||
assertThat(clientCache).describedAs("The Client Cache was not properly initialized!").isNotNull();
|
||||
|
||||
Region parent = clientCache.getRegion("Parent");
|
||||
Region<?, ?> parent = clientCache.getRegion("Parent");
|
||||
|
||||
assertRegion(parent, "Parent");
|
||||
|
||||
Region child = parent.getSubregion("Child");
|
||||
Region<?, ?> child = parent.getSubregion("Child");
|
||||
|
||||
assertRegion(child, "Child", "/Parent/Child");
|
||||
|
||||
Region clientCacheChild = clientCache.getRegion("/Parent/Child");
|
||||
Region<?, ?> clientCacheChild = clientCache.getRegion("/Parent/Child");
|
||||
|
||||
assertThat(child).isSameAs(clientCacheChild);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void springSubRegionCreationConfigurationIsCorrect() {
|
||||
|
||||
assertRegion(parent, "Parent");
|
||||
assertRegion(child, "Child", "/Parent/Child");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void templateCreationConfigurationIsCorrect() {
|
||||
|
||||
assertThat(parentTemplate).isNotNull();
|
||||
assertThat(parentTemplate.getRegion()).isSameAs(parent);
|
||||
assertThat(childTemplate).isNotNull();
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.FixMethodOrder;
|
||||
@@ -54,51 +53,42 @@ 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.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.AbstractGemFireClientServerIntegrationTest;
|
||||
import org.springframework.data.gemfire.test.support.ThreadUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.util.ThreadUtils;
|
||||
import org.springframework.data.gemfire.util.DistributedSystemUtils;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.SocketUtils;
|
||||
|
||||
/**
|
||||
* The DurableClientCacheIntegrationTest class is a test suite of test cases testing GemFire's Durable Client
|
||||
* functionality in the context of Spring Data GemFire.
|
||||
* Integration Tests to test Apache Geode durable clients.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.util.Properties
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.beans.factory.config.BeanPostProcessor
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.data.gemfire.process.ProcessWrapper
|
||||
* @see AbstractGemFireClientServerIntegrationTest
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.apache.geode.cache.client.ClientCacheFactory
|
||||
* @see org.apache.geode.cache.client.Pool
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.util.CacheListenerAdapter
|
||||
* @since 1.6.3
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("all")
|
||||
public class DurableClientCacheIntegrationTest extends AbstractGemFireClientServerIntegrationTest {
|
||||
public class DurableClientCacheIntegrationTest extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static final boolean DEBUG = true;
|
||||
|
||||
private static int serverPort;
|
||||
|
||||
private static AtomicBoolean dirtiesContext = new AtomicBoolean(false);
|
||||
|
||||
private static List<Integer> regionCacheListenerEventValues =
|
||||
Collections.synchronizedList(new ArrayList<Integer>());
|
||||
|
||||
private static ProcessWrapper serverProcess;
|
||||
|
||||
private static final String CACHE_SERVER_PORT =
|
||||
DurableClientCacheIntegrationTest.class.getName().concat(".cache-server-port");
|
||||
|
||||
@@ -112,16 +102,7 @@ public class DurableClientCacheIntegrationTest extends AbstractGemFireClientServ
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws IOException {
|
||||
|
||||
serverPort = setSystemProperty(CACHE_SERVER_PORT, SocketUtils.findAvailableTcpPort());
|
||||
serverProcess = startGemFireServer(DurableClientCacheIntegrationTest.class);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
|
||||
stopGemFireServer(serverProcess);
|
||||
clearTestClassSystemProperties(DurableClientCacheIntegrationTest.class);
|
||||
startGemFireServer(DurableClientCacheIntegrationTest.class);
|
||||
}
|
||||
|
||||
private static boolean isAfterDirtiesContext() {
|
||||
@@ -205,7 +186,7 @@ public class DurableClientCacheIntegrationTest extends AbstractGemFireClientServ
|
||||
try {
|
||||
|
||||
ClientCache clientCache = new ClientCacheFactory()
|
||||
.addPoolServer(SERVER_HOST, serverPort)
|
||||
.addPoolServer(SERVER_HOST, Integer.getInteger(GEMFIRE_POOL_SERVERS_PROPERTY))
|
||||
.set("name", "ClientCacheProducer")
|
||||
.set("log-level", "error")
|
||||
.create();
|
||||
|
||||
@@ -17,7 +17,6 @@ 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;
|
||||
@@ -36,76 +35,52 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.GemfireUtils;
|
||||
import org.springframework.data.gemfire.fork.ServerProcess;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.test.support.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
/**
|
||||
* The GemFireDataSourceIntegrationTest class is a test suite of test cases testing the contract and functionality
|
||||
* of the <gfe-data:datasource> element in the context of a GemFire cluster running both native,
|
||||
* non-Spring configured GemFire Server(s) in addition to Spring configured and bootstrapped GemFire Server(s).
|
||||
* Integration Tests with test cases testing the contract and functionality of the <gfe-data:datasource> element
|
||||
* in the context of an Apache Geode cluster running both native, non-Spring configured Geode Server(s) in addition to
|
||||
* Spring configured and bootstrapped Geode Server(s).
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.springframework.data.gemfire.client.GemfireDataSourcePostProcessor
|
||||
* @see org.springframework.context.ApplicationContext
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
* @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)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings({ "rawtypes", "unused"})
|
||||
public class GemFireDataSourceIntegrationTest extends ClientServerIntegrationTestsSupport {
|
||||
|
||||
private static final String GEMFIRE_LOG_LEVEL = "error";
|
||||
|
||||
private static ProcessWrapper gemfireServer;
|
||||
public class GemFireDataSourceIntegrationTest extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws IOException {
|
||||
|
||||
int availablePort = findAvailablePort();
|
||||
|
||||
String serverName = GemFireDataSourceIntegrationTest.class.getSimpleName().concat("Server");
|
||||
|
||||
File serverWorkingDirectory = new File(FileSystemUtils.WORKING_DIRECTORY, serverName.toLowerCase());
|
||||
|
||||
List<String> arguments = new ArrayList<>();
|
||||
|
||||
arguments.add(String.format("-Dgemfire.name=%s", serverName));
|
||||
arguments.add(String.format("-Dgemfire.log-level=%s", GEMFIRE_LOG_LEVEL));
|
||||
arguments.add(String.format("-Dspring.data.gemfire.cache.server.port=%d", availablePort));
|
||||
arguments.add(String.format("-Dgemfire.name=%s", GemFireDataSourceIntegrationTest.class.getSimpleName().concat("Server")));
|
||||
arguments.add(GemFireDataSourceIntegrationTest.class.getName()
|
||||
.replace(".", "/").concat("-server-context.xml"));
|
||||
|
||||
gemfireServer = run(serverWorkingDirectory, ServerProcess.class, arguments.toArray(new String[0]));
|
||||
startGemFireServer(ServerProcess.class, arguments.toArray(new String[0]));
|
||||
|
||||
waitForServerToStart(DEFAULT_HOSTNAME, availablePort);
|
||||
|
||||
configureGemFireClient(availablePort);
|
||||
}
|
||||
|
||||
private static void configureGemFireClient(int availablePort) {
|
||||
System.setProperty("gemfire.log-level", "error");
|
||||
System.setProperty("spring.data.gemfire.cache.server.port", String.valueOf(availablePort));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
|
||||
stop(gemfireServer);
|
||||
|
||||
System.clearProperty("gemfire.log-level");
|
||||
System.clearProperty("spring.data.gemfire.cache.server.port");
|
||||
|
||||
if (Boolean.valueOf(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
org.springframework.util.FileSystemUtils.deleteRecursively(gemfireServer.getWorkingDirectory());
|
||||
if (Boolean.parseBoolean(System.getProperty("spring.gemfire.fork.clean", Boolean.TRUE.toString()))) {
|
||||
getGemFireServerProcess()
|
||||
.map(ProcessWrapper::getWorkingDirectory)
|
||||
.ifPresent(workingDirectory -> FileSystemUtils.deleteRecursively(workingDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -31,59 +30,33 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.GemfireUtils;
|
||||
import org.springframework.data.gemfire.fork.ServerProcess;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.repository.sample.Person;
|
||||
import org.springframework.data.gemfire.repository.sample.PersonRepository;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests for a GemFire DataSource.
|
||||
* Integration Tests for an Apache Geode DataSource.
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
// TODO: merge with o.s.d.g.client.GemfireDataSourceIntegrationTest
|
||||
public class GemFireDataSourceIntegrationTests extends ClientServerIntegrationTestsSupport {
|
||||
|
||||
private static ProcessWrapper gemfireServer;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@BeforeClass
|
||||
public static void setGemFireLogLevel() {
|
||||
System.setProperty("gemfire.log-level", "error");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void unsetGemFireLogLevel() {
|
||||
System.clearProperty("gemfire.log-level");
|
||||
}
|
||||
public class GemFireDataSourceIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
|
||||
int availablePort = findAvailablePort();
|
||||
|
||||
gemfireServer = run(ServerProcess.class,
|
||||
String.format("-D%s=%d", GEMFIRE_CACHE_SERVER_PORT_PROPERTY, availablePort),
|
||||
startGemFireServer(ServerProcess.class,
|
||||
getServerContextXmlFileLocation(GemFireDataSourceIntegrationTests.class));
|
||||
|
||||
waitForServerToStart(DEFAULT_HOSTNAME, availablePort);
|
||||
|
||||
System.setProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY, String.valueOf(availablePort));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
System.clearProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY);
|
||||
stop(gemfireServer);
|
||||
}
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private void assertRegion(Region<?, ?> region, String name, DataPolicy dataPolicy) {
|
||||
assertRegion(region, name, GemfireUtils.toRegionPath("simple"), dataPolicy);
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -23,6 +25,7 @@ import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
@@ -38,26 +41,25 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.data.gemfire.GemfireUtils;
|
||||
import org.springframework.data.gemfire.fork.GemFireBasedServerProcess;
|
||||
import org.springframework.data.gemfire.process.ProcessExecutor;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.test.support.ThreadUtils;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
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.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
|
||||
/**
|
||||
* The GemFireDataSourceUsingNonSpringConfiguredGemFireServerIntegrationTest class is a test suite of test cases
|
||||
* testing the contract and functionality of the GemfireDataSourcePostProcessor using the <gfe-data:datasource>
|
||||
* element in Spring config to setup a GemFire ClientCache connecting to a native, non-Spring configured GemFire Server
|
||||
* as the DataSource to assert that client Region Proxies are registered as Spring beans
|
||||
* in the Spring ApplicationContext correctly.
|
||||
* Integration Tests with test cases testing the contract and functionality of the {@link GemfireDataSourcePostProcessor}
|
||||
* using the <gfe-data:datasource> element in Spring config to setup a {@link ClientCache} connecting to a native,
|
||||
* non-Spring configured Apache Geode Server as the {@link DataSource} to assert that client {@link Region} proxies
|
||||
* are registered as Spring beans in the Spring {@link ApplicationContext} correctly.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.client.GemfireDataSourcePostProcessor
|
||||
* @since 1.7.0
|
||||
*/
|
||||
@@ -65,33 +67,17 @@ import org.assertj.core.api.Assertions;
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings({ "rawtypes", "unused"})
|
||||
// TODO: slow test!
|
||||
public class GemFireDataSourceUsingNonSpringConfiguredGemFireServerIntegrationTest {
|
||||
|
||||
private static final String GEMFIRE_LOG_LEVEL = "error";
|
||||
public class GemFireDataSourceUsingNonSpringConfiguredGemFireServerIntegrationTests
|
||||
extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static ProcessWrapper gemfireServer;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
private ClientCache gemfireClientCache;
|
||||
|
||||
@Resource(name = "LocalRegion")
|
||||
private Region localRegion;
|
||||
|
||||
@Resource(name = "ServerRegion")
|
||||
private Region serverRegion;
|
||||
|
||||
@Resource(name = "AnotherServerRegion")
|
||||
private Region anotherServerRegion;
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws IOException {
|
||||
|
||||
System.setProperty("gemfire.log-level", GEMFIRE_LOG_LEVEL);
|
||||
|
||||
String serverName = "GemFireDataSourceGemFireBasedServer";
|
||||
String serverName = "DataSourceGemFireBasedServer";
|
||||
|
||||
File serverWorkingDirectory = new File(FileSystemUtils.WORKING_DIRECTORY, serverName.toLowerCase());
|
||||
|
||||
@@ -109,7 +95,7 @@ public class GemFireDataSourceUsingNonSpringConfiguredGemFireServerIntegrationTe
|
||||
arguments.add(String.format("-Dgemfire.name=%s", serverName));
|
||||
arguments.add(String.format("-Dgemfire.log-level=%s", GEMFIRE_LOG_LEVEL));
|
||||
|
||||
gemfireServer = ProcessExecutor.launch(serverWorkingDirectory, customClasspath(),
|
||||
gemfireServer = run(serverWorkingDirectory, customClasspath(),
|
||||
GemFireBasedServerProcess.class, arguments.toArray(new String[0]));
|
||||
|
||||
waitForProcessStart(TimeUnit.SECONDS.toMillis(20), gemfireServer,
|
||||
@@ -139,13 +125,13 @@ public class GemFireDataSourceUsingNonSpringConfiguredGemFireServerIntegrationTe
|
||||
|
||||
private static void waitForProcessStart(long milliseconds, ProcessWrapper process, String processControlFilename) {
|
||||
|
||||
ThreadUtils.timedWait(milliseconds, TimeUnit.MILLISECONDS.toMillis(500), new ThreadUtils.WaitCondition() {
|
||||
ThreadUtils.timedWait(milliseconds, TimeUnit.MILLISECONDS.toMillis(500), new ThreadUtils.Condition() {
|
||||
|
||||
private File processControlFile = new File(process.getWorkingDirectory(), processControlFilename);
|
||||
private final File processControlFile = new File(process.getWorkingDirectory(), processControlFilename);
|
||||
|
||||
@Override
|
||||
public boolean waiting() {
|
||||
return !processControlFile.isFile();
|
||||
public boolean evaluate() {
|
||||
return processControlFile.isFile();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -153,22 +139,35 @@ public class GemFireDataSourceUsingNonSpringConfiguredGemFireServerIntegrationTe
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
|
||||
gemfireServer.shutdown();
|
||||
|
||||
if (Boolean.valueOf(System.getProperty("spring.gemfire.fork.clean", String.valueOf(true)))) {
|
||||
if (Boolean.parseBoolean(System.getProperty("spring.gemfire.fork.clean", String.valueOf(true)))) {
|
||||
org.springframework.util.FileSystemUtils.deleteRecursively(gemfireServer.getWorkingDirectory());
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
private ClientCache gemfireClientCache;
|
||||
|
||||
@Resource(name = "LocalRegion")
|
||||
private Region localRegion;
|
||||
|
||||
@Resource(name = "ServerRegion")
|
||||
private Region serverRegion;
|
||||
|
||||
@Resource(name = "AnotherServerRegion")
|
||||
private Region anotherServerRegion;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void assertRegion(Region actualRegion, String expectedRegionName) {
|
||||
|
||||
Assertions.assertThat(actualRegion).isNotNull();
|
||||
Assertions.assertThat(actualRegion.getName()).isEqualTo(expectedRegionName);
|
||||
Assertions.assertThat(actualRegion.getFullPath()).isEqualTo(GemfireUtils.toRegionPath(expectedRegionName));
|
||||
Assertions.assertThat(gemfireClientCache.getRegion(actualRegion.getFullPath())).isSameAs(actualRegion);
|
||||
Assertions.assertThat(applicationContext.containsBean(expectedRegionName)).isTrue();
|
||||
Assertions.assertThat(applicationContext.getBean(expectedRegionName, Region.class)).isSameAs(actualRegion);
|
||||
assertThat(actualRegion).isNotNull();
|
||||
assertThat(actualRegion.getName()).isEqualTo(expectedRegionName);
|
||||
assertThat(actualRegion.getFullPath()).isEqualTo(GemfireUtils.toRegionPath(expectedRegionName));
|
||||
assertThat(gemfireClientCache.getRegion(actualRegion.getFullPath())).isSameAs(actualRegion);
|
||||
assertThat(applicationContext.containsBean(expectedRegionName)).isTrue();
|
||||
assertThat(applicationContext.getBean(expectedRegionName, Region.class)).isSameAs(actualRegion);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -39,31 +38,33 @@ import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.data.gemfire.support.ConnectionEndpoint;
|
||||
import org.springframework.data.gemfire.support.ConnectionEndpointList;
|
||||
import org.springframework.data.gemfire.test.mock.GemFireMockObjectsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.GemFireMockObjectsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests that test the use of property placeholders in nested <gfe:locator> and <gfe:server>
|
||||
* Integration Tests that test the use of property placeholders in nested <gfe:locator> and <gfe:server>
|
||||
* elements of the SDG XML namespace <gfe:pool> element along with testing property placeholders in
|
||||
* the <gfe:pool> element <code>locators</code> and <code>servers</code> attributes.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.util.Properties
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.client.Pool
|
||||
* @see org.apache.geode.cache.client.PoolFactory
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @see org.springframework.data.gemfire.client.PoolFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.xml.PoolParser
|
||||
* @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/SGF-433">SGF-433</a>
|
||||
* @since 1.6.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class SpELExpressionConfiguredPoolsIntegrationTests {
|
||||
public class SpELExpressionConfiguredPoolsIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final ConnectionEndpointList anotherLocators = new ConnectionEndpointList();
|
||||
private static final ConnectionEndpointList anotherServers = new ConnectionEndpointList();
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
@@ -38,7 +38,11 @@ import org.springframework.mock.env.MockPropertySource;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.config.annotation.AbstractCacheConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.0.2
|
||||
*/
|
||||
public class AbstractCacheConfigurationIntegrationTests {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -32,10 +31,11 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
import org.apache.geode.cache.CacheLoaderException;
|
||||
@@ -47,14 +47,6 @@ import org.apache.geode.cache.client.ServerOperationException;
|
||||
import org.apache.geode.security.NotAuthorizedException;
|
||||
import org.apache.geode.security.ResourcePermission;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -62,35 +54,37 @@ import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.data.gemfire.LocalRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.config.annotation.support.AbstractAuthInitialize;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.util.CollectionUtils;
|
||||
import org.springframework.data.gemfire.util.PropertiesBuilder;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Abstract base test class for implementing Apache Geode Integrated Security Integration Tests.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.security.Principal
|
||||
* @see java.util.Properties
|
||||
* @see org.junit.FixMethodOrder
|
||||
* @see org.junit.Test
|
||||
* @see lombok
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.config.annotation.support.AbstractAuthInitialize
|
||||
* @see org.springframework.data.gemfire.process.ProcessWrapper
|
||||
* @see org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServerIntegrationTestsSupport {
|
||||
|
||||
protected static final int CACHE_SERVER_PORT = 13531;
|
||||
public abstract class AbstractGeodeSecurityIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractGeodeSecurityIntegrationTests.class);
|
||||
|
||||
@@ -101,8 +95,6 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
|
||||
private static final AtomicInteger RUN_COUNT = new AtomicInteger(0);
|
||||
|
||||
private static ProcessWrapper geodeServerProcess;
|
||||
|
||||
@BeforeClass
|
||||
public static void runGeodeServer() throws IOException {
|
||||
|
||||
@@ -113,28 +105,23 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
}
|
||||
}
|
||||
|
||||
protected static ProcessWrapper runGeodeServer(String geodeSecurityProfile) throws IOException {
|
||||
protected static void runGeodeServer(String geodeSecurityProfile) throws IOException {
|
||||
|
||||
Assert.hasText(geodeSecurityProfile, String.format("[%s] System property is required",
|
||||
GEODE_SECURITY_PROFILE_PROPERTY));
|
||||
|
||||
String debugEndpoint = Boolean.getBoolean(DEBUGGING_ENABLED_PROPERTY) ? DEBUG_ENDPOINT : null;
|
||||
|
||||
geodeServerProcess = run(GeodeServerConfiguration.class,
|
||||
startGemFireServer(GeodeServerConfiguration.class,
|
||||
String.format("-Dgemfire.log-file=%s", logFile()),
|
||||
String.format("-Dgemfire.log-level=%s", logLevel(TEST_GEMFIRE_LOG_LEVEL)),
|
||||
String.format("-Dspring.profiles.active=apache-geode-server,%s", geodeSecurityProfile),
|
||||
debugEndpoint);
|
||||
|
||||
waitForServerToStart(CACHE_SERVER_HOST, CACHE_SERVER_PORT);
|
||||
|
||||
return geodeServerProcess;
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopGeodeServer() {
|
||||
System.clearProperty(GEODE_SECURITY_PROFILE_PROPERTY);
|
||||
stop(geodeServerProcess);
|
||||
}
|
||||
|
||||
@Resource(name = "Echo")
|
||||
@@ -215,8 +202,7 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
}
|
||||
}
|
||||
|
||||
@ClientCacheApplication(name = "GeodeSecurityIntegrationTestsClient", logLevel = "error",
|
||||
servers = { @ClientCacheApplication.Server(port = CACHE_SERVER_PORT) })
|
||||
@ClientCacheApplication(name = "GeodeSecurityIntegrationTestsClient")
|
||||
@EnableAuth(clientAuthenticationInitializer =
|
||||
"org.springframework.data.gemfire.config.annotation.AbstractGeodeSecurityIntegrationTests$GeodeClientAuthInitialize.create")
|
||||
@Profile("apache-geode-client")
|
||||
@@ -235,8 +221,7 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
}
|
||||
}
|
||||
|
||||
@CacheServerApplication(name = "GeodeSecurityIntegrationTestsServer", logLevel = "error",
|
||||
port = CACHE_SERVER_PORT)
|
||||
@CacheServerApplication(name = "GeodeSecurityIntegrationTestsServer")
|
||||
@Import({
|
||||
ApacheShiroIniSecurityIntegrationTests.ApacheShiroIniConfiguration.class,
|
||||
ApacheShiroRealmSecurityIntegrationTests.ApacheShiroRealmConfiguration.class,
|
||||
@@ -292,16 +277,14 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
@Getter
|
||||
@EqualsAndHashCode(of = { "name", "credentials" })
|
||||
@RequiredArgsConstructor(staticName = "newUser")
|
||||
@SuppressWarnings("all")
|
||||
public static class User implements Iterable<Role>, Principal, Serializable {
|
||||
|
||||
private Set<Role> roles = new HashSet<>();
|
||||
private final Set<Role> roles = new HashSet<>();
|
||||
|
||||
@NonNull
|
||||
private String name;
|
||||
private final String name;
|
||||
private String credentials;
|
||||
|
||||
/* (non-Javadoc) */
|
||||
public boolean hasPermission(ResourcePermission permission) {
|
||||
|
||||
for (Role role : this) {
|
||||
@@ -313,7 +296,6 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
public boolean hasRole(Role role) {
|
||||
return this.roles.contains(role);
|
||||
}
|
||||
@@ -358,9 +340,9 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
public static class Role implements Iterable<ResourcePermission>, Serializable {
|
||||
|
||||
@NonNull
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
private Set<ResourcePermission> permissions = new HashSet<>();
|
||||
private final Set<ResourcePermission> permissions = new HashSet<>();
|
||||
|
||||
/* (non-Javadoc) */
|
||||
public boolean hasPermission(ResourcePermission permission) {
|
||||
@@ -378,7 +360,6 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
* @inheritDoc
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
public Iterator<ResourcePermission> iterator() {
|
||||
return Collections.unmodifiableSet(this.permissions).iterator();
|
||||
}
|
||||
@@ -391,7 +372,6 @@ public abstract class AbstractGeodeSecurityIntegrationTests extends ClientServer
|
||||
return getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
public Role with(ResourcePermission... permissions) {
|
||||
|
||||
Collections.addAll(this.permissions, permissions);
|
||||
|
||||
@@ -18,11 +18,12 @@ package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.internal.security.shiro.GeodePermissionResolver;
|
||||
|
||||
import org.apache.shiro.realm.text.PropertiesRealm;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -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;
|
||||
@@ -22,6 +21,10 @@ import static org.springframework.data.gemfire.config.annotation.TestSecurityMan
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
import org.apache.geode.cache.CacheLoaderException;
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
@@ -29,11 +32,6 @@ import org.apache.geode.cache.LoaderHelper;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -41,38 +39,28 @@ import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.LocalRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
* The AutoConfiguredAuthenticationConfigurationIntegrationTests class...
|
||||
* Integration Tests for auto-configured authentication configuration.
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @since 1.9.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class AutoConfiguredAuthenticationConfigurationIntegrationTests extends ClientServerIntegrationTestsSupport {
|
||||
|
||||
private static final int PORT = 42124;
|
||||
|
||||
private static ProcessWrapper gemfireServerProcess;
|
||||
public class AutoConfiguredAuthenticationConfigurationIntegrationTests
|
||||
extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
@BeforeClass
|
||||
public static void setupGemFireServer() throws Exception {
|
||||
|
||||
gemfireServerProcess = run(TestGemFireServerConfiguration.class, String.format("-Dgemfire.name=%1$s",
|
||||
asApplicationName(AutoConfiguredAuthenticationConfigurationIntegrationTests.class)));
|
||||
|
||||
Optional.ofNullable(gemfireServerProcess)
|
||||
.ifPresent(server -> waitForServerToStart("localhost", PORT));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownGemFireServer() {
|
||||
stop(gemfireServerProcess);
|
||||
startGemFireServer(TestGemFireServerConfiguration.class);
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -116,8 +104,8 @@ public class AutoConfiguredAuthenticationConfigurationIntegrationTests extends C
|
||||
assertThat(echo.get("Good-Bye")).isEqualTo("Good-Bye");
|
||||
}
|
||||
|
||||
@ClientCacheApplication
|
||||
@EnableSecurity
|
||||
@ClientCacheApplication(logLevel = TEST_GEMFIRE_LOG_LEVEL, servers = @ClientCacheApplication.Server(port = PORT))
|
||||
static class TestGemFireClientConfiguration {
|
||||
|
||||
@Bean("Echo")
|
||||
@@ -133,7 +121,7 @@ public class AutoConfiguredAuthenticationConfigurationIntegrationTests extends C
|
||||
}
|
||||
}
|
||||
|
||||
@CacheServerApplication(logLevel = TEST_GEMFIRE_LOG_LEVEL, port = PORT)
|
||||
@CacheServerApplication
|
||||
@EnableSecurity(securityManagerClassName = "org.springframework.data.gemfire.config.annotation.TestSecurityManager")
|
||||
static class TestGemFireServerConfiguration {
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -31,12 +30,13 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.gemfire.server.CacheServerFactoryBean;
|
||||
import org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link CacheServerConfigurer}.
|
||||
* Integration Tests for {@link CacheServerConfigurer}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -47,6 +47,8 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCacheServer
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCacheServers
|
||||
* @see org.springframework.data.gemfire.server.CacheServerFactoryBean
|
||||
* @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
|
||||
* @since 1.1.0
|
||||
@@ -54,7 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class CacheServerConfigurerIntegrationTests {
|
||||
public class CacheServerConfigurerIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("configurerOne")
|
||||
@@ -94,8 +96,8 @@ public class CacheServerConfigurerIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
GemfireTestBeanPostProcessor testBeanPostProcessor() {
|
||||
return new GemfireTestBeanPostProcessor();
|
||||
GemFireMockObjectsBeanPostProcessor testBeanPostProcessor() {
|
||||
return new GemFireMockObjectsBeanPostProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -13,44 +13,43 @@
|
||||
* 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;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.geode.cache.server.CacheServer;
|
||||
import org.apache.geode.cache.server.ClientSubscriptionConfig;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.server.CacheServer;
|
||||
import org.apache.geode.cache.server.ClientSubscriptionConfig;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.server.SubscriptionEvictionPolicy;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link CacheServerApplication} and {@link EnableCacheServer}.
|
||||
* Integration Tests for {@link CacheServerApplication} and {@link EnableCacheServer}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.server.CacheServer
|
||||
* @see org.apache.geode.cache.server.ClientSubscriptionConfig
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
* @see org.springframework.core.env.PropertySource
|
||||
* @see org.springframework.data.gemfire.config.annotation.CacheServerApplication
|
||||
* @see org.springframework.data.gemfire.server.SubscriptionEvictionPolicy
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.mock.env.MockPropertySource
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class CacheServerPropertiesIntegrationTests {
|
||||
public class CacheServerPropertiesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -24,18 +23,19 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
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;
|
||||
@@ -51,7 +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.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.2.0
|
||||
@@ -59,7 +59,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class CachingDefinedRegionsAppliesRegionConfigurersIntegrationTests {
|
||||
public class CachingDefinedRegionsAppliesRegionConfigurersIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final List<String> configuredRegionNames = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
|
||||
@@ -22,18 +22,19 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.util.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -47,19 +48,16 @@ import org.springframework.stereotype.Service;
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.cache.annotation.CacheConfig
|
||||
* @see org.springframework.cache.annotation.Cacheable
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions
|
||||
* @see org.springframework.data.gemfire.config.annotation.CachingDefinedRegionsConfiguration
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.stereotype.Service
|
||||
* @see <a href="https://jira.spring.io/browse/DATAGEODE-232">Add support for @CacheConfig in @EnableCachingDefinedRegions</a>
|
||||
* @since 2.2.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class CachingDefinedRegionsConsidersCacheConfigCacheNamesIntegrationTests {
|
||||
public class CachingDefinedRegionsConsidersCacheConfigCacheNamesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
@@ -219,5 +217,4 @@ public class CachingDefinedRegionsConsidersCacheConfigCacheNamesIntegrationTests
|
||||
return "TWO";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,18 +24,19 @@ import java.util.Arrays;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.geode.cache.InterestResultPolicy;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.InterestResultPolicy;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.client.Interest;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.util.ArrayUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -49,10 +50,10 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.cache.annotation.Cacheable
|
||||
* @see org.springframework.context.Lifecycle
|
||||
* @see org.springframework.data.gemfire.client.ClientRegionFactoryBean
|
||||
* @see org.springframework.data.gemfire.client.Interest
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @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
|
||||
* @see <a href="https://jira.spring.io/browse/DATAGEODE-219">DATAGEODE-219</a>
|
||||
@@ -60,8 +61,8 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings({ "unchecked", "unused" })
|
||||
public class CachingDefinedRegionsRegistersInterestsIntegrationTests {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
|
||||
public class CachingDefinedRegionsRegistersInterestsIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final Interest testInterest =
|
||||
new Interest<>("TestKey", InterestResultPolicy.KEYS_VALUES, false, true);
|
||||
@@ -80,11 +81,10 @@ public class CachingDefinedRegionsRegistersInterestsIntegrationTests {
|
||||
assertThat(this.cacheTwo).isNotNull();
|
||||
assertThat(this.cacheTwo.getName()).isEqualTo("CacheTwo");
|
||||
|
||||
Arrays.asList(this.cacheOne, this.cacheTwo).forEach(cache -> {
|
||||
Arrays.asList(this.cacheOne, this.cacheTwo).forEach(cache ->
|
||||
verify(cache, times(1))
|
||||
.registerInterest(eq(testInterest.getKey()), eq(testInterest.getPolicy()), eq(testInterest.isDurable()),
|
||||
eq(testInterest.isReceiveValues()));
|
||||
});
|
||||
eq(testInterest.isReceiveValues())));
|
||||
}
|
||||
|
||||
@ClientCacheApplication
|
||||
|
||||
@@ -30,7 +30,8 @@ import org.apache.geode.cache.client.SocketFactory;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
|
||||
/**
|
||||
* Integration Tests for {@link ClientCacheConfiguration}.
|
||||
@@ -40,13 +41,13 @@ import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockOb
|
||||
* @see org.apache.geode.cache.client.Pool
|
||||
* @see org.junit.Test
|
||||
* @see org.mockito.Mockito
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheConfiguration
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.4.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientCacheConfigurationIntegrationTests {
|
||||
public class ClientCacheConfigurationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -23,17 +23,18 @@ import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
|
||||
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.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
@@ -47,13 +48,14 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheConfigurer
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class ClientCacheConfigurerIntegrationTests {
|
||||
public class ClientCacheConfigurerIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final AtomicBoolean testClientCacheConfigurerThreeCalled = new AtomicBoolean(false);
|
||||
|
||||
@@ -125,7 +127,7 @@ public class ClientCacheConfigurerIntegrationTests {
|
||||
|
||||
static final class TestClientCacheConfigurer implements ClientCacheConfigurer, Iterable<String> {
|
||||
|
||||
private Set<String> beanNames = new HashSet<>();
|
||||
private final Set<String> beanNames = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void configure(String beanName, ClientCacheFactoryBean bean) {
|
||||
|
||||
@@ -37,7 +37,8 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
@@ -47,14 +48,15 @@ import org.springframework.mock.env.MockPropertySource;
|
||||
* @see java.util.Properties
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.apache.geode.cache.client.Pool
|
||||
* @see org.springframework.core.env.PropertySource
|
||||
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.mock.env.MockPropertySource
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class ClientCachePropertiesIntegrationTests {
|
||||
public class ClientCachePropertiesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -14,13 +14,16 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
import org.apache.geode.cache.CacheLoaderException;
|
||||
@@ -29,56 +32,38 @@ import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Test suite of test cases testing the contract and functionality of the {@link CacheServerApplication}
|
||||
* and {@link ClientCacheApplication} SDG annotations for configuring and bootstrapping a Pivotal GemFire
|
||||
* or Apache Geode client/server topology
|
||||
* Integration Tests testing the contract and functionality of the {@link CacheServerApplication}
|
||||
* and {@link ClientCacheApplication} SDG annotations for configuring and bootstrapping an Apache Geode
|
||||
* client/server topology
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.data.gemfire.config.annotation.CacheServerApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.apache.geode.cache.server.CacheServer
|
||||
* @see org.springframework.data.gemfire.config.annotation.CacheServerApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.9.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = ClientServerCacheApplicationIntegrationTests.ClientTestConfiguration.class)
|
||||
@SuppressWarnings("all")
|
||||
public class ClientServerCacheApplicationIntegrationTests extends ClientServerIntegrationTestsSupport {
|
||||
|
||||
private static final int PORT = 12480;
|
||||
|
||||
private static ProcessWrapper gemfireServerProcess;
|
||||
public class ClientServerCacheApplicationIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void setupGemFireServer() throws Exception {
|
||||
|
||||
gemfireServerProcess = run(ServerTestConfiguration.class, String.format("-Dgemfire.name=%1$s",
|
||||
asApplicationName(ClientServerCacheApplicationIntegrationTests.class)));
|
||||
|
||||
waitForServerToStart("localhost", PORT);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownGemFireServer() {
|
||||
stop(gemfireServerProcess);
|
||||
startGemFireServer(ServerTestConfiguration.class);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@@ -93,7 +78,7 @@ public class ClientServerCacheApplicationIntegrationTests extends ClientServerIn
|
||||
assertThat(echo.get("Test")).isEqualTo("Test");
|
||||
}
|
||||
|
||||
@ClientCacheApplication(logLevel = TEST_GEMFIRE_LOG_LEVEL, servers = { @ClientCacheApplication.Server(port = PORT)})
|
||||
@ClientCacheApplication
|
||||
static class ClientTestConfiguration {
|
||||
|
||||
@Bean(name = "Echo")
|
||||
@@ -109,8 +94,7 @@ public class ClientServerCacheApplicationIntegrationTests extends ClientServerIn
|
||||
}
|
||||
}
|
||||
|
||||
@CacheServerApplication(name = "ClientServerCacheApplicationIntegrationTests",
|
||||
logLevel = TEST_GEMFIRE_LOG_LEVEL, port = PORT)
|
||||
@CacheServerApplication(name = "ClientServerCacheApplicationIntegrationTests")
|
||||
public static class ServerTestConfiguration {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -41,7 +41,8 @@ import org.springframework.core.annotation.Order;
|
||||
import org.springframework.data.gemfire.config.admin.GemfireAdminOperations;
|
||||
import org.springframework.data.gemfire.config.admin.remote.RestHttpGemfireAdminTemplate;
|
||||
import org.springframework.data.gemfire.config.support.RestTemplateConfigurer;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.InterceptingClientHttpRequestFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -60,7 +61,8 @@ import org.springframework.web.client.RestTemplate;
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClusterConfigurationConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableClusterConfiguration
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @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
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
@@ -70,7 +72,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ClusterConfigurationWithClientHttpRequestInterceptorsIntegrationTests {
|
||||
public class ClusterConfigurationWithClientHttpRequestInterceptorsIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ClientCache clientCache;
|
||||
|
||||
@@ -22,18 +22,19 @@ 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 org.apache.geode.cache.client.ClientCache;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.config.admin.GemfireAdminOperations;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -47,7 +48,8 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.mockito.Mockito
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.springframework.data.gemfire.config.admin.GemfireAdminOperations
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @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.2.0
|
||||
@@ -55,7 +57,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class ClusterConfigurationWithCustomGemfireAdminOperationsIntegrationTests {
|
||||
public class ClusterConfigurationWithCustomGemfireAdminOperationsIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ClientCache clientCache;
|
||||
|
||||
@@ -29,7 +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.test.GemfireTestBeanPostProcessor;
|
||||
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 +48,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.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.1.0
|
||||
@@ -90,8 +91,8 @@ public class DiskStoreConfigurerIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
GemfireTestBeanPostProcessor testBeanPostProcessor() {
|
||||
return new GemfireTestBeanPostProcessor();
|
||||
GemFireMockObjectsBeanPostProcessor testBeanPostProcessor() {
|
||||
return new GemFireMockObjectsBeanPostProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -30,7 +30,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
@@ -38,10 +39,16 @@ import org.springframework.mock.env.MockPropertySource;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.DiskStore
|
||||
* @see org.apache.geode.cache.DiskStoreFactory
|
||||
* @see org.springframework.core.env.PropertySource
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableDiskStore
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.mock.env.MockPropertySource
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class DiskStorePropertiesIntegrationTests {
|
||||
public class DiskStorePropertiesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.support.GemfireBeanFactoryLocator;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
|
||||
/**
|
||||
* Integration Tests for {@link EnableBeanFactoryLocator} and {@link BeanFactoryLocatorConfiguration}.
|
||||
@@ -34,14 +35,14 @@ import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockOb
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.data.gemfire.CacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.client.ClientCacheFactoryBean
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.data.gemfire.config.annotation.BeanFactoryLocatorConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableBeanFactoryLocator
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class EnableBeanFactoryLocatorConfigurationIntegrationTests {
|
||||
public class EnableBeanFactoryLocatorConfigurationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@ import javax.cache.annotation.CacheDefaults;
|
||||
import javax.cache.annotation.CacheRemoveAll;
|
||||
import javax.cache.annotation.CacheResult;
|
||||
|
||||
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.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
@@ -52,22 +52,23 @@ import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.annotation.Caching;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.GemFireMockObjectsSupport;
|
||||
import org.springframework.data.gemfire.test.support.MapBuilder;
|
||||
import org.springframework.data.gemfire.tests.mock.GemFireMockObjectsSupport;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link EnableCachingDefinedRegions} and {@link CachingDefinedRegionsConfiguration}.
|
||||
* Unit Tests for {@link EnableCachingDefinedRegions} and {@link CachingDefinedRegionsConfiguration}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.beans.factory.config.BeanDefinition
|
||||
* @see org.springframework.beans.factory.support.BeanDefinitionRegistry
|
||||
* @see org.springframework.cache.annotation.Cacheable
|
||||
* @see org.springframework.cache.annotation.CacheEvict
|
||||
* @see org.springframework.cache.annotation.CachePut
|
||||
* @see org.springframework.cache.annotation.Caching
|
||||
* @see org.springframework.data.gemfire.config.annotation.CachingDefinedRegionsConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRegions
|
||||
* @see org.springframework.data.gemfire.tests.mock.GemFireMockObjectsSupport
|
||||
* @see org.springframework.stereotype.Service
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
@@ -20,16 +20,15 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
@@ -44,9 +43,8 @@ import org.springframework.data.gemfire.ReplicatedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.config.admin.GemfireAdminOperations;
|
||||
import org.springframework.data.gemfire.config.admin.remote.RestHttpGemfireAdminTemplate;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.support.ConnectionEndpoint;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -68,7 +66,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @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.test.support.ClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.0
|
||||
@@ -76,11 +74,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = EnableClusterConfigurationIntegrationTests.TestConfiguration.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableClusterConfigurationIntegrationTests extends ClientServerIntegrationTestsSupport {
|
||||
|
||||
private static final String GEMFIRE_LOG_LEVEL = "error";
|
||||
|
||||
private static ProcessWrapper gemfireServer;
|
||||
public class EnableClusterConfigurationIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ClientCache gemfireCache;
|
||||
@@ -89,22 +83,7 @@ public class EnableClusterConfigurationIntegrationTests extends ClientServerInte
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
|
||||
int availablePort = findAvailablePort();
|
||||
|
||||
gemfireServer = run(ServerTestConfiguration.class,
|
||||
String.format("-D%s=%d", GEMFIRE_CACHE_SERVER_PORT_PROPERTY, availablePort));
|
||||
|
||||
waitForServerToStart("localhost", availablePort);
|
||||
|
||||
System.setProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY, String.valueOf(availablePort));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
|
||||
stop(gemfireServer);
|
||||
System.clearProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY);
|
||||
startGemFireServer(ServerTestConfiguration.class);
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -136,7 +115,7 @@ public class EnableClusterConfigurationIntegrationTests extends ClientServerInte
|
||||
@Import(ClientTestConfiguration.class)
|
||||
static class TestConfiguration { }
|
||||
|
||||
@ClientCacheApplication(logLevel = GEMFIRE_LOG_LEVEL, subscriptionEnabled = true)
|
||||
@ClientCacheApplication(subscriptionEnabled = true)
|
||||
static class ClientTestConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -198,7 +177,7 @@ public class EnableClusterConfigurationIntegrationTests extends ClientServerInte
|
||||
}
|
||||
}
|
||||
|
||||
@CacheServerApplication(name = "EnableClusterConfigurationIntegrationTests", logLevel = GEMFIRE_LOG_LEVEL)
|
||||
@CacheServerApplication(name = "EnableClusterConfigurationIntegrationTests")
|
||||
static class ServerTestConfiguration {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -26,11 +26,9 @@ import static org.mockito.Mockito.when;
|
||||
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.net.Authenticator;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.URI;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -48,7 +46,9 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.PropertiesPropertySource;
|
||||
import org.springframework.data.gemfire.config.admin.GemfireAdminOperations;
|
||||
import org.springframework.data.gemfire.config.admin.remote.RestHttpGemfireAdminTemplate;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
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.HttpHeaders;
|
||||
import org.springframework.http.HttpRequest;
|
||||
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||
@@ -56,11 +56,10 @@ 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;
|
||||
|
||||
/**
|
||||
* Integration Test for {@link EnableClusterConfiguration} and {@link EnableSecurity}.
|
||||
* Integration Tests for {@link EnableClusterConfiguration} and {@link EnableSecurity}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.net.Authenticator
|
||||
@@ -74,7 +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.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.http.client.ClientHttpRequestInterceptor
|
||||
* @see org.springframework.http.client.InterceptingClientHttpRequestFactory
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
@@ -84,8 +83,9 @@ import org.springframework.web.client.RestTemplate;
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(initializers = EnableClusterConfigurationWithSecurityIntegrationTests.SecurityConfigurationApplicationContextInitializer.class)
|
||||
public class EnableClusterConfigurationWithSecurityIntegrationTests {
|
||||
@ContextConfiguration(initializers =
|
||||
EnableClusterConfigurationWithSecurityIntegrationTests.SecurityConfigurationApplicationContextInitializer.class)
|
||||
public class EnableClusterConfigurationWithSecurityIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final String SECURITY_USERNAME = "security-username";
|
||||
private static final String SECURITY_PASSWORD = "security-password";
|
||||
@@ -100,23 +100,6 @@ public class EnableClusterConfigurationWithSecurityIntegrationTests {
|
||||
@Autowired
|
||||
private ClusterSchemaObjectInitializer initializer;
|
||||
|
||||
// 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 setup() {
|
||||
assertThat(this.authenticator).isNotNull();
|
||||
@@ -146,7 +129,7 @@ public class EnableClusterConfigurationWithSecurityIntegrationTests {
|
||||
|
||||
RestHttpGemfireAdminTemplate template = schemaObjectContext.getGemfireAdminOperations();
|
||||
|
||||
RestTemplate restTemplate = getFieldValue(template, "restTemplate");
|
||||
RestTemplate restTemplate = ReflectionUtils.getFieldValue(template, "restTemplate");
|
||||
|
||||
assertThat(restTemplate).isNotNull();
|
||||
assertThat(restTemplate.getInterceptors()).hasSize(2);
|
||||
|
||||
@@ -21,17 +21,16 @@ import java.util.Collections;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.geode.cache.DataPolicy;
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.DataPolicy;
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -41,16 +40,15 @@ import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.data.gemfire.LocalRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.ReplicatedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.support.ConnectionEndpoint;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.util.CacheUtils;
|
||||
import org.springframework.data.gemfire.util.RegionUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link EnableClusterDefinedRegions} and {@link ClusterDefinedRegionsConfiguration}.
|
||||
* Integration Tests for {@link EnableClusterDefinedRegions} and {@link ClusterDefinedRegionsConfiguration}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -58,8 +56,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClusterDefinedRegionsConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableClusterDefinedRegions
|
||||
* @see org.springframework.data.gemfire.process.ProcessWrapper
|
||||
* @see org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.1.0
|
||||
@@ -67,29 +64,11 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = EnableClusterDefinedRegionsIntegrationTests.ClientTestConfiguration.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableClusterDefinedRegionsIntegrationTests extends ClientServerIntegrationTestsSupport {
|
||||
|
||||
private static final String GEMFIRE_LOG_LEVEL = "error";
|
||||
|
||||
private static ProcessWrapper gemfireServer;
|
||||
public class EnableClusterDefinedRegionsIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
|
||||
int availablePort = findAvailablePort();
|
||||
|
||||
gemfireServer = run(ServerTestConfiguration.class,
|
||||
String.format("-D%s=%d", GEMFIRE_CACHE_SERVER_PORT_PROPERTY, availablePort));
|
||||
|
||||
waitForServerToStart("localhost", availablePort);
|
||||
|
||||
System.setProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY, String.valueOf(availablePort));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
System.clearProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY);
|
||||
stop(gemfireServer);
|
||||
startGemFireServer(ServerTestConfiguration.class);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@@ -128,7 +107,7 @@ public class EnableClusterDefinedRegionsIntegrationTests extends ClientServerInt
|
||||
assertRegion(this.replicateClientProxyRegion, "ReplicateRegion");
|
||||
}
|
||||
|
||||
@ClientCacheApplication(logLevel = GEMFIRE_LOG_LEVEL)
|
||||
@ClientCacheApplication
|
||||
@EnableClusterDefinedRegions
|
||||
static class ClientTestConfiguration {
|
||||
|
||||
@@ -151,7 +130,7 @@ public class EnableClusterDefinedRegionsIntegrationTests extends ClientServerInt
|
||||
}
|
||||
}
|
||||
|
||||
@CacheServerApplication(name = "EnableClusterDefinedRegionsIntegrationTests", logLevel = GEMFIRE_LOG_LEVEL)
|
||||
@CacheServerApplication(name = "EnableClusterDefinedRegionsIntegrationTests")
|
||||
static class ServerTestConfiguration {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -22,13 +22,13 @@ import static org.mockito.Mockito.when;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.client.ClientCache;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.data.gemfire.client.GemfireDataSourcePostProcessor;
|
||||
|
||||
@@ -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;
|
||||
@@ -23,15 +22,15 @@ import static org.springframework.data.gemfire.config.annotation.CompressionConf
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
import org.apache.geode.compression.Compressor;
|
||||
import org.apache.geode.compression.SnappyCompressor;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -40,16 +39,24 @@ import org.springframework.data.gemfire.LocalRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.ReplicatedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.test.model.Person;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
|
||||
/**
|
||||
* The EnableCompressionConfigurationUnitTests class...
|
||||
* Integration Tests for {@link EnableCompression} and {@link CompressionConfiguration}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.config.annotation.CompressionConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableCompression
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class EnableCompressionConfigurationUnitTests {
|
||||
public class EnableCompressionConfigurationUnitTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -25,9 +24,10 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.CacheListener;
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
@@ -41,12 +41,6 @@ import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
import org.apache.geode.cache.query.CqEvent;
|
||||
import org.apache.geode.cache.util.CacheListenerAdapter;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -56,12 +50,15 @@ import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.listener.ContinuousQueryListenerContainer;
|
||||
import org.springframework.data.gemfire.listener.annotation.ContinuousQuery;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.support.ConnectionEndpoint;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link EnableContinuousQueries}, {@link ContinuousQueryConfiguration}, {@link ContinuousQuery}
|
||||
* and {@link ContinuousQueryListenerContainer}.
|
||||
@@ -74,8 +71,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.config.annotation.ContinuousQueryConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableContinuousQueries
|
||||
* @see org.springframework.data.gemfire.listener.annotation.ContinuousQuery
|
||||
* @see org.springframework.data.gemfire.process.ProcessWrapper
|
||||
* @see org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.0.0
|
||||
@@ -83,31 +79,15 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = EnableContinuousQueriesConfigurationIntegrationTests.TestConfiguration.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableContinuousQueriesConfigurationIntegrationTests extends ClientServerIntegrationTestsSupport {
|
||||
public class EnableContinuousQueriesConfigurationIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static AtomicInteger boilingTemperatureReadingsCounter = new AtomicInteger(0);
|
||||
private static AtomicInteger freezingTemperatureReadingsCounter = new AtomicInteger(0);
|
||||
private static AtomicInteger totalTemperatureReadingsCounter = new AtomicInteger(0);
|
||||
|
||||
private static ProcessWrapper gemfireServer;
|
||||
private static final AtomicInteger boilingTemperatureReadingsCounter = new AtomicInteger(0);
|
||||
private static final AtomicInteger freezingTemperatureReadingsCounter = new AtomicInteger(0);
|
||||
private static final AtomicInteger totalTemperatureReadingsCounter = new AtomicInteger(0);
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
|
||||
int availablePort = findAvailablePort();
|
||||
|
||||
gemfireServer = run(GemFireServerConfiguration.class,
|
||||
String.format("-D%s=%d", GEMFIRE_CACHE_SERVER_PORT_PROPERTY, availablePort));
|
||||
|
||||
waitForServerToStart("localhost", availablePort);
|
||||
|
||||
System.setProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY, String.valueOf(availablePort));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
System.clearProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY);
|
||||
stop(gemfireServer);
|
||||
public static void startGeodeServer() throws Exception {
|
||||
startGemFireServer(GemFireServerConfiguration.class);
|
||||
}
|
||||
|
||||
@Resource(name = "TemperatureReadings")
|
||||
|
||||
@@ -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;
|
||||
@@ -28,7 +27,7 @@ import static org.springframework.data.gemfire.util.ArrayUtils.asArray;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import lombok.Data;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
@@ -40,8 +39,6 @@ import org.apache.geode.cache.query.CqEvent;
|
||||
import org.apache.geode.cache.query.CqQuery;
|
||||
import org.apache.geode.cache.query.QueryService;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -61,25 +58,29 @@ import org.springframework.data.gemfire.listener.annotation.ContinuousQuery;
|
||||
import org.springframework.data.gemfire.mapping.GemfireMappingContext;
|
||||
import org.springframework.data.gemfire.repository.config.EnableGemfireRepositories;
|
||||
import org.springframework.data.gemfire.repository.support.GemfireRepositoryFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.GemFireMockObjectsSupport;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.test.model.Person;
|
||||
import org.springframework.data.gemfire.test.repo.PersonRepository;
|
||||
import org.springframework.data.gemfire.test.support.IOUtils;
|
||||
import org.springframework.data.gemfire.tests.mock.GemFireMockObjectsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.util.IOUtils;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link EnableContinuousQueries}, {@link ContinuousQueryConfiguration}, {@link ContinuousQuery}
|
||||
* Unit Tests for {@link EnableContinuousQueries}, {@link ContinuousQueryConfiguration}, {@link ContinuousQuery}
|
||||
* and {@link ContinuousQueryListenerContainer}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see java.lang.reflect.Proxy
|
||||
* @see java.util.concurrent.Executor
|
||||
* @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.apache.geode.cache.query.CqEvent
|
||||
* @see org.apache.geode.cache.query.CqQuery
|
||||
* @see org.apache.geode.cache.query.QueryService
|
||||
* @see org.springframework.aop.framework.ProxyFactory
|
||||
@@ -176,6 +177,7 @@ public class EnableContinuousQueriesConfigurationUnitTests {
|
||||
@EnableGemFireMockObjects
|
||||
@EnableContinuousQueries(errorHandlerBeanName = "mockErrorHandler", phase = 1, poolName = "mockPool",
|
||||
queryServiceBeanName = "mockQueryService", taskExecutorBeanName = "mockTaskExecutor")
|
||||
@SuppressWarnings("unused")
|
||||
static class TestContinuousQueryListenerContainerConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -261,7 +263,7 @@ public class EnableContinuousQueriesConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
RegionAttributesFactoryBean peopleRegionAttributes() {
|
||||
|
||||
RegionAttributesFactoryBean peopleRegionAttributes = new RegionAttributesFactoryBean();
|
||||
@@ -281,7 +283,7 @@ public class EnableContinuousQueriesConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
RegionAttributesFactoryBean examplesRegionAttributes() {
|
||||
|
||||
RegionAttributesFactoryBean examplesRegionAttributes = new RegionAttributesFactoryBean();
|
||||
@@ -293,6 +295,7 @@ public class EnableContinuousQueriesConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("all")
|
||||
ExampleDataAccessObject exampleDao() {
|
||||
|
||||
return (ExampleDataAccessObject) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
|
||||
@@ -300,6 +303,7 @@ public class EnableContinuousQueriesConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@SuppressWarnings("rawtypes")
|
||||
GemfireRepositoryFactoryBean exampleRepository() {
|
||||
|
||||
GemfireRepositoryFactoryBean<ExampleRepository, Example, Long> exampleRepositoryFactory =
|
||||
@@ -340,9 +344,8 @@ public class EnableContinuousQueriesConfigurationUnitTests {
|
||||
@Id Long id;
|
||||
}
|
||||
|
||||
interface ExampleDataAccessObject {
|
||||
}
|
||||
interface ExampleDataAccessObject { }
|
||||
|
||||
interface ExampleRepository extends CrudRepository<Example, Long> { }
|
||||
|
||||
interface ExampleRepository extends CrudRepository<Example, Long> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -24,13 +23,12 @@ import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.geode.cache.query.CqEvent;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.query.CqEvent;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
@@ -38,18 +36,17 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.gemfire.listener.annotation.ContinuousQuery;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.repository.config.EnableGemfireRepositories;
|
||||
import org.springframework.data.gemfire.support.ConnectionEndpoint;
|
||||
import org.springframework.data.gemfire.test.model.Gender;
|
||||
import org.springframework.data.gemfire.test.model.Person;
|
||||
import org.springframework.data.gemfire.test.repo.PersonRepository;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests testing the combination of {@link EnableContinuousQueries} with {@link EnableClusterConfiguration}.
|
||||
* Integration Tests testing the combination of {@link EnableContinuousQueries} with {@link EnableClusterConfiguration}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -57,6 +54,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableClusterConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableContinuousQueries
|
||||
* @see org.springframework.data.gemfire.listener.annotation.ContinuousQuery
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @see <a href="https://jira.spring.io/browse/DATAGEODE-73">Fix race condition between ContinuousQuery registration and EnableClusterConfiguration Region creation.</a>
|
||||
@@ -66,29 +64,13 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@ContextConfiguration(classes = EnableContinuousQueriesWithClusterConfigurationIntegrationTests.TestConfiguration.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableContinuousQueriesWithClusterConfigurationIntegrationTests
|
||||
extends ClientServerIntegrationTestsSupport {
|
||||
extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static final BlockingQueue<Person> events = new ArrayBlockingQueue<>(2);
|
||||
|
||||
private static ProcessWrapper gemfireServer;
|
||||
|
||||
@BeforeClass
|
||||
public static void startGemFireServer() throws Exception {
|
||||
|
||||
int availablePort = findAvailablePort();
|
||||
|
||||
gemfireServer = run(EnableContinuousQueriesWithClusterConfigurationIntegrationTests.GemFireServerConfiguration.class,
|
||||
String.format("-D%s=%d", GEMFIRE_CACHE_SERVER_PORT_PROPERTY, availablePort));
|
||||
|
||||
waitForServerToStart("localhost", availablePort);
|
||||
|
||||
System.setProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY, String.valueOf(availablePort));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void stopGemFireServer() {
|
||||
System.clearProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY);
|
||||
stop(gemfireServer);
|
||||
startGemFireServer(GemFireServerConfiguration.class);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -31,7 +31,8 @@ import org.apache.geode.cache.DiskStore;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
|
||||
/**
|
||||
* Unit Tests for the {@link EnableDiskStore} and {@link EnableDiskStores} annotations as well as
|
||||
@@ -40,15 +41,16 @@ import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockOb
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.DiskStore
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableDiskStore
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableDiskStores
|
||||
* @see org.springframework.data.gemfire.config.annotation.DiskStoreConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.DiskStoresConfiguration
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 1.9.0
|
||||
*/
|
||||
public class EnableDiskStoresConfigurationUnitTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableDiskStoresConfigurationUnitTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final AtomicInteger MOCK_ID = new AtomicInteger(0);
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.GemfireUtils;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.test.model.Person;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
@@ -40,12 +41,15 @@ import org.springframework.mock.env.MockPropertySource;
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableEntityDefinedRegions
|
||||
* @see org.springframework.data.gemfire.config.annotation.EntityDefinedRegionsConfiguration
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.0.2
|
||||
*/
|
||||
public class EnableEntityDefinedRegionsIntegrationTests {
|
||||
public class EnableEntityDefinedRegionsIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ import org.springframework.data.gemfire.mapping.annotation.ClientRegion;
|
||||
import org.springframework.data.gemfire.mapping.annotation.LocalRegion;
|
||||
import org.springframework.data.gemfire.mapping.annotation.PartitionRegion;
|
||||
import org.springframework.data.gemfire.mapping.annotation.ReplicateRegion;
|
||||
import org.springframework.data.gemfire.test.mock.MockObjectsSupport;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.mock.MockObjectsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
|
||||
/**
|
||||
* Unit Tests for the {@link EnableEntityDefinedRegions} annotation and {@link EntityDefinedRegionsConfiguration} class.
|
||||
@@ -75,6 +75,8 @@ import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockOb
|
||||
* @see org.mockito.Mockito
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableEntityDefinedRegions
|
||||
* @see org.springframework.data.gemfire.config.annotation.EntityDefinedRegionsConfiguration
|
||||
* @see org.springframework.data.gemfire.mapping.annotation.ClientRegion
|
||||
@@ -82,8 +84,8 @@ import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockOb
|
||||
* @see org.springframework.data.gemfire.mapping.annotation.PartitionRegion
|
||||
* @see org.springframework.data.gemfire.mapping.annotation.ReplicateRegion
|
||||
* @see org.springframework.data.gemfire.mapping.annotation.ReplicateRegion
|
||||
* @see org.springframework.data.gemfire.test.mock.MockObjectsSupport
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.mock.MockObjectsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 1.9.0
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "unused" })
|
||||
|
||||
@@ -36,7 +36,8 @@ import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.FilterType;
|
||||
import org.springframework.data.gemfire.repository.sample.Algorithm;
|
||||
import org.springframework.data.gemfire.repository.sample.User;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -46,10 +47,10 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @author John Blum
|
||||
* @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.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @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.4.0
|
||||
@@ -57,7 +58,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableEntityDefinedRegionsWithAssignableTypeFilterIntegrationTests {
|
||||
public class EnableEntityDefinedRegionsWithAssignableTypeFilterIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -43,7 +43,8 @@ import org.springframework.core.type.classreading.MetadataReader;
|
||||
import org.springframework.core.type.filter.RegexPatternTypeFilter;
|
||||
import org.springframework.data.gemfire.repository.sample.Account;
|
||||
import org.springframework.data.gemfire.repository.sample.Programmer;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -54,10 +55,10 @@ 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.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @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.4.0
|
||||
@@ -65,7 +66,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableEntityDefinedRegionsWithRegexFilterIntegrationTests {
|
||||
public class EnableEntityDefinedRegionsWithRegexFilterIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -33,8 +33,9 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.eviction.EvictionActionType;
|
||||
import org.springframework.data.gemfire.eviction.EvictionPolicyType;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.test.model.Person;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -44,10 +45,12 @@ import org.springframework.stereotype.Service;
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableEviction
|
||||
* @see org.springframework.data.gemfire.config.annotation.EvictionConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 1.9.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class EnableEvictionConfigurationIntegrationTests {
|
||||
public class EnableEvictionConfigurationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final String GEMFIRE_LOG_LEVEL = "error";
|
||||
|
||||
|
||||
@@ -26,6 +26,10 @@ import static org.springframework.data.gemfire.config.annotation.EnableEviction.
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.EvictionAttributes;
|
||||
import org.apache.geode.cache.Region;
|
||||
@@ -33,10 +37,6 @@ import org.apache.geode.cache.RegionAttributes;
|
||||
import org.apache.geode.cache.RegionFactory;
|
||||
import org.apache.geode.cache.util.ObjectSizer;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.expiration.AnnotationBasedExpiration;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.test.model.Person;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -42,8 +42,12 @@ import org.springframework.stereotype.Service;
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableExpiration
|
||||
* @see org.springframework.data.gemfire.config.annotation.ExpirationConfiguration
|
||||
* @see org.springframework.data.gemfire.expiration.AnnotationBasedExpiration
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 1.9.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.annotation;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -25,35 +24,38 @@ import static org.springframework.data.gemfire.config.annotation.EnableExpiratio
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.CustomExpiry;
|
||||
import org.apache.geode.cache.ExpirationAction;
|
||||
import org.apache.geode.cache.ExpirationAttributes;
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.LocalRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.expiration.ExpirationActionType;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.util.ArrayUtils;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link EnableExpiration} annotation and {@link ExpirationConfiguration} class.
|
||||
* Unit Tests for the {@link EnableExpiration} annotation and {@link ExpirationConfiguration} class.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.mockito.Mockito
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableExpiration
|
||||
* @see org.springframework.data.gemfire.config.annotation.ExpirationConfiguration
|
||||
* @see org.apache.geode.cache.CustomExpiry
|
||||
* @see org.apache.geode.cache.ExpirationAttributes
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableExpiration
|
||||
* @see org.springframework.data.gemfire.config.annotation.ExpirationConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 1.9.0
|
||||
*/
|
||||
public class EnableExpirationConfigurationUnitTests {
|
||||
@@ -106,8 +108,7 @@ public class EnableExpirationConfigurationUnitTests {
|
||||
assertExpiration(customExpiry.getExpiry(regionEntry), expectedExpirationAttributes);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "unused" })
|
||||
private <K, V> void assertExpiration(ExpirationAttributes actualExpirationAttributes,
|
||||
private void assertExpiration(ExpirationAttributes actualExpirationAttributes,
|
||||
ExpirationAttributes expectedExpirationAttributes) {
|
||||
|
||||
assertThat(actualExpirationAttributes).isEqualTo(expectedExpirationAttributes);
|
||||
@@ -131,7 +132,7 @@ public class EnableExpirationConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void usesDefaultExpirationPolicyConfiguration() {
|
||||
|
||||
this.applicationContext = newApplicationContext(DefaultExpirationPolicyConfiguration.class);
|
||||
@@ -148,7 +149,7 @@ public class EnableExpirationConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void usesCustomIdleTimeoutExpirationPolicyConfiguration() {
|
||||
|
||||
this.applicationContext = newApplicationContext(CustomIdleTimeoutExpirationPolicyConfiguration.class);
|
||||
@@ -166,7 +167,7 @@ public class EnableExpirationConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void usesCustomTimeToLiveExpirationPolicyConfiguration() {
|
||||
|
||||
this.applicationContext = newApplicationContext(CustomTimeToLiveTimeoutExpirationPolicyConfiguration.class);
|
||||
@@ -184,7 +185,7 @@ public class EnableExpirationConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void usesRegionSpecificExpirationPolicyConfiguration() {
|
||||
|
||||
this.applicationContext = newApplicationContext(RegionSpecificExpirationPolicyConfiguration.class);
|
||||
@@ -203,7 +204,7 @@ public class EnableExpirationConfigurationUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void usesMixedExpirationPolicyConfiguration() {
|
||||
|
||||
this.applicationContext = newApplicationContext(MixedExpirationPolicyConfiguration.class);
|
||||
|
||||
@@ -25,12 +25,12 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.geode.cache.wan.GatewayReceiver;
|
||||
import org.apache.geode.cache.wan.GatewayTransportFilter;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.wan.GatewayReceiver;
|
||||
import org.apache.geode.cache.wan.GatewayTransportFilter;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@@ -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;
|
||||
@@ -22,19 +21,20 @@ import static org.mockito.Mockito.mock;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.pdx.PdxSerializer;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.pdx.PdxSerializer;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.util.ArrayUtils;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -50,11 +50,14 @@ import org.springframework.util.StringUtils;
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.core.env.PropertySource
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class EnableGemFirePropertiesIntegrationTests {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class EnableGemFirePropertiesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -21,13 +20,13 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.control.ResourceManager;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -37,19 +36,24 @@ import org.springframework.data.gemfire.GemfireUtils;
|
||||
import org.springframework.data.gemfire.LocalRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.ReplicatedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.test.model.Person;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link EnableOffHeap} and {@link OffHeapConfiguration}.
|
||||
* Unit Tests for {@link EnableOffHeap} and {@link OffHeapConfiguration}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableOffHeap
|
||||
* @see org.springframework.data.gemfire.config.annotation.OffHeapConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.0.2
|
||||
*/
|
||||
public class EnableOffHeapConfigurationUnitTests {
|
||||
public class EnableOffHeapConfigurationUnitTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -21,13 +20,13 @@ import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
import org.apache.geode.pdx.PdxSerializer;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -38,15 +37,23 @@ import org.springframework.data.gemfire.DiskStoreFactoryBean;
|
||||
import org.springframework.data.gemfire.LocalRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.mapping.MappingPdxSerializer;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
|
||||
/**
|
||||
* The EnablePdxConfigurationIntegrationTests class...
|
||||
* Integration Tests for {@link EnablePdx} and {@link PdxConfiguration}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @since 1.0.0
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.pdx.PdxSerializer
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnablePdx
|
||||
* @see org.springframework.data.gemfire.config.annotation.PdxConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 1.9.0
|
||||
*/
|
||||
public class EnablePdxConfigurationIntegrationTests {
|
||||
public class EnablePdxConfigurationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
@@ -34,13 +34,13 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.geode.pdx.PdxSerializer;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.apache.geode.pdx.PdxSerializer;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
|
||||
@@ -19,6 +19,11 @@ 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;
|
||||
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
import org.apache.geode.cache.CacheLoaderException;
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
@@ -26,35 +31,35 @@ import org.apache.geode.cache.LoaderHelper;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link EnableSsl} and {@link SslConfiguration}.
|
||||
* Integration Tests for {@link EnableSsl} and {@link SslConfiguration}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableSsl
|
||||
* @see org.springframework.data.gemfire.config.annotation.SslConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(classes = EnableSslConfigurationIntegrationTests.ClientTestConfiguration.class)
|
||||
@SuppressWarnings("all")
|
||||
public class EnableSslConfigurationIntegrationTests extends ClientServerIntegrationTestsSupport {
|
||||
public class EnableSslConfigurationIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static final String LOG_LEVEL = "error";
|
||||
|
||||
|
||||
@@ -28,13 +28,14 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.util.ArrayUtils;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link EnableSsl} and {@link SslConfiguration}.
|
||||
* Unit Tests for {@link EnableSsl} and {@link SslConfiguration}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @author Srikanth Manvi
|
||||
@@ -42,9 +43,11 @@ import org.springframework.util.StringUtils;
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableSsl
|
||||
* @see org.springframework.data.gemfire.config.annotation.SslConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public class EnableSslConfigurationUnitTests {
|
||||
public class EnableSslConfigurationUnitTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
@@ -107,7 +110,7 @@ public class EnableSslConfigurationUnitTests {
|
||||
@Test
|
||||
public void sslPropertyBasedConfigurationIsCorrect() {
|
||||
|
||||
PropertySource testPropertySource = new MockPropertySource("TestPropertySource")
|
||||
PropertySource<?> testPropertySource = new MockPropertySource("TestPropertySource")
|
||||
.withProperty("spring.data.gemfire.security.ssl.ciphers", "Scream, SEAL, SNOW")
|
||||
.withProperty("spring.data.gemfire.security.ssl.components", "locator, server, gateway")
|
||||
.withProperty("spring.data.gemfire.security.ssl.certificate.alias.default", "MockCert")
|
||||
@@ -125,7 +128,6 @@ public class EnableSslConfigurationUnitTests {
|
||||
.withProperty("spring.data.gemfire.security.ssl.use-default-context", "true")
|
||||
.withProperty("spring.data.gemfire.security.ssl.web-require-authentication", "true");
|
||||
|
||||
|
||||
this.applicationContext = newApplicationContext(testPropertySource, SslPropertyBasedConfiguration.class);
|
||||
|
||||
assertThat(this.applicationContext).isNotNull();
|
||||
|
||||
@@ -22,12 +22,12 @@ import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.geode.cache.wan.GatewayReceiver;
|
||||
import org.apache.geode.cache.wan.GatewayTransportFilter;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.wan.GatewayReceiver;
|
||||
import org.apache.geode.cache.wan.GatewayTransportFilter;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@@ -25,12 +25,12 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.geode.cache.wan.GatewayReceiver;
|
||||
import org.apache.geode.cache.wan.GatewayTransportFilter;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.wan.GatewayReceiver;
|
||||
import org.apache.geode.cache.wan.GatewayTransportFilter;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@@ -25,7 +25,9 @@ import java.util.Optional;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.geode.cache.DataPolicy;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.EntryEvent;
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
@@ -35,33 +37,39 @@ import org.apache.geode.cache.wan.GatewayQueueEvent;
|
||||
import org.apache.geode.cache.wan.GatewaySender;
|
||||
import org.apache.geode.cache.wan.GatewayTransportFilter;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.wan.GatewaySenderFactoryBean;
|
||||
import org.springframework.data.gemfire.wan.OrderPolicyType;
|
||||
|
||||
/**
|
||||
* Tests for {@link EnableGatewaySenders} and {@link EnableGatewaySender}.
|
||||
* Integration Tests for {@link EnableGatewaySender} and {@link EnableGatewaySenders}.
|
||||
*
|
||||
* @author Udo Kohlmeyer
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.mockito.Mockito
|
||||
* @see org.apache.geode.cache.server.CacheServer
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.wan.GatewaySender
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableGatewaySender
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableGatewaySenders
|
||||
* @see org.springframework.data.gemfire.config.annotation.GatewaySenderConfigurer
|
||||
* @see org.springframework.data.gemfire.config.annotation.GatewaySenderConfiguration
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.wan.GatewaySenderFactoryBean
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @see org.springframework.data.gemfire.wan.GatewayReceiverFactoryBean
|
||||
* @see GatewaySenderConfigurer
|
||||
* @see GatewaySenderConfiguration
|
||||
* @since 2.2.0
|
||||
*/
|
||||
public class GatewaySenderConfigurationTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class GatewaySenderConfigurationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
@@ -108,9 +116,9 @@ public class GatewaySenderConfigurationTests {
|
||||
assertThat(gatewaySender.getSocketBufferSize()).isEqualTo(16384);
|
||||
|
||||
assertThat(gatewaySender.getGatewayTransportFilters().size()).isEqualTo(2);
|
||||
assertThat(((GatewaySenderConfigurationTests.TestGatewayTransportFilter) gatewaySender
|
||||
assertThat(((GatewaySenderConfigurationIntegrationTests.TestGatewayTransportFilter) gatewaySender
|
||||
.getGatewayTransportFilters().get(0)).name).isEqualTo("transportBean2");
|
||||
assertThat(((GatewaySenderConfigurationTests.TestGatewayTransportFilter) gatewaySender
|
||||
assertThat(((GatewaySenderConfigurationIntegrationTests.TestGatewayTransportFilter) gatewaySender
|
||||
.getGatewayTransportFilters().get(1)).name).isEqualTo("transportBean1");
|
||||
assertThat(gatewaySenderConfigurer.beanNames.get(gatewaySender.getId()).toArray())
|
||||
.isEqualTo(new String[] { "transportBean2", "transportBean1" });
|
||||
@@ -219,7 +227,7 @@ public class GatewaySenderConfigurationTests {
|
||||
GatewaySender gatewaySender = this.applicationContext.getBean("TestGatewaySender", GatewaySender.class);
|
||||
|
||||
assertThat(gatewaySender.getGatewayTransportFilters().size()).isEqualTo(1);
|
||||
assertThat(((GatewaySenderConfigurationTests.TestGatewayTransportFilter) gatewaySender
|
||||
assertThat(((GatewaySenderConfigurationIntegrationTests.TestGatewayTransportFilter) gatewaySender
|
||||
.getGatewayTransportFilters().get(0)).name).isEqualTo("transportBean1");
|
||||
|
||||
gatewaySender = this.applicationContext.getBean("TestGatewaySender2", GatewaySender.class);
|
||||
@@ -258,7 +266,7 @@ public class GatewaySenderConfigurationTests {
|
||||
static class TestConfigurationWithAnnotations {
|
||||
|
||||
@Bean("SomeEventSubstitutionFilter")
|
||||
GatewayEventSubstitutionFilter createGatewayEventSubstitutionFilter() {
|
||||
GatewayEventSubstitutionFilter<?, ?> createGatewayEventSubstitutionFilter() {
|
||||
return new TestGatewayEventSubstitutionFilter("SomeEventSubstitutionFilter");
|
||||
}
|
||||
}
|
||||
@@ -278,7 +286,7 @@ public class GatewaySenderConfigurationTests {
|
||||
static class TestConfigurationWithMultipleGatewaySenderAnnotations {
|
||||
|
||||
@Bean("SomeEventSubstitutionFilter")
|
||||
GatewayEventSubstitutionFilter createGatewayEventSubstitutionFilter() {
|
||||
GatewayEventSubstitutionFilter<?, ?> createGatewayEventSubstitutionFilter() {
|
||||
return new TestGatewayEventSubstitutionFilter("SomeEventSubstitutionFilter");
|
||||
}
|
||||
}
|
||||
@@ -309,11 +317,11 @@ public class GatewaySenderConfigurationTests {
|
||||
|
||||
private static class TestGatewaySenderConfigurer implements GatewaySenderConfigurer {
|
||||
|
||||
private final Map<String, List> beanNames = new TreeMap<>();
|
||||
private final Map<String, List<String>> beanNames = new TreeMap<>();
|
||||
|
||||
@Override
|
||||
public void configure(String beanName, GatewaySenderFactoryBean bean) {
|
||||
beanNames.put(beanName, bean.getTransportFilters().stream()
|
||||
this.beanNames.put(beanName, bean.getTransportFilters().stream()
|
||||
.map(transportFilter -> ((TestGatewayTransportFilter) transportFilter).name)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
@@ -321,7 +329,7 @@ public class GatewaySenderConfigurationTests {
|
||||
|
||||
private static class TestGatewayEventFilter implements GatewayEventFilter {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public TestGatewayEventFilter(String name) {
|
||||
this.name = name;
|
||||
@@ -342,9 +350,9 @@ public class GatewaySenderConfigurationTests {
|
||||
|
||||
}
|
||||
|
||||
private static class TestGatewayEventSubstitutionFilter implements GatewayEventSubstitutionFilter {
|
||||
private static class TestGatewayEventSubstitutionFilter implements GatewayEventSubstitutionFilter<Object, Object> {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public TestGatewayEventSubstitutionFilter(String name) {
|
||||
this.name = name;
|
||||
@@ -362,7 +370,7 @@ public class GatewaySenderConfigurationTests {
|
||||
|
||||
private static class TestGatewayTransportFilter implements GatewayTransportFilter {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public TestGatewayTransportFilter(String name) {
|
||||
this.name = name;
|
||||
@@ -385,6 +393,15 @@ public class GatewaySenderConfigurationTests {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(obj instanceof TestGatewayTransportFilter)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.name.equals(((TestGatewayTransportFilter) obj).name);
|
||||
}
|
||||
}
|
||||
@@ -394,12 +411,12 @@ public class GatewaySenderConfigurationTests {
|
||||
static class BaseGatewaySenderTestConfiguration {
|
||||
|
||||
@Bean("Region1")
|
||||
PartitionedRegionFactoryBean createRegion1(GemFireCache gemFireCache) {
|
||||
PartitionedRegionFactoryBean<?, ?> createRegion1(GemFireCache gemFireCache) {
|
||||
return createRegion("Region1", gemFireCache);
|
||||
}
|
||||
|
||||
@Bean("Region2")
|
||||
PartitionedRegionFactoryBean createRegion2(GemFireCache gemFireCache) {
|
||||
PartitionedRegionFactoryBean<?, ?> createRegion2(GemFireCache gemFireCache) {
|
||||
return createRegion("Region2", gemFireCache);
|
||||
}
|
||||
|
||||
@@ -423,11 +440,13 @@ public class GatewaySenderConfigurationTests {
|
||||
return new TestGatewayEventFilter("SomeEventFilter");
|
||||
}
|
||||
|
||||
public PartitionedRegionFactoryBean createRegion(String name, GemFireCache gemFireCache) {
|
||||
final PartitionedRegionFactoryBean regionFactoryBean = new PartitionedRegionFactoryBean();
|
||||
public PartitionedRegionFactoryBean<?, ?> createRegion(String name, GemFireCache gemFireCache) {
|
||||
|
||||
PartitionedRegionFactoryBean<?, ?> regionFactoryBean = new PartitionedRegionFactoryBean<>();
|
||||
|
||||
regionFactoryBean.setCache(gemFireCache);
|
||||
regionFactoryBean.setDataPolicy(DataPolicy.PARTITION);
|
||||
regionFactoryBean.setName(name);
|
||||
|
||||
return regionFactoryBean;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,9 @@ import java.io.OutputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.geode.cache.DataPolicy;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.EntryEvent;
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
@@ -32,9 +34,6 @@ import org.apache.geode.cache.wan.GatewayQueueEvent;
|
||||
import org.apache.geode.cache.wan.GatewaySender;
|
||||
import org.apache.geode.cache.wan.GatewayTransportFilter;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -42,7 +41,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
@@ -51,16 +51,21 @@ import org.springframework.mock.env.MockPropertySource;
|
||||
* @author Udo Kohlmeyer
|
||||
* @see org.junit.Test
|
||||
* @see org.mockito.Mockito
|
||||
* @see GatewaySenderConfigurer
|
||||
* @see GatewaySenderConfiguration
|
||||
* @see org.apache.geode.cache.server.CacheServer
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.apache.geode.cache.wan.GatewaySender
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.config.annotation.GatewaySenderConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.GatewaySenderConfigurer
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.wan.GatewaySenderFactoryBean
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @see org.springframework.data.gemfire.wan.GatewaySenderFactoryBean
|
||||
* @since 2.2.0
|
||||
*/
|
||||
public class GatewaySenderConfigurerTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class GatewaySenderConfigurerTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
@@ -147,12 +152,12 @@ public class GatewaySenderConfigurerTests {
|
||||
static class BaseGatewaySenderTestConfiguration {
|
||||
|
||||
@Bean("Region1")
|
||||
PartitionedRegionFactoryBean createRegion1(GemFireCache gemFireCache) {
|
||||
PartitionedRegionFactoryBean<?, ?> createRegion1(GemFireCache gemFireCache) {
|
||||
return createRegion("Region1", gemFireCache);
|
||||
}
|
||||
|
||||
@Bean("Region2")
|
||||
PartitionedRegionFactoryBean createRegion2(GemFireCache gemFireCache) {
|
||||
PartitionedRegionFactoryBean<?, ?> createRegion2(GemFireCache gemFireCache) {
|
||||
return createRegion("Region2", gemFireCache);
|
||||
}
|
||||
|
||||
@@ -171,18 +176,20 @@ public class GatewaySenderConfigurerTests {
|
||||
return new TestGatewayEventFilter("SomeEventFilter");
|
||||
}
|
||||
|
||||
public PartitionedRegionFactoryBean createRegion(String name, GemFireCache gemFireCache) {
|
||||
final PartitionedRegionFactoryBean regionFactoryBean = new PartitionedRegionFactoryBean();
|
||||
public PartitionedRegionFactoryBean<?, ?> createRegion(String name, GemFireCache gemFireCache) {
|
||||
|
||||
PartitionedRegionFactoryBean<?, ?> regionFactoryBean = new PartitionedRegionFactoryBean<>();
|
||||
|
||||
regionFactoryBean.setCache(gemFireCache);
|
||||
regionFactoryBean.setDataPolicy(DataPolicy.PARTITION);
|
||||
regionFactoryBean.setName(name);
|
||||
|
||||
return regionFactoryBean;
|
||||
}
|
||||
}
|
||||
|
||||
private static class TestGatewayEventFilter implements GatewayEventFilter {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public TestGatewayEventFilter(String name) {
|
||||
this.name = name;
|
||||
@@ -203,9 +210,9 @@ public class GatewaySenderConfigurerTests {
|
||||
|
||||
}
|
||||
|
||||
private static class TestGatewayEventSubstitutionFilter implements GatewayEventSubstitutionFilter {
|
||||
private static class TestGatewayEventSubstitutionFilter implements GatewayEventSubstitutionFilter<Object, Object> {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public TestGatewayEventSubstitutionFilter(String name) {
|
||||
this.name = name;
|
||||
@@ -223,7 +230,7 @@ public class GatewaySenderConfigurerTests {
|
||||
|
||||
private static class TestGatewayTransportFilter implements GatewayTransportFilter {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public TestGatewayTransportFilter(String name) {
|
||||
this.name = name;
|
||||
@@ -239,11 +246,22 @@ public class GatewaySenderConfigurerTests {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public int hashCode() {
|
||||
return name.hashCode();
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.name.hashCode();
|
||||
}
|
||||
|
||||
@Override public boolean equals(Object obj) {
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(obj instanceof TestGatewayTransportFilter)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.name.equals(((TestGatewayTransportFilter) obj).name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,28 +44,32 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.wan.GatewaySenderFactoryBean;
|
||||
import org.springframework.data.gemfire.wan.OrderPolicyType;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
* Tests for {@link EnableGatewaySenders} and {@link EnableGatewaySender} to test the configuration of {@link GatewaySender} using properties.
|
||||
* Integration Tests for {@link EnableGatewaySender} and {@link EnableGatewaySenders} to test the configuration of
|
||||
* {@link GatewaySender} using properties.
|
||||
*
|
||||
* @author Udo Kohlmeyer
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.mockito.Mockito
|
||||
* @see org.apache.geode.cache.wan.GatewaySender
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.config.annotation.GatewaySenderConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.GatewaySenderConfigurer
|
||||
* @see org.apache.geode.cache.server.CacheServer
|
||||
* @see org.springframework.context.annotation.Configuration
|
||||
* @see org.springframework.data.gemfire.wan.GatewayReceiverFactoryBean
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.wan.GatewaySenderFactoryBean
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.2.0
|
||||
*/
|
||||
public class GatewaySenderPropertiesTests {
|
||||
public class GatewaySenderPropertiesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
@@ -557,7 +561,7 @@ public class GatewaySenderPropertiesTests {
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static class TestGatewayEventSubstitutionFilter implements GatewayEventSubstitutionFilter {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public TestGatewayEventSubstitutionFilter(String name) {
|
||||
this.name = name;
|
||||
@@ -575,7 +579,7 @@ public class GatewaySenderPropertiesTests {
|
||||
|
||||
private static class TestGatewayEventFilter implements GatewayEventFilter {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public TestGatewayEventFilter(String name) {
|
||||
this.name = name;
|
||||
@@ -602,7 +606,7 @@ public class GatewaySenderPropertiesTests {
|
||||
|
||||
private static class TestGatewayTransportFilter implements GatewayTransportFilter {
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
public TestGatewayTransportFilter(String name) {
|
||||
this.name = name;
|
||||
@@ -28,14 +28,14 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
|
||||
import org.springframework.context.annotation.AdviceMode;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
|
||||
@@ -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;
|
||||
@@ -25,14 +24,14 @@ import java.util.Iterator;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.lucene.LuceneIndex;
|
||||
import org.apache.geode.cache.lucene.LuceneService;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.lucene.LuceneIndex;
|
||||
import org.apache.geode.cache.lucene.LuceneService;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -48,10 +47,10 @@ import org.springframework.data.gemfire.mapping.annotation.ClientRegion;
|
||||
import org.springframework.data.gemfire.mapping.annotation.LocalRegion;
|
||||
import org.springframework.data.gemfire.mapping.annotation.ReplicateRegion;
|
||||
import org.springframework.data.gemfire.search.lucene.LuceneIndexFactoryBean;
|
||||
import org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor;
|
||||
import org.springframework.data.gemfire.tests.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link IndexConfigurer}.
|
||||
* Integration Tests for {@link IndexConfigurer}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -61,6 +60,7 @@ import org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor;
|
||||
* @see org.springframework.data.gemfire.IndexFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.IndexConfigurer
|
||||
* @see org.springframework.data.gemfire.search.lucene.LuceneIndexFactoryBean
|
||||
* @see org.springframework.data.gemfire.tests.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@@ -145,8 +145,8 @@ public class IndexConfigurerIntegrationTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
GemfireTestBeanPostProcessor testBeanPostProcessor() {
|
||||
return new GemfireTestBeanPostProcessor();
|
||||
GemFireMockObjectsBeanPostProcessor testBeanPostProcessor() {
|
||||
return new GemFireMockObjectsBeanPostProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -32,7 +32,8 @@ import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
|
||||
/**
|
||||
* Integration Tests for {@link LocatorApplication} and {@link LocatorApplicationConfiguration} asserting that
|
||||
@@ -43,15 +44,17 @@ import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockOb
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.apache.geode.distributed.Locator
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorApplicationConfiguration
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.2.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class LocatorApplicationCannotCoexistWithCacheApplicationIntegrationTests {
|
||||
public class LocatorApplicationCannotCoexistWithCacheApplicationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final String GEMFIRE_LOG_LEVEL = "error";
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.LocatorFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -38,11 +39,11 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.mockito.Mockito
|
||||
* @see org.springframework.beans.factory.config.BeanPostProcessor
|
||||
* @see org.springframework.data.gemfire.LocatorFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorApplicationConfiguration
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @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.3.0
|
||||
@@ -50,7 +51,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class LocatorApplicationConfigurationIntegrationTests {
|
||||
public class LocatorApplicationConfigurationIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
@Autowired
|
||||
private LocatorFactoryBean locatorFactoryBean;
|
||||
|
||||
@@ -34,7 +34,8 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.LocatorFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -48,7 +49,8 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorApplication
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorApplicationConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.LocatorConfigurer
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @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.2.0
|
||||
@@ -56,7 +58,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
@SuppressWarnings("unused")
|
||||
public class LocatorApplicationConfigurerIntegrationTests {
|
||||
public class LocatorApplicationConfigurerIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final String GEMFIRE_LOG_LEVEL = "error";
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ import static org.mockito.Mockito.spy;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.geode.distributed.Locator;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.distributed.Locator;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -35,7 +35,8 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.LocatorFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
@@ -47,16 +48,15 @@ import org.springframework.mock.env.MockPropertySource;
|
||||
* @see java.util.Properties
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.distributed.Locator
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.core.env.PropertySource
|
||||
\ * @see org.springframework.core.env.PropertySource
|
||||
* @see org.springframework.data.gemfire.LocatorFactoryBean
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.mock.env.MockPropertySource
|
||||
* @since 2.2.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class LocatorApplicationPropertiesIntegrationTests {
|
||||
public class LocatorApplicationPropertiesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -21,15 +21,15 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.CacheLoader;
|
||||
import org.apache.geode.cache.CacheLoaderException;
|
||||
import org.apache.geode.cache.LoaderHelper;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.PartitionedRegionFactoryBean;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.data.gemfire.config.annotation;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
@@ -31,8 +32,8 @@ import org.apache.geode.cache.server.CacheServer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.data.gemfire.GemFireProperties;
|
||||
import org.springframework.data.gemfire.process.ProcessWrapper;
|
||||
import org.springframework.data.gemfire.test.support.ClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@@ -44,6 +45,8 @@ 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.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 2.2.0
|
||||
*/
|
||||
@@ -51,7 +54,8 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
@ContextConfiguration(classes = PeerCacheApplicationWithAddedCacheServerIntegrationTests.TestPeerCacheConfiguration.class)
|
||||
@SuppressWarnings("unused")
|
||||
// TODO: Convert to Unit Test once STDG is used by SDG.
|
||||
public class PeerCacheApplicationWithAddedCacheServerIntegrationTests extends ClientServerIntegrationTestsSupport {
|
||||
public class PeerCacheApplicationWithAddedCacheServerIntegrationTests
|
||||
extends ForkingClientServerIntegrationTestsSupport {
|
||||
|
||||
private static int cacheServerPort;
|
||||
private static int locatorPort;
|
||||
@@ -80,12 +84,7 @@ public class PeerCacheApplicationWithAddedCacheServerIntegrationTests extends Cl
|
||||
|
||||
@AfterClass
|
||||
public static void stopGemFireLocator() {
|
||||
|
||||
stop(gemfireLocator);
|
||||
|
||||
System.getProperties().stringPropertyNames().stream()
|
||||
.filter(propertyName -> propertyName.startsWith("spring.data.gemfire."))
|
||||
.forEach(System::clearProperty);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@@ -128,7 +127,7 @@ public class PeerCacheApplicationWithAddedCacheServerIntegrationTests extends Cl
|
||||
|
||||
applicationContext.registerShutdownHook();
|
||||
|
||||
block();
|
||||
new Scanner(System.in).nextLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -23,30 +22,29 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
|
||||
import org.junit.Before;
|
||||
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.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor;
|
||||
import org.springframework.data.gemfire.tests.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link PeerCacheConfigurer}.
|
||||
* Integration Tests for {@link PeerCacheConfigurer}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.junit.runner.RunWith
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @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.test.GemfireTestBeanPostProcessor
|
||||
* @see org.springframework.data.gemfire.tests.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor
|
||||
* @see org.springframework.test.context.junit4.SpringRunner
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@@ -92,8 +90,8 @@ public class PeerCacheConfigurerIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
GemfireTestBeanPostProcessor testBeanPostProcessor() {
|
||||
return new GemfireTestBeanPostProcessor();
|
||||
GemFireMockObjectsBeanPostProcessor testBeanPostProcessor() {
|
||||
return new GemFireMockObjectsBeanPostProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -114,7 +112,7 @@ public class PeerCacheConfigurerIntegrationTests {
|
||||
|
||||
static class TestPeerCacheConfigurer implements Iterable<String>, PeerCacheConfigurer {
|
||||
|
||||
private Set<String> beanNames = new HashSet<>();
|
||||
private final Set<String> beanNames = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void configure(String beanName, CacheFactoryBean bean) {
|
||||
|
||||
@@ -34,7 +34,8 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
@@ -44,17 +45,17 @@ import org.springframework.mock.env.MockPropertySource;
|
||||
* @see java.util.Properties
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Cache
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.core.env.MutablePropertySources
|
||||
* @see org.springframework.core.env.PropertySource
|
||||
* @see org.springframework.data.gemfire.CacheFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.PeerCacheApplication
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.mock.env.MockPropertySource
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class PeerCachePropertiesIntegrationTests {
|
||||
public class PeerCachePropertiesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -34,7 +34,8 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.mock.env.MockPropertySource;
|
||||
|
||||
/**
|
||||
@@ -45,17 +46,17 @@ import org.springframework.mock.env.MockPropertySource;
|
||||
* @see org.apache.geode.cache.client.ClientCache
|
||||
* @see org.apache.geode.cache.client.Pool
|
||||
* @see org.apache.geode.cache.client.PoolFactory
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
* @see org.springframework.core.env.PropertySource
|
||||
* @see org.springframework.data.gemfire.config.annotation.AddPoolConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.AddPoolsConfiguration
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnablePool
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnablePools
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class PoolPropertiesIntegrationTests {
|
||||
public class PoolPropertiesIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ import java.util.Iterator;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -42,27 +42,25 @@ import org.springframework.data.gemfire.mapping.annotation.ClientRegion;
|
||||
import org.springframework.data.gemfire.mapping.annotation.LocalRegion;
|
||||
import org.springframework.data.gemfire.mapping.annotation.PartitionRegion;
|
||||
import org.springframework.data.gemfire.mapping.annotation.ReplicateRegion;
|
||||
import org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link RegionConfigurer}.
|
||||
* Integration Tests for {@link RegionConfigurer}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.GemFireCache
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.context.ConfigurableApplicationContext
|
||||
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
* @see org.springframework.context.annotation.Bean
|
||||
* @see org.springframework.data.gemfire.PartitionedRegionFactoryBean
|
||||
* @see org.springframework.data.gemfire.PeerRegionFactoryBean
|
||||
* @see org.springframework.data.gemfire.client.ClientRegionFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.RegionConfigurer
|
||||
* @see org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor
|
||||
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
|
||||
* @see org.springframework.data.gemfire.tests.mock.beans.factory.config.GemFireMockObjectsBeanPostProcessor
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public class RegionConfigurerIntegrationTests {
|
||||
public class RegionConfigurerIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
@@ -84,7 +82,7 @@ public class RegionConfigurerIntegrationTests {
|
||||
return beanNamesField;
|
||||
})
|
||||
.map(beanNamesField -> (Set<String>) ReflectionUtils.getField(beanNamesField, target))
|
||||
.orElseGet(() -> Collections.emptySet());
|
||||
.orElseGet(Collections::emptySet);
|
||||
}
|
||||
|
||||
private ConfigurableApplicationContext newApplicationContext(Class<?>... annotatedClasses) {
|
||||
@@ -160,8 +158,8 @@ public class RegionConfigurerIntegrationTests {
|
||||
static class AbstractTestConfiguration {
|
||||
|
||||
@Bean
|
||||
GemfireTestBeanPostProcessor testBeanPostProcessor() {
|
||||
return new GemfireTestBeanPostProcessor();
|
||||
GemFireMockObjectsBeanPostProcessor testBeanPostProcessor() {
|
||||
return new GemFireMockObjectsBeanPostProcessor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -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;
|
||||
@@ -24,26 +23,27 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.client.ClientRegionShortcut;
|
||||
|
||||
import org.junit.Assume;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
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.config.annotation.support.RegionDataAccessTracingAspect;
|
||||
import org.springframework.data.gemfire.test.logging.slf4j.logback.TestAppender;
|
||||
import org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.logging.slf4j.logback.TestAppender;
|
||||
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link RegionDataAccessTracingAspect}.
|
||||
* Unit Tests for {@link RegionDataAccessTracingAspect}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -51,15 +51,17 @@ import org.springframework.util.ClassUtils;
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.client.ClientRegionFactoryBean
|
||||
* @see org.springframework.data.gemfire.config.annotation.support.RegionDataAccessTracingAspect
|
||||
* @see org.springframework.data.gemfire.test.logging.slf4j.logback.TestAppender
|
||||
* @see org.springframework.data.gemfire.test.mock.annotation.EnableGemFireMockObjects
|
||||
* @see org.springframework.data.gemfire.tests.logging.slf4j.logback.TestAppender
|
||||
* @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.2
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration
|
||||
public class RegionDataAccessTracingAspectUnitTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class RegionDataAccessTracingAspectUnitTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final String LOGBACK_LOGGER_CLASS_NAME = "ch.qos.logback.classic.Logger";
|
||||
|
||||
@@ -75,7 +77,6 @@ public class RegionDataAccessTracingAspectUnitTests {
|
||||
}
|
||||
|
||||
@Resource(name = "ClientRegion")
|
||||
@SuppressWarnings("all")
|
||||
private Region<Object, Object> region;
|
||||
|
||||
private Runnable regionCallbackArgument(AtomicBoolean called) {
|
||||
@@ -450,7 +451,7 @@ public class RegionDataAccessTracingAspectUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void logsRegionSize() throws Exception {
|
||||
public void logsRegionSize() {
|
||||
|
||||
this.region.size();
|
||||
|
||||
@@ -463,7 +464,7 @@ public class RegionDataAccessTracingAspectUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void logsRegionSizeOnServer() throws Exception {
|
||||
public void logsRegionSizeOnServer() {
|
||||
|
||||
this.region.sizeOnServer();
|
||||
|
||||
@@ -476,7 +477,7 @@ public class RegionDataAccessTracingAspectUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void logsRegionValues() throws Exception {
|
||||
public void logsRegionValues() {
|
||||
|
||||
this.region.values();
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -50,6 +48,9 @@ import org.mockito.Mock;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.internal.matchers.VarargMatcher;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,13 +29,13 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.resource.ResourceException;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.ra.GFConnection;
|
||||
import org.apache.geode.ra.GFConnectionFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
@@ -30,14 +30,15 @@ import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
import javax.resource.ResourceException;
|
||||
|
||||
import org.apache.geode.ra.GFConnection;
|
||||
import org.apache.geode.ra.GFConnectionFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.apache.geode.ra.GFConnection;
|
||||
import org.apache.geode.ra.GFConnectionFactory;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,13 +25,14 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import javax.resource.ResourceException;
|
||||
|
||||
import org.apache.geode.ra.GFConnection;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.apache.geode.ra.GFConnection;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,10 @@ import static org.springframework.data.gemfire.util.CollectionUtils.asSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.apache.geode.cache.Cache;
|
||||
import org.apache.geode.cache.DiskStore;
|
||||
import org.apache.geode.cache.Region;
|
||||
@@ -36,10 +40,6 @@ import org.apache.geode.cache.query.Index;
|
||||
import org.apache.geode.cache.wan.GatewayReceiver;
|
||||
import org.apache.geode.cache.wan.GatewaySender;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link SchemaObjectType}.
|
||||
*
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.schema.definitions;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -25,22 +24,22 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.query.Index;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.query.Index;
|
||||
|
||||
import org.springframework.data.gemfire.IndexType;
|
||||
import org.springframework.data.gemfire.config.admin.GemfireAdminOperations;
|
||||
import org.springframework.data.gemfire.config.schema.SchemaObjectType;
|
||||
import org.springframework.data.gemfire.test.support.IOUtils;
|
||||
import org.springframework.data.gemfire.tests.util.IOUtils;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link IndexDefinition}.
|
||||
* Unit Tests for {@link IndexDefinition}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
@@ -261,7 +260,7 @@ public class IndexDefinitionUnitTests {
|
||||
public void onNullRegion() {
|
||||
|
||||
try {
|
||||
IndexDefinition.from(this.mockIndex).on((Region) null);
|
||||
IndexDefinition.from(this.mockIndex).on((Region<?, ?>) null);
|
||||
}
|
||||
catch (IllegalArgumentException expected) {
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.gemfire.config.schema.definitions;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -25,21 +24,21 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.RegionShortcut;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.apache.geode.cache.Region;
|
||||
import org.apache.geode.cache.RegionShortcut;
|
||||
|
||||
import org.springframework.data.gemfire.config.admin.GemfireAdminOperations;
|
||||
import org.springframework.data.gemfire.config.schema.SchemaObjectType;
|
||||
import org.springframework.data.gemfire.test.support.IOUtils;
|
||||
import org.springframework.data.gemfire.tests.util.IOUtils;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link RegionDefinition}.
|
||||
* Unit Tests for {@link RegionDefinition}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
|
||||
@@ -26,20 +26,20 @@ import static org.springframework.data.gemfire.util.CollectionUtils.asSet;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.config.schema.SchemaObjectCollector;
|
||||
import org.springframework.data.gemfire.config.schema.SchemaObjectType;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ComposableSchemaObjectCollector}.
|
||||
*
|
||||
|
||||
@@ -36,9 +36,6 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -47,6 +44,9 @@ import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
import org.apache.geode.cache.Region;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.data.gemfire.util.CollectionUtils;
|
||||
|
||||
@@ -23,6 +23,8 @@ import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.geode.cache.EvictionAction;
|
||||
import org.apache.geode.cache.ExpirationAction;
|
||||
import org.apache.geode.cache.InterestPolicy;
|
||||
@@ -30,8 +32,6 @@ import org.apache.geode.cache.InterestResultPolicy;
|
||||
import org.apache.geode.cache.Scope;
|
||||
import org.apache.geode.cache.wan.GatewaySender;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.data.gemfire.IndexMaintenancePolicyConverter;
|
||||
import org.springframework.data.gemfire.IndexMaintenancePolicyType;
|
||||
|
||||
@@ -30,20 +30,21 @@ import static org.mockito.Mockito.when;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.geode.cache.query.MultiIndexCreationException;
|
||||
import org.apache.geode.cache.query.QueryService;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import org.apache.geode.cache.query.MultiIndexCreationException;
|
||||
import org.apache.geode.cache.query.QueryService;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.data.gemfire.config.xml.GemfireConstants;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link DefinedIndexesApplicationListener}.
|
||||
*
|
||||
|
||||
@@ -22,17 +22,17 @@ import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.apache.geode.cache.GemFireCache;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
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.test.support.FileSystemUtils;
|
||||
import org.springframework.data.gemfire.tests.util.FileSystemUtils;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
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.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
@@ -34,23 +34,30 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.data.gemfire.PeerRegionFactoryBean;
|
||||
import org.springframework.data.gemfire.test.mock.context.GemFireMockObjectsApplicationContextInitializer;
|
||||
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
|
||||
import org.springframework.data.gemfire.tests.mock.context.GemFireMockObjectsApplicationContextInitializer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link LuceneIndexRegionBeanFactoryPostProcessor}.
|
||||
* Integration Tests for {@link LuceneIndexRegionBeanFactoryPostProcessor}.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.junit.Test
|
||||
* @see org.apache.geode.cache.Region
|
||||
* @see org.springframework.data.gemfire.config.support.LuceneIndexRegionBeanFactoryPostProcessor
|
||||
* @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
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@ContextConfiguration(initializers = GemFireMockObjectsApplicationContextInitializer.class)
|
||||
public class LuceneIndexRegionBeanFactoryPostProcessorIntegrationTests {
|
||||
@SuppressWarnings("unused")
|
||||
public class LuceneIndexRegionBeanFactoryPostProcessorIntegrationTests extends IntegrationTestsSupport {
|
||||
|
||||
private static final List<String> beanNames = new CopyOnWriteArrayList<>();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user