Commit 6e09e497 authored by Phillip Webb's avatar Phillip Webb

Formatting

parent 86f43c47
...@@ -134,6 +134,7 @@ class CloudFoundryWebEndpointServletHandlerMapping ...@@ -134,6 +134,7 @@ class CloudFoundryWebEndpointServletHandlerMapping
} }
return this.delegate.handle(request, body); return this.delegate.handle(request, body);
} }
} }
} }
...@@ -31,7 +31,6 @@ import org.springframework.context.annotation.Configuration; ...@@ -31,7 +31,6 @@ import org.springframework.context.annotation.Configuration;
* *
* @author Phillip Webb * @author Phillip Webb
* @author Andy Wilkinson * @author Andy Wilkinson
*
* @since 2.0.0 * @since 2.0.0
*/ */
@Configuration @Configuration
......
...@@ -28,11 +28,11 @@ import io.micrometer.core.instrument.config.MeterFilter; ...@@ -28,11 +28,11 @@ import io.micrometer.core.instrument.config.MeterFilter;
import org.springframework.boot.util.LambdaSafe; import org.springframework.boot.util.LambdaSafe;
/** /**
* Configurer to apply {@link MeterRegistryCustomizer customizers}, * Configurer to apply {@link MeterRegistryCustomizer customizers}, {@link MeterFilter
* {@link MeterFilter filters}, {@link MeterBinder binders} and {@link Metrics#addRegistry * filters}, {@link MeterBinder binders} and {@link Metrics#addRegistry global
* global registration} to {@link MeterRegistry meter registries}. This configurer * registration} to {@link MeterRegistry meter registries}. This configurer intentionally
* intentionally skips {@link CompositeMeterRegistry} with the assumptions that the * skips {@link CompositeMeterRegistry} with the assumptions that the registries it
* registries it contains are beans and will be customized directly. * contains are beans and will be customized directly.
* *
* @author Jon Schneider * @author Jon Schneider
* @author Phillip Webb * @author Phillip Webb
......
...@@ -124,4 +124,5 @@ public class HealthEndpointAutoConfigurationTests { ...@@ -124,4 +124,5 @@ public class HealthEndpointAutoConfigurationTests {
} }
} }
} }
...@@ -71,8 +71,7 @@ public class SignalFxMetricsExportAutoConfigurationTests { ...@@ -71,8 +71,7 @@ public class SignalFxMetricsExportAutoConfigurationTests {
@Test @Test
public void autoConfigurationCanBeDisabled() { public void autoConfigurationCanBeDisabled() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class) this.contextRunner.withUserConfiguration(BaseConfiguration.class)
.withPropertyValues( .withPropertyValues("management.metrics.export.signalfx.enabled=false")
"management.metrics.export.signalfx.enabled=false")
.run((context) -> assertThat(context) .run((context) -> assertThat(context)
.doesNotHaveBean(SignalFxMeterRegistry.class) .doesNotHaveBean(SignalFxMeterRegistry.class)
.doesNotHaveBean(SignalFxConfig.class)); .doesNotHaveBean(SignalFxConfig.class));
......
...@@ -22,7 +22,6 @@ import org.junit.Test; ...@@ -22,7 +22,6 @@ import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
*
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
public class SimplePropertiesTests { public class SimplePropertiesTests {
......
...@@ -44,7 +44,6 @@ public class BeansEndpoint { ...@@ -44,7 +44,6 @@ public class BeansEndpoint {
/** /**
* Creates a new {@code BeansEndpoint} that will describe the beans in the given * Creates a new {@code BeansEndpoint} that will describe the beans in the given
* {@code context} and all of its ancestors. * {@code context} and all of its ancestors.
*
* @param context the application context * @param context the application context
* @see ConfigurableApplicationContext#getParent() * @see ConfigurableApplicationContext#getParent()
*/ */
......
...@@ -335,6 +335,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext ...@@ -335,6 +335,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
} }
super.serializeAsField(pojo, jgen, provider, writer); super.serializeAsField(pojo, jgen, provider, writer);
} }
} }
/** /**
......
...@@ -51,4 +51,5 @@ public final class MissingParametersException extends InvalidEndpointRequestExce ...@@ -51,4 +51,5 @@ public final class MissingParametersException extends InvalidEndpointRequestExce
public Set<OperationParameter> getMissingParameters() { public Set<OperationParameter> getMissingParameters() {
return this.missingParameters; return this.missingParameters;
} }
} }
...@@ -107,8 +107,8 @@ public class EndpointMBean implements DynamicMBean { ...@@ -107,8 +107,8 @@ public class EndpointMBean implements DynamicMBean {
return this.responseMapper.mapResponse(result); return this.responseMapper.mapResponse(result);
} }
catch (InvalidEndpointRequestException ex) { catch (InvalidEndpointRequestException ex) {
throw new ReflectionException(new IllegalArgumentException( throw new ReflectionException(new IllegalArgumentException(ex.getMessage()),
ex.getMessage()), ex.getMessage()); ex.getMessage());
} }
catch (Exception ex) { catch (Exception ex) {
throw new MBeanException(translateIfNecessary(ex), ex.getMessage()); throw new MBeanException(translateIfNecessary(ex), ex.getMessage());
......
...@@ -210,4 +210,5 @@ class DiscoveredJmxOperation extends AbstractDiscoveredOperation implements JmxO ...@@ -210,4 +210,5 @@ class DiscoveredJmxOperation extends AbstractDiscoveredOperation implements JmxO
} }
} }
} }
...@@ -30,7 +30,6 @@ public class EndpointMapping { ...@@ -30,7 +30,6 @@ public class EndpointMapping {
/** /**
* Creates a new {@code EndpointMapping} using the given {@code path}. * Creates a new {@code EndpointMapping} using the given {@code path}.
*
* @param path the path * @param path the path
*/ */
public EndpointMapping(String path) { public EndpointMapping(String path) {
......
...@@ -44,4 +44,5 @@ class DiscoveredWebEndpoint extends AbstractDiscoveredEndpoint<WebOperation> ...@@ -44,4 +44,5 @@ class DiscoveredWebEndpoint extends AbstractDiscoveredEndpoint<WebOperation>
public String getRootPath() { public String getRootPath() {
return this.rootPath; return this.rootPath;
} }
} }
...@@ -251,6 +251,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping ...@@ -251,6 +251,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
Mono<ResponseEntity<Object>> handle(ServerWebExchange exchange, Mono<ResponseEntity<Object>> handle(ServerWebExchange exchange,
Map<String, String> body); Map<String, String> body);
} }
/** /**
......
...@@ -173,6 +173,7 @@ public class MetricsEndpoint { ...@@ -173,6 +173,7 @@ public class MetricsEndpoint {
public Set<String> getNames() { public Set<String> getNames() {
return this.names; return this.names;
} }
} }
/** /**
...@@ -228,6 +229,7 @@ public class MetricsEndpoint { ...@@ -228,6 +229,7 @@ public class MetricsEndpoint {
public Set<String> getValues() { public Set<String> getValues() {
return this.values; return this.values;
} }
} }
/** /**
......
...@@ -61,18 +61,17 @@ public class MetricsWebFilter implements WebFilter { ...@@ -61,18 +61,17 @@ public class MetricsWebFilter implements WebFilter {
private Publisher<Void> filter(ServerWebExchange exchange, Mono<Void> call) { private Publisher<Void> filter(ServerWebExchange exchange, Mono<Void> call) {
long start = System.nanoTime(); long start = System.nanoTime();
ServerHttpResponse response = exchange.getResponse(); ServerHttpResponse response = exchange.getResponse();
return call.doOnSuccess((done) -> success(exchange, start)) return call.doOnSuccess((done) -> success(exchange, start)).doOnError((cause) -> {
.doOnError((cause) -> { if (response.isCommitted()) {
if (response.isCommitted()) { error(exchange, start, cause);
error(exchange, start, cause); }
} else {
else { response.beforeCommit(() -> {
response.beforeCommit(() -> { error(exchange, start, cause);
error(exchange, start, cause); return Mono.empty();
return Mono.empty();
});
}
}); });
}
});
} }
private void success(ServerWebExchange exchange, long start) { private void success(ServerWebExchange exchange, long start) {
......
...@@ -31,7 +31,6 @@ public interface MappingDescriptionProvider { ...@@ -31,7 +31,6 @@ public interface MappingDescriptionProvider {
/** /**
* Returns the name of the mappings described by this provider. * Returns the name of the mappings described by this provider.
*
* @return the name of the mappings * @return the name of the mappings
*/ */
String getMappingName(); String getMappingName();
......
...@@ -40,7 +40,6 @@ public class FilterRegistrationMappingDescription ...@@ -40,7 +40,6 @@ public class FilterRegistrationMappingDescription
/** /**
* Returns the servlet name mappings for the registered filter. * Returns the servlet name mappings for the registered filter.
*
* @return the mappings * @return the mappings
*/ */
public Collection<String> getServletNameMappings() { public Collection<String> getServletNameMappings() {
...@@ -49,7 +48,6 @@ public class FilterRegistrationMappingDescription ...@@ -49,7 +48,6 @@ public class FilterRegistrationMappingDescription
/** /**
* Returns the URL pattern mappings for the registered filter. * Returns the URL pattern mappings for the registered filter.
*
* @return the mappings * @return the mappings
*/ */
public Collection<String> getUrlPatternMappings() { public Collection<String> getUrlPatternMappings() {
......
...@@ -40,7 +40,6 @@ public class RegistrationMappingDescription<T extends Registration> { ...@@ -40,7 +40,6 @@ public class RegistrationMappingDescription<T extends Registration> {
/** /**
* Returns the name of the registered Filter or Servlet. * Returns the name of the registered Filter or Servlet.
*
* @return the name * @return the name
*/ */
public String getName() { public String getName() {
...@@ -49,7 +48,6 @@ public class RegistrationMappingDescription<T extends Registration> { ...@@ -49,7 +48,6 @@ public class RegistrationMappingDescription<T extends Registration> {
/** /**
* Returns the class name of the registered Filter or Servlet. * Returns the class name of the registered Filter or Servlet.
*
* @return the class name * @return the class name
*/ */
public String getClassName() { public String getClassName() {
......
...@@ -41,7 +41,6 @@ public class ServletRegistrationMappingDescription ...@@ -41,7 +41,6 @@ public class ServletRegistrationMappingDescription
/** /**
* Returns the mappings for the registered servlet. * Returns the mappings for the registered servlet.
*
* @return the mappings * @return the mappings
*/ */
public Collection<String> getMappings() { public Collection<String> getMappings() {
......
...@@ -81,4 +81,5 @@ public class OperationMethodTests { ...@@ -81,4 +81,5 @@ public class OperationMethodTests {
String example(String name) { String example(String name) {
return name; return name;
} }
} }
...@@ -32,4 +32,5 @@ class TestJmxOperationResponseMapper implements JmxOperationResponseMapper { ...@@ -32,4 +32,5 @@ class TestJmxOperationResponseMapper implements JmxOperationResponseMapper {
public Class<?> mapResponseType(Class<?> responseType) { public Class<?> mapResponseType(Class<?> responseType) {
return responseType; return responseType;
} }
} }
...@@ -57,16 +57,17 @@ public class ControllerEndpointDiscovererTests { ...@@ -57,16 +57,17 @@ public class ControllerEndpointDiscovererTests {
@Test @Test
public void getEndpointsWhenNoEndpointBeansShouldReturnEmptyCollection() { public void getEndpointsWhenNoEndpointBeansShouldReturnEmptyCollection() {
this.contextRunner.withUserConfiguration(EmptyConfiguration.class).run( this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
assertDiscoverer((discoverer) -> .run(assertDiscoverer(
assertThat(discoverer.getEndpoints()).isEmpty())); (discoverer) -> assertThat(discoverer.getEndpoints()).isEmpty()));
} }
@Test @Test
public void getEndpointsShouldIncludeControllerEndpoints() { public void getEndpointsShouldIncludeControllerEndpoints() {
this.contextRunner.withUserConfiguration(TestControllerEndpoint.class) this.contextRunner.withUserConfiguration(TestControllerEndpoint.class)
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints(); Collection<ExposableControllerEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1); assertThat(endpoints).hasSize(1);
ExposableControllerEndpoint endpoint = endpoints.iterator().next(); ExposableControllerEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testcontroller"); assertThat(endpoint.getId()).isEqualTo("testcontroller");
...@@ -79,10 +80,11 @@ public class ControllerEndpointDiscovererTests { ...@@ -79,10 +80,11 @@ public class ControllerEndpointDiscovererTests {
@Test @Test
public void getEndpointsShouldDiscoverProxyControllerEndpoints() { public void getEndpointsShouldDiscoverProxyControllerEndpoints() {
this.contextRunner.withUserConfiguration(TestProxyControllerEndpoint.class) this.contextRunner.withUserConfiguration(TestProxyControllerEndpoint.class)
.withConfiguration(AutoConfigurations.of( .withConfiguration(
ValidationAutoConfiguration.class)) AutoConfigurations.of(ValidationAutoConfiguration.class))
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints(); Collection<ExposableControllerEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1); assertThat(endpoints).hasSize(1);
ExposableControllerEndpoint endpoint = endpoints.iterator().next(); ExposableControllerEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testcontroller"); assertThat(endpoint.getId()).isEqualTo("testcontroller");
...@@ -96,7 +98,8 @@ public class ControllerEndpointDiscovererTests { ...@@ -96,7 +98,8 @@ public class ControllerEndpointDiscovererTests {
public void getEndpointsShouldIncludeRestControllerEndpoints() { public void getEndpointsShouldIncludeRestControllerEndpoints() {
this.contextRunner.withUserConfiguration(TestRestControllerEndpoint.class) this.contextRunner.withUserConfiguration(TestRestControllerEndpoint.class)
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints(); Collection<ExposableControllerEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1); assertThat(endpoints).hasSize(1);
ExposableControllerEndpoint endpoint = endpoints.iterator().next(); ExposableControllerEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testrestcontroller"); assertThat(endpoint.getId()).isEqualTo("testrestcontroller");
...@@ -108,10 +111,11 @@ public class ControllerEndpointDiscovererTests { ...@@ -108,10 +111,11 @@ public class ControllerEndpointDiscovererTests {
@Test @Test
public void getEndpointsShouldDiscoverProxyRestControllerEndpoints() { public void getEndpointsShouldDiscoverProxyRestControllerEndpoints() {
this.contextRunner.withUserConfiguration(TestProxyRestControllerEndpoint.class) this.contextRunner.withUserConfiguration(TestProxyRestControllerEndpoint.class)
.withConfiguration(AutoConfigurations.of( .withConfiguration(
ValidationAutoConfiguration.class)) AutoConfigurations.of(ValidationAutoConfiguration.class))
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints(); Collection<ExposableControllerEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1); assertThat(endpoints).hasSize(1);
ExposableControllerEndpoint endpoint = endpoints.iterator().next(); ExposableControllerEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testrestcontroller"); assertThat(endpoint.getId()).isEqualTo("testrestcontroller");
...@@ -125,7 +129,8 @@ public class ControllerEndpointDiscovererTests { ...@@ -125,7 +129,8 @@ public class ControllerEndpointDiscovererTests {
public void getEndpointsShouldNotDiscoverRegularEndpoints() { public void getEndpointsShouldNotDiscoverRegularEndpoints() {
this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class) this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class)
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints(); Collection<ExposableControllerEndpoint> endpoints = discoverer
.getEndpoints();
List<String> ids = endpoints.stream().map(ExposableEndpoint::getId) List<String> ids = endpoints.stream().map(ExposableEndpoint::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
assertThat(ids).containsOnly("testcontroller", "testrestcontroller"); assertThat(ids).containsOnly("testcontroller", "testrestcontroller");
...@@ -137,7 +142,8 @@ public class ControllerEndpointDiscovererTests { ...@@ -137,7 +142,8 @@ public class ControllerEndpointDiscovererTests {
this.contextRunner.withUserConfiguration(TestControllerWithOperation.class) this.contextRunner.withUserConfiguration(TestControllerWithOperation.class)
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
this.thrown.expect(IllegalStateException.class); this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("ControllerEndpoints must not declare operations"); this.thrown.expectMessage(
"ControllerEndpoints must not declare operations");
discoverer.getEndpoints(); discoverer.getEndpoints();
})); }));
} }
......
...@@ -67,15 +67,16 @@ public class ServletEndpointDiscovererTests { ...@@ -67,15 +67,16 @@ public class ServletEndpointDiscovererTests {
@Test @Test
public void getEndpointsWhenNoEndpointBeansShouldReturnEmptyCollection() { public void getEndpointsWhenNoEndpointBeansShouldReturnEmptyCollection() {
this.contextRunner.withUserConfiguration(EmptyConfiguration.class) this.contextRunner.withUserConfiguration(EmptyConfiguration.class)
.run(assertDiscoverer((discoverer) .run(assertDiscoverer(
-> assertThat(discoverer.getEndpoints()).isEmpty())); (discoverer) -> assertThat(discoverer.getEndpoints()).isEmpty()));
} }
@Test @Test
public void getEndpointsShouldIncludeServletEndpoints() { public void getEndpointsShouldIncludeServletEndpoints() {
this.contextRunner.withUserConfiguration(TestServletEndpoint.class) this.contextRunner.withUserConfiguration(TestServletEndpoint.class)
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
Collection<ExposableServletEndpoint> endpoints = discoverer.getEndpoints(); Collection<ExposableServletEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1); assertThat(endpoints).hasSize(1);
ExposableServletEndpoint endpoint = endpoints.iterator().next(); ExposableServletEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testservlet"); assertThat(endpoint.getId()).isEqualTo("testservlet");
...@@ -87,9 +88,11 @@ public class ServletEndpointDiscovererTests { ...@@ -87,9 +88,11 @@ public class ServletEndpointDiscovererTests {
@Test @Test
public void getEndpointsShouldDiscoverProxyServletEndpoints() { public void getEndpointsShouldDiscoverProxyServletEndpoints() {
this.contextRunner.withUserConfiguration(TestProxyServletEndpoint.class) this.contextRunner.withUserConfiguration(TestProxyServletEndpoint.class)
.withConfiguration(AutoConfigurations.of(ValidationAutoConfiguration.class)) .withConfiguration(
AutoConfigurations.of(ValidationAutoConfiguration.class))
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
Collection<ExposableServletEndpoint> endpoints = discoverer.getEndpoints(); Collection<ExposableServletEndpoint> endpoints = discoverer
.getEndpoints();
assertThat(endpoints).hasSize(1); assertThat(endpoints).hasSize(1);
ExposableServletEndpoint endpoint = endpoints.iterator().next(); ExposableServletEndpoint endpoint = endpoints.iterator().next();
assertThat(endpoint.getId()).isEqualTo("testservlet"); assertThat(endpoint.getId()).isEqualTo("testservlet");
...@@ -102,7 +105,8 @@ public class ServletEndpointDiscovererTests { ...@@ -102,7 +105,8 @@ public class ServletEndpointDiscovererTests {
public void getEndpointsShouldNotDiscoverRegularEndpoints() { public void getEndpointsShouldNotDiscoverRegularEndpoints() {
this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class) this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class)
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
Collection<ExposableServletEndpoint> endpoints = discoverer.getEndpoints(); Collection<ExposableServletEndpoint> endpoints = discoverer
.getEndpoints();
List<String> ids = endpoints.stream().map(ExposableEndpoint::getId) List<String> ids = endpoints.stream().map(ExposableEndpoint::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
assertThat(ids).containsOnly("testservlet"); assertThat(ids).containsOnly("testservlet");
...@@ -114,7 +118,8 @@ public class ServletEndpointDiscovererTests { ...@@ -114,7 +118,8 @@ public class ServletEndpointDiscovererTests {
this.contextRunner.withUserConfiguration(TestServletEndpointWithOperation.class) this.contextRunner.withUserConfiguration(TestServletEndpointWithOperation.class)
.run(assertDiscoverer((discoverer) -> { .run(assertDiscoverer((discoverer) -> {
this.thrown.expect(IllegalStateException.class); this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("ServletEndpoints must not declare operations"); this.thrown.expectMessage(
"ServletEndpoints must not declare operations");
discoverer.getEndpoints(); discoverer.getEndpoints();
})); }));
} }
......
...@@ -27,4 +27,5 @@ import org.springframework.context.ConfigurableApplicationContext; ...@@ -27,4 +27,5 @@ import org.springframework.context.ConfigurableApplicationContext;
interface ContextFactory { interface ContextFactory {
ConfigurableApplicationContext createContext(List<Class<?>> configurationClasses); ConfigurableApplicationContext createContext(List<Class<?>> configurationClasses);
} }
...@@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Tests for {@link MetricsWebFilter} * Tests for {@link MetricsWebFilter}
*
* @author Brian Clozel * @author Brian Clozel
*/ */
public class MetricsWebFilterTests { public class MetricsWebFilterTests {
......
...@@ -331,4 +331,5 @@ public class HttpExchangeTracerTests { ...@@ -331,4 +331,5 @@ public class HttpExchangeTracerTests {
} }
return output.toString(); return output.toString();
} }
} }
...@@ -458,6 +458,7 @@ public class RabbitProperties { ...@@ -458,6 +458,7 @@ public class RabbitProperties {
public void setCheckoutTimeout(Duration checkoutTimeout) { public void setCheckoutTimeout(Duration checkoutTimeout) {
this.checkoutTimeout = checkoutTimeout; this.checkoutTimeout = checkoutTimeout;
} }
} }
public static class Connection { public static class Connection {
......
...@@ -75,8 +75,7 @@ public class CacheAutoConfiguration { ...@@ -75,8 +75,7 @@ public class CacheAutoConfiguration {
@Bean @Bean
public CacheManagerValidator cacheAutoConfigurationValidator( public CacheManagerValidator cacheAutoConfigurationValidator(
CacheProperties cacheProperties, CacheProperties cacheProperties, ObjectProvider<CacheManager> cacheManager) {
ObjectProvider<CacheManager> cacheManager) {
return new CacheManagerValidator(cacheProperties, cacheManager); return new CacheManagerValidator(cacheProperties, cacheManager);
} }
......
...@@ -77,4 +77,5 @@ class FreeMarkerServletWebConfiguration extends AbstractFreeMarkerConfiguration ...@@ -77,4 +77,5 @@ class FreeMarkerServletWebConfiguration extends AbstractFreeMarkerConfiguration
public ResourceUrlEncodingFilter resourceUrlEncodingFilter() { public ResourceUrlEncodingFilter resourceUrlEncodingFilter() {
return new ResourceUrlEncodingFilter(); return new ResourceUrlEncodingFilter();
} }
} }
...@@ -34,4 +34,5 @@ public interface GsonBuilderCustomizer { ...@@ -34,4 +34,5 @@ public interface GsonBuilderCustomizer {
* @param gsonBuilder the GsonBuilder to customize * @param gsonBuilder the GsonBuilder to customize
*/ */
void customize(GsonBuilder gsonBuilder); void customize(GsonBuilder gsonBuilder);
} }
...@@ -62,8 +62,8 @@ class DataSourceBeanCreationFailureAnalyzer ...@@ -62,8 +62,8 @@ class DataSourceBeanCreationFailureAnalyzer
if (!StringUtils.hasText(cause.getProperties().getUrl())) { if (!StringUtils.hasText(cause.getProperties().getUrl())) {
description.append("'url' attribute is not specified and "); description.append("'url' attribute is not specified and ");
} }
description.append( description
String.format("no embedded datasource could be configured.%n")); .append(String.format("no embedded datasource could be configured.%n"));
description.append(String.format("%nReason: %s%n", cause.getMessage())); description.append(String.format("%nReason: %s%n", cause.getMessage()));
return description.toString(); return description.toString();
} }
......
...@@ -142,6 +142,7 @@ public final class StaticResourceRequest { ...@@ -142,6 +142,7 @@ public final class StaticResourceRequest {
getDelegateMatchers()); getDelegateMatchers());
return matcher.matches(exchange); return matcher.matches(exchange);
} }
} }
} }
...@@ -191,6 +191,7 @@ public class SessionAutoConfiguration { ...@@ -191,6 +191,7 @@ public class SessionAutoConfiguration {
// Ignore // Ignore
} }
} }
} }
/** /**
......
...@@ -75,6 +75,7 @@ public class TransactionAutoConfiguration { ...@@ -75,6 +75,7 @@ public class TransactionAutoConfiguration {
public TransactionTemplate transactionTemplate() { public TransactionTemplate transactionTemplate() {
return new TransactionTemplate(this.transactionManager); return new TransactionTemplate(this.transactionManager);
} }
} }
@Configuration @Configuration
......
...@@ -957,6 +957,7 @@ public class ServerProperties { ...@@ -957,6 +957,7 @@ public class ServerProperties {
public void setLogLatency(boolean logLatency) { public void setLogLatency(boolean logLatency) {
this.logLatency = logLatency; this.logLatency = logLatency;
} }
} }
} }
......
...@@ -205,6 +205,7 @@ public class WebFluxAutoConfiguration { ...@@ -205,6 +205,7 @@ public class WebFluxAutoConfiguration {
} }
} }
} }
/** /**
......
...@@ -752,11 +752,10 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT ...@@ -752,11 +752,10 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
public void autoConfiguredCacheManagerCanBeSwapped() { public void autoConfiguredCacheManagerCanBeSwapped() {
this.contextRunner this.contextRunner
.withUserConfiguration(CacheManagerPostProcessorConfiguration.class) .withUserConfiguration(CacheManagerPostProcessorConfiguration.class)
.withPropertyValues("spring.cache.type=caffeine") .withPropertyValues("spring.cache.type=caffeine").run((context) -> {
.run((context) -> {
getCacheManager(context, SimpleCacheManager.class); getCacheManager(context, SimpleCacheManager.class);
CacheManagerPostProcessor postProcessor = context.getBean( CacheManagerPostProcessor postProcessor = context
CacheManagerPostProcessor.class); .getBean(CacheManagerPostProcessor.class);
assertThat(postProcessor.cacheManagers).hasSize(1); assertThat(postProcessor.cacheManagers).hasSize(1);
assertThat(postProcessor.cacheManagers.get(0)) assertThat(postProcessor.cacheManagers.get(0))
.isInstanceOf(CaffeineCacheManager.class); .isInstanceOf(CaffeineCacheManager.class);
...@@ -1043,14 +1042,12 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT ...@@ -1043,14 +1042,12 @@ public class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationT
private final List<CacheManager> cacheManagers = new ArrayList<>(); private final List<CacheManager> cacheManagers = new ArrayList<>();
@Override @Override
public Object postProcessBeforeInitialization(Object bean, public Object postProcessBeforeInitialization(Object bean, String beanName) {
String beanName) {
return bean; return bean;
} }
@Override @Override
public Object postProcessAfterInitialization(Object bean, public Object postProcessAfterInitialization(Object bean, String beanName) {
String beanName) {
if (bean instanceof CacheManager) { if (bean instanceof CacheManager) {
this.cacheManagers.add((CacheManager) bean); this.cacheManagers.add((CacheManager) bean);
return new SimpleCacheManager(); return new SimpleCacheManager();
......
...@@ -36,4 +36,3 @@ public class SampleAutoConfiguration { ...@@ -36,4 +36,3 @@ public class SampleAutoConfiguration {
} }
} }
...@@ -158,6 +158,7 @@ public class CassandraDataAutoConfigurationTests { ...@@ -158,6 +158,7 @@ public class CassandraDataAutoConfigurationTests {
public String convert(Person o) { public String convert(Person o) {
return null; return null;
} }
} }
private static class Person { private static class Person {
......
...@@ -186,6 +186,7 @@ public class CouchbaseDataAutoConfigurationTests { ...@@ -186,6 +186,7 @@ public class CouchbaseDataAutoConfigurationTests {
public Boolean convert(CouchbaseProperties value) { public Boolean convert(CouchbaseProperties value) {
return true; return true;
} }
} }
} }
...@@ -76,6 +76,7 @@ public class ElasticsearchNodeTemplate { ...@@ -76,6 +76,7 @@ public class ElasticsearchNodeTemplate {
Arrays.asList(Netty4Plugin.class)); Arrays.asList(Netty4Plugin.class));
new File("target/es/node/logs").mkdirs(); new File("target/es/node/logs").mkdirs();
} }
} }
public final class ElasticsearchNode { public final class ElasticsearchNode {
......
...@@ -291,6 +291,7 @@ public class GsonAutoConfigurationTests { ...@@ -291,6 +291,7 @@ public class GsonAutoConfigurationTests {
private String data = "nested"; private String data = "nested";
} }
} }
} }
...@@ -80,16 +80,16 @@ public class IntegrationAutoConfigurationTests { ...@@ -80,16 +80,16 @@ public class IntegrationAutoConfigurationTests {
.withUserConfiguration(CustomIntegrationComponentScanConfiguration.class) .withUserConfiguration(CustomIntegrationComponentScanConfiguration.class)
.run((context) -> { .run((context) -> {
assertThat(context).hasSingleBean(TestGateway.class); assertThat(context).hasSingleBean(TestGateway.class);
assertThat(context).doesNotHaveBean( assertThat(context)
IntegrationComponentScanConfiguration.class); .doesNotHaveBean(IntegrationComponentScanConfiguration.class);
}); });
} }
@Test @Test
public void noMBeanServerAvailable() { public void noMBeanServerAvailable() {
ApplicationContextRunner contextRunnerWithoutJmx = new ApplicationContextRunner() ApplicationContextRunner contextRunnerWithoutJmx = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of( .withConfiguration(
IntegrationAutoConfiguration.class)); AutoConfigurations.of(IntegrationAutoConfiguration.class));
contextRunnerWithoutJmx.run((context) -> { contextRunnerWithoutJmx.run((context) -> {
assertThat(context).hasSingleBean(TestGateway.class); assertThat(context).hasSingleBean(TestGateway.class);
assertThat(context) assertThat(context)
......
...@@ -232,6 +232,7 @@ public class ActiveMQAutoConfigurationTests { ...@@ -232,6 +232,7 @@ public class ActiveMQAutoConfigurationTests {
factory.setUserName("foobar"); factory.setUserName("foobar");
}; };
} }
} }
} }
...@@ -96,4 +96,5 @@ public class ArtemisEmbeddedConfigurationFactoryTests { ...@@ -96,4 +96,5 @@ public class ArtemisEmbeddedConfigurationFactoryTests {
.getAddressConfigurations(); .getAddressConfigurations();
assertThat(addressConfigurations).hasSize(2); assertThat(addressConfigurations).hasSize(2);
} }
} }
...@@ -55,6 +55,7 @@ public class JsonbAutoConfigurationTests { ...@@ -55,6 +55,7 @@ public class JsonbAutoConfigurationTests {
public void setData(String data) { public void setData(String data) {
this.data = data; this.data = data;
} }
} }
} }
...@@ -127,6 +127,7 @@ public class MustacheAutoConfigurationTests { ...@@ -127,6 +127,7 @@ public class MustacheAutoConfigurationTests {
return Mustache.compiler().standardsMode(true) return Mustache.compiler().standardsMode(true)
.withLoader(mustacheTemplateLoader); .withLoader(mustacheTemplateLoader);
} }
} }
} }
...@@ -87,21 +87,24 @@ public class QuartzAutoConfigurationTests { ...@@ -87,21 +87,24 @@ public class QuartzAutoConfigurationTests {
@Test @Test
public void withDataSourceUseMemoryByDefault() { public void withDataSourceUseMemoryByDefault() {
this.contextRunner.withConfiguration(AutoConfigurations.of( this.contextRunner
DataSourceAutoConfiguration.class, .withConfiguration(
DataSourceTransactionManagerAutoConfiguration.class)).run((context) -> { AutoConfigurations.of(DataSourceAutoConfiguration.class,
assertThat(context).hasSingleBean(Scheduler.class); DataSourceTransactionManagerAutoConfiguration.class))
Scheduler scheduler = context.getBean(Scheduler.class); .run((context) -> {
assertThat(scheduler.getMetaData().getJobStoreClass()) assertThat(context).hasSingleBean(Scheduler.class);
.isAssignableFrom(RAMJobStore.class); Scheduler scheduler = context.getBean(Scheduler.class);
}); assertThat(scheduler.getMetaData().getJobStoreClass())
.isAssignableFrom(RAMJobStore.class);
});
} }
@Test @Test
public void withDataSource() { public void withDataSource() {
this.contextRunner.withUserConfiguration(QuartzJobsConfiguration.class) this.contextRunner.withUserConfiguration(QuartzJobsConfiguration.class)
.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class, .withConfiguration(
DataSourceTransactionManagerAutoConfiguration.class)) AutoConfigurations.of(DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class))
.withPropertyValues("spring.quartz.job-store-type=jdbc") .withPropertyValues("spring.quartz.job-store-type=jdbc")
.run(assertDataSourceJobStore("dataSource")); .run(assertDataSourceJobStore("dataSource"));
} }
...@@ -109,8 +112,8 @@ public class QuartzAutoConfigurationTests { ...@@ -109,8 +112,8 @@ public class QuartzAutoConfigurationTests {
@Test @Test
public void withDataSourceNoTransactionManager() { public void withDataSourceNoTransactionManager() {
this.contextRunner.withUserConfiguration(QuartzJobsConfiguration.class) this.contextRunner.withUserConfiguration(QuartzJobsConfiguration.class)
.withConfiguration(AutoConfigurations.of( .withConfiguration(
DataSourceAutoConfiguration.class)) AutoConfigurations.of(DataSourceAutoConfiguration.class))
.withPropertyValues("spring.quartz.job-store-type=jdbc") .withPropertyValues("spring.quartz.job-store-type=jdbc")
.run(assertDataSourceJobStore("dataSource")); .run(assertDataSourceJobStore("dataSource"));
} }
...@@ -131,13 +134,13 @@ public class QuartzAutoConfigurationTests { ...@@ -131,13 +134,13 @@ public class QuartzAutoConfigurationTests {
Scheduler scheduler = context.getBean(Scheduler.class); Scheduler scheduler = context.getBean(Scheduler.class);
assertThat(scheduler.getMetaData().getJobStoreClass()) assertThat(scheduler.getMetaData().getJobStoreClass())
.isAssignableFrom(LocalDataSourceJobStore.class); .isAssignableFrom(LocalDataSourceJobStore.class);
JdbcTemplate jdbcTemplate = new JdbcTemplate(context.getBean( JdbcTemplate jdbcTemplate = new JdbcTemplate(
datasourceName, DataSource.class)); context.getBean(datasourceName, DataSource.class));
assertThat(jdbcTemplate.queryForObject( assertThat(jdbcTemplate.queryForObject(
"SELECT COUNT(*) FROM QRTZ_JOB_DETAILS", Integer.class)).isEqualTo(2); "SELECT COUNT(*) FROM QRTZ_JOB_DETAILS", Integer.class)).isEqualTo(2);
assertThat(jdbcTemplate.queryForObject( assertThat(jdbcTemplate.queryForObject(
"SELECT COUNT(*) FROM QRTZ_SIMPLE_TRIGGERS", Integer.class)) "SELECT COUNT(*) FROM QRTZ_SIMPLE_TRIGGERS", Integer.class))
.isEqualTo(0); .isEqualTo(0);
}; };
} }
...@@ -185,8 +188,9 @@ public class QuartzAutoConfigurationTests { ...@@ -185,8 +188,9 @@ public class QuartzAutoConfigurationTests {
@Test @Test
public void withQuartzProperties() { public void withQuartzProperties() {
this.contextRunner.withPropertyValues( this.contextRunner
"spring.quartz.properties.org.quartz.scheduler.instanceId=FOO") .withPropertyValues(
"spring.quartz.properties.org.quartz.scheduler.instanceId=FOO")
.run((context) -> { .run((context) -> {
assertThat(context).hasSingleBean(Scheduler.class); assertThat(context).hasSingleBean(Scheduler.class);
Scheduler scheduler = context.getBean(Scheduler.class); Scheduler scheduler = context.getBean(Scheduler.class);
...@@ -204,8 +208,6 @@ public class QuartzAutoConfigurationTests { ...@@ -204,8 +208,6 @@ public class QuartzAutoConfigurationTests {
}); });
} }
@Import(ComponentThatUsesScheduler.class) @Import(ComponentThatUsesScheduler.class)
@Configuration @Configuration
protected static class BaseQuartzConfiguration { protected static class BaseQuartzConfiguration {
......
...@@ -69,4 +69,5 @@ public class WebFluxSecurityConfigurationTests { ...@@ -69,4 +69,5 @@ public class WebFluxSecurityConfigurationTests {
} }
} }
} }
...@@ -203,6 +203,7 @@ public class TransactionAutoConfigurationTests { ...@@ -203,6 +203,7 @@ public class TransactionAutoConfigurationTests {
public AnotherServiceImpl anotherService() { public AnotherServiceImpl anotherService() {
return new AnotherServiceImpl(); return new AnotherServiceImpl();
} }
} }
@Configuration @Configuration
......
...@@ -304,6 +304,7 @@ public class ValidationAutoConfigurationTests { ...@@ -304,6 +304,7 @@ public class ValidationAutoConfigurationTests {
interface AnotherSampleService { interface AnotherSampleService {
void doSomething(@Min(42) Integer counter); void doSomething(@Min(42) Integer counter);
} }
@Validated @Validated
...@@ -313,6 +314,7 @@ public class ValidationAutoConfigurationTests { ...@@ -313,6 +314,7 @@ public class ValidationAutoConfigurationTests {
public void doSomething(Integer counter) { public void doSomething(Integer counter) {
} }
} }
@Configuration @Configuration
...@@ -382,6 +384,7 @@ public class ValidationAutoConfigurationTests { ...@@ -382,6 +384,7 @@ public class ValidationAutoConfigurationTests {
} }
} }
} }
} }
...@@ -373,6 +373,7 @@ public class WebFluxAutoConfigurationTests { ...@@ -373,6 +373,7 @@ public class WebFluxAutoConfigurationTests {
public CodecCustomizer firstCodecCustomizer() { public CodecCustomizer firstCodecCustomizer() {
return mock(CodecCustomizer.class); return mock(CodecCustomizer.class);
} }
} }
@Configuration @Configuration
...@@ -388,6 +389,7 @@ public class WebFluxAutoConfigurationTests { ...@@ -388,6 +389,7 @@ public class WebFluxAutoConfigurationTests {
public ViewResolver anotherViewResolver() { public ViewResolver anotherViewResolver() {
return mock(ViewResolver.class); return mock(ViewResolver.class);
} }
} }
@Configuration @Configuration
...@@ -407,6 +409,7 @@ public class WebFluxAutoConfigurationTests { ...@@ -407,6 +409,7 @@ public class WebFluxAutoConfigurationTests {
public HttpHandler httpHandler() { public HttpHandler httpHandler() {
return (serverHttpRequest, serverHttpResponse) -> null; return (serverHttpRequest, serverHttpResponse) -> null;
} }
} }
@Configuration @Configuration
......
...@@ -311,6 +311,7 @@ public class DefaultErrorWebExceptionHandlerIntegrationTests { ...@@ -311,6 +311,7 @@ public class DefaultErrorWebExceptionHandlerIntegrationTests {
public String bodyValidation(@Valid @RequestBody DummyBody body) { public String bodyValidation(@Valid @RequestBody DummyBody body) {
return body.getContent(); return body.getContent();
} }
} }
} }
......
...@@ -109,4 +109,5 @@ public class TomcatServletWebServerFactoryCustomizerTests { ...@@ -109,4 +109,5 @@ public class TomcatServletWebServerFactoryCustomizerTests {
this.customizer.customize(factory); this.customizer.customize(factory);
return factory; return factory;
} }
} }
...@@ -829,12 +829,13 @@ public class WebMvcAutoConfigurationTests { ...@@ -829,12 +829,13 @@ public class WebMvcAutoConfigurationTests {
@Test @Test
public void contentNegotiationStrategySkipsPathExtension() throws Exception { public void contentNegotiationStrategySkipsPathExtension() throws Exception {
ContentNegotiationStrategy delegate = mock(ContentNegotiationStrategy.class); ContentNegotiationStrategy delegate = mock(ContentNegotiationStrategy.class);
ContentNegotiationStrategy strategy = new WebMvcAutoConfiguration ContentNegotiationStrategy strategy = new WebMvcAutoConfiguration.OptionalPathExtensionContentNegotiationStrategy(
.OptionalPathExtensionContentNegotiationStrategy(delegate); delegate);
MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletRequest request = new MockHttpServletRequest();
request.setAttribute(PathExtensionContentNegotiationStrategy.class request.setAttribute(
.getName() + ".SKIP", Boolean.TRUE); PathExtensionContentNegotiationStrategy.class.getName() + ".SKIP",
Boolean.TRUE);
ServletWebRequest webRequest = new ServletWebRequest(request); ServletWebRequest webRequest = new ServletWebRequest(request);
List<MediaType> mediaTypes = strategy.resolveMediaTypes(webRequest); List<MediaType> mediaTypes = strategy.resolveMediaTypes(webRequest);
assertThat(mediaTypes).containsOnly(MediaType.ALL); assertThat(mediaTypes).containsOnly(MediaType.ALL);
......
...@@ -68,8 +68,7 @@ public class WelcomePageHandlerMappingTests { ...@@ -68,8 +68,7 @@ public class WelcomePageHandlerMappingTests {
.run((context) -> { .run((context) -> {
WelcomePageHandlerMapping handler = context WelcomePageHandlerMapping handler = context
.getBean(WelcomePageHandlerMapping.class); .getBean(WelcomePageHandlerMapping.class);
assertThat(handler.getOrder()) assertThat(handler.getOrder()).isEqualTo(2);
.isEqualTo(2);
}); });
} }
......
...@@ -359,7 +359,8 @@ class ProjectGenerationRequest { ...@@ -359,7 +359,8 @@ class ProjectGenerationRequest {
return builder.build(); return builder.build();
} }
catch (URISyntaxException ex) { catch (URISyntaxException ex) {
throw new ReportableException("Invalid service URL (" + ex.getMessage() + ")"); throw new ReportableException(
"Invalid service URL (" + ex.getMessage() + ")");
} }
} }
......
...@@ -42,4 +42,5 @@ public class JestClientCustomizationExample { ...@@ -42,4 +42,5 @@ public class JestClientCustomizationExample {
} }
// end::customizer[] // end::customizer[]
} }
...@@ -36,6 +36,7 @@ public class UserServiceAutoConfigurationTests { ...@@ -36,6 +36,7 @@ public class UserServiceAutoConfigurationTests {
// tag::runner[] // tag::runner[]
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(UserServiceAutoConfiguration.class)); .withConfiguration(AutoConfigurations.of(UserServiceAutoConfiguration.class));
// end::runner[] // end::runner[]
// tag::test-env[] // tag::test-env[]
......
...@@ -69,4 +69,5 @@ class DataNeo4jTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter ...@@ -69,4 +69,5 @@ class DataNeo4jTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter
protected Set<Class<?>> getComponentIncludes() { protected Set<Class<?>> getComponentIncludes() {
return Collections.emptySet(); return Collections.emptySet();
} }
} }
...@@ -26,8 +26,7 @@ import org.springframework.util.ClassUtils; ...@@ -26,8 +26,7 @@ import org.springframework.util.ClassUtils;
/** /**
* A {@link TestExecutionListener} for Spring REST Docs that removes the need for a * A {@link TestExecutionListener} for Spring REST Docs that removes the need for a
* {@code @Rule} when using JUnit or manual before and after test calls when using * {@code @Rule} when using JUnit or manual before and after test calls when using TestNG.
* TestNG.
* *
* @author Andy Wilkinson * @author Andy Wilkinson
* @since 1.4.0 * @since 1.4.0
......
...@@ -39,4 +39,5 @@ public class ExampleEntry { ...@@ -39,4 +39,5 @@ public class ExampleEntry {
public void setDn(Name dn) { public void setDn(Name dn) {
this.dn = dn; this.dn = dn;
} }
} }
...@@ -24,4 +24,5 @@ import org.springframework.data.neo4j.repository.Neo4jRepository; ...@@ -24,4 +24,5 @@ import org.springframework.data.neo4j.repository.Neo4jRepository;
* @author Eddú Meléndez * @author Eddú Meléndez
*/ */
public interface ExampleRepository extends Neo4jRepository<ExampleGraph, Long> { public interface ExampleRepository extends Neo4jRepository<ExampleGraph, Long> {
} }
...@@ -123,4 +123,5 @@ public class FilteredClassLoader extends URLClassLoader { ...@@ -123,4 +123,5 @@ public class FilteredClassLoader extends URLClassLoader {
} }
} }
} }
...@@ -353,6 +353,7 @@ class ImportsContextCustomizer implements ContextCustomizer { ...@@ -353,6 +353,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
public String toString() { public String toString() {
return this.key.toString(); return this.key.toString();
} }
} }
/** /**
......
...@@ -123,6 +123,7 @@ public class JsonbTester<T> extends AbstractJsonMarshalTester<T> { ...@@ -123,6 +123,7 @@ public class JsonbTester<T> extends AbstractJsonMarshalTester<T> {
Class<?> resourceLoadClass, ResolvableType type, Jsonb marshaller) { Class<?> resourceLoadClass, ResolvableType type, Jsonb marshaller) {
return new JsonbTester<>(resourceLoadClass, type, marshaller); return new JsonbTester<>(resourceLoadClass, type, marshaller);
} }
} }
} }
...@@ -419,6 +419,7 @@ public class ApplicationContextAssertTests { ...@@ -419,6 +419,7 @@ public class ApplicationContextAssertTests {
} }
private static class Foo { private static class Foo {
} }
} }
...@@ -30,4 +30,5 @@ public class TestMethodConfiguration { ...@@ -30,4 +30,5 @@ public class TestMethodConfiguration {
public Object method() { public Object method() {
return null; return null;
} }
} }
...@@ -29,4 +29,5 @@ import java.io.OutputStream; ...@@ -29,4 +29,5 @@ import java.io.OutputStream;
@TestConditionalOnClass(name = "java.io.InputStream", value = OutputStream.class) @TestConditionalOnClass(name = "java.io.InputStream", value = OutputStream.class)
@TestAutoConfigureOrder(123) @TestAutoConfigureOrder(123)
public class TestOrderedClassConfiguration { public class TestOrderedClassConfiguration {
} }
...@@ -151,8 +151,8 @@ public class ConfigurationMetadata { ...@@ -151,8 +151,8 @@ public class ConfigurationMetadata {
} }
candidates.removeIf((itemMetadata) -> !itemMetadata.hasSameType(metadata)); candidates.removeIf((itemMetadata) -> !itemMetadata.hasSameType(metadata));
if (candidates.size() > 1 && metadata.getType() != null) { if (candidates.size() > 1 && metadata.getType() != null) {
candidates.removeIf((itemMetadata) -> candidates.removeIf(
!metadata.getType().equals(itemMetadata.getType())); (itemMetadata) -> !metadata.getType().equals(itemMetadata.getType()));
} }
if (candidates.size() == 1) { if (candidates.size() == 1) {
return candidates.get(0); return candidates.get(0);
......
...@@ -742,8 +742,8 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -742,8 +742,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
"java.lang.String", null, null, null, null, null); "java.lang.String", null, null, null, null, null);
writeAdditionalMetadata(property); writeAdditionalMetadata(property);
ConfigurationMetadata metadata = compile(SimpleProperties.class); ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withGroup("simple") assertThat(metadata)
.fromSource(SimpleProperties.class)); .has(Metadata.withGroup("simple").fromSource(SimpleProperties.class));
assertThat(metadata).has(Metadata.withProperty("simple", String.class)); assertThat(metadata).has(Metadata.withProperty("simple", String.class));
} }
......
...@@ -57,8 +57,10 @@ public interface RandomAccessData { ...@@ -57,8 +57,10 @@ public interface RandomAccessData {
* @param length the number of bytes to be read * @param length the number of bytes to be read
* @return the data * @return the data
* @throws IOException if the data cannot be read * @throws IOException if the data cannot be read
* @throws IndexOutOfBoundsException if offset is beyond the end of the file or subsection * @throws IndexOutOfBoundsException if offset is beyond the end of the file or
* @throws EOFException if offset plus length is greater than the length of the file or subsection * subsection
* @throws EOFException if offset plus length is greater than the length of the file
* or subsection
*/ */
byte[] read(long offset, long length) throws IOException; byte[] read(long offset, long length) throws IOException;
......
...@@ -110,20 +110,23 @@ public class RandomAccessDataFileTests { ...@@ -110,20 +110,23 @@ public class RandomAccessDataFileTests {
} }
@Test @Test
public void readWhenOffsetIsBeyondEndOfSubsectionShouldThrowException() throws Exception { public void readWhenOffsetIsBeyondEndOfSubsectionShouldThrowException()
throws Exception {
this.thrown.expect(IndexOutOfBoundsException.class); this.thrown.expect(IndexOutOfBoundsException.class);
RandomAccessData subsection = this.file.getSubsection(0, 10); RandomAccessData subsection = this.file.getSubsection(0, 10);
subsection.read(11, 0); subsection.read(11, 0);
} }
@Test @Test
public void readWhenOffsetPlusLengthGreaterThanEOFShouldThrowException() throws Exception { public void readWhenOffsetPlusLengthGreaterThanEOFShouldThrowException()
throws Exception {
this.thrown.expect(EOFException.class); this.thrown.expect(EOFException.class);
this.file.read(256, 1); this.file.read(256, 1);
} }
@Test @Test
public void readWhenOffsetPlusLengthGreaterThanEndOfSubsectionShouldThrowException() throws Exception { public void readWhenOffsetPlusLengthGreaterThanEndOfSubsectionShouldThrowException()
throws Exception {
this.thrown.expect(EOFException.class); this.thrown.expect(EOFException.class);
RandomAccessData subsection = this.file.getSubsection(0, 10); RandomAccessData subsection = this.file.getSubsection(0, 10);
subsection.read(10, 1); subsection.read(10, 1);
......
...@@ -199,4 +199,5 @@ public class AsciiBytesTests { ...@@ -199,4 +199,5 @@ public class AsciiBytesTests {
private void matchesSameAsString(String input) { private void matchesSameAsString(String input) {
assertThat(new AsciiBytes(input).matches(input, NO_SUFFIX)).isTrue(); assertThat(new AsciiBytes(input).matches(input, NO_SUFFIX)).isTrue();
} }
} }
...@@ -167,6 +167,7 @@ public final class PropertyMapper { ...@@ -167,6 +167,7 @@ public final class PropertyMapper {
/** /**
* A source that is in the process of being mapped. * A source that is in the process of being mapped.
*
* @param <T> the source type * @param <T> the source type
*/ */
public static final class Source<T> { public static final class Source<T> {
......
...@@ -91,6 +91,7 @@ abstract class AggregateBinder<T> { ...@@ -91,6 +91,7 @@ abstract class AggregateBinder<T> {
/** /**
* Internal class used to supply the aggregate and cache the value. * Internal class used to supply the aggregate and cache the value.
*
* @param <T> The aggregate type * @param <T> The aggregate type
*/ */
protected static class AggregateSupplier<T> { protected static class AggregateSupplier<T> {
......
...@@ -61,4 +61,5 @@ public class SystemEnvironmentOrigin implements Origin { ...@@ -61,4 +61,5 @@ public class SystemEnvironmentOrigin implements Origin {
SystemEnvironmentOrigin other = (SystemEnvironmentOrigin) obj; SystemEnvironmentOrigin other = (SystemEnvironmentOrigin) obj;
return ObjectUtils.nullSafeEquals(this.property, other.property); return ObjectUtils.nullSafeEquals(this.property, other.property);
} }
} }
...@@ -367,6 +367,7 @@ public final class LambdaSafe { ...@@ -367,6 +367,7 @@ public final class LambdaSafe {
* The result of a callback which may be a value, {@code null} or absent entirely if * The result of a callback which may be a value, {@code null} or absent entirely if
* the callback wasn't suitable. Similar in design to {@link Optional} but allows for * the callback wasn't suitable. Similar in design to {@link Optional} but allows for
* {@code null} as a valid value. * {@code null} as a valid value.
*
* @param <R> The result type * @param <R> The result type
*/ */
public static final class InvocationResult<R> { public static final class InvocationResult<R> {
......
...@@ -114,7 +114,8 @@ class SslConnectorCustomizer implements TomcatConnectorCustomizer { ...@@ -114,7 +114,8 @@ class SslConnectorCustomizer implements TomcatConnectorCustomizer {
try { try {
if (sslStoreProvider.getKeyStore() != null) { if (sslStoreProvider.getKeyStore() != null) {
protocol.setKeystorePass(""); protocol.setKeystorePass("");
protocol.setKeystoreFile(SslStoreProviderUrlStreamHandlerFactory.KEY_STORE_URL); protocol.setKeystoreFile(
SslStoreProviderUrlStreamHandlerFactory.KEY_STORE_URL);
} }
if (sslStoreProvider.getTrustStore() != null) { if (sslStoreProvider.getTrustStore() != null) {
protocol.setTruststoreFile( protocol.setTruststoreFile(
...@@ -122,8 +123,7 @@ class SslConnectorCustomizer implements TomcatConnectorCustomizer { ...@@ -122,8 +123,7 @@ class SslConnectorCustomizer implements TomcatConnectorCustomizer {
} }
} }
catch (Exception ex) { catch (Exception ex) {
throw new WebServerException("Could not load store: " + ex.getMessage(), throw new WebServerException("Could not load store: " + ex.getMessage(), ex);
ex);
} }
} }
......
...@@ -126,4 +126,5 @@ final class UndertowCompressionConfigurer { ...@@ -126,4 +126,5 @@ final class UndertowCompressionConfigurer {
} }
} }
} }
...@@ -582,6 +582,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac ...@@ -582,6 +582,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac
return null; return null;
} }
} }
} }
/** /**
...@@ -603,6 +604,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac ...@@ -603,6 +604,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac
initializer.onStartup(servletContext); initializer.onStartup(servletContext);
} }
} }
} }
private static final class LoaderHidingResourceManager implements ResourceManager { private static final class LoaderHidingResourceManager implements ResourceManager {
......
...@@ -214,4 +214,5 @@ public class ServletRegistrationBean<T extends Servlet> ...@@ -214,4 +214,5 @@ public class ServletRegistrationBean<T extends Servlet>
public String getServletName() { public String getServletName() {
return getOrDeduceName(this.servlet); return getOrDeduceName(this.servlet);
} }
} }
...@@ -284,7 +284,6 @@ public abstract class AbstractServletWebServerFactory ...@@ -284,7 +284,6 @@ public abstract class AbstractServletWebServerFactory
/** /**
* Converts the given {@code url} into a decoded file path. * Converts the given {@code url} into a decoded file path.
*
* @param url the url to convert * @param url the url to convert
* @return the file path * @return the file path
* @deprecated Since 2.0.2 in favor of {@link File#File(java.net.URI)} * @deprecated Since 2.0.2 in favor of {@link File#File(java.net.URI)}
......
...@@ -758,8 +758,8 @@ public class ConfigFileApplicationListenerTests { ...@@ -758,8 +758,8 @@ public class ConfigFileApplicationListenerTests {
assertThat(environment).has(matchingProfile("morespecific")); assertThat(environment).has(matchingProfile("morespecific"));
assertThat(environment).has(matchingProfile("yetmorespecific")); assertThat(environment).has(matchingProfile("yetmorespecific"));
assertThat(environment).doesNotHave(matchingProfile("missing")); assertThat(environment).doesNotHave(matchingProfile("missing"));
assertThat(this.out.toString()) assertThat(this.out.toString()).contains(
.contains("The following profiles are active: includeprofile,specific,morespecific,yetmorespecific"); "The following profiles are active: includeprofile,specific,morespecific,yetmorespecific");
} }
@Test @Test
......
...@@ -831,6 +831,7 @@ public class ConfigurationPropertiesTests { ...@@ -831,6 +831,7 @@ public class ConfigurationPropertiesTests {
public NonValidatedJsr303Properties properties() { public NonValidatedJsr303Properties properties() {
return new NonValidatedJsr303Properties(); return new NonValidatedJsr303Properties();
} }
} }
@Configuration @Configuration
...@@ -1374,6 +1375,7 @@ public class ConfigurationPropertiesTests { ...@@ -1374,6 +1375,7 @@ public class ConfigurationPropertiesTests {
interface InterfaceForValidatedImplementation { interface InterfaceForValidatedImplementation {
String getFoo(); String getFoo();
} }
@ConfigurationProperties("test") @ConfigurationProperties("test")
...@@ -1687,6 +1689,7 @@ public class ConfigurationPropertiesTests { ...@@ -1687,6 +1689,7 @@ public class ConfigurationPropertiesTests {
String[] content = StringUtils.split(source, " "); String[] content = StringUtils.split(source, " ");
return new Person(content[0], content[1]); return new Person(content[0], content[1]);
} }
} }
static class GenericPersonConverter implements GenericConverter { static class GenericPersonConverter implements GenericConverter {
...@@ -1704,6 +1707,7 @@ public class ConfigurationPropertiesTests { ...@@ -1704,6 +1707,7 @@ public class ConfigurationPropertiesTests {
String[] content = StringUtils.split((String) source, " "); String[] content = StringUtils.split((String) source, " ");
return new Person(content[0], content[1]); return new Person(content[0], content[1]);
} }
} }
static class PersonPropertyEditor extends PropertyEditorSupport { static class PersonPropertyEditor extends PropertyEditorSupport {
......
...@@ -85,4 +85,5 @@ public class BackCompatibilityBinderIntegrationTests { ...@@ -85,4 +85,5 @@ public class BackCompatibilityBinderIntegrationTests {
} }
} }
} }
...@@ -425,6 +425,7 @@ public class CollectionBinderTests { ...@@ -425,6 +425,7 @@ public class CollectionBinderTests {
public void setItemsSet(Set<String> itemsSet) { public void setItemsSet(Set<String> itemsSet) {
this.itemsSet = itemsSet; this.itemsSet = itemsSet;
} }
} }
public static class ExampleCustomNoDefaultConstructorBean { public static class ExampleCustomNoDefaultConstructorBean {
...@@ -490,6 +491,7 @@ public class CollectionBinderTests { ...@@ -490,6 +491,7 @@ public class CollectionBinderTests {
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
} }
} }
public static class ClonedArrayBean { public static class ClonedArrayBean {
......
...@@ -168,6 +168,7 @@ public class BindFailureAnalyzerTests { ...@@ -168,6 +168,7 @@ public class BindFailureAnalyzerTests {
public void setListValue(List<String> listValue) { public void setListValue(List<String> listValue) {
this.listValue = listValue; this.listValue = listValue;
} }
} }
@ConfigurationProperties("test.foo") @ConfigurationProperties("test.foo")
......
...@@ -221,4 +221,5 @@ public class BindValidationFailureAnalyzerTests { ...@@ -221,4 +221,5 @@ public class BindValidationFailureAnalyzerTests {
} }
} }
} }
...@@ -135,4 +135,5 @@ public class SpringApplicationJsonEnvironmentPostProcessorTests { ...@@ -135,4 +135,5 @@ public class SpringApplicationJsonEnvironmentPostProcessorTests {
assertThat(origin.getPropertyName()).isEqualTo("spring.application.json"); assertThat(origin.getPropertyName()).isEqualTo("spring.application.json");
assertThat(this.environment.resolvePlaceholders("${foo:}")).isEqualTo("bar"); assertThat(this.environment.resolvePlaceholders("${foo:}")).isEqualTo("bar");
} }
} }
...@@ -56,4 +56,5 @@ public class SystemEnvironmentOriginTests { ...@@ -56,4 +56,5 @@ public class SystemEnvironmentOriginTests {
assertThat(origin.toString()) assertThat(origin.toString())
.isEqualTo("System Environment Property \"FOO_BAR\""); .isEqualTo("System Environment Property \"FOO_BAR\"");
} }
} }
...@@ -64,7 +64,8 @@ public class SslConnectorCustomizerTests { ...@@ -64,7 +64,8 @@ public class SslConnectorCustomizerTests {
@After @After
public void stop() throws Exception { public void stop() throws Exception {
ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", null); ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance",
null);
ReflectionTestUtils.setField(URL.class, "factory", null); ReflectionTestUtils.setField(URL.class, "factory", null);
this.tomcat.stop(); this.tomcat.stop();
} }
...@@ -120,50 +121,60 @@ public class SslConnectorCustomizerTests { ...@@ -120,50 +121,60 @@ public class SslConnectorCustomizerTests {
} }
@Test @Test
public void customizeWhenSslStoreProviderProvidesOnlyKeyStoreShouldUseDefaultTruststore() throws Exception { public void customizeWhenSslStoreProviderProvidesOnlyKeyStoreShouldUseDefaultTruststore()
throws Exception {
Ssl ssl = new Ssl(); Ssl ssl = new Ssl();
ssl.setKeyPassword("password"); ssl.setKeyPassword("password");
ssl.setTrustStore("src/test/resources/test.jks"); ssl.setTrustStore("src/test/resources/test.jks");
SslStoreProvider sslStoreProvider = mock(SslStoreProvider.class); SslStoreProvider sslStoreProvider = mock(SslStoreProvider.class);
given(sslStoreProvider.getKeyStore()).willReturn(loadStore()); given(sslStoreProvider.getKeyStore()).willReturn(loadStore());
SslConnectorCustomizer customizer = new SslConnectorCustomizer(ssl, sslStoreProvider); SslConnectorCustomizer customizer = new SslConnectorCustomizer(ssl,
sslStoreProvider);
Connector connector = this.tomcat.getConnector(); Connector connector = this.tomcat.getConnector();
customizer.customize(connector); customizer.customize(connector);
this.tomcat.start(); this.tomcat.start();
SSLHostConfig sslHostConfig = connector.getProtocolHandler() SSLHostConfig sslHostConfig = connector.getProtocolHandler()
.findSslHostConfigs()[0]; .findSslHostConfigs()[0];
SSLHostConfig sslHostConfigWithDefaults = new SSLHostConfig(); SSLHostConfig sslHostConfigWithDefaults = new SSLHostConfig();
assertThat(sslHostConfig.getTruststoreFile()).isEqualTo(sslHostConfigWithDefaults.getTruststoreFile()); assertThat(sslHostConfig.getTruststoreFile())
assertThat(sslHostConfig.getCertificateKeystoreFile()).isEqualTo(SslStoreProviderUrlStreamHandlerFactory.KEY_STORE_URL); .isEqualTo(sslHostConfigWithDefaults.getTruststoreFile());
assertThat(sslHostConfig.getCertificateKeystoreFile())
.isEqualTo(SslStoreProviderUrlStreamHandlerFactory.KEY_STORE_URL);
} }
@Test @Test
public void customizeWhenSslStoreProviderProvidesOnlyTrustStoreShouldUseDefaultKeystore() throws Exception { public void customizeWhenSslStoreProviderProvidesOnlyTrustStoreShouldUseDefaultKeystore()
throws Exception {
Ssl ssl = new Ssl(); Ssl ssl = new Ssl();
ssl.setKeyPassword("password"); ssl.setKeyPassword("password");
ssl.setKeyStore("src/test/resources/test.jks"); ssl.setKeyStore("src/test/resources/test.jks");
SslStoreProvider sslStoreProvider = mock(SslStoreProvider.class); SslStoreProvider sslStoreProvider = mock(SslStoreProvider.class);
given(sslStoreProvider.getTrustStore()).willReturn(loadStore()); given(sslStoreProvider.getTrustStore()).willReturn(loadStore());
SslConnectorCustomizer customizer = new SslConnectorCustomizer(ssl, sslStoreProvider); SslConnectorCustomizer customizer = new SslConnectorCustomizer(ssl,
sslStoreProvider);
Connector connector = this.tomcat.getConnector(); Connector connector = this.tomcat.getConnector();
customizer.customize(connector); customizer.customize(connector);
this.tomcat.start(); this.tomcat.start();
SSLHostConfig sslHostConfig = connector.getProtocolHandler() SSLHostConfig sslHostConfig = connector.getProtocolHandler()
.findSslHostConfigs()[0]; .findSslHostConfigs()[0];
SSLHostConfig sslHostConfigWithDefaults = new SSLHostConfig(); SSLHostConfig sslHostConfigWithDefaults = new SSLHostConfig();
assertThat(sslHostConfig.getTruststoreFile()).isEqualTo(SslStoreProviderUrlStreamHandlerFactory.TRUST_STORE_URL); assertThat(sslHostConfig.getTruststoreFile())
assertThat(sslHostConfig.getCertificateKeystoreFile()).contains(sslHostConfigWithDefaults.getCertificateKeystoreFile()); .isEqualTo(SslStoreProviderUrlStreamHandlerFactory.TRUST_STORE_URL);
assertThat(sslHostConfig.getCertificateKeystoreFile())
.contains(sslHostConfigWithDefaults.getCertificateKeystoreFile());
} }
@Test @Test
public void customizeWhenSslStoreProviderPresentShouldIgnorePasswordFromSsl() throws Exception { public void customizeWhenSslStoreProviderPresentShouldIgnorePasswordFromSsl()
throws Exception {
Ssl ssl = new Ssl(); Ssl ssl = new Ssl();
ssl.setKeyPassword("password"); ssl.setKeyPassword("password");
ssl.setKeyStorePassword("secret"); ssl.setKeyStorePassword("secret");
SslStoreProvider sslStoreProvider = mock(SslStoreProvider.class); SslStoreProvider sslStoreProvider = mock(SslStoreProvider.class);
given(sslStoreProvider.getTrustStore()).willReturn(loadStore()); given(sslStoreProvider.getTrustStore()).willReturn(loadStore());
given(sslStoreProvider.getKeyStore()).willReturn(loadStore()); given(sslStoreProvider.getKeyStore()).willReturn(loadStore());
SslConnectorCustomizer customizer = new SslConnectorCustomizer(ssl, sslStoreProvider); SslConnectorCustomizer customizer = new SslConnectorCustomizer(ssl,
sslStoreProvider);
Connector connector = this.tomcat.getConnector(); Connector connector = this.tomcat.getConnector();
customizer.customize(connector); customizer.customize(connector);
this.tomcat.start(); this.tomcat.start();
......
...@@ -221,8 +221,8 @@ public class UndertowServletWebServerFactoryTests ...@@ -221,8 +221,8 @@ public class UndertowServletWebServerFactoryTests
@Test @Test
public void sslRestrictedProtocolsECDHETLS1Failure() throws Exception { public void sslRestrictedProtocolsECDHETLS1Failure() throws Exception {
this.thrown.expect(anyOf(instanceOf(SSLException.class), this.thrown.expect(
instanceOf(SocketException.class))); anyOf(instanceOf(SSLException.class), instanceOf(SocketException.class)));
testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1" }, testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1" },
new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" }); new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" });
} }
...@@ -241,8 +241,8 @@ public class UndertowServletWebServerFactoryTests ...@@ -241,8 +241,8 @@ public class UndertowServletWebServerFactoryTests
@Test @Test
public void sslRestrictedProtocolsRSATLS11Failure() throws Exception { public void sslRestrictedProtocolsRSATLS11Failure() throws Exception {
this.thrown.expect(anyOf(instanceOf(SSLException.class), this.thrown.expect(
instanceOf(SocketException.class))); anyOf(instanceOf(SSLException.class), instanceOf(SocketException.class)));
testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.1" }, testRestrictedSSLProtocolsAndCipherSuites(new String[] { "TLSv1.1" },
new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA256" }); new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA256" });
} }
......
...@@ -866,8 +866,8 @@ public abstract class AbstractServletWebServerFactoryTests { ...@@ -866,8 +866,8 @@ public abstract class AbstractServletWebServerFactoryTests {
this.webServer = factory.getWebServer(); this.webServer = factory.getWebServer();
Map<String, String> configuredMimeMappings = getActualMimeMappings(); Map<String, String> configuredMimeMappings = getActualMimeMappings();
Collection<MimeMappings.Mapping> expectedMimeMappings = getExpectedMimeMappings(); Collection<MimeMappings.Mapping> expectedMimeMappings = getExpectedMimeMappings();
configuredMimeMappings.forEach((key, value) -> assertThat(expectedMimeMappings). configuredMimeMappings.forEach((key, value) -> assertThat(expectedMimeMappings)
contains(new MimeMappings.Mapping(key, value))); .contains(new MimeMappings.Mapping(key, value)));
for (MimeMappings.Mapping mapping : expectedMimeMappings) { for (MimeMappings.Mapping mapping : expectedMimeMappings) {
assertThat(configuredMimeMappings).containsEntry(mapping.getExtension(), assertThat(configuredMimeMappings).containsEntry(mapping.getExtension(),
mapping.getMimeType()); mapping.getMimeType());
......
...@@ -104,10 +104,10 @@ class ApplicationBuilder { ...@@ -104,10 +104,10 @@ class ApplicationBuilder {
context.put("bootVersion", Versions.getBootVersion()); context.put("bootVersion", Versions.getBootVersion());
context.put("resourcesJarPath", resourcesJar.getAbsolutePath()); context.put("resourcesJarPath", resourcesJar.getAbsolutePath());
try (FileWriter out = new FileWriter(new File(appFolder, "pom.xml")); try (FileWriter out = new FileWriter(new File(appFolder, "pom.xml"));
FileReader templateReader = new FileReader("src/test/resources/pom-template.xml")) { FileReader templateReader = new FileReader(
Mustache.compiler().escapeHTML(false) "src/test/resources/pom-template.xml")) {
.compile(templateReader) Mustache.compiler().escapeHTML(false).compile(templateReader).execute(context,
.execute(context, out); out);
} }
} }
...@@ -120,10 +120,10 @@ class ApplicationBuilder { ...@@ -120,10 +120,10 @@ class ApplicationBuilder {
context.put("repository", repository); context.put("repository", repository);
File settingsXml = new File(appFolder, "settings.xml"); File settingsXml = new File(appFolder, "settings.xml");
try (FileWriter out = new FileWriter(settingsXml); try (FileWriter out = new FileWriter(settingsXml);
FileReader templateReader = new FileReader("src/test/resources/settings-template.xml")) { FileReader templateReader = new FileReader(
Mustache.compiler().escapeHTML(false) "src/test/resources/settings-template.xml")) {
.compile(templateReader) Mustache.compiler().escapeHTML(false).compile(templateReader).execute(context,
.execute(context, out); out);
} }
return settingsXml; return settingsXml;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment