use of org.springframework.boot.actuate.metrics.dropwizard.DropwizardMetricServices in project spring-boot by spring-projects.
the class MetricRepositoryAutoConfigurationTests method dropwizardInstalledIfPresent.
@Test
public void dropwizardInstalledIfPresent() {
this.context = new AnnotationConfigApplicationContext(MetricsDropwizardAutoConfiguration.class, MetricRepositoryAutoConfiguration.class, AopAutoConfiguration.class);
GaugeService gaugeService = this.context.getBean(GaugeService.class);
assertThat(gaugeService).isNotNull();
gaugeService.submit("foo", 2.7);
DropwizardMetricServices exporter = this.context.getBean(DropwizardMetricServices.class);
assertThat(exporter).isEqualTo(gaugeService);
MetricRegistry registry = this.context.getBean(MetricRegistry.class);
@SuppressWarnings("unchecked") Gauge<Double> gauge = (Gauge<Double>) registry.getMetrics().get("gauge.foo");
assertThat(gauge.getValue()).isEqualTo(new Double(2.7));
}
use of org.springframework.boot.actuate.metrics.dropwizard.DropwizardMetricServices in project spring-boot by spring-projects.
the class MetricsDropwizardAutoConfigurationTests method dropwizardWithoutCustomReservoirConfigured.
@Test
public void dropwizardWithoutCustomReservoirConfigured() {
this.context = new AnnotationConfigApplicationContext(MetricsDropwizardAutoConfiguration.class);
DropwizardMetricServices dropwizardMetricServices = this.context.getBean(DropwizardMetricServices.class);
ReservoirFactory reservoirFactory = (ReservoirFactory) ReflectionTestUtils.getField(dropwizardMetricServices, "reservoirFactory");
assertThat(reservoirFactory.getReservoir("test")).isNull();
}
use of org.springframework.boot.actuate.metrics.dropwizard.DropwizardMetricServices in project spring-boot by spring-projects.
the class MetricsDropwizardAutoConfigurationTests method dropwizardWithCustomReservoirConfigured.
@Test
public void dropwizardWithCustomReservoirConfigured() {
this.context = new AnnotationConfigApplicationContext(MetricsDropwizardAutoConfiguration.class, Config.class);
DropwizardMetricServices dropwizardMetricServices = this.context.getBean(DropwizardMetricServices.class);
ReservoirFactory reservoirFactory = (ReservoirFactory) ReflectionTestUtils.getField(dropwizardMetricServices, "reservoirFactory");
assertThat(reservoirFactory.getReservoir("test")).isInstanceOf(UniformReservoir.class);
}
Aggregations