Commit 5fc01880 authored by Stephane Nicoll's avatar Stephane Nicoll

Polish

parent c46d513a
...@@ -33,6 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -33,6 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* *
* @author Phillip Webb * @author Phillip Webb
* @author Artur Konczak * @author Artur Konczak
* @author Stephane Nicoll
*/ */
public class ElasticsearchDataAutoConfigurationTests { public class ElasticsearchDataAutoConfigurationTests {
...@@ -47,45 +48,37 @@ public class ElasticsearchDataAutoConfigurationTests { ...@@ -47,45 +48,37 @@ public class ElasticsearchDataAutoConfigurationTests {
@Test @Test
public void templateExists() { public void templateExists() {
this.context = new AnnotationConfigApplicationContext(); load("spring.data.elasticsearch.properties.path.data:target/data",
EnvironmentTestUtils.addEnvironment(this.context,
"spring.data.elasticsearch.properties.path.data:target/data",
"spring.data.elasticsearch.properties.path.logs:target/logs"); "spring.data.elasticsearch.properties.path.logs:target/logs");
this.context.register(PropertyPlaceholderAutoConfiguration.class,
ElasticsearchAutoConfiguration.class,
ElasticsearchDataAutoConfiguration.class);
this.context.refresh();
assertThat(this.context.getBeanNamesForType(ElasticsearchTemplate.class)) assertThat(this.context.getBeanNamesForType(ElasticsearchTemplate.class))
.hasSize(1); .hasSize(1);
} }
@Test @Test
public void mappingContextExists() { public void mappingContextExists() {
this.context = new AnnotationConfigApplicationContext(); load("spring.data.elasticsearch.properties.path.data:target/data",
EnvironmentTestUtils.addEnvironment(this.context,
"spring.data.elasticsearch.properties.path.data:target/data",
"spring.data.elasticsearch.properties.path.logs:target/logs"); "spring.data.elasticsearch.properties.path.logs:target/logs");
this.context.register(PropertyPlaceholderAutoConfiguration.class,
ElasticsearchAutoConfiguration.class,
ElasticsearchDataAutoConfiguration.class);
this.context.refresh();
assertThat( assertThat(
this.context.getBeanNamesForType(SimpleElasticsearchMappingContext.class)) this.context.getBeanNamesForType(SimpleElasticsearchMappingContext.class))
.hasSize(1); .hasSize(1);
} }
@Test @Test
public void converterExists() { public void converterExists() {
this.context = new AnnotationConfigApplicationContext(); load("spring.data.elasticsearch.properties.path.data:target/data",
EnvironmentTestUtils.addEnvironment(this.context,
"spring.data.elasticsearch.properties.path.data:target/data",
"spring.data.elasticsearch.properties.path.logs:target/logs"); "spring.data.elasticsearch.properties.path.logs:target/logs");
this.context.register(PropertyPlaceholderAutoConfiguration.class,
ElasticsearchAutoConfiguration.class,
ElasticsearchDataAutoConfiguration.class);
this.context.refresh();
assertThat(this.context.getBeanNamesForType(ElasticsearchConverter.class)) assertThat(this.context.getBeanNamesForType(ElasticsearchConverter.class))
.hasSize(1); .hasSize(1);
} }
private void load(String... environment) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(ctx, environment);
ctx.register(PropertyPlaceholderAutoConfiguration.class,
ElasticsearchAutoConfiguration.class,
ElasticsearchDataAutoConfiguration.class);
ctx.refresh();
this.context = ctx;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment