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