|
|
|
|
@ -28,6 +28,7 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
@@ -28,6 +28,7 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
|
|
|
import org.springframework.boot.testsupport.testcontainers.DisabledWithoutDockerTestcontainers; |
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
|
import org.springframework.data.elasticsearch.core.ElasticsearchEntityMapper; |
|
|
|
|
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; |
|
|
|
|
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; |
|
|
|
|
import org.springframework.data.elasticsearch.core.EntityMapper; |
|
|
|
|
@ -44,6 +45,7 @@ import static org.mockito.Mockito.mock;
@@ -44,6 +45,7 @@ import static org.mockito.Mockito.mock;
|
|
|
|
|
* @author Phillip Webb |
|
|
|
|
* @author Artur Konczak |
|
|
|
|
* @author Brian Clozel |
|
|
|
|
* @author Peter-Josef Meisch |
|
|
|
|
*/ |
|
|
|
|
@DisabledWithoutDockerTestcontainers |
|
|
|
|
class ElasticsearchDataAutoConfigurationTests { |
|
|
|
|
@ -90,6 +92,11 @@ class ElasticsearchDataAutoConfigurationTests {
@@ -90,6 +92,11 @@ class ElasticsearchDataAutoConfigurationTests {
|
|
|
|
|
.hasSingleBean(ElasticsearchConverter.class)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void defaultEntityMapperRegistered() { |
|
|
|
|
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(EntityMapper.class)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void customTransportTemplateShouldBeUsed() { |
|
|
|
|
this.contextRunner.withUserConfiguration(CustomTransportTemplate.class).run((context) -> assertThat(context) |
|
|
|
|
@ -109,6 +116,12 @@ class ElasticsearchDataAutoConfigurationTests {
@@ -109,6 +116,12 @@ class ElasticsearchDataAutoConfigurationTests {
|
|
|
|
|
.contains("reactiveElasticsearchTemplate")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void customEntityMapperShouldeBeUsed() { |
|
|
|
|
this.contextRunner.withUserConfiguration(CustomEntityMapper.class).run((context) -> assertThat(context) |
|
|
|
|
.getBeanNames(EntityMapper.class).containsExactly("elasticsearchEntityMapper")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false) |
|
|
|
|
static class CustomTransportTemplate { |
|
|
|
|
|
|
|
|
|
@ -139,4 +152,14 @@ class ElasticsearchDataAutoConfigurationTests {
@@ -139,4 +152,14 @@ class ElasticsearchDataAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false) |
|
|
|
|
static class CustomEntityMapper { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
EntityMapper elasticsearchEntityMapper() { |
|
|
|
|
return mock(ElasticsearchEntityMapper.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|