Search in sources :

Example 1 with MetricsEndpointMetricReader

use of org.springframework.boot.actuate.endpoint.MetricsEndpointMetricReader in project spring-boot by spring-projects.

the class MetricExportAutoConfigurationTests method exportMetricsEndpoint.

@Test
public void exportMetricsEndpoint() {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class, MetricEndpointConfiguration.class, MetricExportAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
    MetricExporters exporters = this.context.getBean(MetricExporters.class);
    MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters().get("writer");
    exporter.setIgnoreTimestamps(true);
    exporter.export();
    MetricsEndpointMetricReader reader = this.context.getBean("endpointReader", MetricsEndpointMetricReader.class);
    Mockito.verify(reader, Mockito.atLeastOnce()).findAll();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) MetricCopyExporter(org.springframework.boot.actuate.metrics.export.MetricCopyExporter) MetricsEndpointMetricReader(org.springframework.boot.actuate.endpoint.MetricsEndpointMetricReader) PropertyPlaceholderAutoConfiguration(org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration) MetricExporters(org.springframework.boot.actuate.metrics.export.MetricExporters) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 MetricsEndpointMetricReader (org.springframework.boot.actuate.endpoint.MetricsEndpointMetricReader)1 MetricCopyExporter (org.springframework.boot.actuate.metrics.export.MetricCopyExporter)1 MetricExporters (org.springframework.boot.actuate.metrics.export.MetricExporters)1 PropertyPlaceholderAutoConfiguration (org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1