Remove need for attached test-jar artifacts
Remove test-jar artifacts from Maven projects and relocate classes. The majority of utilities now live in the `spring-boot-testsupport` module. This update will help us to deploy artifacts using the standard Maven deploy plugin in the future (which doesn't support the filtering of individual artifacts). Fixes gh-9493
This commit is contained in:
parent
54efc36dd8
commit
b94bb00fa1
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -197,7 +198,8 @@
|
|||
<artifactId>spring-data-solr</artifactId>
|
||||
<optional>true</optional>
|
||||
<exclusions>
|
||||
<!-- the version of solr here is incompatible with jackson-xml because of an old woodstox -->
|
||||
<!-- the version of solr here is incompatible with jackson-xml because
|
||||
of an old woodstox -->
|
||||
<exclusion>
|
||||
<artifactId>wstx-asl</artifactId>
|
||||
<groupId>org.codehaus.woodstox</groupId>
|
||||
|
|
@ -278,8 +280,7 @@
|
|||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
<type>test-jar</type>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -287,17 +288,6 @@
|
|||
<artifactId>spring-boot-test-support</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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,7 +16,7 @@
|
|||
|
||||
package org.springframework.boot.actuate;
|
||||
|
||||
import org.springframework.boot.test.testutil.AbstractConfigurationClassTests;
|
||||
import org.springframework.boot.testsupport.context.AbstractConfigurationClassTests;
|
||||
|
||||
/**
|
||||
* Tests for the actuator module's {@code @Configuration} classes.
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ import org.springframework.boot.context.event.ApplicationFailedEvent;
|
|||
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
|
||||
import org.springframework.boot.logging.LoggingSystem;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.testutil.Matched;
|
||||
import org.springframework.boot.testsupport.assertj.Matched;
|
||||
import org.springframework.boot.web.context.ServerPortInfoApplicationContextInitializer;
|
||||
import org.springframework.boot.web.context.WebServerInitializedEvent;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.springframework.boot.actuate.endpoint.mvc.EndpointHandlerMapping;
|
|||
import org.springframework.boot.actuate.endpoint.mvc.JolokiaMvcEndpoint;
|
||||
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint;
|
||||
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpointSecurityInterceptor;
|
||||
import org.springframework.boot.actuate.servlet.MockServletWebServerFactory;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
|
||||
|
|
@ -34,7 +35,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
|||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor;
|
||||
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
|
||||
import org.springframework.boot.web.servlet.server.MockServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
|
|||
|
|
@ -40,12 +40,12 @@ import org.springframework.boot.actuate.endpoint.TomcatPublicMetrics;
|
|||
import org.springframework.boot.actuate.metrics.Metric;
|
||||
import org.springframework.boot.actuate.metrics.rich.RichGauge;
|
||||
import org.springframework.boot.actuate.metrics.rich.RichGaugeReader;
|
||||
import org.springframework.boot.actuate.servlet.MockServletWebServerFactory;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
|
||||
import org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
|
||||
import org.springframework.boot.web.servlet.server.MockServletWebServerFactory;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ import org.junit.Rule;
|
|||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.springframework.boot.testsupport.web.servlet.ExampleServlet;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.server.Ssl;
|
||||
import org.springframework.boot.web.server.WebServer;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.server.ExampleServlet;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.ResourceAccessException;
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
|
|||
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.AbstractEndpoint;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import org.junit.Test;
|
|||
import org.springframework.boot.actuate.metrics.Iterables;
|
||||
import org.springframework.boot.actuate.metrics.Metric;
|
||||
import org.springframework.boot.actuate.metrics.writer.Delta;
|
||||
import org.springframework.boot.redis.RedisTestServer;
|
||||
import org.springframework.boot.testsupport.rule.RedisTestServer;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.junit.runners.Parameterized.Parameters;
|
|||
import org.springframework.boot.actuate.metrics.Iterables;
|
||||
import org.springframework.boot.actuate.metrics.Metric;
|
||||
import org.springframework.boot.actuate.metrics.writer.Delta;
|
||||
import org.springframework.boot.redis.RedisTestServer;
|
||||
import org.springframework.boot.testsupport.rule.RedisTestServer;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright 2012-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.actuate.servlet;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter;
|
||||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet;
|
||||
import org.springframework.boot.web.server.WebServer;
|
||||
import org.springframework.boot.web.server.WebServerException;
|
||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
/**
|
||||
* Mock {@link ServletWebServerFactory}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class MockServletWebServerFactory extends AbstractServletWebServerFactory {
|
||||
|
||||
private MockServletWebServer webServer;
|
||||
|
||||
@Override
|
||||
public WebServer getWebServer(ServletContextInitializer... initializers) {
|
||||
this.webServer = spy(
|
||||
new MockServletWebServer(mergeInitializers(initializers), getPort()));
|
||||
return this.webServer;
|
||||
}
|
||||
|
||||
public MockServletWebServer getWebServer() {
|
||||
return this.webServer;
|
||||
}
|
||||
|
||||
public ServletContext getServletContext() {
|
||||
return getWebServer() == null ? null : getWebServer().getServletContext();
|
||||
}
|
||||
|
||||
public RegisteredServlet getRegisteredServlet(int index) {
|
||||
return getWebServer() == null ? null : getWebServer().getRegisteredServlet(index);
|
||||
}
|
||||
|
||||
public RegisteredFilter getRegisteredFilter(int index) {
|
||||
return getWebServer() == null ? null : getWebServer().getRegisteredFilters(index);
|
||||
}
|
||||
|
||||
public static class MockServletWebServer
|
||||
extends org.springframework.boot.testsupport.web.servlet.MockServletWebServer
|
||||
implements WebServer {
|
||||
|
||||
public MockServletWebServer(ServletContextInitializer[] initializers, int port) {
|
||||
super(Arrays.stream(initializers)
|
||||
.map((i) -> (Initializer) (s) -> i.onStartup(s))
|
||||
.toArray(Initializer[]::new), port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws WebServerException {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="warn" name="test" packages="">
|
||||
<Properties>
|
||||
<Property name="LOG_EXCEPTION_CONVERSION_WORD">%xwEx</Property>
|
||||
<Property name="LOG_LEVEL_PATTERN">%5p</Property>
|
||||
</Properties>
|
||||
<Appenders>
|
||||
<Console name="STDOUT" target="SYSTEM_OUT" follow="true">
|
||||
<PatternLayout pattern="%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{${LOG_LEVEL_PATTERN}} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="info">
|
||||
<AppenderRef ref="STDOUT"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml" />
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</root>
|
||||
<!-- logger name="org.springframework.security" level="DEBUG"/-->
|
||||
</configuration>
|
||||
|
|
@ -678,12 +678,6 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test-support</artifactId>
|
||||
|
|
@ -694,12 +688,6 @@
|
|||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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,7 +16,7 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure;
|
||||
|
||||
import org.springframework.boot.test.testutil.AbstractConfigurationClassTests;
|
||||
import org.springframework.boot.testsupport.context.AbstractConfigurationClassTests;
|
||||
|
||||
/**
|
||||
* Tests for the auto-configure module's {@code @Configuration} classes.
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
|
|||
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.test.City;
|
||||
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ import org.springframework.beans.factory.BeanCreationException;
|
|||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.boot.autoconfigure.cache.support.MockCachingProvider;
|
||||
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionEvaluationRepor
|
|||
import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.testutil.Matched;
|
||||
import org.springframework.boot.testsupport.assertj.Matched;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Condition;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
|
|
@ -20,8 +20,8 @@ import org.junit.After;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.cache.caffeine.CaffeineCacheManager;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
|
|
@ -21,8 +21,8 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.OnBeanCondition.BeanTypeDeductionException;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.springframework.boot.autoconfigure.data.alt.redis.CityRedisRepository
|
|||
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
|
||||
import org.springframework.boot.autoconfigure.data.redis.city.City;
|
||||
import org.springframework.boot.autoconfigure.data.redis.city.CityRepository;
|
||||
import org.springframework.boot.redis.RedisTestServer;
|
||||
import org.springframework.boot.testsupport.rule.RedisTestServer;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ import org.junit.rules.ExpectedException;
|
|||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ import org.junit.After;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
|
|
@ -22,8 +22,8 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.diagnostics.FailureAnalysis;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
|
|||
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
|
||||
import org.springframework.boot.context.event.ApplicationFailedEvent;
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -52,7 +52,7 @@ import static org.junit.Assert.fail;
|
|||
public class AutoConfigurationReportLoggingInitializerTests {
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture outputCapture = new InternalOutputCapture();
|
||||
public OutputCapture outputCapture = new OutputCapture();
|
||||
|
||||
private AutoConfigurationReportLoggingInitializer initializer = new AutoConfigurationReportLoggingInitializer();
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,16 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.security;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.context.properties.bind.Bindable;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
|
||||
import org.springframework.boot.context.properties.source.MockConfigurationPropertySource;
|
||||
import org.springframework.boot.context.properties.source.MapConfigurationPropertySource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
@ -60,9 +64,10 @@ public class SecurityPropertiesTests {
|
|||
|
||||
@Test
|
||||
public void testBindingIgnoredMultiValuedList() {
|
||||
MockConfigurationPropertySource source = new MockConfigurationPropertySource();
|
||||
source.put("security.ignored[0]", "/css/**");
|
||||
source.put("security.ignored[1]", "/foo/**");
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
map.put("security.ignored[0]", "/css/**");
|
||||
map.put("security.ignored[1]", "/foo/**");
|
||||
MapConfigurationPropertySource source = new MapConfigurationPropertySource(map);
|
||||
bind(source);
|
||||
assertThat(this.security.getIgnored()).hasSize(2);
|
||||
assertThat(this.security.getIgnored().contains("/foo/**")).isTrue();
|
||||
|
|
@ -94,7 +99,7 @@ public class SecurityPropertiesTests {
|
|||
}
|
||||
|
||||
private void bind(String name, String value) {
|
||||
bind(new MockConfigurationPropertySource(name, value));
|
||||
bind(new MapConfigurationPropertySource(Collections.singletonMap(name, value)));
|
||||
}
|
||||
|
||||
private void bind(ConfigurationPropertySource source) {
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ import org.springframework.boot.autoconfigure.security.oauth2.OAuth2ClientProper
|
|||
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2RestOperationsConfiguration;
|
||||
import org.springframework.boot.autoconfigure.social.FacebookAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.social.SocialWebAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.MockServletWebServerFactory;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.web.servlet.server.MockServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.junit.Test;
|
|||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
||||
import org.springframework.boot.redis.RedisTestServer;
|
||||
import org.springframework.boot.testsupport.rule.RedisTestServer;
|
||||
import org.springframework.session.data.redis.RedisFlushMode;
|
||||
import org.springframework.session.data.redis.RedisOperationsSessionRepository;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import org.junit.After;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
|
|
@ -22,8 +22,8 @@ import org.junit.After;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.springframework.boot.autoconfigure.web;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.testutil.Matched;
|
||||
import org.springframework.boot.testsupport.assertj.Matched;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hamcrest.CoreMatchers.endsWith;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ import org.junit.Test;
|
|||
|
||||
import org.springframework.boot.context.properties.bind.Bindable;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.boot.context.properties.source.MockConfigurationPropertySource;
|
||||
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
|
||||
import org.springframework.boot.context.properties.source.MapConfigurationPropertySource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
@ -183,8 +184,7 @@ public class ServerPropertiesTests {
|
|||
}
|
||||
|
||||
private void bind(Map<String, String> map) {
|
||||
MockConfigurationPropertySource source = new MockConfigurationPropertySource();
|
||||
map.forEach(source::put);
|
||||
ConfigurationPropertySource source = new MapConfigurationPropertySource(map);
|
||||
new Binder(source).bind("server", Bindable.ofInstance(this.properties));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ import org.mockito.MockitoAnnotations;
|
|||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.boot.context.properties.bind.Bindable;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.boot.context.properties.source.MockConfigurationPropertySource;
|
||||
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
|
||||
import org.springframework.boot.context.properties.source.MapConfigurationPropertySource;
|
||||
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
|
||||
import org.springframework.boot.web.embedded.jetty.JettyWebServer;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatContextCustomizer;
|
||||
|
|
@ -617,8 +618,7 @@ public class DefaultServletWebServerFactoryCustomizerTests {
|
|||
}
|
||||
|
||||
private void bindProperties(Map<String, String> map) {
|
||||
MockConfigurationPropertySource source = new MockConfigurationPropertySource();
|
||||
map.forEach(source::put);
|
||||
ConfigurationPropertySource source = new MapConfigurationPropertySource(map);
|
||||
new Binder(source).bind("server", Bindable.ofInstance(this.properties));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,12 +30,11 @@ import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConf
|
|||
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.session.SessionAutoConfiguration;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter;
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor;
|
||||
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
|
||||
import org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter;
|
||||
import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter;
|
||||
import org.springframework.boot.web.servlet.server.MockServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.MockServletWebServerFactory.RegisteredFilter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
|||
import org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor;
|
||||
import org.springframework.boot.web.servlet.filter.OrderedHiddenHttpMethodFilter;
|
||||
import org.springframework.boot.web.servlet.filter.OrderedHttpPutFormContentFilter;
|
||||
import org.springframework.boot.web.servlet.server.MockServletWebServerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright 2012-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web.servlet;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredFilter;
|
||||
import org.springframework.boot.testsupport.web.servlet.MockServletWebServer.RegisteredServlet;
|
||||
import org.springframework.boot.web.server.WebServer;
|
||||
import org.springframework.boot.web.server.WebServerException;
|
||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
/**
|
||||
* Mock {@link ServletWebServerFactory}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class MockServletWebServerFactory extends AbstractServletWebServerFactory {
|
||||
|
||||
private MockServletWebServer webServer;
|
||||
|
||||
@Override
|
||||
public WebServer getWebServer(ServletContextInitializer... initializers) {
|
||||
this.webServer = spy(
|
||||
new MockServletWebServer(mergeInitializers(initializers), getPort()));
|
||||
return this.webServer;
|
||||
}
|
||||
|
||||
public MockServletWebServer getWebServer() {
|
||||
return this.webServer;
|
||||
}
|
||||
|
||||
public ServletContext getServletContext() {
|
||||
return getWebServer() == null ? null : getWebServer().getServletContext();
|
||||
}
|
||||
|
||||
public RegisteredServlet getRegisteredServlet(int index) {
|
||||
return getWebServer() == null ? null : getWebServer().getRegisteredServlet(index);
|
||||
}
|
||||
|
||||
public RegisteredFilter getRegisteredFilter(int index) {
|
||||
return getWebServer() == null ? null : getWebServer().getRegisteredFilters(index);
|
||||
}
|
||||
|
||||
public static class MockServletWebServer
|
||||
extends org.springframework.boot.testsupport.web.servlet.MockServletWebServer
|
||||
implements WebServer {
|
||||
|
||||
public MockServletWebServer(ServletContextInitializer[] initializers, int port) {
|
||||
super(Arrays.stream(initializers)
|
||||
.map((i) -> (Initializer) (s) -> i.onStartup(s))
|
||||
.toArray(Initializer[]::new), port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws WebServerException {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -31,7 +31,6 @@ import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
|||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
|
||||
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.MockServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ import org.springframework.boot.test.util.TestPropertyValues;
|
|||
import org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor;
|
||||
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
|
||||
import org.springframework.boot.web.servlet.filter.OrderedHttpPutFormContentFilter;
|
||||
import org.springframework.boot.web.servlet.server.MockServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
|
|||
|
|
@ -140,8 +140,7 @@
|
|||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
<type>test-jar</type>
|
||||
<artifactId>spring-boot-test-support</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration;
|
|||
import org.springframework.boot.cli.compiler.GroovyCompilerScope;
|
||||
import org.springframework.boot.cli.compiler.RepositoryConfigurationFactory;
|
||||
import org.springframework.boot.cli.compiler.grape.RepositoryConfiguration;
|
||||
import org.springframework.boot.testutil.Matched;
|
||||
import org.springframework.boot.testsupport.assertj.Matched;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hamcrest.Matchers.hasItems;
|
||||
|
|
|
|||
|
|
@ -225,23 +225,11 @@
|
|||
<artifactId>spring-boot</artifactId>
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
<type>test-jar</type>
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<type>test-jar</type>
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test-autoconfigure</artifactId>
|
||||
|
|
|
|||
|
|
@ -86,12 +86,6 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test-support</artifactId>
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
import static org.mockito.Mockito.times;
|
||||
|
|
|
|||
|
|
@ -774,12 +774,6 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test-support</artifactId>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
|
|
@ -20,9 +20,9 @@ import org.junit.Rule;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration;
|
||||
import org.springframework.boot.test.util.TestPropertyValues;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
|
|
@ -21,8 +21,8 @@ import org.junit.runner.JUnitCore;
|
|||
import org.junit.runner.Result;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
|
|||
|
|
@ -111,12 +111,6 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test-support</artifactId>
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ import org.junit.Rule;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathOverrides;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathOverrides;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import org.junit.runner.Result;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.junit.runner.notification.Failure;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathOverrides;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathOverrides;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import org.junit.runner.Result;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.junit.runner.notification.Failure;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathOverrides;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathOverrides;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import org.junit.runner.Result;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.junit.runner.notification.Failure;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathOverrides;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathOverrides;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import org.junit.runner.Result;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.junit.runner.notification.Failure;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathOverrides;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathOverrides;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.junit.Test;
|
|||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import org.springframework.boot.junit.compiler.TestCompiler;
|
||||
import org.springframework.boot.testsupport.compiler.TestCompiler;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ import org.springframework.boot.configurationsample.specific.InnerClassRootConfi
|
|||
import org.springframework.boot.configurationsample.specific.InvalidAccessorProperties;
|
||||
import org.springframework.boot.configurationsample.specific.InvalidDoubleRegistrationProperties;
|
||||
import org.springframework.boot.configurationsample.specific.SimplePojo;
|
||||
import org.springframework.boot.junit.compiler.TestCompiler;
|
||||
import org.springframework.boot.testsupport.compiler.TestCompiler;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ import org.junit.rules.TemporaryFolder;
|
|||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationsample.ConfigurationProperties;
|
||||
import org.springframework.boot.configurationsample.NestedConfigurationProperty;
|
||||
import org.springframework.boot.junit.compiler.TestCompiler;
|
||||
import org.springframework.boot.junit.compiler.TestCompiler.TestCompilationTask;
|
||||
import org.springframework.boot.testsupport.compiler.TestCompiler;
|
||||
import org.springframework.boot.testsupport.compiler.TestCompiler.TestCompilationTask;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.junit.Test;
|
|||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import org.springframework.boot.configurationsample.fieldvalues.FieldValues;
|
||||
import org.springframework.boot.junit.compiler.TestCompiler;
|
||||
import org.springframework.boot.testsupport.compiler.TestCompiler;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,11 @@
|
|||
<version>1.46</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test-support</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
|
|
|||
|
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.loader;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
/**
|
||||
* Internal JUnit {@code @Rule} to capture output from System.out and System.err.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
class InternalOutputCapture implements TestRule {
|
||||
|
||||
private CaptureOutputStream captureOut;
|
||||
|
||||
private CaptureOutputStream captureErr;
|
||||
|
||||
private ByteArrayOutputStream copy;
|
||||
|
||||
@Override
|
||||
public Statement apply(final Statement base, Description description) {
|
||||
return new Statement() {
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
captureOutput();
|
||||
try {
|
||||
base.evaluate();
|
||||
}
|
||||
finally {
|
||||
releaseOutput();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected void captureOutput() {
|
||||
this.copy = new ByteArrayOutputStream();
|
||||
this.captureOut = new CaptureOutputStream(System.out, this.copy);
|
||||
this.captureErr = new CaptureOutputStream(System.err, this.copy);
|
||||
System.setOut(new PrintStream(this.captureOut));
|
||||
System.setErr(new PrintStream(this.captureErr));
|
||||
}
|
||||
|
||||
protected void releaseOutput() {
|
||||
System.setOut(this.captureOut.getOriginal());
|
||||
System.setErr(this.captureErr.getOriginal());
|
||||
this.copy = null;
|
||||
}
|
||||
|
||||
public void flush() {
|
||||
try {
|
||||
this.captureOut.flush();
|
||||
this.captureErr.flush();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
flush();
|
||||
return this.copy.toString();
|
||||
}
|
||||
|
||||
private static class CaptureOutputStream extends OutputStream {
|
||||
|
||||
private final PrintStream original;
|
||||
|
||||
private final OutputStream copy;
|
||||
|
||||
CaptureOutputStream(PrintStream original, OutputStream copy) {
|
||||
this.original = original;
|
||||
this.copy = copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
this.copy.write(b);
|
||||
this.original.write(b);
|
||||
this.original.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
write(b, 0, b.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
this.copy.write(b, off, len);
|
||||
this.original.write(b, off, len);
|
||||
}
|
||||
|
||||
public PrintStream getOriginal() {
|
||||
return this.original;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
this.copy.flush();
|
||||
this.original.flush();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -39,6 +39,7 @@ import org.mockito.MockitoAnnotations;
|
|||
import org.springframework.boot.loader.archive.Archive;
|
||||
import org.springframework.boot.loader.archive.ExplodedArchive;
|
||||
import org.springframework.boot.loader.archive.JarFileArchive;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
public class PropertiesLauncherTests {
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture output = new InternalOutputCapture();
|
||||
public OutputCapture output = new OutputCapture();
|
||||
|
||||
@Rule
|
||||
public ExpectedException expected = ExpectedException.none();
|
||||
|
|
|
|||
|
|
@ -19,12 +19,6 @@
|
|||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- Provided -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Compile -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
|
|
@ -66,16 +60,50 @@
|
|||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-library</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
</dependency>
|
||||
<!-- Optional -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- Provided -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.testutil;
|
||||
package org.springframework.boot.testsupport.assertj;
|
||||
|
||||
import org.assertj.core.api.Condition;
|
||||
import org.hamcrest.Matcher;
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2012-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utilities and helpers for AssertJ.
|
||||
*/
|
||||
package org.springframework.boot.testsupport.assertj;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.junit.compiler;
|
||||
package org.springframework.boot.testsupport.compiler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
@ -17,4 +17,4 @@
|
|||
/**
|
||||
* Utilities to work with the Java compiler at test time.
|
||||
*/
|
||||
package org.springframework.boot.junit.compiler;
|
||||
package org.springframework.boot.testsupport.compiler;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.test.testutil;
|
||||
package org.springframework.boot.testsupport.context;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2012-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utilities to help test Spring contexts.
|
||||
*/
|
||||
package org.springframework.boot.testsupport.context;
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2012-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal support classes used in Spring Boot tests.
|
||||
*/
|
||||
package org.springframework.boot.testsupport;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.testutil;
|
||||
package org.springframework.boot.testsupport.rule;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -29,9 +29,6 @@ import org.junit.rules.TestRule;
|
|||
import org.junit.runner.Description;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
import org.springframework.boot.ansi.AnsiOutput;
|
||||
import org.springframework.boot.ansi.AnsiOutput.Enabled;
|
||||
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
|
||||
/**
|
||||
|
|
@ -40,7 +37,7 @@ import static org.hamcrest.Matchers.allOf;
|
|||
* @author Phillip Webb
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class InternalOutputCapture implements TestRule {
|
||||
public class OutputCapture implements TestRule {
|
||||
|
||||
private CaptureOutputStream captureOut;
|
||||
|
||||
|
|
@ -61,10 +58,9 @@ public class InternalOutputCapture implements TestRule {
|
|||
}
|
||||
finally {
|
||||
try {
|
||||
if (!InternalOutputCapture.this.matchers.isEmpty()) {
|
||||
String output = InternalOutputCapture.this.toString();
|
||||
Assert.assertThat(output,
|
||||
allOf(InternalOutputCapture.this.matchers));
|
||||
if (!OutputCapture.this.matchers.isEmpty()) {
|
||||
String output = OutputCapture.this.toString();
|
||||
Assert.assertThat(output, allOf(OutputCapture.this.matchers));
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
@ -76,7 +72,7 @@ public class InternalOutputCapture implements TestRule {
|
|||
}
|
||||
|
||||
protected void captureOutput() {
|
||||
AnsiOutput.setEnabled(Enabled.NEVER);
|
||||
// FIXME AnsiOutput.setEnabled(Enabled.NEVER);
|
||||
this.copy = new ByteArrayOutputStream();
|
||||
this.captureOut = new CaptureOutputStream(System.out, this.copy);
|
||||
this.captureErr = new CaptureOutputStream(System.err, this.copy);
|
||||
|
|
@ -85,7 +81,7 @@ public class InternalOutputCapture implements TestRule {
|
|||
}
|
||||
|
||||
protected void releaseOutput() {
|
||||
AnsiOutput.setEnabled(Enabled.DETECT);
|
||||
// FIXME AnsiOutput.setEnabled(Enabled.DETECT);
|
||||
System.setOut(this.captureOut.getOriginal());
|
||||
System.setErr(this.captureErr.getOriginal());
|
||||
this.copy = null;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.redis;
|
||||
package org.springframework.boot.testsupport.rule;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
|
@ -64,7 +64,9 @@ public class RedisTestServer implements TestRule {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the connection factory if any
|
||||
* Return the Redis connection factory or {@code null} if the factory is not
|
||||
* available.
|
||||
* @return the connection factory or {@code null}
|
||||
*/
|
||||
public RedisConnectionFactory getConnectionFactory() {
|
||||
return this.connectionFactory;
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright 2012-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Internal JUnit rules used in Spring Boot tests.
|
||||
*/
|
||||
package org.springframework.boot.testsupport.rule;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.junit.runner.classpath;
|
||||
package org.springframework.boot.testsupport.runner.classpath;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.junit.runner.classpath;
|
||||
package org.springframework.boot.testsupport.runner.classpath;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.junit.runner.classpath;
|
||||
package org.springframework.boot.testsupport.runner.classpath;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.annotation.Annotation;
|
||||
|
|
@ -17,4 +17,4 @@
|
|||
/**
|
||||
* Custom JUnit runner to change the classpath.
|
||||
*/
|
||||
package org.springframework.boot.junit.runner.classpath;
|
||||
package org.springframework.boot.testsupport.runner.classpath;
|
||||
|
|
@ -17,4 +17,4 @@
|
|||
/**
|
||||
* Custom JUnit runners used in Spring Boot's own tests.
|
||||
*/
|
||||
package org.springframework.boot.junit.runner;
|
||||
package org.springframework.boot.testsupport.runner;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.web.servlet.server;
|
||||
package org.springframework.boot.testsupport.web.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.web.servlet.server;
|
||||
package org.springframework.boot.testsupport.web.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
* Copyright 2012-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.testsupport.web.servlet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterRegistration;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRegistration;
|
||||
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* Base class for Mock {@code ServletWebServer} implementations. Reduces the amount of
|
||||
* code that would otherwise be duplicated in {@code spring-boot},
|
||||
* {@code spring-boot-autoconfigure} and {@code spring-boot-actuator}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public abstract class MockServletWebServer {
|
||||
|
||||
private ServletContext servletContext;
|
||||
|
||||
private final Initializer[] initializers;
|
||||
|
||||
private final List<RegisteredServlet> registeredServlets = new ArrayList<>();
|
||||
|
||||
private final List<RegisteredFilter> registeredFilters = new ArrayList<>();
|
||||
|
||||
private final int port;
|
||||
|
||||
public MockServletWebServer(Initializer[] initializers, int port) {
|
||||
this.initializers = initializers;
|
||||
this.port = port;
|
||||
initialize();
|
||||
}
|
||||
|
||||
private void initialize() {
|
||||
try {
|
||||
this.servletContext = mock(ServletContext.class);
|
||||
given(this.servletContext.addServlet(anyString(), (Servlet) any()))
|
||||
.willAnswer(new Answer<ServletRegistration.Dynamic>() {
|
||||
@Override
|
||||
public ServletRegistration.Dynamic answer(
|
||||
InvocationOnMock invocation) throws Throwable {
|
||||
RegisteredServlet registeredServlet = new RegisteredServlet(
|
||||
(Servlet) invocation.getArguments()[1]);
|
||||
MockServletWebServer.this.registeredServlets
|
||||
.add(registeredServlet);
|
||||
return registeredServlet.getRegistration();
|
||||
}
|
||||
});
|
||||
given(this.servletContext.addFilter(anyString(), (Filter) any()))
|
||||
.willAnswer(new Answer<FilterRegistration.Dynamic>() {
|
||||
@Override
|
||||
public FilterRegistration.Dynamic answer(
|
||||
InvocationOnMock invocation) throws Throwable {
|
||||
RegisteredFilter registeredFilter = new RegisteredFilter(
|
||||
(Filter) invocation.getArguments()[1]);
|
||||
MockServletWebServer.this.registeredFilters
|
||||
.add(registeredFilter);
|
||||
return registeredFilter.getRegistration();
|
||||
}
|
||||
});
|
||||
final Map<String, String> initParameters = new HashMap<>();
|
||||
given(this.servletContext.setInitParameter(anyString(), anyString()))
|
||||
.will(new Answer<Void>() {
|
||||
@Override
|
||||
public Void answer(InvocationOnMock invocation) throws Throwable {
|
||||
initParameters.put(invocation.getArgument(0),
|
||||
invocation.getArgument(1));
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
given(this.servletContext.getInitParameterNames())
|
||||
.willReturn(Collections.enumeration(initParameters.keySet()));
|
||||
given(this.servletContext.getInitParameter(anyString()))
|
||||
.willAnswer(new Answer<String>() {
|
||||
@Override
|
||||
public String answer(InvocationOnMock invocation)
|
||||
throws Throwable {
|
||||
return initParameters.get(invocation.getArgument(0));
|
||||
}
|
||||
});
|
||||
given(this.servletContext.getAttributeNames())
|
||||
.willReturn(MockServletWebServer.<String>emptyEnumeration());
|
||||
given(this.servletContext.getNamedDispatcher("default"))
|
||||
.willReturn(mock(RequestDispatcher.class));
|
||||
for (Initializer initializer : this.initializers) {
|
||||
initializer.onStartup(this.servletContext);
|
||||
}
|
||||
}
|
||||
catch (ServletException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
this.servletContext = null;
|
||||
this.registeredServlets.clear();
|
||||
}
|
||||
|
||||
public ServletContext getServletContext() {
|
||||
return this.servletContext;
|
||||
}
|
||||
|
||||
public Servlet[] getServlets() {
|
||||
Servlet[] servlets = new Servlet[this.registeredServlets.size()];
|
||||
for (int i = 0; i < servlets.length; i++) {
|
||||
servlets[i] = this.registeredServlets.get(i).getServlet();
|
||||
}
|
||||
return servlets;
|
||||
}
|
||||
|
||||
public RegisteredServlet getRegisteredServlet(int index) {
|
||||
return getRegisteredServlets().get(index);
|
||||
}
|
||||
|
||||
public List<RegisteredServlet> getRegisteredServlets() {
|
||||
return this.registeredServlets;
|
||||
}
|
||||
|
||||
public RegisteredFilter getRegisteredFilters(int index) {
|
||||
return getRegisteredFilters().get(index);
|
||||
}
|
||||
|
||||
public List<RegisteredFilter> getRegisteredFilters() {
|
||||
return this.registeredFilters;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Enumeration<T> emptyEnumeration() {
|
||||
return (Enumeration<T>) EmptyEnumeration.EMPTY_ENUMERATION;
|
||||
}
|
||||
|
||||
private static class EmptyEnumeration<E> implements Enumeration<E> {
|
||||
|
||||
static final MockServletWebServer.EmptyEnumeration<Object> EMPTY_ENUMERATION = new MockServletWebServer.EmptyEnumeration<>();
|
||||
|
||||
@Override
|
||||
public boolean hasMoreElements() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public E nextElement() {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A registered servlet.
|
||||
*/
|
||||
public static class RegisteredServlet {
|
||||
|
||||
private final Servlet servlet;
|
||||
|
||||
private final ServletRegistration.Dynamic registration;
|
||||
|
||||
public RegisteredServlet(Servlet servlet) {
|
||||
this.servlet = servlet;
|
||||
this.registration = mock(ServletRegistration.Dynamic.class);
|
||||
}
|
||||
|
||||
public ServletRegistration.Dynamic getRegistration() {
|
||||
return this.registration;
|
||||
}
|
||||
|
||||
public Servlet getServlet() {
|
||||
return this.servlet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A registered filter.
|
||||
*/
|
||||
public static class RegisteredFilter {
|
||||
|
||||
private final Filter filter;
|
||||
|
||||
private final FilterRegistration.Dynamic registration;
|
||||
|
||||
public RegisteredFilter(Filter filter) {
|
||||
this.filter = filter;
|
||||
this.registration = mock(FilterRegistration.Dynamic.class);
|
||||
}
|
||||
|
||||
public FilterRegistration.Dynamic getRegistration() {
|
||||
return this.registration;
|
||||
}
|
||||
|
||||
public Filter getFilter() {
|
||||
return this.filter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializer (usually implement by adapting {@code Initializer}).
|
||||
*/
|
||||
protected interface Initializer {
|
||||
|
||||
void onStartup(ServletContext context) throws ServletException;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
|
|
@ -15,6 +15,6 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Redis support classes
|
||||
* Servlet test support.
|
||||
*/
|
||||
package org.springframework.boot.redis;
|
||||
package org.springframework.boot.testsupport.web.servlet;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.testutil;
|
||||
package org.springframework.boot.testsupport.assertj;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.junit.runner.classpath;
|
||||
package org.springframework.boot.testsupport.runner.classpath;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.junit.runner.classpath;
|
||||
package org.springframework.boot.testsupport.runner.classpath;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
|
@ -352,19 +352,4 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.mockito.Captor;
|
|||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import org.springframework.boot.Banner.Mode;
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
|
@ -59,7 +59,7 @@ public class BannerTests {
|
|||
}
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture out = new InternalOutputCapture();
|
||||
public OutputCapture out = new OutputCapture();
|
||||
|
||||
@Captor
|
||||
private ArgumentCaptor<Class<?>> sourceClassCaptor;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
|||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
|
@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
public class SimpleMainTests {
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture outputCapture = new InternalOutputCapture();
|
||||
public OutputCapture outputCapture = new OutputCapture();
|
||||
|
||||
private static final String SPRING_STARTUP = "root of context hierarchy";
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ import org.springframework.boot.context.event.ApplicationFailedEvent;
|
|||
import org.springframework.boot.context.event.ApplicationPreparedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.boot.context.event.ApplicationStartingEvent;
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.reactive.context.ReactiveWebApplicationContext;
|
||||
|
|
@ -123,7 +123,7 @@ public class SpringApplicationTests {
|
|||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture output = new InternalOutputCapture();
|
||||
public OutputCapture output = new OutputCapture();
|
||||
|
||||
private ConfigurableApplicationContext context;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import org.springframework.boot.context.configwarnings.dflt.InDefaultPackageWith
|
|||
import org.springframework.boot.context.configwarnings.orgspring.InOrgSpringPackageConfiguration;
|
||||
import org.springframework.boot.context.configwarnings.real.InRealButScanningProblemPackages;
|
||||
import org.springframework.boot.context.configwarnings.real.InRealPackageConfiguration;
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
@ -52,7 +52,7 @@ public class ConfigurationWarningsApplicationContextInitializerTests {
|
|||
+ "start due to a @ComponentScan of 'org.springframework'.";
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture output = new InternalOutputCapture();
|
||||
public OutputCapture output = new OutputCapture();
|
||||
|
||||
@Test
|
||||
public void logWarningInDefaultPackage() {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import org.springframework.boot.WebApplicationType;
|
|||
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationPreparedEvent;
|
||||
import org.springframework.boot.env.EnvironmentPostProcessor;
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -83,7 +83,7 @@ public class ConfigFileApplicationListenerTests {
|
|||
public ExpectedException expected = ExpectedException.none();
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture out = new InternalOutputCapture();
|
||||
public OutputCapture out = new OutputCapture();
|
||||
|
||||
private ConfigurableApplicationContext context;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import org.springframework.boot.WebApplicationType;
|
|||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.event.ApplicationStartingEvent;
|
||||
import org.springframework.boot.logging.LoggingSystem;
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
public class LoggingApplicationListenerIntegrationTests {
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture outputCapture = new InternalOutputCapture();
|
||||
public OutputCapture outputCapture = new OutputCapture();
|
||||
|
||||
@Test
|
||||
public void loggingSystemRegisteredInTheContext() {
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.context.event.ApplicationFailedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationStartingEvent;
|
||||
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.logging.AbstractLoggingSystem;
|
||||
import org.springframework.boot.logging.LogFile;
|
||||
import org.springframework.boot.logging.LogLevel;
|
||||
|
|
@ -51,7 +49,9 @@ import org.springframework.boot.logging.LoggerConfiguration;
|
|||
import org.springframework.boot.logging.LoggingInitializationContext;
|
||||
import org.springframework.boot.logging.LoggingSystem;
|
||||
import org.springframework.boot.logging.java.JavaLoggingSystem;
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
|
|
@ -87,7 +87,7 @@ public class LoggingApplicationListenerTests {
|
|||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture outputCapture = new InternalOutputCapture();
|
||||
public OutputCapture outputCapture = new OutputCapture();
|
||||
|
||||
private final LoggingApplicationListener initializer = new LoggingApplicationListener();
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
|||
import org.springframework.beans.factory.support.GenericBeanDefinition;
|
||||
import org.springframework.boot.context.properties.bind.BindException;
|
||||
import org.springframework.boot.context.properties.bind.validation.BindValidationException;
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -75,7 +75,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
|
|||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture output = new InternalOutputCapture();
|
||||
public OutputCapture output = new OutputCapture();
|
||||
|
||||
private AnnotationConfigApplicationContext context;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.junit.Test;
|
|||
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.boot.web.server.PortInUseException;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ import static org.junit.Assert.fail;
|
|||
public class FailureAnalyzersIntegrationTests {
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture outputCapture = new InternalOutputCapture();
|
||||
public OutputCapture outputCapture = new OutputCapture();
|
||||
|
||||
@Test
|
||||
public void analysisIsPerformed() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
|
|
@ -22,8 +22,8 @@ import org.junit.runner.RunWith;
|
|||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.diagnostics.FailureAnalysis;
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import org.junit.Test;
|
|||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions;
|
||||
import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.springframework.boot.logging.AbstractLoggingSystemTests;
|
|||
import org.springframework.boot.logging.LogLevel;
|
||||
import org.springframework.boot.logging.LoggerConfiguration;
|
||||
import org.springframework.boot.logging.LoggingSystem;
|
||||
import org.springframework.boot.testutil.InternalOutputCapture;
|
||||
import org.springframework.boot.testsupport.rule.OutputCapture;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
|
|||
getClass().getClassLoader());
|
||||
|
||||
@Rule
|
||||
public InternalOutputCapture output = new InternalOutputCapture();
|
||||
public OutputCapture output = new OutputCapture();
|
||||
|
||||
private Logger logger;
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue