@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); }
@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); }
@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(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); }
@Test public void elasticSearchHealthIndicator() { EnvironmentTestUtils.addEnvironment(this.context, "spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs", "management.health.diskspace.enabled:false"); this.context.register(ElasticsearchAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); Map<String, HealthIndicator> beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); assertEquals(ElasticsearchHealthIndicator.class, beans.values().iterator().next().getClass()); }
@Test public void notElasticSearchHealthIndicator() { EnvironmentTestUtils.addEnvironment(this.context, "management.health.elasticsearch.enabled:false", "spring.data.elasticsearch.properties.path.data:target/data", "spring.data.elasticsearch.properties.path.logs:target/logs", "management.health.diskspace.enabled:false"); this.context.register(ElasticsearchAutoConfiguration.class, ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); this.context.refresh(); Map<String, HealthIndicator> beans = this.context .getBeansOfType(HealthIndicator.class); assertEquals(1, beans.size()); assertEquals(ApplicationHealthIndicator.class, beans.values().iterator().next().getClass()); }
@Test public void elasticSearchHealthIndicator() { EnvironmentTestUtils.addEnvironment(this.context, "spring.data.elasticsearch.properties.path.home:target", "management.health.diskspace.enabled:false"); this.context.register(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); }