Refactor all Unit & Integration Tests starting a Spring container with SpringRunner to extend STDG's IntegrationTestsSupport.

This commit is contained in:
John Blum
2021-03-30 11:25:08 -07:00
parent 9cdb4ca7f3
commit 0728ee1e21
10 changed files with 36 additions and 15 deletions

View File

@@ -31,7 +31,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -39,6 +38,7 @@ import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.StringUtils;
@@ -53,7 +53,9 @@ import org.springframework.util.StringUtils;
* @see org.springframework.boot.autoconfigure.condition.AnyNestedCondition
* @see org.springframework.context.annotation.Condition
* @see org.springframework.context.annotation.Conditional
* @see org.springframework.context.annotation.ConditionContext
* @see org.springframework.context.annotation.Configuration
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
* @see org.springframework.test.context.ContextConfiguration
* @see org.springframework.test.context.junit4.SpringRunner
* @since 1.2.0
@@ -61,7 +63,7 @@ import org.springframework.util.StringUtils;
@RunWith(SpringRunner.class)
@ContextConfiguration
@SuppressWarnings("unused")
public class ComplexConditionalConfigurationIntegrationTests {
public class ComplexConditionalConfigurationIntegrationTests extends IntegrationTestsSupport {
private static final AtomicBoolean importBeanDefinitionRegistrarCalled = new AtomicBoolean(false);
@@ -121,7 +123,7 @@ public class ComplexConditionalConfigurationIntegrationTests {
}
static final class MockConditionOne implements Condition {
static final class MockConditionOne implements org.springframework.context.annotation.Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
@@ -129,7 +131,7 @@ public class ComplexConditionalConfigurationIntegrationTests {
}
}
static final class MockConditionTwo implements Condition {
static final class MockConditionTwo implements org.springframework.context.annotation.Condition {
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {

View File

@@ -28,6 +28,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Profile;
import org.springframework.data.gemfire.GemfireTemplate;
import org.springframework.data.gemfire.config.annotation.EnableEntityDefinedRegions;
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
import org.springframework.geode.boot.autoconfigure.DataImportExportAutoConfiguration;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
@@ -43,6 +44,7 @@ import example.app.golf.model.Golfer;
* @see org.springframework.boot.test.context.SpringBootTest
* @see org.springframework.context.annotation.Profile
* @see org.springframework.data.gemfire.GemfireTemplate
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
* @see org.springframework.geode.boot.autoconfigure.DataImportExportAutoConfiguration
* @see org.springframework.test.context.ActiveProfiles
* @see org.springframework.test.context.junit4.SpringRunner
@@ -57,7 +59,7 @@ import example.app.golf.model.Golfer;
"spring.boot.data.gemfire.cache.data.import.active-profiles=IMPORT-LOCAL"
}
)
public class LocalClientCacheDataImportAutoConfigurationIntegrationTests {
public class LocalClientCacheDataImportAutoConfigurationIntegrationTests extends IntegrationTestsSupport {
@Autowired
@SuppressWarnings("unused")

View File

@@ -28,6 +28,7 @@ import org.apache.geode.distributed.Locator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
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;
@@ -42,6 +43,7 @@ import org.springframework.test.context.junit4.SpringRunner;
* @see org.apache.geode.cache.client.ClientCache
* @see org.apache.geode.distributed.Locator
* @see org.springframework.boot.autoconfigure.SpringBootApplication
* @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
@@ -50,7 +52,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@ContextConfiguration
@SuppressWarnings("unused")
public class SpringBootLocatorApplicationIntegrationTests {
public class SpringBootLocatorApplicationIntegrationTests extends IntegrationTestsSupport {
@Autowired(required = false)
private GemFireCache clientCache;