mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-13 07:32:11 +00:00
DATAES-576 - Fix ElasticsearchTemplateTests.
We now delete documents with a type query instead of a term query. Also, added index cleanup to ReactiveElasticsearchTemplateTests.
This commit is contained in:
parent
b6fa4c8a74
commit
1f04e6453c
@ -74,7 +74,7 @@ import org.springframework.data.util.CloseableIterator;
|
||||
|
||||
/**
|
||||
* Base for testing rest/transport templates
|
||||
*
|
||||
*
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
* @author Franck Marchand
|
||||
@ -460,7 +460,7 @@ public class ElasticsearchTemplateTests {
|
||||
|
||||
// when
|
||||
DeleteQuery deleteQuery = new DeleteQuery();
|
||||
deleteQuery.setQuery(termQuery("message", "foo"));
|
||||
deleteQuery.setQuery(typeQuery(TYPE_NAME));
|
||||
deleteQuery.setType(TYPE_NAME);
|
||||
deleteQuery.setIndex("test-index-*");
|
||||
|
||||
|
@ -34,10 +34,12 @@ import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.data.annotation.Id;
|
||||
@ -82,7 +84,7 @@ public class ReactiveElasticsearchTemplateTests {
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
TestUtils.deleteIndex(DEFAULT_INDEX, ALTERNATE_INDEX);
|
||||
deleteIndices();
|
||||
|
||||
restTemplate = new ElasticsearchRestTemplate(TestUtils.restHighLevelClient());
|
||||
restTemplate.createIndex(SampleEntity.class);
|
||||
@ -94,6 +96,15 @@ public class ReactiveElasticsearchTemplateTests {
|
||||
restTemplate.getElasticsearchConverter().getMappingContext(), new DefaultConversionService())));
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
deleteIndices();
|
||||
}
|
||||
|
||||
private void deleteIndices() {
|
||||
TestUtils.deleteIndex(DEFAULT_INDEX, ALTERNATE_INDEX, "rx-template-test-index-this", "rx-template-test-index-that");
|
||||
}
|
||||
|
||||
@Test // DATAES-504
|
||||
public void executeShouldProvideResource() {
|
||||
|
||||
@ -547,6 +558,8 @@ public class ReactiveElasticsearchTemplateTests {
|
||||
.as(StepVerifier::create) //
|
||||
.expectNext(2L) //
|
||||
.verifyComplete();
|
||||
|
||||
TestUtils.deleteIndex(thisIndex, thatIndex);
|
||||
}
|
||||
|
||||
@Test // DATAES-547
|
||||
@ -575,6 +588,8 @@ public class ReactiveElasticsearchTemplateTests {
|
||||
.as(StepVerifier::create) //
|
||||
.expectNext(0L) //
|
||||
.verifyComplete();
|
||||
|
||||
TestUtils.deleteIndex(thisIndex, thatIndex);
|
||||
}
|
||||
|
||||
@Test // DATAES-504
|
||||
|
Loading…
x
Reference in New Issue
Block a user