Java 类org.springframework.boot.actuate.metrics.statsd.StatsdMetricWriter 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfiguration.java   
@Bean
@ExportMetricWriter
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "spring.metrics.export.statsd", name = "host")
public StatsdMetricWriter statsdMetricWriter() {
    MetricExportProperties.Statsd statsdProperties = this.properties.getStatsd();
    return new StatsdMetricWriter(statsdProperties.getPrefix(),
            statsdProperties.getHost(), statsdProperties.getPort());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfigurationTests.java   
@Test
public void statsdMissingHost() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(WriterConfig.class, MetricEndpointConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    this.thrown.expect(NoSuchBeanDefinitionException.class);
    this.context.getBean(StatsdMetricWriter.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfigurationTests.java   
@Test
public void statsdWithHost() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.metrics.export.statsd.host=localhost");
    this.context.register(WriterConfig.class, MetricEndpointConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBean(StatsdMetricWriter.class)).isNotNull();
}
项目:spring-boot-concourse    文件:MetricExportAutoConfiguration.java   
@Bean
@ExportMetricWriter
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "spring.metrics.export.statsd", name = "host")
public StatsdMetricWriter statsdMetricWriter() {
    MetricExportProperties.Statsd statsdProperties = this.properties.getStatsd();
    return new StatsdMetricWriter(statsdProperties.getPrefix(),
            statsdProperties.getHost(), statsdProperties.getPort());
}
项目:spring-boot-concourse    文件:MetricExportAutoConfigurationTests.java   
@Test
public void statsdMissingHost() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(WriterConfig.class, MetricEndpointConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    this.thrown.expect(NoSuchBeanDefinitionException.class);
    this.context.getBean(StatsdMetricWriter.class);
}
项目:spring-boot-concourse    文件:MetricExportAutoConfigurationTests.java   
@Test
public void statsdWithHost() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.metrics.export.statsd.host=localhost");
    this.context.register(WriterConfig.class, MetricEndpointConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBean(StatsdMetricWriter.class)).isNotNull();
}
项目:contestparser    文件:MetricExportAutoConfiguration.java   
@Bean
@ExportMetricWriter
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "spring.metrics.export.statsd", name = "host")
public StatsdMetricWriter statsdMetricWriter() {
    MetricExportProperties.Statsd statsdProperties = this.properties.getStatsd();
    return new StatsdMetricWriter(statsdProperties.getPrefix(),
            statsdProperties.getHost(), statsdProperties.getPort());
}
项目:contestparser    文件:MetricExportAutoConfigurationTests.java   
@Test
public void statsdMissingHost() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(WriterConfig.class, MetricEndpointConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    this.thrown.expect(NoSuchBeanDefinitionException.class);
    this.context.getBean(StatsdMetricWriter.class);
}
项目:contestparser    文件:MetricExportAutoConfigurationTests.java   
@Test
public void statsdWithHost() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.metrics.export.statsd.host=localhost");
    this.context.register(WriterConfig.class, MetricEndpointConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBean(StatsdMetricWriter.class), notNullValue());
}