Format with Eclipse Oxygen SR2

This commit is contained in:
Andy Wilkinson
2018-02-08 10:53:53 +00:00
parent b4f4dd3fdd
commit 76a450dfba
126 changed files with 556 additions and 611 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -108,7 +108,7 @@ public class BatchAutoConfiguration {
@ConditionalOnMissingBean(JobOperator.class)
public SimpleJobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher,
ListableJobLocator jobRegistry, JobRepository jobRepository)
throws Exception {
throws Exception {
SimpleJobOperator factory = new SimpleJobOperator();
factory.setJobExplorer(jobExplorer);
factory.setJobLauncher(jobLauncher);

View File

@@ -230,7 +230,7 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
private Class<?> doGetFactoryBeanGeneric(ConfigurableListableBeanFactory beanFactory,
BeanDefinition definition)
throws Exception, ClassNotFoundException, LinkageError {
throws Exception, ClassNotFoundException, LinkageError {
if (StringUtils.hasLength(definition.getFactoryBeanName())
&& StringUtils.hasLength(definition.getFactoryMethodName())) {
return getConfigurationClassFactoryBeanGeneric(beanFactory, definition);
@@ -243,7 +243,7 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
private Class<?> getConfigurationClassFactoryBeanGeneric(
ConfigurableListableBeanFactory beanFactory, BeanDefinition definition)
throws Exception {
throws Exception {
Method method = getFactoryMethod(beanFactory, definition);
Class<?> generic = ResolvableType.forMethodReturnType(method)
.as(FactoryBean.class).resolveGeneric();
@@ -305,7 +305,7 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
private Class<?> getDirectFactoryBeanGeneric(
ConfigurableListableBeanFactory beanFactory, BeanDefinition definition)
throws ClassNotFoundException, LinkageError {
throws ClassNotFoundException, LinkageError {
Class<?> factoryBeanClass = ClassUtils.forName(definition.getBeanClassName(),
beanFactory.getBeanClassLoader());
Class<?> generic = ResolvableType.forClass(factoryBeanClass).as(FactoryBean.class)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -248,7 +248,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
private Collection<String> getBeanNamesForType(ListableBeanFactory beanFactory,
String type, ClassLoader classLoader, boolean considerHierarchy)
throws LinkageError {
throws LinkageError {
try {
Set<String> result = new LinkedHashSet<>();
collectBeanNamesForType(result, beanFactory,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -106,7 +106,7 @@ class OnPropertyCondition extends SpringBootCondition {
ConditionMessage.forCondition(ConditionalOnProperty.class, spec)
.found("different value in property",
"different value in properties")
.items(Style.QUOTE, nonMatchingProperties));
.items(Style.QUOTE, nonMatchingProperties));
}
return ConditionOutcome.match(ConditionMessage
.forCondition(ConditionalOnProperty.class, spec).because("matched"));

View File

@@ -165,9 +165,8 @@ public class FlywayAutoConfiguration {
Assert.state(locations.length != 0,
"Migration script locations not configured");
boolean exists = hasAtLeastOneLocation(locations);
Assert.state(exists,
() -> "Cannot find migrations location in: " + Arrays.asList(
locations)
Assert.state(exists, () -> "Cannot find migrations location in: "
+ Arrays.asList(locations)
+ " (please add migrations or check your Flyway configuration)");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -86,7 +86,7 @@ class ActiveMQConnectionFactoryFactory {
private <T extends ActiveMQConnectionFactory> T createConnectionFactoryInstance(
Class<T> factoryClass) throws InstantiationException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException {
InvocationTargetException, NoSuchMethodException {
String brokerUrl = determineBrokerUrl();
String user = this.properties.getUser();
String password = this.properties.getPassword();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -47,7 +47,7 @@ class ArtemisXAConnectionFactoryConfiguration {
@Bean(name = { "jmsConnectionFactory", "xaJmsConnectionFactory" })
public ConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory,
ArtemisProperties properties, XAConnectionFactoryWrapper wrapper)
throws Exception {
throws Exception {
return wrapper.wrapConnectionFactory(
new ArtemisConnectionFactoryFactory(beanFactory, properties)
.createConnectionFactory(ActiveMQXAConnectionFactory.class));

View File

@@ -292,13 +292,13 @@ public class JpaProperties {
private void applyNamingStrategies(Map<String, Object> properties,
ImplicitNamingStrategy implicitStrategyBean,
PhysicalNamingStrategy physicalStrategyBean) {
applyNamingStrategy(properties,
"hibernate.implicit_naming_strategy", implicitStrategyBean != null
? implicitStrategyBean : this.implicitStrategy,
applyNamingStrategy(properties, "hibernate.implicit_naming_strategy",
implicitStrategyBean != null ? implicitStrategyBean
: this.implicitStrategy,
DEFAULT_IMPLICIT_STRATEGY);
applyNamingStrategy(properties,
"hibernate.physical_naming_strategy", physicalStrategyBean != null
? physicalStrategyBean : this.physicalStrategy,
applyNamingStrategy(properties, "hibernate.physical_naming_strategy",
physicalStrategyBean != null ? physicalStrategyBean
: this.physicalStrategy,
DEFAULT_PHYSICAL_STRATEGY);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -24,9 +24,9 @@ import org.springframework.security.web.server.WebFilterChainProxy;
/**
* Switches on {@link EnableWebFluxSecurity} for a reactive web application if this
* annotation has not been added by the user. It delegates
* to Spring Security's content-negotiation mechanism for authentication. This configuration also
* backs off if a bean of type {@link WebFilterChainProxy} has been configured in any other way.
* annotation has not been added by the user. It delegates to Spring Security's
* content-negotiation mechanism for authentication. This configuration also backs off if
* a bean of type {@link WebFilterChainProxy} has been configured in any other way.
*
* @author Madhura Bhave
*/

View File

@@ -69,10 +69,8 @@ public class UserDetailsServiceAutoConfiguration {
ObjectProvider<PasswordEncoder> passwordEncoder) throws Exception {
SecurityProperties.User user = properties.getUser();
List<String> roles = user.getRoles();
return new InMemoryUserDetailsManager(
User.withUsername(user.getName())
.password(getOrDeducePassword(user,
passwordEncoder.getIfAvailable()))
return new InMemoryUserDetailsManager(User.withUsername(user.getName())
.password(getOrDeducePassword(user, passwordEncoder.getIfAvailable()))
.roles(roles.toArray(new String[roles.size()])).build());
}

View File

@@ -191,10 +191,10 @@ public abstract class AbstractErrorWebExceptionHandler
StringBuilder builder = new StringBuilder();
Object message = error.get("message");
Date timestamp = (Date) error.get("timestamp");
builder.append("<html><body><h1>Whitelabel Error Page</h1>")
.append("<p>This application has no configured error view, so you are seeing this as a fallback.</p>")
.append("<div id='created'>").append(timestamp)
.append("</div>").append("<div>There was an unexpected error (type=")
builder.append("<html><body><h1>Whitelabel Error Page</h1>").append(
"<p>This application has no configured error view, so you are seeing this as a fallback.</p>")
.append("<div id='created'>").append(timestamp).append("</div>")
.append("<div>There was an unexpected error (type=")
.append(htmlEscape(error.get("error"))).append(", status=")
.append(htmlEscape(error.get("status"))).append(").</div>");
if (message != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -43,7 +43,7 @@ public class WebClientCodecCustomizer implements WebClientCustomizer {
.exchangeStrategies(ExchangeStrategies.builder()
.codecs((codecs) -> this.codecCustomizers
.forEach((customizer) -> customizer.customize(codecs)))
.build());
.build());
}
}

View File

@@ -321,10 +321,9 @@ public class WebMvcAutoConfiguration {
CacheControl cacheControl = this.resourceProperties.getCache()
.getCachecontrol().toHttpCacheControl();
if (!registry.hasMappingForPattern("/webjars/**")) {
customizeResourceHandlerRegistration(
registry.addResourceHandler("/webjars/**")
.addResourceLocations(
"classpath:/META-INF/resources/webjars/")
customizeResourceHandlerRegistration(registry
.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/")
.setCachePeriod(getSeconds(cachePeriod))
.setCacheControl(cacheControl));
}
@@ -334,8 +333,8 @@ public class WebMvcAutoConfiguration {
registry.addResourceHandler(staticPathPattern)
.addResourceLocations(getResourceLocations(
this.resourceProperties.getStaticLocations()))
.setCachePeriod(getSeconds(cachePeriod))
.setCacheControl(cacheControl));
.setCachePeriod(getSeconds(cachePeriod))
.setCacheControl(cacheControl));
}
}

View File

@@ -765,9 +765,9 @@ public class CacheAutoConfigurationTests {
"spring.cache.cacheNames[0]=foo",
"spring.cache.cacheNames[1]=bar")
.run((context) ->
// see customizer
assertThat(getCacheManager(context, JCacheCacheManager.class)
.getCacheNames()).containsOnly("foo", "custom1"));
// see customizer
assertThat(getCacheManager(context, JCacheCacheManager.class).getCacheNames())
.containsOnly("foo", "custom1"));
}
finally {
Caching.getCachingProvider(cachingProviderClassName).close();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -66,8 +66,8 @@ public class ElasticsearchAutoConfigurationTests {
public void createTransportClient() {
this.context = new AnnotationConfigApplicationContext();
new ElasticsearchNodeTemplate().doWithNode((node) -> {
TestPropertyValues
.of("spring.data.elasticsearch.cluster-nodes:localhost:"
TestPropertyValues.of(
"spring.data.elasticsearch.cluster-nodes:localhost:"
+ node.getTcpPort(),
"spring.data.elasticsearch.properties.path.home:target/es/client")
.applyTo(this.context);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -194,15 +194,17 @@ public class NoSuchBeanDefinitionFailureAnalyzerTests {
}
private void assertActionMissingType(FailureAnalysis analysis, Class<?> type) {
assertThat(analysis.getAction()).startsWith(String
.format("Consider revisiting the conditions above or defining a bean of type '%s' "
+ "in your configuration.", type.getName()));
assertThat(analysis.getAction()).startsWith(String.format(
"Consider revisiting the conditions above or defining a bean of type '%s' "
+ "in your configuration.",
type.getName()));
}
private void assertActionMissingName(FailureAnalysis analysis, String name) {
assertThat(analysis.getAction()).startsWith(String
.format("Consider revisiting the conditions above or defining a bean named '%s' "
+ "in your configuration.", name));
assertThat(analysis.getAction()).startsWith(String.format(
"Consider revisiting the conditions above or defining a bean named '%s' "
+ "in your configuration.",
name));
}
private void assertBeanMethodDisabled(FailureAnalysis analysis, String description,

View File

@@ -89,9 +89,8 @@ public class FreeMarkerAutoConfigurationReactiveIntegrationTests {
@Test
public void customTemplateLoaderPath() {
this.contextRunner
.withPropertyValues(
"spring.freemarker.templateLoaderPath:classpath:/custom-templates/")
this.contextRunner.withPropertyValues(
"spring.freemarker.templateLoaderPath:classpath:/custom-templates/")
.run((context) -> {
MockServerWebExchange exchange = render(context, "custom");
String result = exchange.getResponse().getBodyAsString().block();

View File

@@ -78,9 +78,8 @@ public class FreeMarkerAutoConfigurationTests {
@Test
public void nonExistentLocationAndEmptyLocation() {
new File("target/test-classes/templates/empty-directory").mkdir();
this.contextRunner
.withPropertyValues("spring.freemarker.templateLoaderPath:"
+ "classpath:/does-not-exist/,classpath:/templates/empty-directory/")
this.contextRunner.withPropertyValues("spring.freemarker.templateLoaderPath:"
+ "classpath:/does-not-exist/,classpath:/templates/empty-directory/")
.run((context) -> {
});
}

View File

@@ -51,9 +51,8 @@ public class ProjectInfoAutoConfigurationTests {
@Test
public void gitPropertiesWithNoData() {
this.contextRunner
.withPropertyValues("spring.info.git.location="
+ "classpath:/org/springframework/boot/autoconfigure/info/git-no-data.properties")
this.contextRunner.withPropertyValues("spring.info.git.location="
+ "classpath:/org/springframework/boot/autoconfigure/info/git-no-data.properties")
.run((context) -> {
GitProperties gitProperties = context.getBean(GitProperties.class);
assertThat(gitProperties.getBranch()).isNull();
@@ -87,9 +86,8 @@ public class ProjectInfoAutoConfigurationTests {
@Test
public void buildPropertiesCustomLocation() {
this.contextRunner
.withPropertyValues("spring.info.build.location="
+ "classpath:/org/springframework/boot/autoconfigure/info/build-info.properties")
this.contextRunner.withPropertyValues("spring.info.build.location="
+ "classpath:/org/springframework/boot/autoconfigure/info/build-info.properties")
.run((context) -> {
BuildProperties buildProperties = context
.getBean(BuildProperties.class);

View File

@@ -139,9 +139,8 @@ public class JacksonAutoConfigurationTests {
@Test
public void customDateFormatClass() {
this.contextRunner
.withPropertyValues(
"spring.jackson.date-format:org.springframework.boot.autoconfigure.jackson.JacksonAutoConfigurationTests.MyDateFormat")
this.contextRunner.withPropertyValues(
"spring.jackson.date-format:org.springframework.boot.autoconfigure.jackson.JacksonAutoConfigurationTests.MyDateFormat")
.run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.class);
assertThat(mapper.getDateFormat()).isInstanceOf(MyDateFormat.class);
@@ -169,9 +168,8 @@ public class JacksonAutoConfigurationTests {
@Test
public void customPropertyNamingStrategyClass() {
this.contextRunner
.withPropertyValues(
"spring.jackson.property-naming-strategy:com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy")
this.contextRunner.withPropertyValues(
"spring.jackson.property-naming-strategy:com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy")
.run((context) -> {
ObjectMapper mapper = context.getBean(ObjectMapper.class);
assertThat(mapper.getPropertyNamingStrategy())

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -130,21 +130,20 @@ public class JmsAutoConfigurationTests {
@Test
public void testEnableJmsCreateDefaultContainerFactory() {
this.contextRunner.withUserConfiguration(EnableJmsConfiguration.class)
.run((context) -> assertThat(context)
.getBean("jmsListenerContainerFactory",
JmsListenerContainerFactory.class)
.run((context) -> assertThat(context).getBean(
"jmsListenerContainerFactory", JmsListenerContainerFactory.class)
.isExactlyInstanceOf(DefaultJmsListenerContainerFactory.class));
}
@Test
public void testJmsListenerContainerFactoryBackOff() {
this.contextRunner
.withUserConfiguration(TestConfiguration6.class,
EnableJmsConfiguration.class)
.run((context) -> assertThat(context)
.getBean("jmsListenerContainerFactory",
JmsListenerContainerFactory.class)
.isExactlyInstanceOf(SimpleJmsListenerContainerFactory.class));
this.contextRunner.withUserConfiguration(TestConfiguration6.class,
EnableJmsConfiguration.class).run(
(context) -> assertThat(context)
.getBean("jmsListenerContainerFactory",
JmsListenerContainerFactory.class)
.isExactlyInstanceOf(
SimpleJmsListenerContainerFactory.class));
}
@Test
@@ -414,9 +413,8 @@ public class JmsAutoConfigurationTests {
@Test
public void enableJmsAutomatically() {
this.contextRunner.withUserConfiguration(NoEnableJmsConfiguration.class)
.run((context) -> assertThat(context)
.hasBean(
JmsListenerConfigUtils.JMS_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)
.run((context) -> assertThat(context).hasBean(
JmsListenerConfigUtils.JMS_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)
.hasBean(
JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -214,9 +214,8 @@ public class ArtemisAutoConfigurationTests {
@Test
public void embeddedServiceWithCustomArtemisConfiguration() {
this.contextRunner.withUserConfiguration(CustomArtemisConfiguration.class)
.run((context) -> assertThat(context
.getBean(
org.apache.activemq.artemis.core.config.Configuration.class)
.run((context) -> assertThat(context.getBean(
org.apache.activemq.artemis.core.config.Configuration.class)
.getName()).isEqualTo("customFooBar"));
}
@@ -250,19 +249,22 @@ public class ArtemisAutoConfigurationTests {
this.contextRunner
.withPropertyValues("spring.artemis.embedded.queues=Queue2")
.run((second) -> {
ArtemisProperties firstProperties = first
.getBean(ArtemisProperties.class);
ArtemisProperties secondProperties = second
.getBean(ArtemisProperties.class);
assertThat(firstProperties.getEmbedded().getServerId())
.isLessThan(secondProperties.getEmbedded().getServerId());
DestinationChecker firstChecker = new DestinationChecker(first);
firstChecker.checkQueue("Queue1", true);
firstChecker.checkQueue("Queue2", true);
DestinationChecker secondChecker = new DestinationChecker(second);
secondChecker.checkQueue("Queue2", true);
secondChecker.checkQueue("Queue1", true);
});
ArtemisProperties firstProperties = first
.getBean(ArtemisProperties.class);
ArtemisProperties secondProperties = second
.getBean(ArtemisProperties.class);
assertThat(firstProperties.getEmbedded().getServerId())
.isLessThan(secondProperties.getEmbedded()
.getServerId());
DestinationChecker firstChecker = new DestinationChecker(
first);
firstChecker.checkQueue("Queue1", true);
firstChecker.checkQueue("Queue2", true);
DestinationChecker secondChecker = new DestinationChecker(
second);
secondChecker.checkQueue("Queue2", true);
secondChecker.checkQueue("Queue1", true);
});
});
}
@@ -279,12 +281,13 @@ public class ArtemisAutoConfigurationTests {
// Do not start a specific one
"spring.artemis.embedded.enabled=false")
.run((secondContext) -> {
DestinationChecker firstChecker = new DestinationChecker(first);
firstChecker.checkQueue("Queue1", true);
DestinationChecker secondChecker = new DestinationChecker(
secondContext);
secondChecker.checkQueue("Queue1", true);
});
DestinationChecker firstChecker = new DestinationChecker(
first);
firstChecker.checkQueue("Queue1", true);
DestinationChecker secondChecker = new DestinationChecker(
secondContext);
secondChecker.checkQueue("Queue1", true);
});
});
}

View File

@@ -77,12 +77,11 @@ public class LdapAutoConfigurationTests {
@Test
public void contextSourceWithExtraCustomization() {
this.contextRunner
.withPropertyValues("spring.ldap.urls:ldap://localhost:123",
"spring.ldap.username:root", "spring.ldap.password:secret",
"spring.ldap.anonymous-read-only:true",
"spring.ldap.base:cn=SpringDevelopers",
"spring.ldap.baseEnvironment.java.naming.security.authentication:DIGEST-MD5")
this.contextRunner.withPropertyValues("spring.ldap.urls:ldap://localhost:123",
"spring.ldap.username:root", "spring.ldap.password:secret",
"spring.ldap.anonymous-read-only:true",
"spring.ldap.base:cn=SpringDevelopers",
"spring.ldap.baseEnvironment.java.naming.security.authentication:DIGEST-MD5")
.run((context) -> {
LdapContextSource contextSource = context
.getBean(LdapContextSource.class);

View File

@@ -102,9 +102,8 @@ public class MongoReactiveAutoConfigurationTests {
@Test
public void customizerOverridesAutoConfig() {
this.contextRunner
.withPropertyValues(
"spring.data.mongodb.uri:mongodb://localhost/test?appname=auto-config")
this.contextRunner.withPropertyValues(
"spring.data.mongodb.uri:mongodb://localhost/test?appname=auto-config")
.withUserConfiguration(SimpleCustomizerConfig.class).run((context) -> {
assertThat(context).hasSingleBean(MongoClient.class);
MongoClient client = context.getBean(MongoClient.class);

View File

@@ -63,10 +63,9 @@ public class CustomHibernateJpaAutoConfigurationTests {
@Test
public void namingStrategyDelegatorTakesPrecedence() {
this.contextRunner
.withPropertyValues(
"spring.jpa.properties.hibernate.ejb.naming_strategy_delegator:"
+ "org.hibernate.cfg.naming.ImprovedNamingStrategyDelegator")
this.contextRunner.withPropertyValues(
"spring.jpa.properties.hibernate.ejb.naming_strategy_delegator:"
+ "org.hibernate.cfg.naming.ImprovedNamingStrategyDelegator")
.run((context) -> {
JpaProperties bean = context.getBean(JpaProperties.class);
Map<String, Object> hibernateProperties = bean.getHibernateProperties(

View File

@@ -131,10 +131,9 @@ public class HibernateJpaAutoConfigurationTests
@Test
public void testLiquibasePlusValidation() {
contextRunner()
.withPropertyValues("spring.datasource.initialization-mode:never",
"spring.liquibase.changeLog:classpath:db/changelog/db.changelog-city.yaml",
"spring.jpa.hibernate.ddl-auto:validate")
contextRunner().withPropertyValues("spring.datasource.initialization-mode:never",
"spring.liquibase.changeLog:classpath:db/changelog/db.changelog-city.yaml",
"spring.jpa.hibernate.ddl-auto:validate")
.withConfiguration(
AutoConfigurations.of(LiquibaseAutoConfiguration.class))
.run((context) -> assertThat(context).hasNotFailed());
@@ -224,11 +223,10 @@ public class HibernateJpaAutoConfigurationTests
@Test
public void providerDisablesAutoCommitIsNotConfiguredIfPropertyIsSet() {
contextRunner()
.withPropertyValues(
"spring.datasource.type:" + HikariDataSource.class.getName(),
"spring.datasource.hikari.auto-commit:false",
"spring.jpa.properties.hibernate.connection.provider_disables_autocommit=false")
contextRunner().withPropertyValues(
"spring.datasource.type:" + HikariDataSource.class.getName(),
"spring.datasource.hikari.auto-commit:false",
"spring.jpa.properties.hibernate.connection.provider_disables_autocommit=false")
.run((context) -> {
Map<String, Object> jpaProperties = context
.getBean(LocalContainerEntityManagerFactoryBean.class)

View File

@@ -74,10 +74,9 @@ public class JpaPropertiesTests {
@Test
public void hibernate5CustomNamingStrategies() {
this.contextRunner
.withPropertyValues(
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit",
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical")
this.contextRunner.withPropertyValues(
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit",
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical")
.run(assertJpaProperties((properties) -> {
Map<String, Object> hibernateProperties = properties
.getHibernateProperties(
@@ -111,10 +110,9 @@ public class JpaPropertiesTests {
@Test
public void namingStrategyInstancesTakePrecedenceOverNamingStrategyProperties() {
this.contextRunner
.withPropertyValues(
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit",
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical")
this.contextRunner.withPropertyValues(
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit",
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical")
.run(assertJpaProperties((properties) -> {
ImplicitNamingStrategy implicitStrategy = mock(
ImplicitNamingStrategy.class);
@@ -136,10 +134,9 @@ public class JpaPropertiesTests {
@Test
public void hibernatePropertiesCustomizerTakePrecedenceOverStrategyInstancesAndNamingStrategyProperties() {
this.contextRunner
.withPropertyValues(
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit",
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical")
this.contextRunner.withPropertyValues(
"spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit",
"spring.jpa.hibernate.naming.physical-strategy:com.example.Physical")
.run(assertJpaProperties((properties) -> {
ImplicitNamingStrategy implicitStrategy = mock(
ImplicitNamingStrategy.class);
@@ -174,10 +171,9 @@ public class JpaPropertiesTests {
@Test
public void hibernate5CustomNamingStrategiesViaJpaProperties() {
this.contextRunner
.withPropertyValues(
"spring.jpa.properties.hibernate.implicit_naming_strategy:com.example.Implicit",
"spring.jpa.properties.hibernate.physical_naming_strategy:com.example.Physical")
this.contextRunner.withPropertyValues(
"spring.jpa.properties.hibernate.implicit_naming_strategy:com.example.Implicit",
"spring.jpa.properties.hibernate.physical_naming_strategy:com.example.Physical")
.run(assertJpaProperties((properties) -> {
Map<String, Object> hibernateProperties = properties
.getHibernateProperties(

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -187,9 +187,8 @@ public class OAuth2WebSecurityConfigurationTests {
private ClientRegistration getClientRegistration(String id, String userInfoUri) {
ClientRegistration.Builder builder = ClientRegistration
.withRegistrationId(id);
builder.clientName("foo").clientId("foo")
.clientAuthenticationMethod(
org.springframework.security.oauth2.core.ClientAuthenticationMethod.BASIC)
builder.clientName("foo").clientId("foo").clientAuthenticationMethod(
org.springframework.security.oauth2.core.ClientAuthenticationMethod.BASIC)
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
.scope("read").clientSecret("secret")
.redirectUriTemplate("http://redirect-uri.com")

View File

@@ -46,8 +46,8 @@ import static org.mockito.Mockito.mock;
public class ReactiveUserDetailsServiceAutoConfigurationTests {
private final ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner()
.withConfiguration(
AutoConfigurations.of(ReactiveUserDetailsServiceAutoConfiguration.class));
.withConfiguration(AutoConfigurations
.of(ReactiveUserDetailsServiceAutoConfiguration.class));
@Test
public void configuresADefaultUser() {
@@ -62,7 +62,8 @@ public class ReactiveUserDetailsServiceAutoConfigurationTests {
@Test
public void doesNotConfigureDefaultUserIfUserDetailsServiceAvailable() {
this.contextRunner.withUserConfiguration(UserConfig.class, TestSecurityConfiguration.class)
this.contextRunner
.withUserConfiguration(UserConfig.class, TestSecurityConfiguration.class)
.run((context) -> {
ReactiveUserDetailsService userDetailsService = context
.getBean(ReactiveUserDetailsService.class);
@@ -88,8 +89,7 @@ public class ReactiveUserDetailsServiceAutoConfigurationTests {
@Test
public void userDetailsServiceWhenPasswordEncoderAbsentAndDefaultPassword() {
this.contextRunner
.withUserConfiguration(TestSecurityConfiguration.class)
this.contextRunner.withUserConfiguration(TestSecurityConfiguration.class)
.run(((context) -> {
MapReactiveUserDetailsService userDetailsService = context
.getBean(MapReactiveUserDetailsService.class);
@@ -117,8 +117,7 @@ public class ReactiveUserDetailsServiceAutoConfigurationTests {
private void testPasswordEncoding(Class<?> configClass, String providedPassword,
String expectedPassword) {
this.contextRunner
.withUserConfiguration(configClass)
this.contextRunner.withUserConfiguration(configClass)
.withPropertyValues("spring.security.user.password=" + providedPassword)
.run(((context) -> {
MapReactiveUserDetailsService userDetailsService = context

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -38,8 +38,11 @@ public class WebFluxSecurityConfigurationTests {
@Test
public void backsOffWhenWebFilterChainProxyBeanPresent() {
this.contextRunner.withUserConfiguration(WebFilterChainProxyConfiguration.class, WebFluxSecurityConfiguration.class)
.run(context -> assertThat(context).doesNotHaveBean(WebFluxSecurityConfiguration.class));
this.contextRunner
.withUserConfiguration(WebFilterChainProxyConfiguration.class,
WebFluxSecurityConfiguration.class)
.run(context -> assertThat(context)
.doesNotHaveBean(WebFluxSecurityConfiguration.class));
}
@Test

View File

@@ -78,14 +78,15 @@ public class SecurityAutoConfigurationTests {
@Test
public void testDefaultFilterOrderWithSecurityAdapter() {
this.contextRunner.withConfiguration(AutoConfigurations.of(WebSecurity.class,
SecurityFilterAutoConfiguration.class)).run(
(context) -> assertThat(context
.getBean("securityFilterChainRegistration",
DelegatingFilterProxyRegistrationBean.class)
.getOrder()).isEqualTo(
FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER
- 100));
this.contextRunner
.withConfiguration(AutoConfigurations.of(WebSecurity.class,
SecurityFilterAutoConfiguration.class))
.run((context) -> assertThat(context
.getBean("securityFilterChainRegistration",
DelegatingFilterProxyRegistrationBean.class)
.getOrder()).isEqualTo(
FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER
- 100));
}
@Test
@@ -118,14 +119,15 @@ public class SecurityAutoConfigurationTests {
@Test
public void testDefaultFilterOrder() {
this.contextRunner.withConfiguration(
AutoConfigurations.of(SecurityFilterAutoConfiguration.class)).run(
(context) -> assertThat(context
.getBean("securityFilterChainRegistration",
DelegatingFilterProxyRegistrationBean.class)
.getOrder()).isEqualTo(
FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER
- 100));
this.contextRunner
.withConfiguration(
AutoConfigurations.of(SecurityFilterAutoConfiguration.class))
.run((context) -> assertThat(context
.getBean("securityFilterChainRegistration",
DelegatingFilterProxyRegistrationBean.class)
.getOrder()).isEqualTo(
FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER
- 100));
}
@Test
@@ -137,7 +139,7 @@ public class SecurityAutoConfigurationTests {
(context) -> assertThat(context
.getBean("securityFilterChainRegistration",
DelegatingFilterProxyRegistrationBean.class)
.getOrder()).isEqualTo(12345));
.getOrder()).isEqualTo(12345));
}
@Test

View File

@@ -52,8 +52,8 @@ import static org.mockito.Mockito.mock;
public class UserDetailsServiceAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withUserConfiguration(TestSecurityConfiguration.class)
.withConfiguration(AutoConfigurations.of(UserDetailsServiceAutoConfiguration.class));
.withUserConfiguration(TestSecurityConfiguration.class).withConfiguration(
AutoConfigurations.of(UserDetailsServiceAutoConfiguration.class));
@Rule
public OutputCapture outputCapture = new OutputCapture();
@@ -115,7 +115,8 @@ public class UserDetailsServiceAutoConfigurationTests {
@Test
public void userDetailsServiceWhenPasswordEncoderAbsentAndDefaultPassword() {
this.contextRunner.withUserConfiguration(TestSecurityConfiguration.class).run(((context) -> {
this.contextRunner.withUserConfiguration(TestSecurityConfiguration.class)
.run(((context) -> {
InMemoryUserDetailsManager userDetailsService = context
.getBean(InMemoryUserDetailsManager.class);
String password = userDetailsService.loadUserByUsername("user")
@@ -150,8 +151,7 @@ public class UserDetailsServiceAutoConfigurationTests {
private void testPasswordEncoding(Class<?> configClass, String providedPassword,
String expectedPassword) {
this.contextRunner
.withUserConfiguration(configClass)
this.contextRunner.withUserConfiguration(configClass)
.withPropertyValues("spring.security.user.password=" + providedPassword)
.run(((context) -> {
InMemoryUserDetailsManager userDetailsService = context

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -117,10 +117,9 @@ public class SessionAutoConfigurationJdbcTests
@Test
public void customTableName() {
this.contextRunner
.withPropertyValues("spring.session.store-type=jdbc",
"spring.session.jdbc.table-name=FOO_BAR",
"spring.session.jdbc.schema=classpath:session/custom-schema-h2.sql")
this.contextRunner.withPropertyValues("spring.session.store-type=jdbc",
"spring.session.jdbc.table-name=FOO_BAR",
"spring.session.jdbc.schema=classpath:session/custom-schema-h2.sql")
.run((context) -> {
JdbcOperationsSessionRepository repository = validateSessionRepository(
context, JdbcOperationsSessionRepository.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -202,11 +202,9 @@ public class MultipartAutoConfigurationTests {
private void verify404() throws Exception {
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
ClientHttpRequest request = requestFactory
.createRequest(
new URI("http://localhost:"
+ this.context.getWebServer().getPort() + "/"),
HttpMethod.GET);
ClientHttpRequest request = requestFactory.createRequest(new URI(
"http://localhost:" + this.context.getWebServer().getPort() + "/"),
HttpMethod.GET);
ClientHttpResponse response = request.execute();
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
}

View File

@@ -880,7 +880,7 @@ public class WebMvcAutoConfigurationTests {
@Override
protected void renderMergedOutputModel(Map<String, Object> model,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
throws Exception {
response.getOutputStream().write("Hello World".getBytes());
}

View File

@@ -205,7 +205,7 @@ public class WelcomePageHandlerMappingTests {
@Override
protected void renderMergedOutputModel(Map<String, Object> model,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
throws Exception {
response.getWriter().print(name + " template");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -259,7 +259,7 @@ public class BasicErrorControllerIntegrationTests {
@Override
protected void renderMergedOutputModel(Map<String, Object> model,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
throws Exception {
response.getWriter().write("ERROR_BEAN");
}
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 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.
@@ -153,7 +153,7 @@ public class BasicErrorControllerMockMvcTests {
@Override
protected void renderMergedOutputModel(Map<String, Object> model,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
throws Exception {
response.getWriter().write("ERROR_BEAN");
}
};