From 55b8ca53737667edf972081c3e66746a7580f016 Mon Sep 17 00:00:00 2001 From: John Blum Date: Tue, 30 Mar 2021 11:58:39 -0700 Subject: [PATCH] Annotate Spring Geode Sample test classes with Spring Test Framework's @DirtiesContext annotation to avoid test conflicts. --- .../CustomerServiceApplicationIntegrationTests.java | 9 +++++---- .../inline/CalculatorApplicationIntegrationTests.java | 11 +++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spring-geode-samples/boot/configuration/src/test/java/example/app/crm/CustomerServiceApplicationIntegrationTests.java b/spring-geode-samples/boot/configuration/src/test/java/example/app/crm/CustomerServiceApplicationIntegrationTests.java index 091882f3..e6763391 100644 --- a/spring-geode-samples/boot/configuration/src/test/java/example/app/crm/CustomerServiceApplicationIntegrationTests.java +++ b/spring-geode-samples/boot/configuration/src/test/java/example/app/crm/CustomerServiceApplicationIntegrationTests.java @@ -19,15 +19,16 @@ import static org.assertj.core.api.Assertions.assertThat; import javax.annotation.Resource; -import org.apache.geode.cache.Region; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.apache.geode.cache.Region; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; @@ -42,14 +43,14 @@ import example.app.crm.repo.CustomerRepository; * @see org.apache.geode.cache.Region * @see org.springframework.boot.test.context.SpringBootTest * @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport + * @see org.springframework.test.annotation.DirtiesContext * @see org.springframework.test.context.ActiveProfiles * @see org.springframework.test.context.junit4.SpringRunner - * @see example.app.crm.model.Customer - * @see example.app.crm.repo.CustomerRepository * @since 1.1.0 */ // tag::class[] @ActiveProfiles("debug") +@DirtiesContext @RunWith(SpringRunner.class) @SpringBootTest(properties = { "spring.boot.data.gemfire.security.ssl.environment.post-processor.enabled=false" diff --git a/spring-geode-samples/caching/inline/src/test/java/example/app/caching/inline/CalculatorApplicationIntegrationTests.java b/spring-geode-samples/caching/inline/src/test/java/example/app/caching/inline/CalculatorApplicationIntegrationTests.java index 729fcfee..b22c21f8 100644 --- a/spring-geode-samples/caching/inline/src/test/java/example/app/caching/inline/CalculatorApplicationIntegrationTests.java +++ b/spring-geode-samples/caching/inline/src/test/java/example/app/caching/inline/CalculatorApplicationIntegrationTests.java @@ -21,15 +21,16 @@ import java.util.concurrent.atomic.AtomicBoolean; import javax.annotation.Resource; -import org.apache.geode.cache.Region; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.apache.geode.cache.Region; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; import example.app.caching.inline.model.Operator; @@ -46,14 +47,12 @@ import example.app.caching.inline.service.CalculatorService; * @see org.apache.geode.cache.Region * @see org.springframework.boot.test.context.SpringBootTest * @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport + * @see org.springframework.test.annotation.DirtiesContext * @see org.springframework.test.context.junit4.SpringRunner - * @see example.app.caching.inline.model.Operator - * @see example.app.caching.inline.model.ResultHolder - * @see example.app.caching.inline.repo.CalculatorRepository - * @see example.app.caching.inline.service.CalculatorService * @since 1.1.0 */ // tag::class[] +@DirtiesContext @RunWith(SpringRunner.class) @SpringBootTest(properties = { "spring.boot.data.gemfire.security.ssl.environment.post-processor.enabled=false"