Browse Source

Polish

pull/590/head
Phillip Webb 12 years ago
parent
commit
beaddb2362
  1. 4
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ShellPropertiesTests.java
  2. 10
      spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/writer/CodahaleMetricWriterTests.java
  3. 5
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.java
  4. 4
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java
  5. 6
      spring-boot-cli/src/it/java/org/springframework/boot/cli/JarCommandIT.java
  6. 8
      spring-boot-samples/spring-boot-sample-actuator-log4j/src/test/java/sample/actuator/log4j/SampleActuatorApplicationTests.java
  7. 4
      spring-boot-samples/spring-boot-sample-web-secure/src/main/java/sample/ui/secure/SampleWebSecureApplication.java
  8. 6
      spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.java
  9. 2
      spring-boot/src/main/java/org/springframework/boot/bind/PropertySourceUtils.java
  10. 5
      spring-boot/src/main/java/org/springframework/boot/bind/RelaxedPropertyResolver.java
  11. 5
      spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerCustomizerBeanPostProcessor.java
  12. 1
      spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationContextInitializerTests.java
  13. 1
      spring-boot/src/test/java/org/springframework/boot/context/config/DelegatingApplicationListenerTests.java
  14. 2
      spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java

4
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.Assert;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.MutablePropertyValues; 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.CrshShellProperties;
import org.springframework.boot.actuate.autoconfigure.ShellProperties.JaasAuthenticationProperties; import org.springframework.boot.actuate.autoconfigure.ShellProperties.JaasAuthenticationProperties;
import org.springframework.boot.actuate.autoconfigure.ShellProperties.KeyAuthenticationProperties; import org.springframework.boot.actuate.autoconfigure.ShellProperties.KeyAuthenticationProperties;

10
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -127,16 +127,16 @@ public class CodahaleMetricWriterTests {
public void run() { public void run() {
for (int i = 0; i < 10000; i++) { for (int i = 0; i < 10000; i++) {
try { try {
Metric<Integer> metric1 = new Metric<Integer>( Metric<Integer> metric1 = new Metric<Integer>("timer.test.service",
"timer.test.service", this.index); this.index);
this.writer.set(metric1); this.writer.set(metric1);
Metric<Integer> metric2 = new Metric<Integer>( Metric<Integer> metric2 = new Metric<Integer>(
"histogram.test.service", this.index); "histogram.test.service", this.index);
this.writer.set(metric2); this.writer.set(metric2);
Metric<Integer> metric3 = new Metric<Integer>( Metric<Integer> metric3 = new Metric<Integer>("gauge.test.service",
"gauge.test.service", this.index); this.index);
this.writer.set(metric3); this.writer.set(metric3);
} }
catch (IllegalArgumentException iae) { catch (IllegalArgumentException iae) {

5
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 EnableAutoConfiguration Auto-configuration} that configures the
* {@link ConfigurableEmbeddedServletContainer} from a {@link ServerProperties} * {@link ConfigurableEmbeddedServletContainer} from a {@link ServerProperties} bean.
* bean.
* *
* @author Dave Syer * @author Dave Syer
*/ */

4
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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; import static org.junit.Assert.assertEquals;
/** /**
* Tests for {@link MongoAutoConfiguration}.
*
* @author Dave Syer * @author Dave Syer
*/ */
public class MongoAutoConfigurationTests { public class MongoAutoConfigurationTests {

6
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.getErrorOutput(), equalTo(""));
assertThat(invocation.getStandardOutput(), containsString("Hello World!")); assertThat(invocation.getStandardOutput(), containsString("Hello World!"));
assertThat(invocation.getStandardOutput(), containsString("/public/public.txt")); 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("/static/static.txt"));
assertThat(invocation.getStandardOutput(), containsString("/templates/template.txt")); assertThat(invocation.getStandardOutput(),
containsString("/templates/template.txt"));
} }
} }

8
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,8 +16,6 @@
package sample.actuator.log4j; package sample.actuator.log4j;
import static org.junit.Assert.assertEquals;
import java.util.Map; import java.util.Map;
import org.junit.Test; 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.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.context.web.WebAppConfiguration;
import static org.junit.Assert.assertEquals;
/** /**
* Basic integration tests for service demo application. * Basic integration tests for service demo application.
* *
* @author Dave Syer * @author Dave Syer
*/ */
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes=SampleActuatorApplication.class) @SpringApplicationConfiguration(classes = SampleActuatorApplication.class)
@WebAppConfiguration @WebAppConfiguration
@IntegrationTest @IntegrationTest
@DirtiesContext @DirtiesContext

4
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 { public static void main(String[] args) throws Exception {
// Set user password to "password" for demo purposes only // Set user password to "password" for demo purposes only
new SpringApplicationBuilder(SampleWebSecureApplication.class).properties("security.user.password=password").run( new SpringApplicationBuilder(SampleWebSecureApplication.class).properties(
args); "security.user.password=password").run(args);
} }
@Override @Override

6
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<Project> {
enhanceRunTask(project); enhanceRunTask(project);
addRunAppTask(project); addRunAppTask(project);
if (project.getTasks().withType(JavaExec.class).isEmpty()) { 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); project.getPlugins().apply(ApplicationPlugin.class);
} }
} }
@ -111,7 +112,8 @@ public class SpringBootPlugin implements Plugin<Project> {
if (!project.getTasksByName("compileJava", false).isEmpty()) { if (!project.getTasksByName("compileJava", false).isEmpty()) {
if (!project.getTasksByName("compileGroovy", false).isEmpty()) { if (!project.getTasksByName("compileGroovy", false).isEmpty()) {
runJarTask.dependsOn("compileJava", "compileGroovy"); runJarTask.dependsOn("compileJava", "compileGroovy");
} else { }
else {
runJarTask.dependsOn("compileJava"); runJarTask.dependsOn("compileJava");
} }
} }

2
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

5
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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, Assert.isInstanceOf(ConfigurableEnvironment.class, this.resolver,
"SubProperties not available."); "SubProperties not available.");
ConfigurableEnvironment env = (ConfigurableEnvironment) this.resolver; ConfigurableEnvironment env = (ConfigurableEnvironment) this.resolver;
return PropertySourceUtils.getSubProperties(env.getPropertySources(), this.prefix, keyPrefix); return PropertySourceUtils.getSubProperties(env.getPropertySources(),
this.prefix, keyPrefix);
} }
} }

5
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -62,8 +62,7 @@ public class EmbeddedServletContainerCustomizerBeanPostProcessor implements
return bean; return bean;
} }
private void postProcessBeforeInitialization( private void postProcessBeforeInitialization(ConfigurableEmbeddedServletContainer bean) {
ConfigurableEmbeddedServletContainer bean) {
for (EmbeddedServletContainerCustomizer customizer : getCustomizers()) { for (EmbeddedServletContainerCustomizer customizer : getCustomizers()) {
customizer.customize(bean); customizer.customize(bean);
} }

1
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.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
import org.springframework.boot.context.config.DelegatingApplicationContextInitializer;
import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.context.ApplicationContextException; import org.springframework.context.ApplicationContextException;
import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ApplicationContextInitializer;

1
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.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.config.DelegatingApplicationListener;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;

2
spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java

@ -76,7 +76,7 @@ public class LogbackLoggingSystemTests {
this.loggingSystem.beforeInitialize(); this.loggingSystem.beforeInitialize();
ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory(); ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
LoggerContext context = (LoggerContext) factory; 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")); assertNotNull(root.getAppender("CONSOLE"));
} }

Loading…
Cancel
Save