Java 类org.springframework.boot.actuate.metrics.export.MetricExporters 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfigurationTests.java   
@Test
public void provideAdditionalWriter() {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
            MetricRepositoryAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertThat(gaugeService).isNotNull();
    gaugeService.submit("foo", 2.7);
    MetricExporters exporters = this.context.getBean(MetricExporters.class);
    MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
            .get("writer");
    exporter.setIgnoreTimestamps(true);
    exporter.export();
    MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
    Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
项目:spring-boot-concourse    文件:MetricExportAutoConfigurationTests.java   
@Test
public void provideAdditionalWriter() {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
            MetricRepositoryAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertThat(gaugeService).isNotNull();
    gaugeService.submit("foo", 2.7);
    MetricExporters exporters = this.context.getBean(MetricExporters.class);
    MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
            .get("writer");
    exporter.setIgnoreTimestamps(true);
    exporter.export();
    MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
    Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
项目:contestparser    文件:MetricExportAutoConfigurationTests.java   
@Test
public void provideAdditionalWriter() {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
            MetricRepositoryAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertNotNull(gaugeService);
    gaugeService.submit("foo", 2.7);
    MetricExporters exporters = this.context.getBean(MetricExporters.class);
    MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
            .get("writer");
    exporter.setIgnoreTimestamps(true);
    exporter.export();
    MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
    Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfigurationTests.java   
@Test
public void metricsFlushAutomatically() throws Exception {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
            MetricRepositoryAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertThat(gaugeService).isNotNull();
    gaugeService.submit("foo", 2.7);
    MetricExporters flusher = this.context.getBean(MetricExporters.class);
    flusher.close(); // this will be called by Spring on shutdown
    MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
    Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfigurationTests.java   
@Test
public void defaultExporterWhenMessageChannelAvailable() throws Exception {
    this.context = new AnnotationConfigApplicationContext(
            MessageChannelConfiguration.class,
            MetricRepositoryAutoConfiguration.class,
            MetricsChannelAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    MetricExporters exporter = this.context.getBean(MetricExporters.class);
    assertThat(exporter).isNotNull();
    assertThat(exporter.getExporters()).containsKey("messageChannelMetricWriter");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfigurationTests.java   
@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();
}
项目:spring-boot-concourse    文件:MetricExportAutoConfigurationTests.java   
@Test
public void metricsFlushAutomatically() throws Exception {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
            MetricRepositoryAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertThat(gaugeService).isNotNull();
    gaugeService.submit("foo", 2.7);
    MetricExporters flusher = this.context.getBean(MetricExporters.class);
    flusher.close(); // this will be called by Spring on shutdown
    MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
    Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
项目:spring-boot-concourse    文件:MetricExportAutoConfigurationTests.java   
@Test
public void defaultExporterWhenMessageChannelAvailable() throws Exception {
    this.context = new AnnotationConfigApplicationContext(
            MessageChannelConfiguration.class,
            MetricRepositoryAutoConfiguration.class,
            MetricsChannelAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    MetricExporters exporter = this.context.getBean(MetricExporters.class);
    assertThat(exporter).isNotNull();
    assertThat(exporter.getExporters()).containsKey("messageChannelMetricWriter");
}
项目:spring-boot-concourse    文件:MetricExportAutoConfigurationTests.java   
@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();
}
项目:contestparser    文件:MetricExportAutoConfigurationTests.java   
@Test
public void defaultExporterWhenMessageChannelAvailable() throws Exception {
    this.context = new AnnotationConfigApplicationContext(
            MessageChannelConfiguration.class,
            MetricRepositoryAutoConfiguration.class,
            MetricsChannelAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    MetricExporters exporter = this.context.getBean(MetricExporters.class);
    assertNotNull(exporter);
}
项目:contestparser    文件:MetricExportAutoConfigurationTests.java   
@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();
}