Commit 6121208c authored by Phillip Webb's avatar Phillip Webb

Polish formatting

parent 4b9cba35
...@@ -126,6 +126,7 @@ public class ManagementWebSecurityAutoConfiguration { ...@@ -126,6 +126,7 @@ public class ManagementWebSecurityAutoConfiguration {
} }
} }
} }
@Configuration @Configuration
......
...@@ -45,8 +45,8 @@ import org.springframework.web.util.UrlPathHelper; ...@@ -45,8 +45,8 @@ import org.springframework.web.util.UrlPathHelper;
*/ */
@ConfigurationProperties(prefix = "endpoints.jolokia", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.jolokia", ignoreUnknownFields = false)
@HypermediaDisabled @HypermediaDisabled
public class JolokiaMvcEndpoint extends AbstractNamedMvcEndpoint public class JolokiaMvcEndpoint extends AbstractNamedMvcEndpoint implements
implements InitializingBean, ApplicationContextAware, ServletContextAware, DisposableBean { InitializingBean, ApplicationContextAware, ServletContextAware, DisposableBean {
private final ServletWrappingController controller = new ServletWrappingController(); private final ServletWrappingController controller = new ServletWrappingController();
......
...@@ -64,8 +64,8 @@ public class AuthorizationAuditListener extends AbstractAuthorizationAuditListen ...@@ -64,8 +64,8 @@ public class AuthorizationAuditListener extends AbstractAuthorizationAuditListen
if (event.getAuthentication().getDetails() != null) { if (event.getAuthentication().getDetails() != null) {
data.put("details", event.getAuthentication().getDetails()); data.put("details", event.getAuthentication().getDetails());
} }
publish(new AuditEvent(event.getAuthentication().getName(), publish(new AuditEvent(event.getAuthentication().getName(), AUTHORIZATION_FAILURE,
AUTHORIZATION_FAILURE, data)); data));
} }
} }
...@@ -346,8 +346,8 @@ public class CrshAutoConfigurationTests { ...@@ -346,8 +346,8 @@ public class CrshAutoConfigurationTests {
&& authentication.getCredentials().equals(PASSWORD)) { && authentication.getCredentials().equals(PASSWORD)) {
authentication = new UsernamePasswordAuthenticationToken( authentication = new UsernamePasswordAuthenticationToken(
authentication.getPrincipal(), authentication.getPrincipal(),
authentication.getCredentials(), Collections authentication.getCredentials(), Collections.singleton(
.singleton(new SimpleGrantedAuthority("ACTUATOR"))); new SimpleGrantedAuthority("ACTUATOR")));
} }
else { else {
throw new BadCredentialsException( throw new BadCredentialsException(
......
...@@ -269,8 +269,8 @@ public class EndpointMBeanExporterTests { ...@@ -269,8 +269,8 @@ public class EndpointMBeanExporterTests {
MBeanExporter mbeanExporter = registerLoggersEndpoint(); MBeanExporter mbeanExporter = registerLoggersEndpoint();
Object response = mbeanExporter.getServer().invoke( Object response = mbeanExporter.getServer().invoke(
getObjectName("loggersEndpoint", this.context), "setLogLevel", getObjectName("loggersEndpoint", this.context), "setLogLevel",
new Object[]{"com.example", "trace"}, new Object[] { "com.example", "trace" },
new String[]{String.class.getName(), String.class.getName()}); new String[] { String.class.getName(), String.class.getName() });
assertThat(response).isNull(); assertThat(response).isNull();
} }
...@@ -280,10 +280,9 @@ public class EndpointMBeanExporterTests { ...@@ -280,10 +280,9 @@ public class EndpointMBeanExporterTests {
this.thrown.expect(MBeanException.class); this.thrown.expect(MBeanException.class);
this.thrown.expectCause(hasMessage(containsString("No enum constant"))); this.thrown.expectCause(hasMessage(containsString("No enum constant")));
this.thrown.expectCause(hasMessage(containsString("LogLevel.INVALID"))); this.thrown.expectCause(hasMessage(containsString("LogLevel.INVALID")));
mbeanExporter.getServer().invoke( mbeanExporter.getServer().invoke(getObjectName("loggersEndpoint", this.context),
getObjectName("loggersEndpoint", this.context), "setLogLevel", "setLogLevel", new Object[] { "com.example", "invalid" },
new Object[]{"com.example", "invalid"}, new String[] { String.class.getName(), String.class.getName() });
new String[]{String.class.getName(), String.class.getName()});
} }
private MBeanExporter registerLoggersEndpoint() { private MBeanExporter registerLoggersEndpoint() {
......
...@@ -109,6 +109,7 @@ public class MvcEndpointsTests { ...@@ -109,6 +109,7 @@ public class MvcEndpointsTests {
TestMvcEndpoint(Endpoint<?> delegate) { TestMvcEndpoint(Endpoint<?> delegate) {
super(delegate); super(delegate);
} }
} }
private static class OtherTestMvcEndpoint extends EndpointMvcAdapter { private static class OtherTestMvcEndpoint extends EndpointMvcAdapter {
...@@ -116,6 +117,7 @@ public class MvcEndpointsTests { ...@@ -116,6 +117,7 @@ public class MvcEndpointsTests {
OtherTestMvcEndpoint(Endpoint<?> delegate) { OtherTestMvcEndpoint(Endpoint<?> delegate) {
super(delegate); super(delegate);
} }
} }
} }
...@@ -86,8 +86,8 @@ public class AuthenticationAuditListenerTests { ...@@ -86,8 +86,8 @@ public class AuthenticationAuditListenerTests {
AuditApplicationEvent event = handleAuthenticationEvent( AuditApplicationEvent event = handleAuthenticationEvent(
new AuthenticationSwitchUserEvent( new AuthenticationSwitchUserEvent(
new UsernamePasswordAuthenticationToken("user", "password"), new UsernamePasswordAuthenticationToken("user", "password"),
new User("user", "password", new User("user", "password", AuthorityUtils
AuthorityUtils.commaSeparatedStringToAuthorityList("USER")))); .commaSeparatedStringToAuthorityList("USER"))));
assertThat(event.getAuditEvent().getType()) assertThat(event.getAuditEvent().getType())
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_SWITCH); .isEqualTo(AuthenticationAuditListener.AUTHENTICATION_SWITCH);
} }
...@@ -98,12 +98,12 @@ public class AuthenticationAuditListenerTests { ...@@ -98,12 +98,12 @@ public class AuthenticationAuditListenerTests {
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
"user", "password"); "user", "password");
authentication.setDetails(details); authentication.setDetails(details);
AuditApplicationEvent event = handleAuthenticationEvent(new AuthenticationFailureExpiredEvent( AuditApplicationEvent event = handleAuthenticationEvent(
authentication, new BadCredentialsException("Bad user"))); new AuthenticationFailureExpiredEvent(authentication,
new BadCredentialsException("Bad user")));
assertThat(event.getAuditEvent().getType()) assertThat(event.getAuditEvent().getType())
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE); .isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
assertThat(event.getAuditEvent().getData()) assertThat(event.getAuditEvent().getData()).containsEntry("details", details);
.containsEntry("details", details);
} }
private AuditApplicationEvent handleAuthenticationEvent( private AuditApplicationEvent handleAuthenticationEvent(
......
...@@ -56,7 +56,8 @@ public class AuthorizationAuditListenerTests { ...@@ -56,7 +56,8 @@ public class AuthorizationAuditListenerTests {
public void testAuthenticationCredentialsNotFound() { public void testAuthenticationCredentialsNotFound() {
AuditApplicationEvent event = handleAuthorizationEvent( AuditApplicationEvent event = handleAuthorizationEvent(
new AuthenticationCredentialsNotFoundEvent(this, new AuthenticationCredentialsNotFoundEvent(this,
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")), Collections.<ConfigAttribute>singletonList(
new SecurityConfig("USER")),
new AuthenticationCredentialsNotFoundException("Bad user"))); new AuthenticationCredentialsNotFoundException("Bad user")));
assertThat(event.getAuditEvent().getType()) assertThat(event.getAuditEvent().getType())
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE); .isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
...@@ -66,7 +67,8 @@ public class AuthorizationAuditListenerTests { ...@@ -66,7 +67,8 @@ public class AuthorizationAuditListenerTests {
public void testAuthorizationFailure() { public void testAuthorizationFailure() {
AuditApplicationEvent event = handleAuthorizationEvent( AuditApplicationEvent event = handleAuthorizationEvent(
new AuthorizationFailureEvent(this, new AuthorizationFailureEvent(this,
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")), Collections.<ConfigAttribute>singletonList(
new SecurityConfig("USER")),
new UsernamePasswordAuthenticationToken("user", "password"), new UsernamePasswordAuthenticationToken("user", "password"),
new AccessDeniedException("Bad user"))); new AccessDeniedException("Bad user")));
assertThat(event.getAuditEvent().getType()) assertThat(event.getAuditEvent().getType())
...@@ -81,7 +83,8 @@ public class AuthorizationAuditListenerTests { ...@@ -81,7 +83,8 @@ public class AuthorizationAuditListenerTests {
authentication.setDetails(details); authentication.setDetails(details);
AuditApplicationEvent event = handleAuthorizationEvent( AuditApplicationEvent event = handleAuthorizationEvent(
new AuthorizationFailureEvent(this, new AuthorizationFailureEvent(this,
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")), Collections.<ConfigAttribute>singletonList(
new SecurityConfig("USER")),
authentication, new AccessDeniedException("Bad user"))); authentication, new AccessDeniedException("Bad user")));
assertThat(event.getAuditEvent().getType()) assertThat(event.getAuditEvent().getType())
.isEqualTo(AuthorizationAuditListener.AUTHORIZATION_FAILURE); .isEqualTo(AuthorizationAuditListener.AUTHORIZATION_FAILURE);
......
...@@ -30,7 +30,6 @@ public enum SearchStrategy { ...@@ -30,7 +30,6 @@ public enum SearchStrategy {
/** /**
* Search all parents and ancestors, but not the current context. * Search all parents and ancestors, but not the current context.
*
* @deprecated since 1.5 in favor of {@link SearchStrategy#ANCESTORS} * @deprecated since 1.5 in favor of {@link SearchStrategy#ANCESTORS}
*/ */
@Deprecated PARENTS, @Deprecated PARENTS,
......
...@@ -84,6 +84,7 @@ abstract class DataSourceConfiguration { ...@@ -84,6 +84,7 @@ abstract class DataSourceConfiguration {
/** /**
* DBCP DataSource configuration. * DBCP DataSource configuration.
*
* @deprecated as of Spring Boot 1.5 in favor of DBCP2 * @deprecated as of Spring Boot 1.5 in favor of DBCP2
*/ */
@ConditionalOnClass(org.apache.commons.dbcp.BasicDataSource.class) @ConditionalOnClass(org.apache.commons.dbcp.BasicDataSource.class)
......
...@@ -124,8 +124,8 @@ class DataSourceInitializer implements ApplicationListener<DataSourceInitialized ...@@ -124,8 +124,8 @@ class DataSourceInitializer implements ApplicationListener<DataSourceInitialized
runScripts(scripts, username, password); runScripts(scripts, username, password);
} }
private List<Resource> getScripts(String propertyName, private List<Resource> getScripts(String propertyName, List<String> resources,
List<String> resources, String fallback) { String fallback) {
if (resources != null) { if (resources != null) {
return getResources(propertyName, resources, true); return getResources(propertyName, resources, true);
} }
...@@ -136,8 +136,8 @@ class DataSourceInitializer implements ApplicationListener<DataSourceInitialized ...@@ -136,8 +136,8 @@ class DataSourceInitializer implements ApplicationListener<DataSourceInitialized
return getResources(propertyName, fallbackResources, false); return getResources(propertyName, fallbackResources, false);
} }
private List<Resource> getResources(String propertyName, private List<Resource> getResources(String propertyName, List<String> locations,
List<String> locations, boolean validate) { boolean validate) {
List<Resource> resources = new ArrayList<Resource>(); List<Resource> resources = new ArrayList<Resource>();
for (String location : locations) { for (String location : locations) {
for (Resource resource : doGetResources(location)) { for (Resource resource : doGetResources(location)) {
......
...@@ -130,6 +130,7 @@ public class JmsProperties { ...@@ -130,6 +130,7 @@ public class JmsProperties {
? this.concurrency + "-" + this.maxConcurrency ? this.concurrency + "-" + this.maxConcurrency
: String.valueOf(this.concurrency)); : String.valueOf(this.concurrency));
} }
} }
public static class Template { public static class Template {
......
...@@ -30,8 +30,8 @@ import org.springframework.jdbc.support.SQLExceptionTranslator; ...@@ -30,8 +30,8 @@ import org.springframework.jdbc.support.SQLExceptionTranslator;
import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator; import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator;
/** /**
* Transforms {@link java.sql.SQLException} into a Spring-specific {@link * Transforms {@link java.sql.SQLException} into a Spring-specific
* DataAccessException}. * {@link DataAccessException}.
* *
* @author Lukas Eder * @author Lukas Eder
* @author Andreas Ahlenstorf * @author Andreas Ahlenstorf
......
...@@ -56,7 +56,8 @@ public class ValidationAutoConfiguration { ...@@ -56,7 +56,8 @@ public class ValidationAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public MethodValidationPostProcessor methodValidationPostProcessor(Validator validator) { public MethodValidationPostProcessor methodValidationPostProcessor(
Validator validator) {
MethodValidationPostProcessor processor = new MethodValidationPostProcessor(); MethodValidationPostProcessor processor = new MethodValidationPostProcessor();
processor.setValidator(validator); processor.setValidator(validator);
return processor; return processor;
......
...@@ -1554,6 +1554,7 @@ public class ServerProperties ...@@ -1554,6 +1554,7 @@ public class ServerProperties
public void setRotate(boolean rotate) { public void setRotate(boolean rotate) {
this.rotate = rotate; this.rotate = rotate;
} }
} }
} }
......
...@@ -297,9 +297,8 @@ public class DataSourceInitializerTests { ...@@ -297,9 +297,8 @@ public class DataSourceInitializerTests {
PropertyPlaceholderAutoConfiguration.class); PropertyPlaceholderAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, EnvironmentTestUtils.addEnvironment(this.context,
"spring.datasource.initialize:true", "spring.datasource.initialize:true",
"spring.datasource.schema:" "spring.datasource.schema:" + ClassUtils
+ ClassUtils.addResourcePathToPackagePath(getClass(), .addResourcePathToPackagePath(getClass(), "schema.sql"),
"schema.sql"),
"spring.datasource.data:classpath:does/not/exist.sql"); "spring.datasource.data:classpath:does/not/exist.sql");
this.thrown.expect(BeanCreationException.class); this.thrown.expect(BeanCreationException.class);
......
...@@ -67,14 +67,15 @@ public class ValidationAutoConfigurationTests { ...@@ -67,14 +67,15 @@ public class ValidationAutoConfigurationTests {
public void userDefinedMethodValidationPostProcessorTakesPrecedence() { public void userDefinedMethodValidationPostProcessorTakesPrecedence() {
load(SampleConfiguration.class); load(SampleConfiguration.class);
assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1); assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1);
Object userMethodValidationPostProcessor = Object userMethodValidationPostProcessor = this.context
this.context.getBean("testMethodValidationPostProcessor"); .getBean("testMethodValidationPostProcessor");
assertThat(this.context.getBean(MethodValidationPostProcessor.class)) assertThat(this.context.getBean(MethodValidationPostProcessor.class))
.isSameAs(userMethodValidationPostProcessor); .isSameAs(userMethodValidationPostProcessor);
assertThat(this.context.getBeansOfType(MethodValidationPostProcessor.class)) assertThat(this.context.getBeansOfType(MethodValidationPostProcessor.class))
.hasSize(1); .hasSize(1);
assertThat(this.context.getBean(Validator.class)).isNotSameAs( assertThat(this.context.getBean(Validator.class))
new DirectFieldAccessor(userMethodValidationPostProcessor).getPropertyValue("validator")); .isNotSameAs(new DirectFieldAccessor(userMethodValidationPostProcessor)
.getPropertyValue("validator"));
} }
public void load(Class<?> config) { public void load(Class<?> config) {
......
...@@ -36,7 +36,8 @@ public class DependencyResolutionContextTests { ...@@ -36,7 +36,8 @@ public class DependencyResolutionContextTests {
@Test @Test
public void canAddSpringBootDependencies() { public void canAddSpringBootDependencies() {
DependencyResolutionContext dependencyResolutionContext = new DependencyResolutionContext(); DependencyResolutionContext dependencyResolutionContext = new DependencyResolutionContext();
dependencyResolutionContext.addDependencyManagement(new SpringBootDependenciesDependencyManagement()); dependencyResolutionContext.addDependencyManagement(
new SpringBootDependenciesDependencyManagement());
assertThat(dependencyResolutionContext.getManagedDependencies()).isNotEmpty(); assertThat(dependencyResolutionContext.getManagedDependencies()).isNotEmpty();
} }
......
...@@ -35,7 +35,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -35,7 +35,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@TestPropertySource(properties = {"endpoints.hypermedia.enabled: true", "management.security.enabled: false"}) @TestPropertySource(properties = { "endpoints.hypermedia.enabled: true",
"management.security.enabled: false" })
public class SampleHypermediaGsonApplicationTests { public class SampleHypermediaGsonApplicationTests {
@Autowired @Autowired
......
...@@ -73,8 +73,8 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter { ...@@ -73,8 +73,8 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
@Override @Override
public void init(AuthenticationManagerBuilder auth) throws Exception { public void init(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("admin").password("admin") auth.inMemoryAuthentication().withUser("admin").password("admin")
.roles("ADMIN", "USER", "ACTUATOR").and().withUser("user").password("user") .roles("ADMIN", "USER", "ACTUATOR").and().withUser("user")
.roles("USER"); .password("user").roles("USER");
} }
} }
......
...@@ -25,9 +25,9 @@ import java.lang.annotation.Target; ...@@ -25,9 +25,9 @@ import java.lang.annotation.Target;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
/** /**
* {@link ImportAutoConfiguration Auto-configuration imports} for typical jdbc tests. * {@link ImportAutoConfiguration Auto-configuration imports} for typical jdbc tests. Most
* Most tests should consider using {@link JdbcTest @JdbcTest} rather than using * tests should consider using {@link JdbcTest @JdbcTest} rather than using this
* this annotation directly. * annotation directly.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.5.0 * @since 1.5.0
...@@ -38,4 +38,5 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration; ...@@ -38,4 +38,5 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
@Documented @Documented
@ImportAutoConfiguration @ImportAutoConfiguration
public @interface AutoConfigureJdbc { public @interface AutoConfigureJdbc {
} }
...@@ -49,10 +49,10 @@ class JdbcTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter { ...@@ -49,10 +49,10 @@ class JdbcTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
@Override @Override
protected ComponentScan.Filter[] getFilters(FilterType type) { protected ComponentScan.Filter[] getFilters(FilterType type) {
switch (type) { switch (type) {
case INCLUDE: case INCLUDE:
return this.annotation.includeFilters(); return this.annotation.includeFilters();
case EXCLUDE: case EXCLUDE:
return this.annotation.excludeFilters(); return this.annotation.excludeFilters();
} }
throw new IllegalStateException("Unsupported type " + type); throw new IllegalStateException("Unsupported type " + type);
} }
......
...@@ -34,7 +34,8 @@ import org.springframework.boot.test.autoconfigure.properties.PropertyMapping; ...@@ -34,7 +34,8 @@ import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
* instead of any application defined or auto-configured {@link DataSource}. * instead of any application defined or auto-configured {@link DataSource}.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @deprecated since 1.5 in favour of {@link org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase} * @deprecated since 1.5 in favour of
* {@link org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase}
*/ */
@Target({ ElementType.TYPE, ElementType.METHOD }) @Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
......
...@@ -62,16 +62,14 @@ public class AutoConfigureTestDatabaseWithMultipleDatasourcesIntegrationTests { ...@@ -62,16 +62,14 @@ public class AutoConfigureTestDatabaseWithMultipleDatasourcesIntegrationTests {
@Primary @Primary
public DataSource dataSource() { public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder() EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
.generateUniqueName(true) .generateUniqueName(true).setType(EmbeddedDatabaseType.HSQL);
.setType(EmbeddedDatabaseType.HSQL);
return builder.build(); return builder.build();
} }
@Bean @Bean
public DataSource secondaryDataSource() { public DataSource secondaryDataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder() EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
.generateUniqueName(true) .generateUniqueName(true).setType(EmbeddedDatabaseType.HSQL);
.setType(EmbeddedDatabaseType.HSQL);
return builder.build(); return builder.build();
} }
......
...@@ -34,8 +34,7 @@ public class ExampleJdbcApplication { ...@@ -34,8 +34,7 @@ public class ExampleJdbcApplication {
@Bean @Bean
public DataSource dataSource() { public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder() EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
.generateUniqueName(true) .generateUniqueName(true).setType(EmbeddedDatabaseType.HSQL);
.setType(EmbeddedDatabaseType.HSQL);
return builder.build(); return builder.build();
} }
......
...@@ -49,8 +49,9 @@ public class ExampleRepository { ...@@ -49,8 +49,9 @@ public class ExampleRepository {
} }
public ExampleEntity findById(int id) { public ExampleEntity findById(int id) {
return this.jdbcTemplate.queryForObject("select id, name from example where id =?", return this.jdbcTemplate.queryForObject(
new Object[] { id }, ROW_MAPPER); "select id, name from example where id =?", new Object[] { id },
ROW_MAPPER);
} }
public Collection<ExampleEntity> findAll() { public Collection<ExampleEntity> findAll() {
...@@ -65,6 +66,7 @@ public class ExampleRepository { ...@@ -65,6 +66,7 @@ public class ExampleRepository {
String name = rs.getString("name"); String name = rs.getString("name");
return new ExampleEntity(id, name); return new ExampleEntity(id, name);
} }
} }
} }
...@@ -61,8 +61,7 @@ public class JdbcTestWithAutoConfigureTestDatabaseReplaceExplicitIntegrationTest ...@@ -61,8 +61,7 @@ public class JdbcTestWithAutoConfigureTestDatabaseReplaceExplicitIntegrationTest
@Bean @Bean
public DataSource dataSource() { public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder() EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
.generateUniqueName(true) .generateUniqueName(true).setType(EmbeddedDatabaseType.H2);
.setType(EmbeddedDatabaseType.H2);
return builder.build(); return builder.build();
} }
......
...@@ -63,8 +63,7 @@ public class JdbcTestWithAutoConfigureTestDatabaseReplacePropertyAnyIntegrationT ...@@ -63,8 +63,7 @@ public class JdbcTestWithAutoConfigureTestDatabaseReplacePropertyAnyIntegrationT
@Bean @Bean
public DataSource dataSource() { public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder() EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
.generateUniqueName(true) .generateUniqueName(true).setType(EmbeddedDatabaseType.H2);
.setType(EmbeddedDatabaseType.H2);
return builder.build(); return builder.build();
} }
......
...@@ -93,8 +93,7 @@ public class TestDatabaseAutoConfigurationTests { ...@@ -93,8 +93,7 @@ public class TestDatabaseAutoConfigurationTests {
@Bean @Bean
public DataSource dataSource() { public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder() EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
.generateUniqueName(true) .generateUniqueName(true).setType(EmbeddedDatabaseType.HSQL);
.setType(EmbeddedDatabaseType.HSQL);
return builder.build(); return builder.build();
} }
......
...@@ -76,8 +76,7 @@ public class DataJpaTestWithAutoConfigureTestDatabaseReplaceExplicitIntegrationT ...@@ -76,8 +76,7 @@ public class DataJpaTestWithAutoConfigureTestDatabaseReplaceExplicitIntegrationT
@Bean @Bean
public DataSource dataSource() { public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder() EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
.generateUniqueName(true) .generateUniqueName(true).setType(EmbeddedDatabaseType.H2);
.setType(EmbeddedDatabaseType.H2);
return builder.build(); return builder.build();
} }
......
...@@ -34,8 +34,7 @@ public class ExampleDataJpaApplication { ...@@ -34,8 +34,7 @@ public class ExampleDataJpaApplication {
@Bean @Bean
public DataSource dataSource() { public DataSource dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder() EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
.generateUniqueName(true) .generateUniqueName(true).setType(EmbeddedDatabaseType.HSQL);
.setType(EmbeddedDatabaseType.HSQL);
return builder.build(); return builder.build();
} }
......
...@@ -68,8 +68,7 @@ public class WebMvcTestAllControllersIntegrationTests { ...@@ -68,8 +68,7 @@ public class WebMvcTestAllControllersIntegrationTests {
@Test @Test
public void shouldRunValidationSuccess() throws Exception { public void shouldRunValidationSuccess() throws Exception {
this.mvc.perform(get("/three/OK")) this.mvc.perform(get("/three/OK")).andExpect(status().isOk())
.andExpect(status().isOk())
.andExpect(content().string("Hello OK")); .andExpect(content().string("Hello OK"));
} }
......
...@@ -59,7 +59,8 @@ class TypeElementMembers { ...@@ -59,7 +59,8 @@ class TypeElementMembers {
private final FieldValuesParser fieldValuesParser; private final FieldValuesParser fieldValuesParser;
TypeElementMembers(ProcessingEnvironment env, FieldValuesParser fieldValuesParser, TypeElement element) { TypeElementMembers(ProcessingEnvironment env, FieldValuesParser fieldValuesParser,
TypeElement element) {
this.env = env; this.env = env;
this.typeUtils = new TypeUtils(this.env); this.typeUtils = new TypeUtils(this.env);
this.fieldValuesParser = fieldValuesParser; this.fieldValuesParser = fieldValuesParser;
......
...@@ -357,10 +357,18 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -357,10 +357,18 @@ public class ConfigurationMetadataAnnotationProcessorTests {
ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class); ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class);
assertThat(metadata).has(Metadata.withGroup("nestedChildProps") assertThat(metadata).has(Metadata.withGroup("nestedChildProps")
.fromSource(ClassWithNestedProperties.NestedChildClass.class)); .fromSource(ClassWithNestedProperties.NestedChildClass.class));
assertThat(metadata).has(Metadata.withProperty("nestedChildProps.child-class-property", Integer.class) assertThat(metadata)
.fromSource(ClassWithNestedProperties.NestedChildClass.class).withDefaultValue(20)); .has(Metadata
assertThat(metadata).has(Metadata.withProperty("nestedChildProps.parent-class-property", Integer.class) .withProperty("nestedChildProps.child-class-property",
.fromSource(ClassWithNestedProperties.NestedChildClass.class).withDefaultValue(10)); Integer.class)
.fromSource(ClassWithNestedProperties.NestedChildClass.class)
.withDefaultValue(20));
assertThat(metadata)
.has(Metadata
.withProperty("nestedChildProps.parent-class-property",
Integer.class)
.fromSource(ClassWithNestedProperties.NestedChildClass.class)
.withDefaultValue(10));
} }
@Test @Test
......
...@@ -52,6 +52,7 @@ public class DeprecatedMethodConfig { ...@@ -52,6 +52,7 @@ public class DeprecatedMethodConfig {
public void setFlag(boolean flag) { public void setFlag(boolean flag) {
this.flag = flag; this.flag = flag;
} }
} }
} }
...@@ -36,6 +36,7 @@ public class ClassWithNestedProperties { ...@@ -36,6 +36,7 @@ public class ClassWithNestedProperties {
public void setParentClassProperty(int parentClassProperty) { public void setParentClassProperty(int parentClassProperty) {
this.parentClassProperty = parentClassProperty; this.parentClassProperty = parentClassProperty;
} }
} }
@ConfigurationProperties(prefix = "nestedChildProps") @ConfigurationProperties(prefix = "nestedChildProps")
...@@ -50,5 +51,7 @@ public class ClassWithNestedProperties { ...@@ -50,5 +51,7 @@ public class ClassWithNestedProperties {
public void setChildClassProperty(int childClassProperty) { public void setChildClassProperty(int childClassProperty) {
this.childClassProperty = childClassProperty; this.childClassProperty = childClassProperty;
} }
} }
} }
...@@ -392,7 +392,6 @@ public abstract class MainClassFinder { ...@@ -392,7 +392,6 @@ public abstract class MainClassFinder {
* Creates a new {@code MainClass} rather represents the main class with the given * Creates a new {@code MainClass} rather represents the main class with the given
* {@code name}. The class is annotated with the annotations with the given * {@code name}. The class is annotated with the annotations with the given
* {@code annotationNames}. * {@code annotationNames}.
*
* @param name the name of the class * @param name the name of the class
* @param annotationNames the names of the annotations on the class * @param annotationNames the names of the annotations on the class
*/ */
......
...@@ -65,7 +65,8 @@ public class ExplodedArchive implements Archive { ...@@ -65,7 +65,8 @@ public class ExplodedArchive implements Archive {
* Create a new {@link ExplodedArchive} instance. * Create a new {@link ExplodedArchive} instance.
* @param root the root folder * @param root the root folder
* @param recursive if recursive searching should be used to locate the manifest. * @param recursive if recursive searching should be used to locate the manifest.
* Defaults to {@code true}, folders with a large tree might want to set this to {@code * Defaults to {@code true}, folders with a large tree might want to set this to
* {@code
* false}. * false}.
*/ */
public ExplodedArchive(File root, boolean recursive) { public ExplodedArchive(File root, boolean recursive) {
......
...@@ -412,8 +412,8 @@ public class UndertowEmbeddedServletContainerFactory ...@@ -412,8 +412,8 @@ public class UndertowEmbeddedServletContainerFactory
String prefix = (this.accessLogPrefix != null ? this.accessLogPrefix String prefix = (this.accessLogPrefix != null ? this.accessLogPrefix
: "access_log."); : "access_log.");
AccessLogReceiver accessLogReceiver = new DefaultAccessLogReceiver( AccessLogReceiver accessLogReceiver = new DefaultAccessLogReceiver(
createWorker(), this.accessLogDirectory, prefix, createWorker(), this.accessLogDirectory, prefix, this.accessLogSuffix,
this.accessLogSuffix, this.accessLogRotate); this.accessLogRotate);
String formatString = (this.accessLogPattern != null) ? this.accessLogPattern String formatString = (this.accessLogPattern != null) ? this.accessLogPattern
: "common"; : "common";
return new AccessLogHandler(handler, accessLogReceiver, formatString, return new AccessLogHandler(handler, accessLogReceiver, formatString,
......
...@@ -164,7 +164,7 @@ public enum DatabaseDriver { ...@@ -164,7 +164,7 @@ public enum DatabaseDriver {
* Informix. * Informix.
*/ */
INFORMIX("informix", "Informix Dynamic Server", "com.informix.jdbc.IfxDriver", null, INFORMIX("informix", "Informix Dynamic Server", "com.informix.jdbc.IfxDriver", null,
"select count(*) from systables") { "select count(*) from systables") {
@Override @Override
protected Collection<String> getUrlPrefixes() { protected Collection<String> getUrlPrefixes() {
......
...@@ -184,6 +184,7 @@ public abstract class AbstractLoggingSystem extends LoggingSystem { ...@@ -184,6 +184,7 @@ public abstract class AbstractLoggingSystem extends LoggingSystem {
/** /**
* Maintains a mapping between native levels and {@link LogLevel}. * Maintains a mapping between native levels and {@link LogLevel}.
*
* @param <T> The native level type * @param <T> The native level type
*/ */
protected static class LogLevels<T> { protected static class LogLevels<T> {
......
...@@ -48,9 +48,9 @@ public abstract class LoggingSystem { ...@@ -48,9 +48,9 @@ public abstract class LoggingSystem {
public static final String NONE = "none"; public static final String NONE = "none";
/** /**
* The name used for the root logger. LoggingSystem implementations should ensure * The name used for the root logger. LoggingSystem implementations should ensure that
* that this is the name used to represent the root logger, regardless of the * this is the name used to represent the root logger, regardless of the underlying
* underlying implementation. * implementation.
*/ */
public static final String ROOT_LOGGER_NAME = "ROOT"; public static final String ROOT_LOGGER_NAME = "ROOT";
......
...@@ -75,16 +75,15 @@ public class SpringPhysicalNamingStrategy implements PhysicalNamingStrategy { ...@@ -75,16 +75,15 @@ public class SpringPhysicalNamingStrategy implements PhysicalNamingStrategy {
} }
String text = builder.toString(); String text = builder.toString();
String finalText = isCaseInsensitive(jdbcEnvironment) ? text.toLowerCase(Locale.ROOT) String finalText = isCaseInsensitive(jdbcEnvironment)
: text; ? text.toLowerCase(Locale.ROOT) : text;
return new Identifier(finalText, name.isQuoted()); return new Identifier(finalText, name.isQuoted());
} }
/** /**
* Specify whether the database is case sensitive. * Specify whether the database is case sensitive.
* @param jdbcEnvironment The JDBC environment which can be used to determine case * @param jdbcEnvironment The JDBC environment which can be used to determine case
* @return true if the database is case insensitive * @return true if the database is case insensitive sensitivity
* sensitivity
*/ */
protected boolean isCaseInsensitive(JdbcEnvironment jdbcEnvironment) { protected boolean isCaseInsensitive(JdbcEnvironment jdbcEnvironment) {
return true; return true;
......
...@@ -699,6 +699,7 @@ public class EnableConfigurationPropertiesTests { ...@@ -699,6 +699,7 @@ public class EnableConfigurationPropertiesTests {
} }
// No getter - you should be able to bind to a write-only bean // No getter - you should be able to bind to a write-only bean
} }
// No annotation // No annotation
......
...@@ -176,7 +176,8 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { ...@@ -176,7 +176,8 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
List<LoggerConfiguration> configurations = this.loggingSystem List<LoggerConfiguration> configurations = this.loggingSystem
.getLoggerConfigurations(); .getLoggerConfigurations();
assertThat(configurations).isNotEmpty(); assertThat(configurations).isNotEmpty();
assertThat(configurations.get(0).getName()).isEqualTo(LoggingSystem.ROOT_LOGGER_NAME); assertThat(configurations.get(0).getName())
.isEqualTo(LoggingSystem.ROOT_LOGGER_NAME);
} }
@Test @Test
......
...@@ -70,13 +70,14 @@ public class SpringPhysicalNamingStrategyTests { ...@@ -70,13 +70,14 @@ public class SpringPhysicalNamingStrategyTests {
@Test @Test
public void tableNameShouldNotBeLowerCaseIfCaseSensitive() throws Exception { public void tableNameShouldNotBeLowerCaseIfCaseSensitive() throws Exception {
this.metadata = this.metadataSources.getMetadataBuilder(this.serviceRegistry) this.metadata = this.metadataSources.getMetadataBuilder(this.serviceRegistry)
.applyPhysicalNamingStrategy(new TestSpringPhysicalNamingStrategy()).build(); .applyPhysicalNamingStrategy(new TestSpringPhysicalNamingStrategy())
.build();
PersistentClass binding = this.metadata PersistentClass binding = this.metadata
.getEntityBinding(TelephoneNumber.class.getName()); .getEntityBinding(TelephoneNumber.class.getName());
assertThat(binding.getTable().getQuotedName()).isEqualTo("Telephone_Number"); assertThat(binding.getTable().getQuotedName()).isEqualTo("Telephone_Number");
} }
private class TestSpringPhysicalNamingStrategy extends SpringPhysicalNamingStrategy { private class TestSpringPhysicalNamingStrategy extends SpringPhysicalNamingStrategy {
@Override @Override
protected boolean isCaseInsensitive(JdbcEnvironment jdbcEnvironment) { protected boolean isCaseInsensitive(JdbcEnvironment jdbcEnvironment) {
...@@ -84,4 +85,5 @@ public class SpringPhysicalNamingStrategyTests { ...@@ -84,4 +85,5 @@ public class SpringPhysicalNamingStrategyTests {
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment