Formatting

This commit is contained in:
Spencer Gibb
2019-09-19 19:07:25 -04:00
parent 6ceb2b1fbc
commit eefdb5adc7
3 changed files with 11 additions and 6 deletions

View File

@@ -59,7 +59,8 @@ public class GatewayMetricsAutoConfiguration {
}
@Bean
public PropertiesTagsProvider propertiesTagsProvider(GatewayMetricsProperties gatewayMetricsProperties) {
public PropertiesTagsProvider propertiesTagsProvider(
GatewayMetricsProperties gatewayMetricsProperties) {
return new PropertiesTagsProvider(gatewayMetricsProperties.getTags());
}

View File

@@ -41,4 +41,5 @@ public class PropertiesTagsProvider implements GatewayTagsProvider {
public Tags apply(ServerWebExchange serverWebExchange) {
return propertiesTags;
}
}

View File

@@ -37,15 +37,18 @@ public class PropertiesTagsProviderTests {
@Test
public void test() {
contextRunner
.withConfiguration(AutoConfigurations.of(GatewayMetricsAutoConfiguration.class))
.withPropertyValues(
"spring.cloud.gateway.metrics.tags.foo1=bar1",
.withConfiguration(
AutoConfigurations.of(GatewayMetricsAutoConfiguration.class))
.withPropertyValues("spring.cloud.gateway.metrics.tags.foo1=bar1",
"spring.cloud.gateway.metrics.tags.foo2=bar2")
.run(context -> {
PropertiesTagsProvider provider = context.getBean(PropertiesTagsProvider.class);
Tags tags = provider.apply(MockServerWebExchange.from(MockServerHttpRequest.get("").build()));
PropertiesTagsProvider provider = context
.getBean(PropertiesTagsProvider.class);
Tags tags = provider.apply(MockServerWebExchange
.from(MockServerHttpRequest.get("").build()));
assertThat(tags).isEqualTo(Tags.of("foo1", "bar1", "foo2", "bar2"));
});
}
}