Java 类org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void elasticsearchHealthIndicator() {
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.data.elasticsearch.properties.path.home:target",
            "management.health.diskspace.enabled:false");
    this.context.register(JestClientConfiguration.class,
            JestAutoConfiguration.class, ElasticsearchAutoConfiguration.class,
            ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
    this.context.refresh();

    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(ElasticsearchHealthIndicator.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void notElasticsearchHealthIndicator() {
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.elasticsearch.enabled:false",
            "spring.data.elasticsearch.properties.path.home:target",
            "management.health.diskspace.enabled:false");
    this.context.register(JestClientConfiguration.class,
            JestAutoConfiguration.class, ElasticsearchAutoConfiguration.class,
            ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
    this.context.refresh();

    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(ApplicationHealthIndicator.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void elasticsearchJestHealthIndicator() {
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.diskspace.enabled:false");
    this.context.register(JestClientConfiguration.class,
            JestAutoConfiguration.class, ManagementServerProperties.class,
            HealthIndicatorAutoConfiguration.class);
    this.context.refresh();

    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(ElasticsearchJestHealthIndicator.class);
}