Commit 9632abf8 authored by Phillip Webb's avatar Phillip Webb

Formatting and cleanup

parent cd77bae3
...@@ -29,7 +29,7 @@ import org.springframework.util.Assert; ...@@ -29,7 +29,7 @@ import org.springframework.util.Assert;
* <p> * <p>
* If a different order is required or a new {@link Status} type will be used, the order * If a different order is required or a new {@link Status} type will be used, the order
* can be set by calling {@link #setStatusOrder(List)}. * can be set by calling {@link #setStatusOrder(List)}.
* *
* @author Christian Dupuis * @author Christian Dupuis
* @since 1.1.0 * @since 1.1.0
*/ */
......
...@@ -42,7 +42,7 @@ import static org.junit.Assert.assertTrue; ...@@ -42,7 +42,7 @@ import static org.junit.Assert.assertTrue;
/** /**
* Tests for {@link EndpointAutoConfiguration}. * Tests for {@link EndpointAutoConfiguration}.
* *
* @author Dave Syer * @author Dave Syer
* @author Phillip Webb * @author Phillip Webb
* @author Greg Turnquist * @author Greg Turnquist
......
...@@ -21,11 +21,11 @@ import java.util.Map; ...@@ -21,11 +21,11 @@ import java.util.Map;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.actuate.health.DataSourceHealthIndicator;
import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.actuate.health.MongoHealthIndicator; import org.springframework.boot.actuate.health.MongoHealthIndicator;
import org.springframework.boot.actuate.health.RabbitHealthIndicator; import org.springframework.boot.actuate.health.RabbitHealthIndicator;
import org.springframework.boot.actuate.health.RedisHealthIndicator; import org.springframework.boot.actuate.health.RedisHealthIndicator;
import org.springframework.boot.actuate.health.DataSourceHealthIndicator;
import org.springframework.boot.actuate.health.SolrHealthIndicator; import org.springframework.boot.actuate.health.SolrHealthIndicator;
import org.springframework.boot.actuate.health.VanillaHealthIndicator; import org.springframework.boot.actuate.health.VanillaHealthIndicator;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
...@@ -41,7 +41,7 @@ import static org.junit.Assert.assertEquals; ...@@ -41,7 +41,7 @@ import static org.junit.Assert.assertEquals;
/** /**
* Tests for {@link HealthIndicatorAutoConfiguration}. * Tests for {@link HealthIndicatorAutoConfiguration}.
* *
* @author Christian Dupuis * @author Christian Dupuis
*/ */
public class HealthIndicatorAutoConfigurationTests { public class HealthIndicatorAutoConfigurationTests {
...@@ -149,8 +149,8 @@ public class HealthIndicatorAutoConfigurationTests { ...@@ -149,8 +149,8 @@ public class HealthIndicatorAutoConfigurationTests {
Map<String, HealthIndicator> beans = this.context Map<String, HealthIndicator> beans = this.context
.getBeansOfType(HealthIndicator.class); .getBeansOfType(HealthIndicator.class);
assertEquals(1, beans.size()); assertEquals(1, beans.size());
assertEquals(DataSourceHealthIndicator.class, beans.values().iterator() assertEquals(DataSourceHealthIndicator.class, beans.values().iterator().next()
.next().getClass()); .getClass());
} }
@Test @Test
......
...@@ -37,7 +37,7 @@ import static org.mockito.Mockito.when; ...@@ -37,7 +37,7 @@ import static org.mockito.Mockito.when;
/** /**
* Tests for {@link SolrHealthIndicator} * Tests for {@link SolrHealthIndicator}
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
public class SolrHealthIndicatorTests { public class SolrHealthIndicatorTests {
......
...@@ -22,7 +22,7 @@ import static org.junit.Assert.assertEquals; ...@@ -22,7 +22,7 @@ import static org.junit.Assert.assertEquals;
/** /**
* Tests for {@link VanillaHealthIndicator}. * Tests for {@link VanillaHealthIndicator}.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
public class VanillaHealthIndicatorTests { public class VanillaHealthIndicatorTests {
......
...@@ -37,7 +37,7 @@ import org.springframework.data.solr.repository.SolrRepository; ...@@ -37,7 +37,7 @@ import org.springframework.data.solr.repository.SolrRepository;
* If active auto configuration does the same as * If active auto configuration does the same as
* {@link org.springframework.data.solr.repository.config.EnableSolrRepositories} would * {@link org.springframework.data.solr.repository.config.EnableSolrRepositories} would
* do. * do.
* *
* @author Christoph Strobl * @author Christoph Strobl
* @since 1.1.0 * @since 1.1.0
*/ */
......
...@@ -44,7 +44,7 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; ...@@ -44,7 +44,7 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for FreeMarker. * {@link EnableAutoConfiguration Auto-configuration} for FreeMarker.
* *
* @author Andy Wilkinson * @author Andy Wilkinson
* @author Dave Syer * @author Dave Syer
* @since 1.1.0 * @since 1.1.0
......
...@@ -47,7 +47,7 @@ import org.springframework.web.servlet.view.velocity.VelocityViewResolver; ...@@ -47,7 +47,7 @@ import org.springframework.web.servlet.view.velocity.VelocityViewResolver;
/** /**
* {@link EnableAutoConfiguration Auto-configuration} for Velocity. * {@link EnableAutoConfiguration Auto-configuration} for Velocity.
* *
* @author Andy Wilkinson * @author Andy Wilkinson
* @since 1.1.0 * @since 1.1.0
*/ */
......
...@@ -22,7 +22,6 @@ import org.junit.Test; ...@@ -22,7 +22,6 @@ import org.junit.Test;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage; import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.data.alt.elasticsearch.CityElasticsearchDbRepository; import org.springframework.boot.autoconfigure.data.alt.elasticsearch.CityElasticsearchDbRepository;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.city.City; import org.springframework.boot.autoconfigure.data.elasticsearch.city.City;
import org.springframework.boot.autoconfigure.data.elasticsearch.city.CityRepository; import org.springframework.boot.autoconfigure.data.elasticsearch.city.CityRepository;
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage; import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
......
...@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati ...@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage; import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.data.alt.mongo.CityMongoDbRepository; import org.springframework.boot.autoconfigure.data.alt.mongo.CityMongoDbRepository;
import org.springframework.boot.autoconfigure.data.alt.solr.CitySolrRepository; import org.springframework.boot.autoconfigure.data.alt.solr.CitySolrRepository;
import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.jpa.city.City; import org.springframework.boot.autoconfigure.data.jpa.city.City;
import org.springframework.boot.autoconfigure.data.jpa.city.CityRepository; import org.springframework.boot.autoconfigure.data.jpa.city.CityRepository;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration; import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
......
...@@ -20,7 +20,6 @@ import org.junit.After; ...@@ -20,7 +20,6 @@ import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage; import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration.JpaWebConfiguration; import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration.JpaWebConfiguration;
import org.springframework.boot.autoconfigure.data.jpa.city.City; import org.springframework.boot.autoconfigure.data.jpa.city.City;
import org.springframework.boot.autoconfigure.data.jpa.city.CityRepository; import org.springframework.boot.autoconfigure.data.jpa.city.CityRepository;
......
...@@ -22,6 +22,7 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -22,6 +22,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
public interface CityRepository extends JpaRepository<City, Long> { public interface CityRepository extends JpaRepository<City, Long> {
@Override
Page<City> findAll(Pageable pageable); Page<City> findAll(Pageable pageable);
Page<City> findByNameLikeAndCountryLikeAllIgnoringCase(String name, String country, Page<City> findByNameLikeAndCountryLikeAllIgnoringCase(String name, String country,
......
...@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati ...@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfigurati
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage; import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
import org.springframework.boot.autoconfigure.data.alt.solr.CitySolrRepository; import org.springframework.boot.autoconfigure.data.alt.solr.CitySolrRepository;
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage; import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
import org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.data.solr.city.City; import org.springframework.boot.autoconfigure.data.solr.city.City;
import org.springframework.boot.autoconfigure.data.solr.city.CityRepository; import org.springframework.boot.autoconfigure.data.solr.city.CityRepository;
import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration; import org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration;
......
...@@ -26,8 +26,11 @@ import org.springframework.data.solr.core.mapping.SolrDocument; ...@@ -26,8 +26,11 @@ import org.springframework.data.solr.core.mapping.SolrDocument;
@SolrDocument(solrCoreName = "collection1") @SolrDocument(solrCoreName = "collection1")
public class City { public class City {
private @Id String id; @Id
private @Indexed String name; private String id;
@Indexed
private String name;
public String getId() { public String getId() {
return this.id; return this.id;
......
...@@ -16,11 +16,6 @@ ...@@ -16,11 +16,6 @@
package org.springframework.boot.autoconfigure.jdbc; package org.springframework.boot.autoconfigure.jdbc;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.sql.Connection; import java.sql.Connection;
...@@ -50,6 +45,11 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; ...@@ -50,6 +45,11 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.HikariDataSource;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
/** /**
* Tests for {@link DataSourceAutoConfiguration}. * Tests for {@link DataSourceAutoConfiguration}.
* *
...@@ -70,7 +70,7 @@ public class DataSourceAutoConfigurationTests { ...@@ -70,7 +70,7 @@ public class DataSourceAutoConfigurationTests {
@After @After
public void restore() { public void restore() {
EmbeddedDatabaseConnection.override = null; EmbeddedDatabaseConnection.override = null;
if (context!=null) { if (context != null) {
context.close(); context.close();
} }
} }
...@@ -264,6 +264,7 @@ public class DataSourceAutoConfigurationTests { ...@@ -264,6 +264,7 @@ public class DataSourceAutoConfigurationTests {
return false; return false;
} }
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException { public Logger getParentLogger() throws SQLFeatureNotSupportedException {
return Mockito.mock(Logger.class); return Mockito.mock(Logger.class);
} }
......
...@@ -207,8 +207,7 @@ public class JmsAutoConfigurationTests { ...@@ -207,8 +207,7 @@ public class JmsAutoConfigurationTests {
Class<?>... additionalClasses) { Class<?>... additionalClasses) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(additionalClasses); context.register(additionalClasses);
context.register(ActiveMQAutoConfiguration.class, context.register(ActiveMQAutoConfiguration.class, JmsAutoConfiguration.class);
JmsAutoConfiguration.class);
return context; return context;
} }
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
package org.springframework.boot.autoconfigure.jms.activemq; package org.springframework.boot.autoconfigure.jms.activemq;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQProperties;
import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.core.env.StandardEnvironment; import org.springframework.core.env.StandardEnvironment;
......
...@@ -19,8 +19,6 @@ package org.springframework.boot.autoconfigure.jms.hornetq; ...@@ -19,8 +19,6 @@ package org.springframework.boot.autoconfigure.jms.hornetq;
import org.hornetq.core.config.Configuration; import org.hornetq.core.config.Configuration;
import org.hornetq.core.server.JournalType; import org.hornetq.core.server.JournalType;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.autoconfigure.jms.hornetq.HornetQEmbeddedConfigurationFactory;
import org.springframework.boot.autoconfigure.jms.hornetq.HornetQProperties;
import static org.hamcrest.Matchers.endsWith; import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
......
...@@ -33,7 +33,7 @@ import static org.junit.Assert.assertThat; ...@@ -33,7 +33,7 @@ import static org.junit.Assert.assertThat;
/** /**
* Tests for {@link HibernateJpaAutoConfiguration}. * Tests for {@link HibernateJpaAutoConfiguration}.
* *
* @author Dave Syer * @author Dave Syer
* @author Phillip Webb * @author Phillip Webb
* @author Andy Wilkinson * @author Andy Wilkinson
......
...@@ -106,7 +106,7 @@ public class RunCommand extends OptionParsingCommand { ...@@ -106,7 +106,7 @@ public class RunCommand extends OptionParsingCommand {
this.runner = new SpringApplicationRunner(configuration, this.runner = new SpringApplicationRunner(configuration,
sourceOptions.getSourcesArray(), sourceOptions.getArgsArray()); sourceOptions.getSourcesArray(), sourceOptions.getArgsArray());
this.runner.compileAndRun(); this.runner.compileAndRun();
return ExitStatus.OK; return ExitStatus.OK;
} }
......
...@@ -70,7 +70,8 @@ public abstract class AstUtils { ...@@ -70,7 +70,8 @@ public abstract class AstUtils {
String... annotations) { String... annotations) {
for (AnnotationNode annotationNode : node.getAnnotations()) { for (AnnotationNode annotationNode : node.getAnnotations()) {
for (String annotation : annotations) { for (String annotation : annotations) {
if (PatternMatchUtils.simpleMatch(annotation, annotationNode.getClassNode().getName())) { if (PatternMatchUtils.simpleMatch(annotation, annotationNode
.getClassNode().getName())) {
return true; return true;
} }
} }
......
...@@ -33,7 +33,7 @@ import org.springframework.boot.cli.compiler.grape.DependencyResolutionContext; ...@@ -33,7 +33,7 @@ import org.springframework.boot.cli.compiler.grape.DependencyResolutionContext;
* <p> * <p>
* This class provides a fluent API for conditionally adding dependencies. For example: * This class provides a fluent API for conditionally adding dependencies. For example:
* {@code dependencies.ifMissing("com.corp.SomeClass").add(module)}. * {@code dependencies.ifMissing("com.corp.SomeClass").add(module)}.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
......
...@@ -265,7 +265,8 @@ public class GroovyCompiler { ...@@ -265,7 +265,8 @@ public class GroovyCompiler {
public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) public void call(SourceUnit source, GeneratorContext context, ClassNode classNode)
throws CompilationFailedException { throws CompilationFailedException {
ImportCustomizer importCustomizer = new SmartImportCustomizer(source, context, classNode); ImportCustomizer importCustomizer = new SmartImportCustomizer(source,
context, classNode);
ClassNode mainClassNode = getMainClass(source.getAST().getClasses()); ClassNode mainClassNode = getMainClass(source.getAST().getClasses());
// Additional auto configuration // Additional auto configuration
......
...@@ -42,10 +42,8 @@ public class JUnitCompilerAutoConfiguration extends CompilerAutoConfiguration { ...@@ -42,10 +42,8 @@ public class JUnitCompilerAutoConfiguration extends CompilerAutoConfiguration {
} }
@Override @Override
public void applyImports(ImportCustomizer imports) public void applyImports(ImportCustomizer imports) throws CompilationFailedException {
throws CompilationFailedException { imports.addStarImports("org.junit").addStaticStars("org.junit.Assert")
imports.addStarImports("org.junit")
.addStaticStars("org.junit.Assert")
.addStaticStars("org.hamcrest.MatcherAssert") .addStaticStars("org.hamcrest.MatcherAssert")
.addStaticStars("org.hamcrest.Matchers"); .addStaticStars("org.hamcrest.Matchers");
} }
......
...@@ -46,7 +46,7 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration ...@@ -46,7 +46,7 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration
public void applyImports(ImportCustomizer imports) { public void applyImports(ImportCustomizer imports) {
imports.addImports("reactor.core.Reactor", "reactor.core.spec.Reactors", imports.addImports("reactor.core.Reactor", "reactor.core.spec.Reactors",
"reactor.core.Observable", "reactor.event.Event", "reactor.core.Observable", "reactor.event.Event",
"reactor.function.Functions", "reactor.function.Predicates", "reactor.function.Functions", "reactor.function.Predicates",
"reactor.function.Suppliers", "reactor.function.Suppliers",
"reactor.spring.context.annotation.Consumer", "reactor.spring.context.annotation.Consumer",
"reactor.spring.context.annotation.Selector", "reactor.spring.context.annotation.Selector",
......
...@@ -45,8 +45,10 @@ public class SpringBootCompilerAutoConfiguration extends CompilerAutoConfigurati ...@@ -45,8 +45,10 @@ public class SpringBootCompilerAutoConfiguration extends CompilerAutoConfigurati
@Override @Override
public void applyImports(ImportCustomizer imports) { public void applyImports(ImportCustomizer imports) {
imports.addImports("javax.annotation.PostConstruct", imports.addImports(
"javax.annotation.PreDestroy", "groovy.util.logging.Log", "javax.annotation.PostConstruct",
"javax.annotation.PreDestroy",
"groovy.util.logging.Log",
"org.springframework.stereotype.Controller", "org.springframework.stereotype.Controller",
"org.springframework.stereotype.Service", "org.springframework.stereotype.Service",
"org.springframework.stereotype.Component", "org.springframework.stereotype.Component",
......
...@@ -50,8 +50,7 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio ...@@ -50,8 +50,7 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio
public void applyImports(ImportCustomizer imports) { public void applyImports(ImportCustomizer imports) {
imports.addStarImports("org.springframework.web.bind.annotation", imports.addStarImports("org.springframework.web.bind.annotation",
"org.springframework.web.servlet.config.annotation", "org.springframework.web.servlet.config.annotation",
"org.springframework.web.servlet", "org.springframework.web.servlet", "org.springframework.http",
"org.springframework.http",
"org.springframework.web.servlet.handler", "org.springframework.http", "org.springframework.web.servlet.handler", "org.springframework.http",
"org.springframework.ui", "groovy.text"); "org.springframework.ui", "groovy.text");
imports.addStaticImport(GroovyTemplate.class.getName(), "template"); imports.addStaticImport(GroovyTemplate.class.getName(), "template");
......
...@@ -23,7 +23,7 @@ package org.springframework.boot.cli.compiler.dependencies; ...@@ -23,7 +23,7 @@ package org.springframework.boot.cli.compiler.dependencies;
* the relevant piece from the identifier. Alternatively the identifier may be in the form * the relevant piece from the identifier. Alternatively the identifier may be in the form
* {@code artifactId}, in which case coordinate resolution uses implementation-specific * {@code artifactId}, in which case coordinate resolution uses implementation-specific
* metadata to resolve the groupId and version. * metadata to resolve the groupId and version.
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
public interface ArtifactCoordinatesResolver { public interface ArtifactCoordinatesResolver {
......
...@@ -48,7 +48,7 @@ import org.eclipse.aether.util.filter.DependencyFilterUtils; ...@@ -48,7 +48,7 @@ import org.eclipse.aether.util.filter.DependencyFilterUtils;
* A {@link GrapeEngine} implementation that uses <a * A {@link GrapeEngine} implementation that uses <a
* href="http://eclipse.org/aether">Aether</a>, the dependency resolution system used by * href="http://eclipse.org/aether">Aether</a>, the dependency resolution system used by
* Maven. * Maven.
* *
* @author Andy Wilkinson * @author Andy Wilkinson
* @author Phillip Webb * @author Phillip Webb
*/ */
......
...@@ -27,8 +27,7 @@ import org.springframework.boot.dependency.tools.ManagedDependencies; ...@@ -27,8 +27,7 @@ import org.springframework.boot.dependency.tools.ManagedDependencies;
import org.springframework.boot.dependency.tools.PomDependencies; import org.springframework.boot.dependency.tools.PomDependencies;
/** /**
* Factory to create Maven {@link Dependency} objects from Boot * Factory to create Maven {@link Dependency} objects from Boot {@link PomDependencies}.
* {@link PomDependencies}.
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
......
...@@ -55,8 +55,8 @@ public abstract class GroovyTemplate { ...@@ -55,8 +55,8 @@ public abstract class GroovyTemplate {
return result.toString(); return result.toString();
} }
private static Template getTemplate(TemplateEngine engine, String name) throws CompilationFailedException, private static Template getTemplate(TemplateEngine engine, String name)
ClassNotFoundException, IOException { throws CompilationFailedException, ClassNotFoundException, IOException {
File file = new File("templates", name); File file = new File("templates", name);
if (file.exists()) { if (file.exists()) {
......
...@@ -39,7 +39,7 @@ import static org.mockito.Mockito.when; ...@@ -39,7 +39,7 @@ import static org.mockito.Mockito.when;
/** /**
* Tests for {@link DependencyCustomizer} * Tests for {@link DependencyCustomizer}
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
public class DependencyCustomizerTests { public class DependencyCustomizerTests {
......
...@@ -25,7 +25,7 @@ import org.springframework.boot.dependency.tools.ManagedDependencies; ...@@ -25,7 +25,7 @@ import org.springframework.boot.dependency.tools.ManagedDependencies;
/** /**
* Tests for using the Gradle plugin's support for custom version management * Tests for using the Gradle plugin's support for custom version management
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
public class CustomVersionManagementTests { public class CustomVersionManagementTests {
......
...@@ -22,21 +22,21 @@ import org.springframework.boot.dependency.tools.ManagedDependencies; ...@@ -22,21 +22,21 @@ import org.springframework.boot.dependency.tools.ManagedDependencies;
/** /**
* Tests for using the Gradle plugin's support for installing artifacts * Tests for using the Gradle plugin's support for installing artifacts
* *
* @author Dave Syer * @author Dave Syer
*/ */
public class InstallTests { public class InstallTests {
private ProjectConnection project; private ProjectConnection project;
private static final String BOOT_VERSION = ManagedDependencies.get().find( private static final String BOOT_VERSION = ManagedDependencies.get()
"spring-boot").getVersion(); .find("spring-boot").getVersion();
@Test @Test
public void cleanInstall() throws Exception { public void cleanInstall() throws Exception {
project = new ProjectCreator().createProject("installer"); project = new ProjectCreator().createProject("installer");
project.newBuild().forTasks("install").withArguments( project.newBuild().forTasks("install")
"-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run();
} }
@Test @Test
...@@ -44,8 +44,9 @@ public class InstallTests { ...@@ -44,8 +44,9 @@ public class InstallTests {
project = new ProjectCreator().createProject("install-app"); project = new ProjectCreator().createProject("install-app");
// "install" from the application plugin was renamed "installApp" in Gradle // "install" from the application plugin was renamed "installApp" in Gradle
// 1.0 // 1.0
project.newBuild().forTasks("installApp").withArguments( project.newBuild().forTasks("installApp")
"-PbootVersion=" + BOOT_VERSION, "--stacktrace", "--info").run(); .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace", "--info")
.run();
} }
} }
...@@ -25,7 +25,7 @@ import org.springframework.boot.dependency.tools.ManagedDependencies; ...@@ -25,7 +25,7 @@ import org.springframework.boot.dependency.tools.ManagedDependencies;
/** /**
* Tests for using the Gradle plugin's support for installing artifacts * Tests for using the Gradle plugin's support for installing artifacts
* *
* @author Dave Syer * @author Dave Syer
*/ */
public class MainClassTests { public class MainClassTests {
...@@ -42,7 +42,8 @@ public class MainClassTests { ...@@ -42,7 +42,8 @@ public class MainClassTests {
@Test @Test
public void buildFromRunTask() { public void buildFromRunTask() {
project.newBuild().forTasks("build").withArguments("-PbootVersion=" + BOOT_VERSION, "--info").run(); project.newBuild().forTasks("build")
.withArguments("-PbootVersion=" + BOOT_VERSION, "--info").run();
} }
} }
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
package org.springframework.boot.gradle; package org.springframework.boot.gradle;
import static org.junit.Assert.assertFalse;
import java.io.File; import java.io.File;
import org.gradle.tooling.ProjectConnection; import org.gradle.tooling.ProjectConnection;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.dependency.tools.ManagedDependencies; import org.springframework.boot.dependency.tools.ManagedDependencies;
import static org.junit.Assert.assertFalse;
/** /**
* Tests for using the Gradle plugin's support for flat directory repos * Tests for using the Gradle plugin's support for flat directory repos
* *
......
...@@ -38,7 +38,7 @@ import static org.junit.Assert.fail; ...@@ -38,7 +38,7 @@ import static org.junit.Assert.fail;
/** /**
* Tests for the various starter projects to check that they don't pull in unwanted * Tests for the various starter projects to check that they don't pull in unwanted
* transitive dependencies when used with Gradle * transitive dependencies when used with Gradle
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
......
...@@ -16,10 +16,6 @@ ...@@ -16,10 +16,6 @@
package sample.actuator; package sample.actuator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Map; import java.util.Map;
import org.junit.Test; import org.junit.Test;
...@@ -34,6 +30,10 @@ import org.springframework.test.annotation.DirtiesContext; ...@@ -34,6 +30,10 @@ 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;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/** /**
* Integration tests for endpoints configuration. * Integration tests for endpoints configuration.
* *
...@@ -42,7 +42,7 @@ import org.springframework.test.context.web.WebAppConfiguration; ...@@ -42,7 +42,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleActuatorApplication.class) @SpringApplicationConfiguration(classes = SampleActuatorApplication.class)
@WebAppConfiguration @WebAppConfiguration
@IntegrationTest({"server.port=0", "management.context_path=/admin"}) @IntegrationTest({ "server.port=0", "management.context_path=/admin" })
@DirtiesContext @DirtiesContext
public class ManagementPathSampleActuatorApplicationTests { public class ManagementPathSampleActuatorApplicationTests {
......
...@@ -16,10 +16,6 @@ ...@@ -16,10 +16,6 @@
package sample.actuator; package sample.actuator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Map; import java.util.Map;
import org.junit.Test; import org.junit.Test;
...@@ -34,6 +30,10 @@ import org.springframework.test.annotation.DirtiesContext; ...@@ -34,6 +30,10 @@ 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;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/** /**
* Integration tests for endpoints configuration. * Integration tests for endpoints configuration.
* *
...@@ -42,7 +42,7 @@ import org.springframework.test.context.web.WebAppConfiguration; ...@@ -42,7 +42,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleActuatorApplication.class) @SpringApplicationConfiguration(classes = SampleActuatorApplication.class)
@WebAppConfiguration @WebAppConfiguration
@IntegrationTest({"server.port=0", "server.servletPath=/spring"}) @IntegrationTest({ "server.port=0", "server.servletPath=/spring" })
@DirtiesContext @DirtiesContext
public class ServletPathSampleActuatorApplicationTests { public class ServletPathSampleActuatorApplicationTests {
...@@ -53,7 +53,8 @@ public class ServletPathSampleActuatorApplicationTests { ...@@ -53,7 +53,8 @@ public class ServletPathSampleActuatorApplicationTests {
public void testErrorPath() throws Exception { public void testErrorPath() throws Exception {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate("user", "password") ResponseEntity<Map> entity = new TestRestTemplate("user", "password")
.getForEntity("http://localhost:" + this.port + "/spring/error", Map.class); .getForEntity("http://localhost:" + this.port + "/spring/error",
Map.class);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, entity.getStatusCode()); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, entity.getStatusCode());
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String, Object> body = entity.getBody(); Map<String, Object> body = entity.getBody();
......
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
package sample.actuator; package sample.actuator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import java.util.Map; import java.util.Map;
import org.junit.Test; import org.junit.Test;
...@@ -33,6 +30,9 @@ import org.springframework.test.annotation.DirtiesContext; ...@@ -33,6 +30,9 @@ 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;
import static org.junit.Assert.assertFalse;
/** /**
* Integration tests for unsecured service endpoints (even with Spring Security on * Integration tests for unsecured service endpoints (even with Spring Security on
* classpath). * classpath).
...@@ -42,7 +42,8 @@ import org.springframework.test.context.web.WebAppConfiguration; ...@@ -42,7 +42,8 @@ import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleActuatorApplication.class) @SpringApplicationConfiguration(classes = SampleActuatorApplication.class)
@WebAppConfiguration @WebAppConfiguration
@IntegrationTest({ "server.port:0", "security.basic.enabled:false", "server.servletPath:/spring" }) @IntegrationTest({ "server.port:0", "security.basic.enabled:false",
"server.servletPath:/spring" })
@DirtiesContext @DirtiesContext
public class ServletPathUnsecureSampleActuatorApplicationTests { public class ServletPathUnsecureSampleActuatorApplicationTests {
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
package sample.data.elasticsearch; package sample.data.elasticsearch;
import static org.junit.Assert.*;
import java.net.ConnectException; import java.net.ConnectException;
import org.junit.Rule; import org.junit.Rule;
...@@ -25,9 +23,11 @@ import org.junit.Test; ...@@ -25,9 +23,11 @@ import org.junit.Test;
import org.springframework.boot.test.OutputCapture; import org.springframework.boot.test.OutputCapture;
import org.springframework.core.NestedCheckedException; import org.springframework.core.NestedCheckedException;
import static org.junit.Assert.assertTrue;
/** /**
* Tests for {@link SampleElasticsearchApplication}. * Tests for {@link SampleElasticsearchApplication}.
* *
* @author Artur Konczak * @author Artur Konczak
*/ */
public class SampleElasticsearchApplicationTests { public class SampleElasticsearchApplicationTests {
......
...@@ -16,10 +16,6 @@ ...@@ -16,10 +16,6 @@
package sample.ui.secure; package sample.ui.secure;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.Arrays; import java.util.Arrays;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -42,6 +38,10 @@ import org.springframework.test.context.web.WebAppConfiguration; ...@@ -42,6 +38,10 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/** /**
* Basic integration tests for demo application. * Basic integration tests for demo application.
* *
...@@ -65,8 +65,8 @@ public class SampleSecureApplicationTests { ...@@ -65,8 +65,8 @@ public class SampleSecureApplicationTests {
"http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>( "http://localhost:" + this.port, HttpMethod.GET, new HttpEntity<Void>(
headers), String.class); headers), String.class);
assertEquals(HttpStatus.FOUND, entity.getStatusCode()); assertEquals(HttpStatus.FOUND, entity.getStatusCode());
assertTrue("Wrong location:\n" + entity.getHeaders(), assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders()
entity.getHeaders().getLocation().toString().endsWith(port + "/login")); .getLocation().toString().endsWith(port + "/login"));
} }
@Test @Test
...@@ -74,8 +74,8 @@ public class SampleSecureApplicationTests { ...@@ -74,8 +74,8 @@ public class SampleSecureApplicationTests {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
ResponseEntity<String> entity = new TestRestTemplate().exchange( ResponseEntity<String> entity = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/login", HttpMethod.GET, new HttpEntity<Void>( "http://localhost:" + this.port + "/login", HttpMethod.GET,
headers), String.class); new HttpEntity<Void>(headers), String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals(HttpStatus.OK, entity.getStatusCode());
assertTrue("Wrong content:\n" + entity.getBody(), assertTrue("Wrong content:\n" + entity.getBody(),
entity.getBody().contains("_csrf")); entity.getBody().contains("_csrf"));
...@@ -94,8 +94,8 @@ public class SampleSecureApplicationTests { ...@@ -94,8 +94,8 @@ public class SampleSecureApplicationTests {
new HttpEntity<MultiValueMap<String, String>>(form, headers), new HttpEntity<MultiValueMap<String, String>>(form, headers),
String.class); String.class);
assertEquals(HttpStatus.FOUND, entity.getStatusCode()); assertEquals(HttpStatus.FOUND, entity.getStatusCode());
assertTrue("Wrong location:\n" + entity.getHeaders(), assertTrue("Wrong location:\n" + entity.getHeaders(), entity.getHeaders()
entity.getHeaders().getLocation().toString().endsWith(port + "/")); .getLocation().toString().endsWith(port + "/"));
assertNotNull("Missing cookie:\n" + entity.getHeaders(), assertNotNull("Missing cookie:\n" + entity.getHeaders(),
entity.getHeaders().get("Set-Cookie")); entity.getHeaders().get("Set-Cookie"));
} }
...@@ -107,8 +107,8 @@ public class SampleSecureApplicationTests { ...@@ -107,8 +107,8 @@ public class SampleSecureApplicationTests {
assertEquals(HttpStatus.OK, page.getStatusCode()); assertEquals(HttpStatus.OK, page.getStatusCode());
String cookie = page.getHeaders().getFirst("Set-Cookie"); String cookie = page.getHeaders().getFirst("Set-Cookie");
headers.set("Cookie", cookie); headers.set("Cookie", cookie);
Matcher matcher = Pattern.compile("(?s).*name=\"_csrf\".*?value=\"([^\"]+).*").matcher( Matcher matcher = Pattern.compile("(?s).*name=\"_csrf\".*?value=\"([^\"]+).*")
page.getBody()); .matcher(page.getBody());
assertTrue("No csrf token: " + page.getBody(), matcher.matches()); assertTrue("No csrf token: " + page.getBody(), matcher.matches());
headers.set("X-CSRF-TOKEN", matcher.group(1)); headers.set("X-CSRF-TOKEN", matcher.group(1));
return headers; return headers;
......
...@@ -23,9 +23,9 @@ import java.util.Properties; ...@@ -23,9 +23,9 @@ import java.util.Properties;
import java.util.TreeMap; import java.util.TreeMap;
/** /**
* {@link Dependencies} backed by an external properties file (of the form created * {@link Dependencies} backed by an external properties file (of the form created by the
* by the Spring IO platform). The property key should be the groupId and artifactId (in * Spring IO platform). The property key should be the groupId and artifactId (in the form
* the form {@literal groupId:artifactId}) and the value should be the version. * {@literal groupId:artifactId}) and the value should be the version.
* *
* @author Phillip Webb * @author Phillip Webb
* @since 1.1.0 * @since 1.1.0
...@@ -33,8 +33,8 @@ import java.util.TreeMap; ...@@ -33,8 +33,8 @@ import java.util.TreeMap;
public class PropertiesFileDependencies extends AbstractDependencies { public class PropertiesFileDependencies extends AbstractDependencies {
/** /**
* Create a new {@link PropertiesFileDependencies} instance from the specified * Create a new {@link PropertiesFileDependencies} instance from the specified input
* input stream. * stream.
* @param inputStream source input stream (will be closed when properties have been * @param inputStream source input stream (will be closed when properties have been
* loaded) * loaded)
* @throws IOException * @throws IOException
......
...@@ -110,7 +110,8 @@ class JarURLConnection extends java.net.JarURLConnection { ...@@ -110,7 +110,8 @@ class JarURLConnection extends java.net.JarURLConnection {
this.connected = true; this.connected = true;
} }
private void throwFileNotFound(Object entry, JarFile jarFile) throws FileNotFoundException { private void throwFileNotFound(Object entry, JarFile jarFile)
throws FileNotFoundException {
if (Boolean.TRUE.equals(useFastExceptions.get())) { if (Boolean.TRUE.equals(useFastExceptions.get())) {
throw FILE_NOT_FOUND_EXCEPTION; throw FILE_NOT_FOUND_EXCEPTION;
} }
......
...@@ -33,7 +33,7 @@ import static org.mockito.Mockito.when; ...@@ -33,7 +33,7 @@ import static org.mockito.Mockito.when;
/** /**
* Tests for {@link ExecutableArchiveLauncher} * Tests for {@link ExecutableArchiveLauncher}
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
public class ExecutableArchiveLauncherTests { public class ExecutableArchiveLauncherTests {
...@@ -74,16 +74,17 @@ public class ExecutableArchiveLauncherTests { ...@@ -74,16 +74,17 @@ public class ExecutableArchiveLauncherTests {
when(this.javaAgentDetector.isJavaAgentJar(javaAgent)).thenReturn(true); when(this.javaAgentDetector.isJavaAgentJar(javaAgent)).thenReturn(true);
doWithTccl(new URLClassLoader(new URL[] { javaAgent, one }), new Callable<Void>() { doWithTccl(new URLClassLoader(new URL[] { javaAgent, one }),
new Callable<Void>() {
@Override
public Void call() throws Exception { @Override
ClassLoader classLoader = ExecutableArchiveLauncherTests.this.launcher public Void call() throws Exception {
.createClassLoader(new URL[0]); ClassLoader classLoader = ExecutableArchiveLauncherTests.this.launcher
assertClassLoaderUrls(classLoader, new URL[] { one }); .createClassLoader(new URL[0]);
return null; assertClassLoaderUrls(classLoader, new URL[] { one });
} return null;
}); }
});
} }
private void assertClassLoaderUrls(ClassLoader classLoader, URL[] urls) { private void assertClassLoaderUrls(ClassLoader classLoader, URL[] urls) {
...@@ -92,7 +93,7 @@ public class ExecutableArchiveLauncherTests { ...@@ -92,7 +93,7 @@ public class ExecutableArchiveLauncherTests {
} }
private static final class UnitTestExecutableArchiveLauncher extends private static final class UnitTestExecutableArchiveLauncher extends
ExecutableArchiveLauncher { ExecutableArchiveLauncher {
public UnitTestExecutableArchiveLauncher(JavaAgentDetector javaAgentDetector) { public UnitTestExecutableArchiveLauncher(JavaAgentDetector javaAgentDetector) {
super(javaAgentDetector); super(javaAgentDetector);
......
...@@ -28,7 +28,7 @@ import static org.junit.Assert.assertTrue; ...@@ -28,7 +28,7 @@ import static org.junit.Assert.assertTrue;
/** /**
* Tests for {@link InputArgumentsJavaAgentDetector} * Tests for {@link InputArgumentsJavaAgentDetector}
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
public class InputArgumentsJavaAgentDetectorTests { public class InputArgumentsJavaAgentDetectorTests {
...@@ -39,7 +39,7 @@ public class InputArgumentsJavaAgentDetectorTests { ...@@ -39,7 +39,7 @@ public class InputArgumentsJavaAgentDetectorTests {
InputArgumentsJavaAgentDetector detector = new InputArgumentsJavaAgentDetector( InputArgumentsJavaAgentDetector detector = new InputArgumentsJavaAgentDetector(
Arrays.asList("-javaagent:my-agent.jar")); Arrays.asList("-javaagent:my-agent.jar"));
assertFalse(detector.isJavaAgentJar(new File("something-else.jar") assertFalse(detector.isJavaAgentJar(new File("something-else.jar")
.getCanonicalFile().toURI().toURL())); .getCanonicalFile().toURI().toURL()));
} }
@Test @Test
......
...@@ -78,16 +78,15 @@ public class JarFileArchiveTests { ...@@ -78,16 +78,15 @@ public class JarFileArchiveTests {
@Test @Test
public void getUrl() throws Exception { public void getUrl() throws Exception {
URL url = this.archive.getUrl(); URL url = this.archive.getUrl();
assertThat(url.toString(), equalTo("jar:" + this.rootJarFileUrl assertThat(url.toString(), equalTo("jar:" + this.rootJarFileUrl + "!/"));
+ "!/"));
} }
@Test @Test
public void getNestedArchive() throws Exception { public void getNestedArchive() throws Exception {
Entry entry = getEntriesMap(this.archive).get("nested.jar"); Entry entry = getEntriesMap(this.archive).get("nested.jar");
Archive nested = this.archive.getNestedArchive(entry); Archive nested = this.archive.getNestedArchive(entry);
assertThat(nested.getUrl().toString(), assertThat(nested.getUrl().toString(), equalTo("jar:" + this.rootJarFileUrl
equalTo("jar:" + this.rootJarFileUrl + "!/nested.jar!/")); + "!/nested.jar!/"));
} }
@Test @Test
......
...@@ -151,9 +151,9 @@ public class LoggingApplicationListener implements SmartApplicationListener { ...@@ -151,9 +151,9 @@ public class LoggingApplicationListener implements SmartApplicationListener {
// Logback won't read backslashes so add a clean path for it to use // Logback won't read backslashes so add a clean path for it to use
if (!StringUtils.hasLength(System.getProperty("LOG_TEMP"))) { if (!StringUtils.hasLength(System.getProperty("LOG_TEMP"))) {
String path = System.getProperty("java.io.tmpdir"); String path = System.getProperty("java.io.tmpdir");
path = StringUtils.cleanPath(path); path = StringUtils.cleanPath(path);
if(path.endsWith("/")) { if (path.endsWith("/")) {
path = path.substring(0,path.length()-1); path = path.substring(0, path.length() - 1);
} }
System.setProperty("LOG_TEMP", path); System.setProperty("LOG_TEMP", path);
} }
......
...@@ -86,10 +86,11 @@ public class LoggingApplicationListenerTests { ...@@ -86,10 +86,11 @@ public class LoggingApplicationListenerTests {
} }
private String tmpDir() { private String tmpDir() {
String path = this.context.getEnvironment().resolvePlaceholders("${java.io.tmpdir}"); String path = this.context.getEnvironment().resolvePlaceholders(
"${java.io.tmpdir}");
path = path.replace("\\", "/"); path = path.replace("\\", "/");
if(path.endsWith("/")) { if (path.endsWith("/")) {
path = path.substring(0, path.length()-1); path = path.substring(0, path.length() - 1);
} }
return path; return path;
} }
......
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