Annotate tests with Spring Test's @DirtiesContext.

This commit is contained in:
John Blum
2022-02-02 15:53:23 -08:00
parent 09b12ec723
commit 821144bfcd
4 changed files with 15 additions and 12 deletions

View File

@@ -34,6 +34,7 @@ import org.springframework.data.gemfire.config.annotation.EnableCachingDefinedRe
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
import org.springframework.data.gemfire.util.RegionUtils;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringRunner;
import example.app.books.NonBeanType;
@@ -53,9 +54,11 @@ import example.app.books.service.support.CachingBookService;
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
* @see org.springframework.geode.boot.autoconfigure.CachingProviderAutoConfiguration
* @see org.springframework.test.annotation.DirtiesContext
* @see org.springframework.test.context.junit4.SpringRunner
* @since 1.0.0
*/
@DirtiesContext
@RunWith(SpringRunner.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)

View File

@@ -77,6 +77,7 @@ import example.app.books.model.ISBN;
* (server(s)) are secure (i.e. when both Authentication and TLS/SSL are enabled).
*
* @author John Blum
* @see java.security.KeyStore
* @see org.junit.Test
* @see org.apache.geode.cache.GemFireCache
* @see org.apache.geode.cache.Region
@@ -86,10 +87,11 @@ import example.app.books.model.ISBN;
* @see org.springframework.boot.test.context.SpringBootTest
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.Profile
* @see org.springframework.core.env.Environment
* @see org.springframework.core.env.Profiles
* @see org.springframework.data.gemfire.GemfireTemplate
* @see org.springframework.data.gemfire.config.annotation.CacheServerApplication
* @see org.springframework.data.gemfire.config.annotation.EnableManager
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
* @see org.springframework.geode.config.annotation.ClusterAwareConfiguration
* @see org.springframework.geode.config.annotation.EnableClusterAware
* @see org.springframework.geode.security.TestSecurityManager
* @see org.springframework.test.annotation.DirtiesContext
@@ -117,9 +119,9 @@ public class SecureClusterAwareConfigurationIntegrationTests extends ForkingClie
@BeforeClass
public static void startGeodeServer() throws IOException {
//startGemFireServer(TestGeodeServerConfiguration.class,
// "-Dspring.profiles.active=cluster-aware-with-secure-server,ssl",
// "-Dapache-geode.logback.log.level=INFO");
startGemFireServer(TestGeodeServerConfiguration.class,
"-Dspring.profiles.active=cluster-aware-with-secure-server,ssl",
"-Dapache-geode.logback.log.level=INFO");
}
@BeforeClass @AfterClass

View File

@@ -50,7 +50,6 @@ import org.springframework.data.gemfire.config.annotation.EnableEntityDefinedReg
import org.springframework.data.gemfire.config.annotation.EnableManager;
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
import org.springframework.geode.security.TestSecurityManager;
import org.springframework.geode.util.GeodeConstants;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.ClientHttpRequestInterceptor;
@@ -67,18 +66,22 @@ import example.app.books.model.ISBN;
* server is configured with Security (Authentication).
*
* @author John Blum
* @see java.io.File
* @see java.net.URI
* @see org.junit.Test
* @see org.apache.geode.cache.GemFireCache
* @see org.apache.geode.cache.Region
* @see org.springframework.boot.ApplicationRunner
* @see org.springframework.boot.autoconfigure.SpringBootApplication
* @see org.springframework.boot.builder.SpringApplicationBuilder
* @see org.springframework.boot.test.context.SpringBootTest
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.Profile
* @see org.springframework.data.gemfire.GemfireTemplate
* @see org.springframework.data.gemfire.config.annotation.EnableClusterConfiguration
* @see org.springframework.data.gemfire.config.annotation.EnableEntityDefinedRegions
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
* @see org.springframework.geode.security.TestSecurityManager
* @see org.springframework.test.annotation.DirtiesContext
* @see org.springframework.test.context.ActiveProfiles
* @see org.springframework.test.context.junit4.SpringRunner
* @since 1.0.0
@@ -180,8 +183,6 @@ public class ClusterConfigurationWithAuthenticationIntegrationTests extends Fork
@EnableManager(start = true)
static class GeodeServerConfiguration {
private static final String GEODE_HOME_PROPERTY = GeodeConstants.GEMFIRE_PROPERTY_PREFIX + "home";
public static void main(String[] args) throws IOException {
new SpringApplicationBuilder(GeodeServerConfiguration.class)

View File

@@ -68,9 +68,6 @@ import example.app.books.model.ISBN;
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.Profile
* @see org.springframework.data.gemfire.GemfireTemplate
* @see org.springframework.data.gemfire.LocalRegionFactoryBean
* @see org.springframework.data.gemfire.client.ClientRegionFactoryBean
* @see org.springframework.data.gemfire.config.annotation.CacheServerApplication
* @see org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport
* @see org.springframework.geode.boot.autoconfigure.DataImportExportAutoConfiguration
* @see org.springframework.test.annotation.DirtiesContext