Skip to content

Commit 3702da4

Browse files
committed
Formatting
1 parent 2215709 commit 3702da4

File tree

32 files changed

+195
-199
lines changed

32 files changed

+195
-199
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/CompositeReactiveHealthIndicatorConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ protected ReactiveHealthIndicator createHealthIndicator(Map<String, S> beans) {
4444
return createHealthIndicator(beans.values().iterator().next());
4545
}
4646
ReactiveHealthIndicatorRegistry registry = new DefaultReactiveHealthIndicatorRegistry();
47-
beans.forEach((name, source) -> registry.register(name,
48-
createHealthIndicator(source)));
47+
beans.forEach(
48+
(name, source) -> registry.register(name, createHealthIndicator(source)));
4949
return new CompositeReactiveHealthIndicator(this.healthAggregator, registry);
5050
}
5151

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ static class ReactiveHealthIndicatorConfiguration {
8989
public ReactiveHealthIndicatorRegistry reactiveHealthIndicatorRegistry(
9090
ObjectProvider<Map<String, ReactiveHealthIndicator>> reactiveHealthIndicators,
9191
ObjectProvider<Map<String, HealthIndicator>> healthIndicators) {
92-
return new ReactiveHealthIndicatorRegistryFactory().createReactiveHealthIndicatorRegistry(
93-
reactiveHealthIndicators.getIfAvailable(Collections::emptyMap),
94-
healthIndicators.getIfAvailable(Collections::emptyMap));
92+
return new ReactiveHealthIndicatorRegistryFactory()
93+
.createReactiveHealthIndicatorRegistry(
94+
reactiveHealthIndicators
95+
.getIfAvailable(Collections::emptyMap),
96+
healthIndicators.getIfAvailable(Collections::emptyMap));
9597
}
9698

9799
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ public PropertiesMeterFilter(MetricsProperties properties) {
5757

5858
private static MeterFilter createMapFilter(Map<String, String> tags) {
5959
if (tags.isEmpty()) {
60-
return new MeterFilter() { };
60+
return new MeterFilter() {
61+
};
6162
}
62-
Tags commonTags = Tags.of(tags.entrySet().stream().map((entry) ->
63-
Tag.of(entry.getKey(), entry.getValue())).collect(Collectors.toList()));
63+
Tags commonTags = Tags.of(tags.entrySet().stream()
64+
.map((entry) -> Tag.of(entry.getKey(), entry.getValue()))
65+
.collect(Collectors.toList()));
6466
return MeterFilter.commonTags(commonTags);
6567
}
6668

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebEndpointDiscovererTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ private WebOperation findMainReadOperation(ExposableWebEndpoint endpoint) {
7373
return operation;
7474
}
7575
}
76-
throw new IllegalStateException("No main read operation found from "
77-
+ endpoint.getOperations());
76+
throw new IllegalStateException(
77+
"No main read operation found from " + endpoint.getOperations());
7878
}
7979

8080
private void load(Class<?> configuration,

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/HealthEndpointDocumentationTests.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ public class HealthEndpointDocumentationTests extends MockMvcEndpointDocumentati
6161
fieldWithPath("status")
6262
.description("Status of a specific part of the application"),
6363
subsectionWithPath("details").description(
64-
"Details of the health of a specific part of the"
65-
+ " application."));
64+
"Details of the health of a specific part of the" + " application."));
6665

6766
@Test
6867
public void health() throws Exception {
@@ -111,18 +110,17 @@ public DiskSpaceHealthIndicator diskSpaceHealthIndicator() {
111110
}
112111

113112
@Bean
114-
public DataSourceHealthIndicator dbHealthIndicator(
115-
DataSource dataSource) {
113+
public DataSourceHealthIndicator dbHealthIndicator(DataSource dataSource) {
116114
return new DataSourceHealthIndicator(dataSource);
117115
}
118116

119117
@Bean
120118
public CompositeHealthIndicator brokerHealthIndicator() {
121119
Map<String, HealthIndicator> indicators = new LinkedHashMap<>();
122-
indicators.put("us1", () -> Health.up().withDetail("version", "1.0.2")
123-
.build());
124-
indicators.put("us2", () -> Health.up().withDetail("version", "1.0.4")
125-
.build());
120+
indicators.put("us1",
121+
() -> Health.up().withDetail("version", "1.0.2").build());
122+
indicators.put("us2",
123+
() -> Health.up().withDetail("version", "1.0.4").build());
126124
return new CompositeHealthIndicator(new OrderedHealthAggregator(),
127125
new DefaultHealthIndicatorRegistry(indicators));
128126
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointWebExtensionTests.java

Lines changed: 59 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
public class HealthEndpointWebExtensionTests {
5454

5555
private WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
56-
.withUserConfiguration(HealthIndicatorsConfiguration.class)
57-
.withConfiguration(
56+
.withUserConfiguration(HealthIndicatorsConfiguration.class).withConfiguration(
5857
AutoConfigurations.of(HealthIndicatorAutoConfiguration.class,
5958
HealthEndpointAutoConfiguration.class));
6059

@@ -96,8 +95,9 @@ public void unauthenticatedUsersAreNotShownDetailsByDefault() {
9695
this.contextRunner.run((context) -> {
9796
HealthEndpointWebExtension extension = context
9897
.getBean(HealthEndpointWebExtension.class);
99-
assertThat(extension.health(mock(SecurityContext.class)).getBody()
100-
.getDetails()).isEmpty();
98+
assertThat(
99+
extension.health(mock(SecurityContext.class)).getBody().getDetails())
100+
.isEmpty();
101101
});
102102
}
103103

@@ -124,9 +124,8 @@ public void authenticatedUsersWhenAuthorizedCanBeShownDetails() {
124124
SecurityContext securityContext = mock(SecurityContext.class);
125125
given(securityContext.getPrincipal())
126126
.willReturn(mock(Principal.class));
127-
assertThat(
128-
extension.health(securityContext).getBody().getDetails())
129-
.isNotEmpty();
127+
assertThat(extension.health(securityContext).getBody().getDetails())
128+
.isNotEmpty();
130129
});
131130
}
132131

@@ -165,9 +164,8 @@ public void detailsCanBeHiddenFromUnauthorizedUsers() {
165164
given(securityContext.getPrincipal())
166165
.willReturn(mock(Principal.class));
167166
given(securityContext.isUserInRole("ACTUATOR")).willReturn(false);
168-
assertThat(
169-
extension.health(securityContext).getBody().getDetails())
170-
.isEmpty();
167+
assertThat(extension.health(securityContext).getBody().getDetails())
168+
.isEmpty();
171169
});
172170
}
173171

@@ -182,9 +180,8 @@ public void detailsCanBeShownToAuthorizedUsers() {
182180
given(securityContext.getPrincipal())
183181
.willReturn(mock(Principal.class));
184182
given(securityContext.isUserInRole("ACTUATOR")).willReturn(true);
185-
assertThat(
186-
extension.health(securityContext).getBody().getDetails())
187-
.isNotEmpty();
183+
assertThat(extension.health(securityContext).getBody().getDetails())
184+
.isNotEmpty();
188185
});
189186
}
190187

@@ -193,8 +190,8 @@ public void unauthenticatedUsersAreNotShownComponentByDefault() {
193190
this.contextRunner.run((context) -> {
194191
HealthEndpointWebExtension extension = context
195192
.getBean(HealthEndpointWebExtension.class);
196-
assertDetailsNotFound(extension.healthForComponent(
197-
mock(SecurityContext.class), "simple"));
193+
assertDetailsNotFound(
194+
extension.healthForComponent(mock(SecurityContext.class), "simple"));
198195
});
199196
}
200197

@@ -205,8 +202,8 @@ public void authenticatedUsersAreNotShownComponentByDefault() {
205202
.getBean(HealthEndpointWebExtension.class);
206203
SecurityContext securityContext = mock(SecurityContext.class);
207204
given(securityContext.getPrincipal()).willReturn(mock(Principal.class));
208-
assertDetailsNotFound(extension.healthForComponent(securityContext,
209-
"simple"));
205+
assertDetailsNotFound(
206+
extension.healthForComponent(securityContext, "simple"));
210207
});
211208
}
212209

@@ -221,8 +218,8 @@ public void authenticatedUsersWhenAuthorizedCanBeShownComponent() {
221218
SecurityContext securityContext = mock(SecurityContext.class);
222219
given(securityContext.getPrincipal())
223220
.willReturn(mock(Principal.class));
224-
assertSimpleComponent(extension.healthForComponent(
225-
securityContext, "simple"));
221+
assertSimpleComponent(
222+
extension.healthForComponent(securityContext, "simple"));
226223
});
227224
}
228225

@@ -244,8 +241,8 @@ public void componentCanBeHiddenFromAuthenticatedUsers() {
244241
.run((context) -> {
245242
HealthEndpointWebExtension extension = context
246243
.getBean(HealthEndpointWebExtension.class);
247-
assertDetailsNotFound(extension.healthForComponent(
248-
mock(SecurityContext.class), "simple"));
244+
assertDetailsNotFound(extension
245+
.healthForComponent(mock(SecurityContext.class), "simple"));
249246
});
250247
}
251248

@@ -254,31 +251,31 @@ public void componentCanBeHiddenFromUnauthorizedUsers() {
254251
this.contextRunner.withPropertyValues(
255252
"management.endpoint.health.show-details=when-authorized",
256253
"management.endpoint.health.roles=ACTUATOR").run((context) -> {
257-
HealthEndpointWebExtension extension = context
258-
.getBean(HealthEndpointWebExtension.class);
259-
SecurityContext securityContext = mock(SecurityContext.class);
260-
given(securityContext.getPrincipal())
261-
.willReturn(mock(Principal.class));
262-
given(securityContext.isUserInRole("ACTUATOR")).willReturn(false);
263-
assertDetailsNotFound(extension.healthForComponent(securityContext,
264-
"simple"));
265-
});
254+
HealthEndpointWebExtension extension = context
255+
.getBean(HealthEndpointWebExtension.class);
256+
SecurityContext securityContext = mock(SecurityContext.class);
257+
given(securityContext.getPrincipal())
258+
.willReturn(mock(Principal.class));
259+
given(securityContext.isUserInRole("ACTUATOR")).willReturn(false);
260+
assertDetailsNotFound(
261+
extension.healthForComponent(securityContext, "simple"));
262+
});
266263
}
267264

268265
@Test
269266
public void componentCanBeShownToAuthorizedUsers() {
270267
this.contextRunner.withPropertyValues(
271268
"management.endpoint.health.show-details=when-authorized",
272269
"management.endpoint.health.roles=ACTUATOR").run((context) -> {
273-
HealthEndpointWebExtension extension = context
274-
.getBean(HealthEndpointWebExtension.class);
275-
SecurityContext securityContext = mock(SecurityContext.class);
276-
given(securityContext.getPrincipal())
277-
.willReturn(mock(Principal.class));
278-
given(securityContext.isUserInRole("ACTUATOR")).willReturn(true);
279-
assertSimpleComponent(extension.healthForComponent(securityContext,
280-
"simple"));
281-
});
270+
HealthEndpointWebExtension extension = context
271+
.getBean(HealthEndpointWebExtension.class);
272+
SecurityContext securityContext = mock(SecurityContext.class);
273+
given(securityContext.getPrincipal())
274+
.willReturn(mock(Principal.class));
275+
given(securityContext.isUserInRole("ACTUATOR")).willReturn(true);
276+
assertSimpleComponent(
277+
extension.healthForComponent(securityContext, "simple"));
278+
});
282279
}
283280

284281
@Test
@@ -288,8 +285,8 @@ public void componentThatDoesNotExistMapTo404() {
288285
.run((context) -> {
289286
HealthEndpointWebExtension extension = context
290287
.getBean(HealthEndpointWebExtension.class);
291-
assertDetailsNotFound(extension.healthForComponent(null,
292-
"does-not-exist"));
288+
assertDetailsNotFound(
289+
extension.healthForComponent(null, "does-not-exist"));
293290
});
294291
}
295292

@@ -360,31 +357,31 @@ public void componentInstanceCanBeHiddenFromUnauthorizedUsers() {
360357
this.contextRunner.withPropertyValues(
361358
"management.endpoint.health.show-details=when-authorized",
362359
"management.endpoint.health.roles=ACTUATOR").run((context) -> {
363-
HealthEndpointWebExtension extension = context
364-
.getBean(HealthEndpointWebExtension.class);
365-
SecurityContext securityContext = mock(SecurityContext.class);
366-
given(securityContext.getPrincipal())
367-
.willReturn(mock(Principal.class));
368-
given(securityContext.isUserInRole("ACTUATOR")).willReturn(false);
369-
assertDetailsNotFound(extension.healthForComponentInstance(securityContext,
370-
"composite", "one"));
371-
});
360+
HealthEndpointWebExtension extension = context
361+
.getBean(HealthEndpointWebExtension.class);
362+
SecurityContext securityContext = mock(SecurityContext.class);
363+
given(securityContext.getPrincipal())
364+
.willReturn(mock(Principal.class));
365+
given(securityContext.isUserInRole("ACTUATOR")).willReturn(false);
366+
assertDetailsNotFound(extension.healthForComponentInstance(
367+
securityContext, "composite", "one"));
368+
});
372369
}
373370

374371
@Test
375372
public void componentInstanceCanBeShownToAuthorizedUsers() {
376373
this.contextRunner.withPropertyValues(
377374
"management.endpoint.health.show-details=when-authorized",
378375
"management.endpoint.health.roles=ACTUATOR").run((context) -> {
379-
HealthEndpointWebExtension extension = context
380-
.getBean(HealthEndpointWebExtension.class);
381-
SecurityContext securityContext = mock(SecurityContext.class);
382-
given(securityContext.getPrincipal())
383-
.willReturn(mock(Principal.class));
384-
given(securityContext.isUserInRole("ACTUATOR")).willReturn(true);
385-
assertSimpleComponent(extension.healthForComponentInstance(securityContext,
386-
"composite", "one"));
387-
});
376+
HealthEndpointWebExtension extension = context
377+
.getBean(HealthEndpointWebExtension.class);
378+
SecurityContext securityContext = mock(SecurityContext.class);
379+
given(securityContext.getPrincipal())
380+
.willReturn(mock(Principal.class));
381+
given(securityContext.isUserInRole("ACTUATOR")).willReturn(true);
382+
assertSimpleComponent(extension.healthForComponentInstance(
383+
securityContext, "composite", "one"));
384+
});
388385
}
389386

390387
@Test
@@ -406,8 +403,7 @@ private void assertDetailsNotFound(WebEndpointResponse<?> response) {
406403

407404
private void assertSimpleComponent(WebEndpointResponse<Health> response) {
408405
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value());
409-
assertThat(response.getBody().getDetails()).containsOnly(
410-
entry("counter", 42));
406+
assertThat(response.getBody().getDetails()).containsOnly(entry("counter", 42));
411407
}
412408

413409
@Test
@@ -421,9 +417,8 @@ public void roleCanBeCustomized() {
421417
given(securityContext.getPrincipal())
422418
.willReturn(mock(Principal.class));
423419
given(securityContext.isUserInRole("ADMIN")).willReturn(true);
424-
assertThat(
425-
extension.health(securityContext).getBody().getDetails())
426-
.isNotEmpty();
420+
assertThat(extension.health(securityContext).getBody().getDetails())
421+
.isNotEmpty();
427422
});
428423
}
429424

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthEndpointWebExtensionTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,11 @@ public void roleCanBeCustomized() {
220220

221221
@Test
222222
public void registryCanBeAltered() {
223-
this.contextRunner
224-
.withUserConfiguration(HealthIndicatorsConfiguration.class)
223+
this.contextRunner.withUserConfiguration(HealthIndicatorsConfiguration.class)
225224
.withPropertyValues("management.endpoint.health.show-details=always")
226225
.run((context) -> {
227-
ReactiveHealthIndicatorRegistry registry = context.getBean(
228-
ReactiveHealthIndicatorRegistry.class);
226+
ReactiveHealthIndicatorRegistry registry = context
227+
.getBean(ReactiveHealthIndicatorRegistry.class);
229228
ReactiveHealthEndpointWebExtension extension = context
230229
.getBean(ReactiveHealthEndpointWebExtension.class);
231230
assertThat(extension.health(null).block().getBody().getDetails())

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationIntegrationTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,12 @@ public void propertyBasedMeterFilteringIsAutoConfigured() {
5858
@Test
5959
public void propertyBasedCommonTagsIsAutoConfigured() {
6060
this.contextRunner.withPropertyValues("management.metrics.tags.region=test",
61-
"management.metrics.tags.origin=local")
62-
.run((context) -> {
61+
"management.metrics.tags.origin=local").run((context) -> {
6362
MeterRegistry registry = context.getBean(MeterRegistry.class);
6463
registry.counter("my.counter", "env", "qa");
6564
assertThat(registry.find("my.counter").tags("env", "qa")
6665
.tags("region", "test").tags("origin", "local").counter())
67-
.isNotNull();
66+
.isNotNull();
6867
});
6968
}
7069

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/CachesEndpoint.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public CachesReport caches() {
6868
new CacheDescriptor(entry.getTarget()));
6969
});
7070
Map<String, CacheManagerDescriptor> cacheManagerDescriptors = new LinkedHashMap<>();
71-
descriptors.forEach((name, entries) ->
72-
cacheManagerDescriptors.put(name, new CacheManagerDescriptor(entries)));
71+
descriptors.forEach((name, entries) -> cacheManagerDescriptors.put(name,
72+
new CacheManagerDescriptor(entries)));
7373
return new CachesReport(cacheManagerDescriptors);
7474
}
7575

0 commit comments

Comments
 (0)