|
33 | 33 | import org.springframework.data.elasticsearch.annotations.Document;
|
34 | 34 | import org.springframework.data.elasticsearch.annotations.Routing;
|
35 | 35 | import org.springframework.data.elasticsearch.annotations.Setting;
|
36 |
| -import org.springframework.data.elasticsearch.core.ElasticsearchOperations; |
37 |
| -import org.springframework.data.elasticsearch.core.IndexOperations; |
38 |
| -import org.springframework.data.elasticsearch.core.MultiGetItem; |
39 |
| -import org.springframework.data.elasticsearch.core.SearchHits; |
| 36 | +import org.springframework.data.elasticsearch.core.*; |
40 | 37 | import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
| 38 | +import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext; |
41 | 39 | import org.springframework.data.elasticsearch.core.query.BaseQuery;
|
42 | 40 | import org.springframework.data.elasticsearch.core.query.Query;
|
43 | 41 | import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration;
|
|
47 | 45 |
|
48 | 46 | /**
|
49 | 47 | * @author Peter-Josef Meisch
|
| 48 | + * @author Anton Naydenov |
50 | 49 | */
|
51 | 50 | @SuppressWarnings("ConstantConditions")
|
52 | 51 | @SpringIntegrationTest
|
@@ -159,6 +158,21 @@ void shouldUseRoutingValuesInMultiget() {
|
159 | 158 | softly.assertAll();
|
160 | 159 | }
|
161 | 160 |
|
| 161 | + @Test |
| 162 | + void shouldCreateACopyOfTheClientWithRefreshPolicy() { |
| 163 | + //given |
| 164 | + AbstractElasticsearchTemplate sourceTemplate = (AbstractElasticsearchTemplate) operations; |
| 165 | + SimpleElasticsearchMappingContext mappingContext = new SimpleElasticsearchMappingContext(); |
| 166 | + DefaultRoutingResolver defaultRoutingResolver = new DefaultRoutingResolver(mappingContext); |
| 167 | + |
| 168 | + //when |
| 169 | + ElasticsearchOperations operationsCopy = this.operations.withRouting(defaultRoutingResolver); |
| 170 | + AbstractElasticsearchTemplate copyTemplate = (AbstractElasticsearchTemplate) operationsCopy; |
| 171 | + |
| 172 | + //then |
| 173 | + assertThat(sourceTemplate.getRefreshPolicy()).isEqualTo(copyTemplate.getRefreshPolicy()); |
| 174 | + } |
| 175 | + |
162 | 176 | @Document(indexName = INDEX)
|
163 | 177 | @Setting(shards = 7)
|
164 | 178 | @Routing("routing")
|
|
0 commit comments