diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.java index ff8ed2e945..5deb06e0ce 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java index ebcc1bc6e9..d4d9b80236 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasMetricsExportAutoConfigurationTests.java index 93dc4a0671..2e46a15a79 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,7 +107,7 @@ public class AtlasMetricsExportAutoConfigurationTests { @Bean public AtlasConfig customConfig() { - return (k) -> null; + return (key) -> null; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasPropertiesTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasPropertiesTests.java index 1122f471ce..b00e2d4c92 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasPropertiesTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/atlas/AtlasPropertiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ public class AtlasPropertiesTests { @Test public void defaultValuesAreConsistent() { AtlasProperties properties = new AtlasProperties(); - AtlasConfig config = (k) -> null; + AtlasConfig config = (key) -> null; assertThat(properties.getStep()).isEqualTo(config.step()); assertThat(properties.isEnabled()).isEqualTo(config.enabled()); assertThat(properties.getConnectTimeout()).isEqualTo(config.connectTimeout()); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfigurationTests.java index 55527f9e05..66e8ae6f2c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,8 +116,8 @@ public class DatadogMetricsExportAutoConfigurationTests { @Bean public DatadogConfig customConfig() { - return (k) -> { - if ("datadog.apiKey".equals(k)) { + return (key) -> { + if ("datadog.apiKey".equals(key)) { return "12345"; } return null; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfigurationTests.java index 2e141ba6ed..05cfd3713a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,14 +125,14 @@ public class DynatraceMetricsExportAutoConfigurationTests { @Bean public DynatraceConfig customConfig() { - return (k) -> { - if ("dynatrace.uri".equals(k)) { + return (key) -> { + if ("dynatrace.uri".equals(key)) { return "https://dynatrace.example.com"; } - if ("dynatrace.apiToken".equals(k)) { + if ("dynatrace.apiToken".equals(key)) { return "abcde"; } - if ("dynatrace.deviceId".equals(k)) { + if ("dynatrace.deviceId".equals(key)) { return "test"; } return null; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticMetricsExportAutoConfigurationTests.java index 761029c8c1..d9158283ef 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,7 +108,7 @@ public class ElasticMetricsExportAutoConfigurationTests { @Bean public ElasticConfig customConfig() { - return (k) -> null; + return (key) -> null; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaMetricsExportAutoConfigurationTests.java index 8fb5036115..5dd868890b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/ganglia/GangliaMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,7 +107,7 @@ public class GangliaMetricsExportAutoConfigurationTests { @Bean public GangliaConfig customConfig() { - return (k) -> null; + return (key) -> null; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteMetricsExportAutoConfigurationTests.java index 0a8af33424..799879dd88 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/graphite/GraphiteMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -124,8 +124,8 @@ public class GraphiteMetricsExportAutoConfigurationTests { @Bean public GraphiteConfig customConfig() { - return (k) -> { - if ("Graphite.apiKey".equals(k)) { + return (key) -> { + if ("Graphite.apiKey".equals(key)) { return "12345"; } return null; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfigurationTests.java index f3d863f100..cf7dcd3cc1 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ public class HumioMetricsExportAutoConfigurationTests { @Bean public HumioConfig customConfig() { - return (k) -> null; + return (key) -> null; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfigurationTests.java index 2f490c2b21..f511bd3ed2 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,7 +107,7 @@ public class InfluxMetricsExportAutoConfigurationTests { @Bean public InfluxConfig customConfig() { - return (k) -> null; + return (key) -> null; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfigurationTests.java index f3e3d53559..a542e58987 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,11 +129,11 @@ public class NewRelicMetricsExportAutoConfigurationTests { @Bean public NewRelicConfig customConfig() { - return (k) -> { - if ("newrelic.accountId".equals(k)) { + return (key) -> { + if ("newrelic.accountId".equals(key)) { return "abcde"; } - if ("newrelic.apiKey".equals(k)) { + if ("newrelic.apiKey".equals(key)) { return "12345"; } return null; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfigurationTests.java index 7fbb5076ad..7ae9e3b7ae 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -157,7 +157,7 @@ public class PrometheusMetricsExportAutoConfigurationTests { @Bean public PrometheusConfig customConfig() { - return (k) -> null; + return (key) -> null; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfigurationTests.java index ceb048df95..324c5cadc8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -124,8 +124,8 @@ public class SignalFxMetricsExportAutoConfigurationTests { @Bean public SignalFxConfig customConfig() { - return (k) -> { - if ("signalfx.accessToken".equals(k)) { + return (key) -> { + if ("signalfx.accessToken".equals(key)) { return "abcde"; } return null; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfigurationTests.java index fb79339bb2..b6d7f554f4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,7 +90,7 @@ public class SimpleMetricsExportAutoConfigurationTests { @Bean public SimpleConfig customConfig() { - return (k) -> null; + return (key) -> null; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfigurationTests.java index effc1e12f1..28dc751db0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java index d1d7d98df4..db934b567e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicator.java index 1024dded02..48291d291c 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,7 +81,6 @@ public class ElasticsearchRestHealthIndicator extends AbstractHealthIndicator { else { builder.up(); } - builder.withDetails(response); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicatorTest.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicatorTest.java index 0387073731..fddd0ce36f 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicatorTest.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,8 +33,8 @@ import org.springframework.boot.actuate.health.Status; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.mock; -import static org.mockito.BDDMockito.when; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; /** * Tests for {@link ElasticsearchRestHealthIndicator}. @@ -54,15 +54,12 @@ public class ElasticsearchRestHealthIndicatorTest { BasicHttpEntity httpEntity = new BasicHttpEntity(); httpEntity.setContent( new ByteArrayInputStream(createJsonResult(200, "green").getBytes())); - Response response = mock(Response.class); StatusLine statusLine = mock(StatusLine.class); - - when(statusLine.getStatusCode()).thenReturn(200); - when(response.getStatusLine()).thenReturn(statusLine); - when(response.getEntity()).thenReturn(httpEntity); - when(this.restClient.performRequest(any(Request.class))).thenReturn(response); - + given(statusLine.getStatusCode()).willReturn(200); + given(response.getStatusLine()).willReturn(statusLine); + given(response.getEntity()).willReturn(httpEntity); + given(this.restClient.performRequest(any(Request.class))).willReturn(response); Health health = this.elasticsearchRestHealthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertHealthDetailsWithStatus(health.getDetails(), "green"); @@ -73,15 +70,12 @@ public class ElasticsearchRestHealthIndicatorTest { BasicHttpEntity httpEntity = new BasicHttpEntity(); httpEntity.setContent( new ByteArrayInputStream(createJsonResult(200, "yellow").getBytes())); - Response response = mock(Response.class); StatusLine statusLine = mock(StatusLine.class); - - when(statusLine.getStatusCode()).thenReturn(200); - when(response.getStatusLine()).thenReturn(statusLine); - when(response.getEntity()).thenReturn(httpEntity); - when(this.restClient.performRequest(any(Request.class))).thenReturn(response); - + given(statusLine.getStatusCode()).willReturn(200); + given(response.getStatusLine()).willReturn(statusLine); + given(response.getEntity()).willReturn(httpEntity); + given(this.restClient.performRequest(any(Request.class))).willReturn(response); Health health = this.elasticsearchRestHealthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertHealthDetailsWithStatus(health.getDetails(), "yellow"); @@ -89,9 +83,8 @@ public class ElasticsearchRestHealthIndicatorTest { @Test public void elasticsearchIsDown() throws IOException { - when(this.restClient.performRequest(any(Request.class))) - .thenThrow(new IOException("Couldn't connect")); - + given(this.restClient.performRequest(any(Request.class))) + .willThrow(new IOException("Couldn't connect")); Health health = this.elasticsearchRestHealthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(health.getDetails()) @@ -102,12 +95,10 @@ public class ElasticsearchRestHealthIndicatorTest { public void elasticsearchIsDownByResponseCode() throws IOException { Response response = mock(Response.class); StatusLine statusLine = mock(StatusLine.class); - - when(statusLine.getStatusCode()).thenReturn(500); - when(statusLine.getReasonPhrase()).thenReturn("Internal server error"); - when(response.getStatusLine()).thenReturn(statusLine); - when(this.restClient.performRequest(any(Request.class))).thenReturn(response); - + given(statusLine.getStatusCode()).willReturn(500); + given(statusLine.getReasonPhrase()).willReturn("Internal server error"); + given(response.getStatusLine()).willReturn(statusLine); + given(this.restClient.performRequest(any(Request.class))).willReturn(response); Health health = this.elasticsearchRestHealthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(health.getDetails()).contains(entry("statusCode", 500), @@ -119,15 +110,12 @@ public class ElasticsearchRestHealthIndicatorTest { BasicHttpEntity httpEntity = new BasicHttpEntity(); httpEntity.setContent( new ByteArrayInputStream(createJsonResult(200, "red").getBytes())); - Response response = mock(Response.class); StatusLine statusLine = mock(StatusLine.class); - - when(statusLine.getStatusCode()).thenReturn(200); - when(response.getStatusLine()).thenReturn(statusLine); - when(response.getEntity()).thenReturn(httpEntity); - when(this.restClient.performRequest(any(Request.class))).thenReturn(response); - + given(statusLine.getStatusCode()).willReturn(200); + given(response.getStatusLine()).willReturn(statusLine); + given(response.getEntity()).willReturn(httpEntity); + given(this.restClient.performRequest(any(Request.class))).willReturn(response); Health health = this.elasticsearchRestHealthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.OUT_OF_SERVICE); assertHealthDetailsWithStatus(health.getDetails(), "red"); @@ -148,9 +136,8 @@ public class ElasticsearchRestHealthIndicatorTest { } private String createJsonResult(int responseCode, String status) { - String json; if (responseCode == 200) { - json = String.format("{\"cluster_name\":\"elasticsearch\"," + return String.format("{\"cluster_name\":\"elasticsearch\"," + "\"status\":\"%s\",\"timed_out\":false,\"number_of_nodes\":1," + "\"number_of_data_nodes\":1,\"active_primary_shards\":0," + "\"active_shards\":0,\"relocating_shards\":0,\"initializing_shards\":0," @@ -159,12 +146,8 @@ public class ElasticsearchRestHealthIndicatorTest { + "\"task_max_waiting_in_queue_millis\":0,\"active_shards_percent_as_number\":100.0}", status); } - else { - json = "{\n" + " \"error\": \"Server Error\",\n" + " \"status\": " - + responseCode + "\n" + "}"; - } - - return json; + return "{\n" + " \"error\": \"Server Error\",\n" + " \"status\": " + + responseCode + "\n" + "}"; } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizer.java index 346bf60b6f..939ca97b95 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizer.java @@ -66,9 +66,8 @@ public class NettyWebServerFactoryCustomizer .to((maxHttpRequestHeaderSize) -> customizeMaxHttpHeaderSize(factory, maxHttpRequestHeaderSize)); propertyMapper.from(this.serverProperties::getConnectionTimeout).whenNonNull() - .asInt(Duration::toMillis) - .to((duration) -> customizeConnectionTimeOut(factory, duration)); - + .asInt(Duration::toMillis).to((duration) -> factory + .addServerCustomizers(getConnectionTimeOutCustomizer(duration))); } private boolean getOrDeduceUseForwardHeaders(ServerProperties serverProperties, @@ -87,11 +86,9 @@ public class NettyWebServerFactoryCustomizer .maxHeaderSize(maxHttpHeaderSize))); } - private void customizeConnectionTimeOut(NettyReactiveWebServerFactory factory, - int duration) { - factory.addServerCustomizers((NettyServerCustomizer) (httpServer) -> httpServer - .tcpConfiguration((tcpServer) -> tcpServer - .selectorOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, duration))); + private NettyServerCustomizer getConnectionTimeOutCustomizer(int duration) { + return (httpServer) -> httpServer.tcpConfiguration((tcpServer) -> tcpServer + .selectorOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, duration)); } } diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index e3c2101bfd..0b73a341b7 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -164,7 +164,7 @@ 5.1.4.RELEASE 2.1.3.RELEASE - 4.1.0.RELEASE + 4.1.1.RELEASE 2.0.4.RELEASE Lovelace-SR4 ${spring.version} diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java index 99d0582a26..d868297a6f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandler.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandler.java index f02c169821..0ce338c1a3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandler.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,9 +70,6 @@ public class ValidationBindHandler extends AbstractBindHandler { public void onFinish(ConfigurationPropertyName name, Bindable target, BindContext context, Object result) throws Exception { validate(name, target, context, result); - if (context.getDepth() == 0 && !this.exceptions.isEmpty()) { - throw this.exceptions.pop(); - } super.onFinish(name, target, context, result); } @@ -81,9 +78,6 @@ public class ValidationBindHandler extends AbstractBindHandler { BindContext context, Exception error) throws Exception { Object result = super.onFailure(name, target, context, error); validate(name, target, context, null); - if (!this.exceptions.isEmpty()) { - throw this.exceptions.pop(); - } return result; } @@ -91,7 +85,12 @@ public class ValidationBindHandler extends AbstractBindHandler { BindContext context, Object result) { Object validationTarget = getValidationTarget(target, context, result); Class validationType = target.getBoxedType().resolve(); - validate(name, validationTarget, validationType); + if (validationTarget != null) { + validateAndPush(name, validationTarget, validationType); + } + if (context.getDepth() == 0 && !this.exceptions.isEmpty()) { + throw this.exceptions.pop(); + } } private Object getValidationTarget(Bindable target, BindContext context, @@ -105,14 +104,13 @@ public class ValidationBindHandler extends AbstractBindHandler { return null; } - private void validate(ConfigurationPropertyName name, Object target, Class type) { - if (target != null) { - BindingResult errors = new BeanPropertyBindingResult(target, name.toString()); - Arrays.stream(this.validators).filter((validator) -> validator.supports(type)) - .forEach((validator) -> validator.validate(target, errors)); - if (errors.hasErrors()) { - this.exceptions.push(getBindValidationException(name, errors)); - } + private void validateAndPush(ConfigurationPropertyName name, Object target, + Class type) { + BindingResult errors = new BeanPropertyBindingResult(target, name.toString()); + Arrays.stream(this.validators).filter((validator) -> validator.supports(type)) + .forEach((validator) -> validator.validate(target, errors)); + if (errors.hasErrors()) { + this.exceptions.push(getBindValidationException(name, errors)); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/CompressionConnectorCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/CompressionConnectorCustomizer.java index c6cdee070e..c374809ddb 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/CompressionConnectorCustomizer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/CompressionConnectorCustomizer.java @@ -54,30 +54,37 @@ class CompressionConnectorCustomizer implements TomcatConnectorCustomizer { } } - private void customize(Http2Protocol upgradeProtocol) { + private void customize(Http2Protocol protocol) { Compression compression = this.compression; - upgradeProtocol.setCompression("on"); - upgradeProtocol - .setCompressionMinSize((int) compression.getMinResponseSize().toBytes()); - upgradeProtocol.setCompressibleMimeType( - StringUtils.arrayToCommaDelimitedString(compression.getMimeTypes())); + protocol.setCompression("on"); + protocol.setCompressionMinSize(getMinResponseSize(compression)); + protocol.setCompressibleMimeType(getMimeTypes(compression)); if (this.compression.getExcludedUserAgents() != null) { - upgradeProtocol - .setNoCompressionUserAgents(StringUtils.arrayToCommaDelimitedString( - this.compression.getExcludedUserAgents())); + protocol.setNoCompressionUserAgents(getExcludedUserAgents()); } } private void customize(AbstractHttp11Protocol protocol) { Compression compression = this.compression; protocol.setCompression("on"); - protocol.setCompressionMinSize((int) compression.getMinResponseSize().toBytes()); - protocol.setCompressibleMimeType( - StringUtils.arrayToCommaDelimitedString(compression.getMimeTypes())); + protocol.setCompressionMinSize(getMinResponseSize(compression)); + protocol.setCompressibleMimeType(getMimeTypes(compression)); if (this.compression.getExcludedUserAgents() != null) { - protocol.setNoCompressionUserAgents(StringUtils.arrayToCommaDelimitedString( - this.compression.getExcludedUserAgents())); + protocol.setNoCompressionUserAgents(getExcludedUserAgents()); } } + private int getMinResponseSize(Compression compression) { + return (int) compression.getMinResponseSize().toBytes(); + } + + private String getMimeTypes(Compression compression) { + return StringUtils.arrayToCommaDelimitedString(compression.getMimeTypes()); + } + + private String getExcludedUserAgents() { + return StringUtils + .arrayToCommaDelimitedString(this.compression.getExcludedUserAgents()); + } + } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java index 8e03fecfdd..16d3ff3bf3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java index a96e437926..784d7ab8d9 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/validation/ValidationBindHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java index 3852df32f8..3decba3496 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java @@ -403,9 +403,9 @@ public class RestTemplateBuilderTests { RestTemplateCustomizer customizer2 = mock(RestTemplateCustomizer.class); RestTemplate template = this.builder.customizers(customizer1) .additionalCustomizers(customizer2).build(); - InOrder inOrder = inOrder(customizer1, customizer2); - inOrder.verify(customizer1).customize(template); - inOrder.verify(customizer2).customize(template); + InOrder ordered = inOrder(customizer1, customizer2); + ordered.verify(customizer1).customize(template); + ordered.verify(customizer2).customize(template); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java index 22579828bc..10392ac316 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -306,12 +306,12 @@ public class JettyServletWebServerFactoryTests contexts.iterator().next().addEventListener(new ServletContextListener() { @Override - public void contextInitialized(ServletContextEvent sce) { + public void contextInitialized(ServletContextEvent event) { throw new RuntimeException(); } @Override - public void contextDestroyed(ServletContextEvent sce) { + public void contextDestroyed(ServletContextEvent event) { } }); diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index 9e299a5710..adb53afe84 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -26,5 +26,12 @@ value="Please use specialized AssertJ assertThat*Exception method." /> + + + + + +