Java 类org.springframework.boot.actuate.metrics.buffer.BufferCounterService 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricRepositoryAutoConfigurationTests.java   
@Test
public void createServices() throws Exception {
    this.context = new AnnotationConfigApplicationContext(
            MetricRepositoryAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(BufferGaugeService.class);
    assertThat(gaugeService).isNotNull();
    assertThat(this.context.getBean(BufferCounterService.class)).isNotNull();
    assertThat(this.context.getBean(PrefixMetricReader.class)).isNotNull();
    gaugeService.submit("foo", 2.7);
    MetricReader bean = this.context.getBean(MetricReader.class);
    assertThat(bean.findOne("gauge.foo").getValue()).isEqualTo(2.7);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricRepositoryAutoConfigurationTests.java   
@Test
public void skipsIfBeansExist() throws Exception {
    this.context = new AnnotationConfigApplicationContext(Config.class,
            MetricRepositoryAutoConfiguration.class);
    assertThat(this.context.getBeansOfType(BufferGaugeService.class)).isEmpty();
    assertThat(this.context.getBeansOfType(BufferCounterService.class)).isEmpty();
}
项目:spring-boot-concourse    文件:MetricRepositoryAutoConfigurationTests.java   
@Test
public void createServices() throws Exception {
    this.context = new AnnotationConfigApplicationContext(
            MetricRepositoryAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(BufferGaugeService.class);
    assertThat(gaugeService).isNotNull();
    assertThat(this.context.getBean(BufferCounterService.class)).isNotNull();
    assertThat(this.context.getBean(PrefixMetricReader.class)).isNotNull();
    gaugeService.submit("foo", 2.7);
    MetricReader bean = this.context.getBean(MetricReader.class);
    assertThat(bean.findOne("gauge.foo").getValue()).isEqualTo(2.7);
}
项目:spring-boot-concourse    文件:MetricRepositoryAutoConfigurationTests.java   
@Test
public void skipsIfBeansExist() throws Exception {
    this.context = new AnnotationConfigApplicationContext(Config.class,
            MetricRepositoryAutoConfiguration.class);
    assertThat(this.context.getBeansOfType(BufferGaugeService.class)).isEmpty();
    assertThat(this.context.getBeansOfType(BufferCounterService.class)).isEmpty();
}
项目:contestparser    文件:MetricRepositoryAutoConfigurationTests.java   
@Test
public void createServices() throws Exception {
    this.context = new AnnotationConfigApplicationContext(
            MetricRepositoryAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(BufferGaugeService.class);
    assertNotNull(gaugeService);
    assertNotNull(this.context.getBean(BufferCounterService.class));
    assertNotNull(this.context.getBean(PrefixMetricReader.class));
    gaugeService.submit("foo", 2.7);
    assertEquals(2.7,
            this.context.getBean(MetricReader.class).findOne("gauge.foo").getValue());
}
项目:contestparser    文件:MetricRepositoryAutoConfigurationTests.java   
@Test
public void skipsIfBeansExist() throws Exception {
    this.context = new AnnotationConfigApplicationContext(Config.class,
            MetricRepositoryAutoConfiguration.class);
    assertThat(this.context.getBeansOfType(BufferGaugeService.class).size(),
            equalTo(0));
    assertThat(this.context.getBeansOfType(BufferCounterService.class).size(),
            equalTo(0));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricRepositoryAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(CounterService.class)
public BufferCounterService counterService(CounterBuffers writer) {
    return new BufferCounterService(writer);
}
项目:spring-boot-concourse    文件:MetricRepositoryAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(CounterService.class)
public BufferCounterService counterService(CounterBuffers writer) {
    return new BufferCounterService(writer);
}
项目:contestparser    文件:MetricRepositoryAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(CounterService.class)
public BufferCounterService counterService(CounterBuffers writer) {
    return new BufferCounterService(writer);
}