Workaround for data source cycle with hibernate

The JpaInvokerConfiguration (nested in RefreshAutoConfiguration can be
removed when and if the issue is resolved in Boot.

Also splits the hibernate test dependencies out into a separate module
so the main context tests run quicker.

Fixes gh-355
This commit is contained in:
Dave Syer
2018-05-11 09:37:07 +01:00
parent f7519a30ad
commit 0e259eab35
18 changed files with 1327 additions and 32 deletions

View File

@@ -20,8 +20,52 @@ import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.springframework.cloud.autoconfigure.LifecycleMvcAutoConfigurationTests;
import org.springframework.cloud.autoconfigure.RefreshAutoConfigurationClassPathTests;
import org.springframework.cloud.autoconfigure.RefreshAutoConfigurationMoreClassPathTests;
import org.springframework.cloud.autoconfigure.RefreshAutoConfigurationTests;
import org.springframework.cloud.bootstrap.BootstrapDisabledAutoConfigurationIntegrationTests;
import org.springframework.cloud.bootstrap.BootstrapOrderingAutoConfigurationIntegrationTests;
import org.springframework.cloud.bootstrap.BootstrapOrderingCustomPropertySourceIntegrationTests;
import org.springframework.cloud.bootstrap.BootstrapOrderingSpringApplicationJsonIntegrationTests;
import org.springframework.cloud.bootstrap.BootstrapSourcesOrderingTests;
import org.springframework.cloud.bootstrap.MessageSourceConfigurationTests;
import org.springframework.cloud.bootstrap.config.BootstrapConfigurationTests;
import org.springframework.cloud.bootstrap.config.BootstrapListenerHierarchyIntegrationTests;
import org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfigurationTests;
import org.springframework.cloud.bootstrap.encrypt.EncryptionIntegrationTests;
import org.springframework.cloud.bootstrap.encrypt.EncryptorFactoryTests;
import org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializerTests;
import org.springframework.cloud.bootstrap.encrypt.RsaDisabledTests;
import org.springframework.cloud.context.environment.EnvironmentManagerIntegrationTests;
import org.springframework.cloud.context.environment.EnvironmentManagerTest;
import org.springframework.cloud.context.named.NamedContextFactoryTests;
import org.springframework.cloud.context.properties.ConfigurationPropertiesRebinderIntegrationTests;
import org.springframework.cloud.context.properties.ConfigurationPropertiesRebinderLifecycleIntegrationTests;
import org.springframework.cloud.context.properties.ConfigurationPropertiesRebinderListIntegrationTests;
import org.springframework.cloud.context.properties.ConfigurationPropertiesRebinderProxyIntegrationTests;
import org.springframework.cloud.context.properties.ConfigurationPropertiesRebinderRefreshScopeIntegrationTests;
import org.springframework.cloud.context.refresh.ContextRefresherIntegrationTests;
import org.springframework.cloud.context.refresh.ContextRefresherTests;
import org.springframework.cloud.context.restart.RestartIntegrationTests;
import org.springframework.cloud.context.scope.refresh.ImportRefreshScopeIntegrationTests;
import org.springframework.cloud.context.scope.refresh.MoreRefreshScopeIntegrationTests;
import org.springframework.cloud.context.scope.refresh.RefreshEndpointIntegrationTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopeConcurrencyTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopeConfigurationScaleTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopeConfigurationTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopeIntegrationTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopeLazyIntegrationTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopeListBindingIntegrationTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopeNullBeanIntegrationTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopePureScaleTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopeScaleTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopeSerializationTests;
import org.springframework.cloud.context.scope.refresh.RefreshScopeWebIntegrationTests;
import org.springframework.cloud.endpoint.RefreshEndpointTests;
import org.springframework.cloud.health.RefreshScopeHealthIndicatorTests;
import org.springframework.cloud.logging.LoggingRebinderTests;
/**
* A test suite for probing weird ordering problems in the tests.
@@ -29,7 +73,39 @@ import org.springframework.cloud.endpoint.RefreshEndpointTests;
* @author Dave Syer
*/
@RunWith(Suite.class)
@SuiteClasses({ RefreshEndpointTests.class, ContextRefresherTests.class })
@SuiteClasses({ BootstrapSourcesOrderingTests.class,
BootstrapDisabledAutoConfigurationIntegrationTests.class,
EncryptionBootstrapConfigurationTests.class, RsaDisabledTests.class,
EncryptorFactoryTests.class, EnvironmentDecryptApplicationInitializerTests.class,
EncryptionIntegrationTests.class,
BootstrapOrderingAutoConfigurationIntegrationTests.class,
MessageSourceConfigurationTests.class,
BootstrapOrderingSpringApplicationJsonIntegrationTests.class,
BootstrapConfigurationTests.class,
BootstrapListenerHierarchyIntegrationTests.class,
BootstrapOrderingCustomPropertySourceIntegrationTests.class,
RefreshEndpointTests.class, RefreshAutoConfigurationClassPathTests.class,
RefreshAutoConfigurationMoreClassPathTests.class,
LifecycleMvcAutoConfigurationTests.class, RefreshAutoConfigurationTests.class,
RestartIntegrationTests.class, ContextRefresherIntegrationTests.class,
ContextRefresherTests.class,
ConfigurationPropertiesRebinderListIntegrationTests.class,
ConfigurationPropertiesRebinderLifecycleIntegrationTests.class,
ConfigurationPropertiesRebinderIntegrationTests.class,
ConfigurationPropertiesRebinderRefreshScopeIntegrationTests.class,
ConfigurationPropertiesRebinderProxyIntegrationTests.class,
RefreshScopeIntegrationTests.class, RefreshScopeConfigurationTests.class,
RefreshScopeLazyIntegrationTests.class, ImportRefreshScopeIntegrationTests.class,
RefreshScopeConcurrencyTests.class, RefreshEndpointIntegrationTests.class,
RefreshScopeConfigurationScaleTests.class,
RefreshScopeNullBeanIntegrationTests.class,
MoreRefreshScopeIntegrationTests.class,
RefreshScopeListBindingIntegrationTests.class,
RefreshScopeWebIntegrationTests.class, RefreshScopePureScaleTests.class,
RefreshScopeScaleTests.class, RefreshScopeSerializationTests.class,
NamedContextFactoryTests.class, EnvironmentManagerIntegrationTests.class,
EnvironmentManagerTest.class, LoggingRebinderTests.class,
RefreshScopeHealthIndicatorTests.class })
@Ignore
public class AdhocTestSuite {

View File

@@ -74,7 +74,7 @@ public class EncryptionBootstrapConfigurationTests {
@Test
public void rsaProperties() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
EncryptionBootstrapConfiguration.class).web(false).properties(
EncryptionBootstrapConfiguration.class).web(WebApplicationType.NONE).properties(
"encrypt.key-store.location:classpath:/server.jks",
"encrypt.key-store.password:letmein",
"encrypt.key-store.alias:mytestkey", "encrypt.key-store.secret:changeme",

View File

@@ -22,6 +22,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.test.ClassPathExclusions;
import org.springframework.cloud.test.ModifiedClassPathRunner;
@@ -41,8 +42,8 @@ public class RsaDisabledTests {
@Before
public void setUp() {
context = new SpringApplicationBuilder().web(false)
.sources(EncryptionBootstrapConfiguration.class).web(false).properties(
context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.sources(EncryptionBootstrapConfiguration.class).web(WebApplicationType.NONE).properties(
"encrypt.key:mykey",
"encrypt.rsa.strong:true",
"encrypt.rsa.salt:foobar").run();

View File

@@ -209,6 +209,7 @@ public class RefreshScopeIntegrationTests {
}
}
@SuppressWarnings("serial")
public static class ServiceException extends Exception {}
@Configuration