|
|
@ -26,7 +26,6 @@ import org.springframework.boot.autoconfigure.data.alt.elasticsearch.CityElastic
|
|
|
|
import org.springframework.boot.autoconfigure.data.elasticsearch.city.City;
|
|
|
|
import org.springframework.boot.autoconfigure.data.elasticsearch.city.City;
|
|
|
|
import org.springframework.boot.autoconfigure.data.elasticsearch.city.CityRepository;
|
|
|
|
import org.springframework.boot.autoconfigure.data.elasticsearch.city.CityRepository;
|
|
|
|
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
|
|
|
|
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
|
|
|
|
import org.springframework.boot.test.util.EnvironmentTestUtils;
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
|
|
|
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
|
|
@ -50,7 +49,6 @@ public class ElasticsearchRepositoriesAutoConfigurationTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testDefaultRepositoryConfiguration() throws Exception {
|
|
|
|
public void testDefaultRepositoryConfiguration() throws Exception {
|
|
|
|
this.context = new AnnotationConfigApplicationContext();
|
|
|
|
this.context = new AnnotationConfigApplicationContext();
|
|
|
|
addElasticsearchProperties(this.context);
|
|
|
|
|
|
|
|
this.context.register(TestConfiguration.class,
|
|
|
|
this.context.register(TestConfiguration.class,
|
|
|
|
ElasticsearchAutoConfiguration.class,
|
|
|
|
ElasticsearchAutoConfiguration.class,
|
|
|
|
ElasticsearchRepositoriesAutoConfiguration.class,
|
|
|
|
ElasticsearchRepositoriesAutoConfiguration.class,
|
|
|
@ -64,7 +62,6 @@ public class ElasticsearchRepositoriesAutoConfigurationTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testNoRepositoryConfiguration() throws Exception {
|
|
|
|
public void testNoRepositoryConfiguration() throws Exception {
|
|
|
|
this.context = new AnnotationConfigApplicationContext();
|
|
|
|
this.context = new AnnotationConfigApplicationContext();
|
|
|
|
addElasticsearchProperties(this.context);
|
|
|
|
|
|
|
|
this.context.register(EmptyConfiguration.class,
|
|
|
|
this.context.register(EmptyConfiguration.class,
|
|
|
|
ElasticsearchAutoConfiguration.class,
|
|
|
|
ElasticsearchAutoConfiguration.class,
|
|
|
|
ElasticsearchRepositoriesAutoConfiguration.class,
|
|
|
|
ElasticsearchRepositoriesAutoConfiguration.class,
|
|
|
@ -77,7 +74,6 @@ public class ElasticsearchRepositoriesAutoConfigurationTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void doesNotTriggerDefaultRepositoryDetectionIfCustomized() {
|
|
|
|
public void doesNotTriggerDefaultRepositoryDetectionIfCustomized() {
|
|
|
|
this.context = new AnnotationConfigApplicationContext();
|
|
|
|
this.context = new AnnotationConfigApplicationContext();
|
|
|
|
addElasticsearchProperties(this.context);
|
|
|
|
|
|
|
|
this.context.register(CustomizedConfiguration.class,
|
|
|
|
this.context.register(CustomizedConfiguration.class,
|
|
|
|
ElasticsearchAutoConfiguration.class,
|
|
|
|
ElasticsearchAutoConfiguration.class,
|
|
|
|
ElasticsearchRepositoriesAutoConfiguration.class,
|
|
|
|
ElasticsearchRepositoriesAutoConfiguration.class,
|
|
|
@ -87,12 +83,6 @@ public class ElasticsearchRepositoriesAutoConfigurationTests {
|
|
|
|
assertThat(this.context.getBean(CityElasticsearchDbRepository.class)).isNotNull();
|
|
|
|
assertThat(this.context.getBean(CityElasticsearchDbRepository.class)).isNotNull();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void addElasticsearchProperties(AnnotationConfigApplicationContext context) {
|
|
|
|
|
|
|
|
EnvironmentTestUtils.addEnvironment(context,
|
|
|
|
|
|
|
|
"spring.data.elasticsearch.properties.path.data:target/data",
|
|
|
|
|
|
|
|
"spring.data.elasticsearch.properties.path.logs:target/logs");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
@TestAutoConfigurationPackage(City.class)
|
|
|
|
@TestAutoConfigurationPackage(City.class)
|
|
|
|
protected static class TestConfiguration {
|
|
|
|
protected static class TestConfiguration {
|
|
|
|