mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-05-31 09:12:11 +00:00
DATAES-853 - Cleanup tests that do not delete test indices.
Original PR: #476
This commit is contained in:
parent
8fea655854
commit
8dbbc80887
@ -34,6 +34,7 @@ import java.util.Map;
|
||||
import org.apache.lucene.search.join.ScoreMode;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -67,11 +68,16 @@ public class NestedObjectTests {
|
||||
|
||||
@Autowired private ElasticsearchOperations operations;
|
||||
|
||||
private final List<Class<?>> entityClasses = Arrays.asList(Book.class, Person.class, PersonMultipleLevelNested.class);
|
||||
|
||||
@BeforeEach
|
||||
public void before() {
|
||||
IndexInitializer.init(operations.indexOps(Book.class));
|
||||
IndexInitializer.init(operations.indexOps(Person.class));
|
||||
IndexInitializer.init(operations.indexOps(PersonMultipleLevelNested.class));
|
||||
entityClasses.stream().map(operations::indexOps).forEach(IndexInitializer::init);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
entityClasses.forEach(clazz -> operations.indexOps(clazz).delete());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -24,6 +24,7 @@ import java.lang.Double;
|
||||
import java.lang.Long;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.BeansException;
|
||||
@ -42,6 +43,7 @@ import org.springframework.data.elasticsearch.annotations.ScriptedField;
|
||||
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
|
||||
import org.springframework.data.elasticsearch.core.IndexOperations;
|
||||
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
|
||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||
import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration;
|
||||
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||
@ -90,6 +92,12 @@ public class EnableElasticsearchRepositoriesTests implements ApplicationContextA
|
||||
IndexInitializer.init(indexOperations);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
operations.indexOps(IndexCoordinates.of("test-index-sample-config-not-nested")).delete();
|
||||
operations.indexOps(IndexCoordinates.of("test-index-uuid-keyed-config-not-nested")).delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootstrapsRepository() {
|
||||
|
||||
|
@ -151,6 +151,8 @@ public abstract class ElasticsearchTemplateTests {
|
||||
operations.indexOps(IndexCoordinates.of(INDEX_3_NAME)).delete();
|
||||
operations.indexOps(SearchHitsEntity.class).delete();
|
||||
operations.indexOps(HighlightEntity.class).delete();
|
||||
operations.indexOps(OptimisticEntity.class).delete();
|
||||
operations.indexOps(OptimisticAndVersionedEntity.class).delete();
|
||||
}
|
||||
|
||||
@Test // DATAES-106
|
||||
|
@ -119,7 +119,9 @@ public class ReactiveElasticsearchTemplateTests {
|
||||
}
|
||||
|
||||
private void deleteIndices() {
|
||||
TestUtils.deleteIndex(DEFAULT_INDEX, ALTERNATE_INDEX, "rx-template-test-index-this", "rx-template-test-index-that");
|
||||
TestUtils.deleteIndex(DEFAULT_INDEX, ALTERNATE_INDEX, "rx-template-test-index-this", "rx-template-test-index-that",
|
||||
"test-index-reactive-optimistic-entity-template",
|
||||
"test-index-reactive-optimistic-and-versioned-entity-template");
|
||||
}
|
||||
|
||||
@Test // DATAES-504
|
||||
|
@ -47,6 +47,7 @@ import java.util.Set;
|
||||
import org.assertj.core.data.Percentage;
|
||||
import org.elasticsearch.search.suggest.completion.context.ContextMapping;
|
||||
import org.json.JSONException;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -91,8 +92,9 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
||||
@Autowired private ElasticsearchOperations operations;
|
||||
private IndexOperations indexOperations;
|
||||
|
||||
@AfterEach
|
||||
@BeforeEach
|
||||
public void before() {
|
||||
public void deleteIndices() {
|
||||
indexOperations = operations.indexOps(SimpleRecursiveEntity.class);
|
||||
indexOperations.delete();
|
||||
operations.indexOps(StockPrice.class).delete();
|
||||
|
Loading…
x
Reference in New Issue
Block a user