From beaddb2362d928b5e13acee77d3606d1b49cbc4d Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 26 Mar 2014 13:24:22 -0700 Subject: [PATCH] Polish --- .../actuate/autoconfigure/ShellPropertiesTests.java | 4 +--- .../metrics/writer/CodahaleMetricWriterTests.java | 10 +++++----- .../web/ServerPropertiesAutoConfiguration.java | 5 ++--- .../jms/JmsTemplateAutoConfigurationTests.java | 2 +- .../mongo/MongoAutoConfigurationTests.java | 4 +++- .../org/springframework/boot/cli/JarCommandIT.java | 6 ++++-- .../actuator/log4j/SampleActuatorApplicationTests.java | 8 ++++---- .../sample/ui/secure/SampleWebSecureApplication.java | 4 ++-- .../springframework/boot/gradle/SpringBootPlugin.java | 6 ++++-- .../springframework/boot/bind/PropertySourceUtils.java | 2 +- .../boot/bind/RelaxedPropertyResolver.java | 5 +++-- ...dedServletContainerCustomizerBeanPostProcessor.java | 5 ++--- .../DelegatingApplicationContextInitializerTests.java | 1 - .../config/DelegatingApplicationListenerTests.java | 1 - .../logging/logback/LogbackLoggingSystemTests.java | 2 +- 15 files changed, 33 insertions(+), 32 deletions(-) diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java index 99eb8ba6d6..73213385cd 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-2014 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. @@ -26,8 +26,6 @@ import org.crsh.plugin.PluginLifeCycle; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.MutablePropertyValues; -import org.springframework.boot.actuate.autoconfigure.CrshAutoConfiguration; -import org.springframework.boot.actuate.autoconfigure.ShellProperties; import org.springframework.boot.actuate.autoconfigure.ShellProperties.CrshShellProperties; import org.springframework.boot.actuate.autoconfigure.ShellProperties.JaasAuthenticationProperties; import org.springframework.boot.actuate.autoconfigure.ShellProperties.KeyAuthenticationProperties; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriterTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriterTests.java index 7772580a76..04d06104c6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriterTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 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. @@ -127,16 +127,16 @@ public class CodahaleMetricWriterTests { public void run() { for (int i = 0; i < 10000; i++) { try { - Metric metric1 = new Metric( - "timer.test.service", this.index); + Metric metric1 = new Metric("timer.test.service", + this.index); this.writer.set(metric1); Metric metric2 = new Metric( "histogram.test.service", this.index); this.writer.set(metric2); - Metric metric3 = new Metric( - "gauge.test.service", this.index); + Metric metric3 = new Metric("gauge.test.service", + this.index); this.writer.set(metric3); } catch (IllegalArgumentException iae) { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.java index 3ad3597858..b17d08d9eb 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 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. @@ -33,8 +33,7 @@ import org.springframework.util.StringUtils; /** * {@link EnableAutoConfiguration Auto-configuration} that configures the - * {@link ConfigurableEmbeddedServletContainer} from a {@link ServerProperties} - * bean. + * {@link ConfigurableEmbeddedServletContainer} from a {@link ServerProperties} bean. * * @author Dave Syer */ diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfigurationTests.java index 8dab5b4094..ea7ade86dc 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jms/JmsTemplateAutoConfigurationTests.java @@ -36,7 +36,7 @@ import static org.junit.Assert.assertTrue; /** * Tests for {@link JmsTemplateAutoConfiguration}. - * + * * @author Greg Turnquist */ public class JmsTemplateAutoConfigurationTests { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java index 8b129dcbcf..c40aceb17d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 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. @@ -25,6 +25,8 @@ import org.springframework.data.mongodb.core.MongoTemplate; import static org.junit.Assert.assertEquals; /** + * Tests for {@link MongoAutoConfiguration}. + * * @author Dave Syer */ public class MongoAutoConfigurationTests { diff --git a/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java b/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java index c6c49550e0..5d14faf0fb 100644 --- a/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java +++ b/spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java @@ -75,8 +75,10 @@ public class JarCommandIT { assertThat(invocation.getErrorOutput(), equalTo("")); assertThat(invocation.getStandardOutput(), containsString("Hello World!")); assertThat(invocation.getStandardOutput(), containsString("/public/public.txt")); - assertThat(invocation.getStandardOutput(), containsString("/resources/resource.txt")); + assertThat(invocation.getStandardOutput(), + containsString("/resources/resource.txt")); assertThat(invocation.getStandardOutput(), containsString("/static/static.txt")); - assertThat(invocation.getStandardOutput(), containsString("/templates/template.txt")); + assertThat(invocation.getStandardOutput(), + containsString("/templates/template.txt")); } } diff --git a/spring-boot-samples/spring-boot-sample-actuator-log4j/src/test/java/sample/actuator/log4j/SampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator-log4j/src/test/java/sample/actuator/log4j/SampleActuatorApplicationTests.java index e322d74c6a..35d914b029 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-log4j/src/test/java/sample/actuator/log4j/SampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator-log4j/src/test/java/sample/actuator/log4j/SampleActuatorApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 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. @@ -16,8 +16,6 @@ package sample.actuator.log4j; -import static org.junit.Assert.assertEquals; - import java.util.Map; import org.junit.Test; @@ -31,13 +29,15 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; +import static org.junit.Assert.assertEquals; + /** * Basic integration tests for service demo application. * * @author Dave Syer */ @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes=SampleActuatorApplication.class) +@SpringApplicationConfiguration(classes = SampleActuatorApplication.class) @WebAppConfiguration @IntegrationTest @DirtiesContext diff --git a/spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/ui/secure/SampleWebSecureApplication.java b/spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/ui/secure/SampleWebSecureApplication.java index 76f9d4f532..139e696e03 100644 --- a/spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/ui/secure/SampleWebSecureApplication.java +++ b/spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/ui/secure/SampleWebSecureApplication.java @@ -52,8 +52,8 @@ public class SampleWebSecureApplication extends WebMvcConfigurerAdapter { public static void main(String[] args) throws Exception { // Set user password to "password" for demo purposes only - new SpringApplicationBuilder(SampleWebSecureApplication.class).properties("security.user.password=password").run( - args); + new SpringApplicationBuilder(SampleWebSecureApplication.class).properties( + "security.user.password=password").run(args); } @Override diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java index a73fd71e44..240fc85bb7 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java @@ -68,7 +68,8 @@ public class SpringBootPlugin implements Plugin { enhanceRunTask(project); addRunAppTask(project); if (project.getTasks().withType(JavaExec.class).isEmpty()) { - // Add the ApplicationPlugin so that a JavaExec task is available (run) to enhance + // Add the ApplicationPlugin so that a JavaExec task is available (run) to + // enhance project.getPlugins().apply(ApplicationPlugin.class); } } @@ -111,7 +112,8 @@ public class SpringBootPlugin implements Plugin { if (!project.getTasksByName("compileJava", false).isEmpty()) { if (!project.getTasksByName("compileGroovy", false).isEmpty()) { runJarTask.dependsOn("compileJava", "compileGroovy"); - } else { + } + else { runJarTask.dependsOn("compileJava"); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourceUtils.java b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourceUtils.java index 1766fd6f6f..c84fb9110c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourceUtils.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/PropertySourceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 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. diff --git a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java index 5603e40847..6cd469382c 100644 --- a/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java +++ b/spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 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. @@ -144,7 +144,8 @@ public class RelaxedPropertyResolver implements PropertyResolver { Assert.isInstanceOf(ConfigurableEnvironment.class, this.resolver, "SubProperties not available."); ConfigurableEnvironment env = (ConfigurableEnvironment) this.resolver; - return PropertySourceUtils.getSubProperties(env.getPropertySources(), this.prefix, keyPrefix); + return PropertySourceUtils.getSubProperties(env.getPropertySources(), + this.prefix, keyPrefix); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java index 0f9fb30f82..043fab472f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-2014 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. @@ -62,8 +62,7 @@ public class EmbeddedServletContainerCustomizerBeanPostProcessor implements return bean; } - private void postProcessBeforeInitialization( - ConfigurableEmbeddedServletContainer bean) { + private void postProcessBeforeInitialization(ConfigurableEmbeddedServletContainer bean) { for (EmbeddedServletContainerCustomizer customizer : getCustomizers()) { customizer.customize(bean); } diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java index 2e76891615..90a6987ab0 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java @@ -19,7 +19,6 @@ package org.springframework.boot.context.config; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.springframework.boot.context.config.DelegatingApplicationContextInitializer; import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.context.ApplicationContextException; import org.springframework.context.ApplicationContextInitializer; diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java index 6208f81347..5f9d471cca 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java @@ -21,7 +21,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.springframework.boot.SpringApplication; -import org.springframework.boot.context.config.DelegatingApplicationListener; import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.context.ApplicationListener; diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java index 537ff02cb3..98837f91e3 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java @@ -76,7 +76,7 @@ public class LogbackLoggingSystemTests { this.loggingSystem.beforeInitialize(); ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory(); LoggerContext context = (LoggerContext) factory; - Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME); + Logger root = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME); assertNotNull(root.getAppender("CONSOLE")); }