use of org.springframework.boot.actuate.metrics.statsd.StatsdMetricWriter in project spring-boot by spring-projects.
the class MetricExportAutoConfigurationTests method statsdWithHost.
@SuppressWarnings("unchecked")
@Test
public void statsdWithHost() throws Exception {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "spring.metrics.export.statsd.host=localhost");
this.context.register(MetricEndpointConfiguration.class, MetricExportAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
StatsdMetricWriter statsdWriter = this.context.getBean(StatsdMetricWriter.class);
assertThat(statsdWriter).isNotNull();
SchedulingConfigurer schedulingConfigurer = this.context.getBean(SchedulingConfigurer.class);
Map<String, GaugeWriter> exporters = (Map<String, GaugeWriter>) ReflectionTestUtils.getField(schedulingConfigurer, "writers");
assertThat(exporters).containsValue(statsdWriter);
}
Aggregations