Skip to content

Commit 7b120c1

Browse files
committed
Formatting
1 parent 42c053c commit 7b120c1

File tree

31 files changed

+212
-206
lines changed

31 files changed

+212
-206
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/OnEnabledEndpointCondition.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ private AnnotationAttributes getEndpointAttributes(ConditionContext context,
9797
return getEndpointAttributes(endpointType);
9898
}
9999

100-
private Class<?> getEndpointType(ConditionContext context,
101-
MethodMetadata metadata) {
102-
Map<String, Object> attributes = metadata.getAnnotationAttributes(
103-
ConditionalOnEnabledEndpoint.class.getName());
100+
private Class<?> getEndpointType(ConditionContext context, MethodMetadata metadata) {
101+
Map<String, Object> attributes = metadata
102+
.getAnnotationAttributes(ConditionalOnEnabledEndpoint.class.getName());
104103
if (attributes != null && attributes.containsKey("endpoint")) {
105104
Class<?> target = (Class<?>) attributes.get("endpoint");
106105
if (target != Void.class) {

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/integration/IntegrationGraphEndpointAutoConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
import org.springframework.integration.support.management.graph.IntegrationGraphServer;
3131

3232
/**
33-
* {@link EnableAutoConfiguration Auto-configuration} for the {@link IntegrationGraphEndpoint}.
33+
* {@link EnableAutoConfiguration Auto-configuration} for the
34+
* {@link IntegrationGraphEndpoint}.
3435
*
3536
* @author Tim Ysewyn
3637
* @author Stephane Nicoll
@@ -58,4 +59,3 @@ public IntegrationGraphServer integrationGraphServer() {
5859
}
5960

6061
}
61-

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/reactive/WebClientMetricsAutoConfiguration.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,21 @@
3737
import org.springframework.web.reactive.function.client.WebClient;
3838

3939
/**
40-
* {@link EnableAutoConfiguration Auto-configuration} for instrumentation
41-
* of {@link org.springframework.web.reactive.function.client.WebClient}.
40+
* {@link EnableAutoConfiguration Auto-configuration} for instrumentation of
41+
* {@link org.springframework.web.reactive.function.client.WebClient}.
4242
*
43-
* <p>This is reusing the {@link io.micrometer.core.instrument.config.MeterFilter}
44-
* defined in {@link RestTemplateMetricsAutoConfiguration} for limiting the
45-
* cardinality of "uri" tags.
43+
* <p>
44+
* This is reusing the {@link io.micrometer.core.instrument.config.MeterFilter} defined in
45+
* {@link RestTemplateMetricsAutoConfiguration} for limiting the cardinality of "uri"
46+
* tags.
4647
*
4748
* @author Brian Clozel
4849
* @since 2.1.0
4950
*/
5051
@Configuration
5152
@ConditionalOnClass(WebClient.class)
52-
@AutoConfigureAfter({MetricsAutoConfiguration.class,
53-
SimpleMetricsExportAutoConfiguration.class})
53+
@AutoConfigureAfter({ MetricsAutoConfiguration.class,
54+
SimpleMetricsExportAutoConfiguration.class })
5455
@AutoConfigureBefore(WebClientAutoConfiguration.class)
5556
@ConditionalOnBean(MeterRegistry.class)
5657
public class WebClientMetricsAutoConfiguration {
@@ -62,8 +63,8 @@ public WebClientExchangeTagsProvider defaultWebClientExchangeTagsProvider() {
6263
}
6364

6465
@Bean
65-
public MetricsWebClientCustomizer metricsWebClientCustomizer(MeterRegistry meterRegistry,
66-
WebClientExchangeTagsProvider tagsProvider,
66+
public MetricsWebClientCustomizer metricsWebClientCustomizer(
67+
MeterRegistry meterRegistry, WebClientExchangeTagsProvider tagsProvider,
6768
MetricsProperties properties) {
6869
return new MetricsWebClientCustomizer(meterRegistry, tagsProvider,
6970
properties.getWeb().getClient().getRequestsMetricName());

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/reactive/WebFluxMetricsAutoConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
import org.springframework.context.annotation.Configuration;
3434

3535
/**
36-
* {@link EnableAutoConfiguration Auto-configuration} for instrumentation
37-
* of Spring WebFlux applications.
36+
* {@link EnableAutoConfiguration Auto-configuration} for instrumentation of Spring
37+
* WebFlux applications.
3838
*
3939
* @author Jon Schneider
4040
* @since 2.0.0

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfigurationTests.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,14 @@ public class CachesEndpointAutoConfigurationTests {
4242

4343
@Test
4444
public void runShouldHaveEndpointBean() {
45-
this.contextRunner.withUserConfiguration(CacheConfiguration.class)
46-
.run((context) ->
47-
assertThat(context).hasSingleBean(CachesEndpoint.class));
45+
this.contextRunner.withUserConfiguration(CacheConfiguration.class).run(
46+
(context) -> assertThat(context).hasSingleBean(CachesEndpoint.class));
4847
}
4948

5049
@Test
5150
public void runWithoutCacheManagerShouldHaveEndpointBean() {
52-
this.contextRunner.run((context) ->
53-
assertThat(context).hasSingleBean(CachesEndpoint.class));
51+
this.contextRunner.run(
52+
(context) -> assertThat(context).hasSingleBean(CachesEndpoint.class));
5453
}
5554

5655
@Test

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/condition/ConditionalOnEnabledEndpointTests.java

+16-15
Original file line numberDiff line numberDiff line change
@@ -104,41 +104,42 @@ public void outcomeWhenNoPropertiesAndExtensionAnnotationIsNotEnabledByDefaultSh
104104

105105
@Test
106106
public void outcomeWithReferenceWhenNoPropertiesShouldMatch() {
107-
this.contextRunner.withUserConfiguration(FooEndpointEnabledByDefaultTrue.class,
108-
ComponentEnabledIfEndpointIsEnabledConfiguration.class).run((context) ->
109-
assertThat(context).hasBean("fooComponent"));
107+
this.contextRunner
108+
.withUserConfiguration(FooEndpointEnabledByDefaultTrue.class,
109+
ComponentEnabledIfEndpointIsEnabledConfiguration.class)
110+
.run((context) -> assertThat(context).hasBean("fooComponent"));
110111
}
111112

112113
@Test
113114
public void outcomeWithReferenceWhenEndpointEnabledPropertyIsTrueShouldMatch() {
114115
this.contextRunner.withPropertyValues("management.endpoint.foo.enabled=true")
115116
.withUserConfiguration(FooEndpointEnabledByDefaultTrue.class,
116117
ComponentEnabledIfEndpointIsEnabledConfiguration.class)
117-
.run((context) ->
118-
assertThat(context).hasBean("fooComponent"));
118+
.run((context) -> assertThat(context).hasBean("fooComponent"));
119119
}
120120

121121
@Test
122122
public void outcomeWithReferenceWhenEndpointEnabledPropertyIsFalseShouldNotMatch() {
123123
this.contextRunner.withPropertyValues("management.endpoint.foo.enabled=false")
124124
.withUserConfiguration(FooEndpointEnabledByDefaultTrue.class,
125125
ComponentEnabledIfEndpointIsEnabledConfiguration.class)
126-
.run((context) ->
127-
assertThat(context).doesNotHaveBean("fooComponent"));
126+
.run((context) -> assertThat(context).doesNotHaveBean("fooComponent"));
128127
}
129128

130129
@Test
131130
public void outcomeWithNoReferenceShouldFail() {
132-
this.contextRunner.withUserConfiguration(
133-
ComponentWithNoEndpointReferenceConfiguration.class).run((context) -> {
134-
assertThat(context).hasFailed();
135-
assertThat(context.getStartupFailure().getCause().getMessage()).contains(
136-
"No endpoint is specified and the return type of the @Bean method "
137-
+ "is neither an @Endpoint, nor an @EndpointExtension");
138-
});
131+
this.contextRunner
132+
.withUserConfiguration(
133+
ComponentWithNoEndpointReferenceConfiguration.class)
134+
.run((context) -> {
135+
assertThat(context).hasFailed();
136+
assertThat(context.getStartupFailure().getCause().getMessage())
137+
.contains(
138+
"No endpoint is specified and the return type of the @Bean method "
139+
+ "is neither an @Endpoint, nor an @EndpointExtension");
140+
});
139141
}
140142

141-
142143
@Endpoint(id = "foo", enableByDefault = true)
143144
static class FooEndpointEnabledByDefaultTrue {
144145

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

+19-19
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,19 @@
4545

4646
/**
4747
* Tests for generating documentation describing the {@link CachesEndpoint}
48+
*
4849
* @author Stephane Nicoll
4950
*/
5051
public class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
5152

5253
private static final List<FieldDescriptor> levelFields = Arrays.asList(
5354
fieldWithPath("name").description("Cache name."),
5455
fieldWithPath("cacheManager").description("Cache manager name."),
55-
fieldWithPath("target").description(
56-
"Fully qualified name of the native cache."));
56+
fieldWithPath("target")
57+
.description("Fully qualified name of the native cache."));
5758

58-
private static final List<ParameterDescriptor> requestParameters = Collections.singletonList(
59-
parameterWithName("cacheManager")
59+
private static final List<ParameterDescriptor> requestParameters = Collections
60+
.singletonList(parameterWithName("cacheManager")
6061
.description("Name of the cacheManager to qualify the cache. May be "
6162
+ "omitted if the cache name is unique.")
6263
.optional());
@@ -67,12 +68,11 @@ public void allCaches() throws Exception {
6768
.andDo(MockMvcRestDocumentation.document("caches/all", responseFields(
6869
fieldWithPath("cacheManagers")
6970
.description("Cache managers keyed by id."),
70-
fieldWithPath("cacheManagers.*")
71-
.description("Caches in the application context keyed by "
72-
+ "name."))
73-
.andWithPrefix("cacheManagers.*.*.", fieldWithPath("target")
74-
.description(
75-
"Fully qualified name of the native cache."))));
71+
fieldWithPath("cacheManagers.*").description(
72+
"Caches in the application context keyed by " + "name."))
73+
.andWithPrefix("cacheManagers.*.*.",
74+
fieldWithPath("target").description(
75+
"Fully qualified name of the native cache."))));
7676
}
7777

7878
@Test
@@ -91,25 +91,25 @@ public void evictAllCaches() throws Exception {
9191

9292
@Test
9393
public void evictNamedCache() throws Exception {
94-
this.mockMvc.perform(
95-
delete("/actuator/caches/countries?cacheManager=anotherCacheManager"))
96-
.andExpect(status().isNoContent()).andDo(
97-
MockMvcRestDocumentation.document("caches/evict-named",
94+
this.mockMvc
95+
.perform(delete(
96+
"/actuator/caches/countries?cacheManager=anotherCacheManager"))
97+
.andExpect(status().isNoContent())
98+
.andDo(MockMvcRestDocumentation.document("caches/evict-named",
9899
requestParameters(requestParameters)));
99100
}
100101

101-
102102
@Configuration
103103
@Import(BaseDocumentationConfiguration.class)
104104
static class TestConfiguration {
105105

106106
@Bean
107107
public CachesEndpoint endpoint() {
108108
Map<String, CacheManager> cacheManagers = new HashMap<>();
109-
cacheManagers.put("cacheManager", new ConcurrentMapCacheManager(
110-
"countries", "cities"));
111-
cacheManagers.put("anotherCacheManager", new ConcurrentMapCacheManager(
112-
"countries"));
109+
cacheManagers.put("cacheManager",
110+
new ConcurrentMapCacheManager("countries", "cities"));
111+
cacheManagers.put("anotherCacheManager",
112+
new ConcurrentMapCacheManager("countries"));
113113
return new CachesEndpoint(cacheManagers);
114114
}
115115

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
*
3636
* @author Tim Ysewyn
3737
*/
38-
public class IntegrationGraphEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
38+
public class IntegrationGraphEndpointDocumentationTests
39+
extends MockMvcEndpointDocumentationTests {
3940

4041
@Test
4142
public void graph() throws Exception {
@@ -45,8 +46,8 @@ public void graph() throws Exception {
4546

4647
@Test
4748
public void rebuild() throws Exception {
48-
this.mockMvc.perform(post("/actuator/integrationgraph")).andExpect(status()
49-
.isNoContent())
49+
this.mockMvc.perform(post("/actuator/integrationgraph"))
50+
.andExpect(status().isNoContent())
5051
.andDo(MockMvcRestDocumentation.document("integrationgraph/rebuild"));
5152
}
5253

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integration/IntegrationGraphEndpointAutoConfigurationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() {
5959
@Test
6060
public void runWhenSpringIntegrationIsNotEnabledShouldNotHaveEndpointBean() {
6161
ApplicationContextRunner noSpringIntegrationRunner = new ApplicationContextRunner()
62-
.withConfiguration(AutoConfigurations.of(
63-
IntegrationGraphEndpointAutoConfiguration.class));
62+
.withConfiguration(AutoConfigurations
63+
.of(IntegrationGraphEndpointAutoConfiguration.class));
6464
noSpringIntegrationRunner.run((context) -> {
6565
assertThat(context).doesNotHaveBean(IntegrationGraphEndpoint.class);
6666
assertThat(context).doesNotHaveBean(IntegrationGraphServer.class);

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfigurationTests.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ public void autoConfiguredEntityManagerFactoryWithoutStatsIsNotInstrumented() {
9090

9191
@Test
9292
public void entityManagerFactoryInstrumentationCanBeDisabled() {
93-
this.contextRunner.withPropertyValues("management.metrics.enable.hibernate=false",
94-
"spring.jpa.properties.hibernate.generate_statistics:true")
93+
this.contextRunner
94+
.withPropertyValues("management.metrics.enable.hibernate=false",
95+
"spring.jpa.properties.hibernate.generate_statistics:true")
9596
.run((context) -> {
9697
context.getBean(EntityManagerFactory.class)
9798
.unwrap(SessionFactory.class);
@@ -130,7 +131,7 @@ public void entityManagerFactoryInstrumentationIsDisabledIfNotHibernateSessionFa
130131
// ensure EntityManagerFactory is not an Hibernate SessionFactory
131132
assertThatThrownBy(() -> context.getBean(EntityManagerFactory.class)
132133
.unwrap(SessionFactory.class))
133-
.isInstanceOf(PersistenceException.class);
134+
.isInstanceOf(PersistenceException.class);
134135
MeterRegistry registry = context.getBean(MeterRegistry.class);
135136
assertThat(registry.find("hibernate.statements").meter()).isNull();
136137
});

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/RestTemplateMetricsAutoConfigurationTests.java

+21-19
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,27 @@ public void afterMaxUrisReachedFurtherUrisAreDenied() {
7878
this.contextRunner
7979
.withPropertyValues("management.metrics.web.client.max-uri-tags=10")
8080
.run((context) -> {
81-
MetricsProperties properties = context.getBean(MetricsProperties.class);
82-
int maxUriTags = properties.getWeb().getClient().getMaxUriTags();
83-
MeterRegistry registry = context.getBean(MeterRegistry.class);
84-
RestTemplate restTemplate = context.getBean(RestTemplateBuilder.class)
85-
.build();
86-
MockRestServiceServer server = MockRestServiceServer
87-
.createServer(restTemplate);
88-
for (int i = 0; i < maxUriTags + 10; i++) {
89-
server.expect(requestTo("/test/" + i))
90-
.andRespond(withStatus(HttpStatus.OK));
91-
}
92-
for (int i = 0; i < maxUriTags + 10; i++) {
93-
restTemplate.getForObject("/test/" + i, String.class);
94-
}
95-
assertThat(registry.get("http.client.requests").meters()).hasSize(maxUriTags);
96-
assertThat(this.out.toString())
97-
.contains("Reached the maximum number of URI tags "
98-
+ "for 'http.client.requests'");
99-
});
81+
MetricsProperties properties = context
82+
.getBean(MetricsProperties.class);
83+
int maxUriTags = properties.getWeb().getClient().getMaxUriTags();
84+
MeterRegistry registry = context.getBean(MeterRegistry.class);
85+
RestTemplate restTemplate = context.getBean(RestTemplateBuilder.class)
86+
.build();
87+
MockRestServiceServer server = MockRestServiceServer
88+
.createServer(restTemplate);
89+
for (int i = 0; i < maxUriTags + 10; i++) {
90+
server.expect(requestTo("/test/" + i))
91+
.andRespond(withStatus(HttpStatus.OK));
92+
}
93+
for (int i = 0; i < maxUriTags + 10; i++) {
94+
restTemplate.getForObject("/test/" + i, String.class);
95+
}
96+
assertThat(registry.get("http.client.requests").meters())
97+
.hasSize(maxUriTags);
98+
assertThat(this.out.toString())
99+
.contains("Reached the maximum number of URI tags "
100+
+ "for 'http.client.requests'");
101+
});
100102
}
101103

102104
private void validateRestTemplate(RestTemplate restTemplate, MeterRegistry registry) {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/reactive/WebClientMetricsAutoConfigurationTests.java

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ protected static class CustomTagsProviderConfig {
116116
public WebClientExchangeTagsProvider customTagProvider() {
117117
return mock(WebClientExchangeTagsProvider.class);
118118
}
119+
119120
}
120121

121122
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/reactive/WebFluxMetricsAutoConfigurationTests.java

+2
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,7 @@ protected static class CustomWebFluxTagsProviderConfig {
6565
public WebFluxTagsProvider customWebFluxTagsProvider() {
6666
return mock(WebFluxTagsProvider.class);
6767
}
68+
6869
}
70+
6971
}

0 commit comments

Comments
 (0)