From a4fd008a241c11fe78f0e7c364a229a8cf4442d2 Mon Sep 17 00:00:00 2001 From: Peter-Josef Meisch Date: Sat, 9 May 2020 19:48:26 +0200 Subject: [PATCH] DATAES-819 - Test refactorings. Original PR: #450 --- .../data/elasticsearch/NestedObjectTests.java | 5 ++--- ...EnableNestedElasticsearchRepositoriesTransportTests.java | 2 +- .../notnested/EnableElasticsearchRepositoriesTests.java | 6 +++--- .../data/elasticsearch/core/index/MappingBuilderTests.java | 4 ++-- .../core/index/SimpleDynamicTemplatesMappingTests.java | 5 ----- .../immutable/ImmutableElasticsearchRepositoryTests.java | 4 ++-- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/test/java/org/springframework/data/elasticsearch/NestedObjectTests.java b/src/test/java/org/springframework/data/elasticsearch/NestedObjectTests.java index e57bb32f..a359f373 100644 --- a/src/test/java/org/springframework/data/elasticsearch/NestedObjectTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/NestedObjectTests.java @@ -30,7 +30,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import org.apache.lucene.search.join.ScoreMode; import org.elasticsearch.index.query.BoolQueryBuilder; @@ -50,7 +49,7 @@ import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates; import org.springframework.data.elasticsearch.core.query.IndexQuery; import org.springframework.data.elasticsearch.core.query.NativeSearchQuery; import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; -import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchTemplateConfiguration; +import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration; import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest; import org.springframework.data.elasticsearch.utils.IndexInitializer; import org.springframework.test.context.ContextConfiguration; @@ -63,7 +62,7 @@ import org.springframework.test.context.ContextConfiguration; * @author Mark Paluch */ @SpringIntegrationTest -@ContextConfiguration(classes = { ElasticsearchTemplateConfiguration.class }) +@ContextConfiguration(classes = { ElasticsearchRestTemplateConfiguration.class }) public class NestedObjectTests { @Autowired private ElasticsearchOperations operations; diff --git a/src/test/java/org/springframework/data/elasticsearch/config/nested/EnableNestedElasticsearchRepositoriesTransportTests.java b/src/test/java/org/springframework/data/elasticsearch/config/nested/EnableNestedElasticsearchRepositoriesTransportTests.java index ed2790f2..7f6bf3c3 100644 --- a/src/test/java/org/springframework/data/elasticsearch/config/nested/EnableNestedElasticsearchRepositoriesTransportTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/config/nested/EnableNestedElasticsearchRepositoriesTransportTests.java @@ -25,7 +25,7 @@ import org.springframework.test.context.ContextConfiguration; * @author Peter-Josef Meisch */ @ContextConfiguration(classes = { EnableNestedElasticsearchRepositoriesTransportTests.Config.class }) -public class EnableNestedElasticsearchRepositoriesTransportTests { +public class EnableNestedElasticsearchRepositoriesTransportTests extends EnableNestedElasticsearchRepositoriesTests { @Configuration @Import({ ElasticsearchTemplateConfiguration.class }) @EnableElasticsearchRepositories(considerNestedRepositories = true) diff --git a/src/test/java/org/springframework/data/elasticsearch/config/notnested/EnableElasticsearchRepositoriesTests.java b/src/test/java/org/springframework/data/elasticsearch/config/notnested/EnableElasticsearchRepositoriesTests.java index 6b585560..33f41c2f 100644 --- a/src/test/java/org/springframework/data/elasticsearch/config/notnested/EnableElasticsearchRepositoriesTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/config/notnested/EnableElasticsearchRepositoriesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-15 the original author or authors. + * Copyright 2013-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,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.junit.jupiter.ElasticsearchTemplateConfiguration; +import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration; import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; @@ -71,7 +71,7 @@ public class EnableElasticsearchRepositoriesTests implements ApplicationContextA } @Configuration - @Import({ ElasticsearchTemplateConfiguration.class }) + @Import({ ElasticsearchRestTemplateConfiguration.class }) @EnableElasticsearchRepositories static class Config {} diff --git a/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderTests.java b/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderTests.java index a59904a6..7b4c8993 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderTests.java @@ -63,7 +63,7 @@ import org.springframework.data.elasticsearch.core.query.IndexQuery; import org.springframework.data.elasticsearch.core.query.NativeSearchQuery; import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; import org.springframework.data.elasticsearch.core.query.SeqNoPrimaryTerm; -import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchTemplateConfiguration; +import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration; import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest; import org.springframework.data.geo.Box; import org.springframework.data.geo.Circle; @@ -85,7 +85,7 @@ import org.springframework.test.context.ContextConfiguration; * @author Roman Puchkovskiy */ @SpringIntegrationTest -@ContextConfiguration(classes = { ElasticsearchTemplateConfiguration.class }) +@ContextConfiguration(classes = { ElasticsearchRestTemplateConfiguration.class }) public class MappingBuilderTests extends MappingContextBaseTests { @Autowired private ElasticsearchOperations operations; diff --git a/src/test/java/org/springframework/data/elasticsearch/core/index/SimpleDynamicTemplatesMappingTests.java b/src/test/java/org/springframework/data/elasticsearch/core/index/SimpleDynamicTemplatesMappingTests.java index 8faff283..be3f6471 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/index/SimpleDynamicTemplatesMappingTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/index/SimpleDynamicTemplatesMappingTests.java @@ -26,10 +26,7 @@ import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.DynamicTemplates; import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.FieldType; -import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchTemplateConfiguration; -import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest; import org.springframework.lang.Nullable; -import org.springframework.test.context.ContextConfiguration; /** * Dynamic templates tests @@ -37,8 +34,6 @@ import org.springframework.test.context.ContextConfiguration; * @author Petr Kukral * @author Peter-Josef Meisch */ -@SpringIntegrationTest -@ContextConfiguration(classes = { ElasticsearchTemplateConfiguration.class }) public class SimpleDynamicTemplatesMappingTests extends MappingContextBaseTests { @Test // DATAES-568 diff --git a/src/test/java/org/springframework/data/elasticsearch/immutable/ImmutableElasticsearchRepositoryTests.java b/src/test/java/org/springframework/data/elasticsearch/immutable/ImmutableElasticsearchRepositoryTests.java index 31983004..5cd8d4af 100644 --- a/src/test/java/org/springframework/data/elasticsearch/immutable/ImmutableElasticsearchRepositoryTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/immutable/ImmutableElasticsearchRepositoryTests.java @@ -31,7 +31,7 @@ import org.springframework.context.annotation.Import; import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.core.ElasticsearchOperations; import org.springframework.data.elasticsearch.core.IndexOperations; -import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchTemplateConfiguration; +import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration; import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest; import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; import org.springframework.data.repository.CrudRepository; @@ -49,7 +49,7 @@ import org.springframework.test.context.ContextConfiguration; public class ImmutableElasticsearchRepositoryTests { @Configuration - @Import({ ElasticsearchTemplateConfiguration.class }) + @Import({ ElasticsearchRestTemplateConfiguration.class }) @EnableElasticsearchRepositories(basePackages = { "org.springframework.data.elasticsearch.immutable" }, considerNestedRepositories = true) static class Config {}