Closes gh-10948
This commit is contained in:
Johnny Lim
2017-11-08 01:13:01 +09:00
committed by Stephane Nicoll
parent 2de0247ce9
commit cbb483735d
19 changed files with 37 additions and 41 deletions

View File

@@ -63,15 +63,15 @@ public class SpringIntegrationMetrics implements MeterBinder, SmartInitializingS
@Override
public void bindTo(MeterRegistry registry) {
registerGuage(registry, this.configurer, this.tags,
registerGauge(registry, this.configurer, this.tags,
"spring.integration.channelNames",
"The number of spring integration channels",
(configurer) -> configurer.getChannelNames().length);
registerGuage(registry, this.configurer, this.tags,
registerGauge(registry, this.configurer, this.tags,
"spring.integration.handlerNames",
"The number of spring integration handlers",
(configurer) -> configurer.getHandlerNames().length);
registerGuage(registry, this.configurer, this.tags,
registerGauge(registry, this.configurer, this.tags,
"spring.integration.sourceNames",
"The number of spring integration sources",
(configurer) -> configurer.getSourceNames().length);
@@ -105,7 +105,7 @@ public class SpringIntegrationMetrics implements MeterBinder, SmartInitializingS
registerTimedGauge(registry, handlerMetrics, tagsWithHandler,
"spring.integration.handler.duration.mean",
"The mean handler duration", MessageHandlerMetrics::getMeanDuration);
registerGuage(registry, handlerMetrics, tagsWithHandler,
registerGauge(registry, handlerMetrics, tagsWithHandler,
"spring.integration.handler.activeCount",
"The number of active handlers",
MessageHandlerMetrics::getActiveCount);
@@ -133,7 +133,7 @@ public class SpringIntegrationMetrics implements MeterBinder, SmartInitializingS
}
}
private <T> void registerGuage(MeterRegistry registry, T object, Iterable<Tag> tags,
private <T> void registerGauge(MeterRegistry registry, T object, Iterable<Tag> tags,
String name, String description, ToDoubleFunction<T> value) {
Gauge.Builder<?> builder = Gauge.builder(name, object, value);
builder.tags(this.tags).description(description).register(registry);

View File

@@ -45,7 +45,7 @@ public class HealthTests {
public void createWithStatus() throws Exception {
Health health = Health.status(Status.UP).build();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}
@Test
@@ -100,7 +100,7 @@ public class HealthTests {
public void unknown() throws Exception {
Health health = new Health.Builder().unknown().build();
assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}
@Test
@@ -114,7 +114,7 @@ public class HealthTests {
public void up() throws Exception {
Health health = new Health.Builder().up().build();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}
@Test
@@ -130,28 +130,28 @@ public class HealthTests {
public void down() throws Exception {
Health health = Health.down().build();
assertThat(health.getStatus()).isEqualTo(Status.DOWN);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}
@Test
public void outOfService() throws Exception {
Health health = Health.outOfService().build();
assertThat(health.getStatus()).isEqualTo(Status.OUT_OF_SERVICE);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}
@Test
public void statusCode() throws Exception {
Health health = Health.status("UP").build();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}
@Test
public void status() throws Exception {
Health health = Health.status(Status.UP).build();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().size()).isEqualTo(0);
assertThat(health.getDetails()).isEmpty();
}
}

View File

@@ -50,7 +50,7 @@ public class EnvironmentInfoContributorTests {
public void extractNoEntry() {
TestPropertyValues.of("foo=bar").applyTo(this.environment);
Info actual = contributeFrom(this.environment);
assertThat(actual.getDetails().size()).isEqualTo(0);
assertThat(actual.getDetails()).isEmpty();
}
@Test

View File

@@ -68,7 +68,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Tests for {@link WebMvcMetricsFilter}
* Tests for {@link WebMvcMetricsFilter}.
*
* @author Jon Schneider
*/