diff --git a/Jenkinsfile b/Jenkinsfile
index b8f4b46cb..380c24c15 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -32,7 +32,7 @@ pipeline {
sh 'mkdir -p /tmp/jenkins-home'
sh 'chown -R 1001:1001 .'
sh 'rm -rf ?'
- sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw clean dependency:list verify -Dsort -U -B'
+ sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw clean dependency:list test -Dsort -U -B'
sh 'chown -R 1001:1001 .'
}
}
@@ -59,7 +59,7 @@ pipeline {
sh 'mkdir -p /tmp/jenkins-home'
sh 'chown -R 1001:1001 .'
sh 'rm -rf ?'
- sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean dependency:list verify -Dsort -U -B'
+ sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean dependency:list test -Dsort -U -B'
sh 'chown -R 1001:1001 .'
}
}
@@ -78,7 +78,7 @@ pipeline {
sh 'mkdir -p /tmp/jenkins-home'
sh 'chown -R 1001:1001 .'
sh 'rm -rf ?'
- sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean dependency:list verify -Dsort -U -B'
+ sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean dependency:list test -Dsort -U -B'
sh 'chown -R 1001:1001 .'
}
}
diff --git a/pom.xml b/pom.xml
index 1fb40b2b3..6047cae99 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,417 +1,396 @@
- 4.0.0
+ 4.0.0
- org.springframework.data
- spring-data-elasticsearch
- 4.1.0-SNAPSHOT
+ org.springframework.data
+ spring-data-elasticsearch
+ 4.1.0-SNAPSHOT
-
- org.springframework.data.build
- spring-data-parent
- 2.4.0-SNAPSHOT
-
+
+ org.springframework.data.build
+ spring-data-parent
+ 2.4.0-SNAPSHOT
+
- Spring Data Elasticsearch
- Spring Data Implementation for Elasticsearch
- https://github.com/spring-projects/spring-data-elasticsearch
+ Spring Data Elasticsearch
+ Spring Data Implementation for Elasticsearch
+ https://github.com/spring-projects/spring-data-elasticsearch
-
- 2.6
- 7.9.1
- 2.13.3
- 4.1.50.Final
- 2.4.0-SNAPSHOT
- 1.14.3
- spring.data.elasticsearch
-
+
+ 2.6
+ 7.9.1
+ 2.13.3
+ 4.1.50.Final
+ 2.4.0-SNAPSHOT
+ 1.14.3
+ spring.data.elasticsearch
+
-
-
- biomedcentral
- BioMed Central Development Team
- +0
-
-
- cstrobl
- Christoph Strobl
- cstrobl at pivotal.io
- Pivotal
- https://www.pivotal.io
-
- Developer
-
- +1
-
-
- mpaluch
- Mark Paluch
- mpaluch at pivotal.io
- Pivotal
- https://www.pivotal.io
-
- Developer
-
- +1
-
-
+
+
+ biomedcentral
+ BioMed Central Development Team
+ +0
+
+
+ cstrobl
+ Christoph Strobl
+ cstrobl at pivotal.io
+ Pivotal
+ https://www.pivotal.io
+
+ Developer
+
+ +1
+
+
+ mpaluch
+ Mark Paluch
+ mpaluch at pivotal.io
+ Pivotal
+ https://www.pivotal.io
+
+ Developer
+
+ +1
+
+
-
- https://github.com/spring-projects/spring-data-elasticsearch
- scm:git:git://github.com/spring-projects/spring-data-elasticsearch.git
- scm:git:ssh://git@github.com/spring-projects/spring-data-elasticsearch.git
-
-
+
+ https://github.com/spring-projects/spring-data-elasticsearch
+ scm:git:git://github.com/spring-projects/spring-data-elasticsearch.git
+ scm:git:ssh://git@github.com/spring-projects/spring-data-elasticsearch.git
+
+
-
- Bamboo
- https://build.spring.io/browse/SPRINGDATAES
-
+
+ Bamboo
+ https://build.spring.io/browse/SPRINGDATAES
+
-
- JIRA
- https://jira.spring.io/browse/DATAES
-
+
+ JIRA
+ https://jira.spring.io/browse/DATAES
+
-
+
-
-
- io.netty
- netty-bom
- ${netty}
- pom
- import
-
-
-
+
+
+ io.netty
+ netty-bom
+ ${netty}
+ pom
+ import
+
+
+
-
+
-
-
- org.springframework
- spring-context
-
-
- commons-logging
- commons-logging
-
-
-
+
+
+ org.springframework
+ spring-context
+
+
+ commons-logging
+ commons-logging
+
+
+
-
- org.springframework
- spring-tx
-
+
+ org.springframework
+ spring-tx
+
-
-
- org.springframework.data
- spring-data-commons
- ${springdata.commons}
-
+
+
+ org.springframework.data
+ spring-data-commons
+ ${springdata.commons}
+
-
-
- org.springframework
- spring-webflux
- true
-
+
+
+ org.springframework
+ spring-webflux
+ true
+
-
- io.projectreactor.netty
- reactor-netty-http
- true
-
+
+ io.projectreactor.netty
+ reactor-netty-http
+ true
+
-
- io.projectreactor
- reactor-test
- test
-
+
+ io.projectreactor
+ reactor-test
+ test
+
-
-
- commons-lang
- commons-lang
- ${commonslang}
- test
-
+
+
+ commons-lang
+ commons-lang
+ ${commonslang}
+ test
+
-
-
- joda-time
- joda-time
- ${jodatime}
- true
-
+
+
+ joda-time
+ joda-time
+ ${jodatime}
+ true
+
-
-
- org.elasticsearch.client
- transport
- ${elasticsearch}
-
-
- commons-logging
- commons-logging
-
-
-
+
+
+ org.elasticsearch.client
+ transport
+ ${elasticsearch}
+
+
+ commons-logging
+ commons-logging
+
+
+
-
-
- org.elasticsearch.plugin
- transport-netty4-client
- ${elasticsearch}
-
+
+
+ org.elasticsearch.plugin
+ transport-netty4-client
+ ${elasticsearch}
+
-
- org.elasticsearch.client
- elasticsearch-rest-high-level-client
- ${elasticsearch}
-
-
- commons-logging
- commons-logging
-
-
-
+
+ org.elasticsearch.client
+ elasticsearch-rest-high-level-client
+ ${elasticsearch}
+
+
+ commons-logging
+ commons-logging
+
+
+
-
- org.slf4j
- log4j-over-slf4j
- ${slf4j}
- test
-
+
+ org.slf4j
+ log4j-over-slf4j
+ ${slf4j}
+ test
+
-
- org.apache.logging.log4j
- log4j-core
- ${log4j}
- test
-
+
+ org.apache.logging.log4j
+ log4j-core
+ ${log4j}
+ test
+
-
-
- com.fasterxml.jackson.core
- jackson-core
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
-
-
- javax.enterprise
- cdi-api
- ${cdi}
- provided
- true
-
+
+
+ javax.enterprise
+ cdi-api
+ ${cdi}
+ provided
+ true
+
-
-
- org.springframework
- spring-test
- test
-
-
- ch.qos.logback
- logback-classic
-
-
-
+
+
+ org.springframework
+ spring-test
+ test
+
+
+ ch.qos.logback
+ logback-classic
+
+
+
-
- org.apache.openwebbeans.test
- cditest-owb
- 1.2.8
- test
-
-
- org.apache.geronimo.specs
- geronimo-jcdi_1.0_spec
-
-
- org.apache.geronimo.specs
- geronimo-atinject_1.0_spec
-
-
-
+
+ org.apache.openwebbeans.test
+ cditest-owb
+ 1.2.8
+ test
+
+
+ org.apache.geronimo.specs
+ geronimo-jcdi_1.0_spec
+
+
+ org.apache.geronimo.specs
+ geronimo-atinject_1.0_spec
+
+
+
-
- org.skyscreamer
- jsonassert
- 1.5.0
- test
-
+
+ org.skyscreamer
+ jsonassert
+ 1.5.0
+ test
+
-
- com.github.tomakehurst
- wiremock-jre8
- 2.26.3
- test
-
-
-
- commons-logging
- commons-logging
-
-
- org.ow2.asm
- asm
-
-
-
+
+ com.github.tomakehurst
+ wiremock-jre8
+ 2.26.3
+ test
+
+
+
+ commons-logging
+ commons-logging
+
+
+ org.ow2.asm
+ asm
+
+
+
-
-
- org.apache.xbean
- xbean-asm5-shaded
- 4.5
- test
-
+
+
+ org.apache.xbean
+ xbean-asm5-shaded
+ 4.5
+ test
+
-
- javax.servlet
- javax.servlet-api
- 3.1.0
- test
-
+
+ javax.servlet
+ javax.servlet-api
+ 3.1.0
+ test
+
-
- org.mockito
- mockito-junit-jupiter
- ${mockito}
- test
-
+
+ org.mockito
+ mockito-junit-jupiter
+ ${mockito}
+ test
+
-
- org.testcontainers
- elasticsearch
- ${testcontainers}
- test
-
+
+ org.testcontainers
+ elasticsearch
+ ${testcontainers}
+ test
+
-
+
-
-
-
- src/main/resources
- true
-
- **/versions.properties
-
-
-
- src/main/resources
- false
-
- **/versions.properties
-
-
-
+
+
+
+ src/main/resources
+ true
+
+ **/versions.properties
+
+
+
+ src/main/resources
+ false
+
+ **/versions.properties
+
+
+
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- true
- false
-
- **/*Tests.java
- **/*Test.java
-
- integration-test
-
-
-
- org.apache.maven.plugins
- maven-failsafe-plugin
-
-
- **/*Tests.java
- **/*Test.java
-
- integration-test
-
- false
-
-
-
-
-
- integration-test
- verify
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- org.asciidoctor
- asciidoctor-maven-plugin
-
-
-
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+ false
+
+ **/*Tests.java
+ **/*Test.java
+
+
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ org.asciidoctor
+ asciidoctor-maven-plugin
+
+
+
-
-
+
+
- ci
+ ci
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
-
-
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+
+
-
-
+
+
-
-
-
- **/*
- .git/**/*,target/**/*,**/target/**/*,.idea/**/*,**/spring.schemas,**/*.svg,mvnw,mvnw.cmd,**/*.policy
- ./
-
-
-
-
+
+
+
+ **/*
+ .git/**/*,target/**/*,**/target/**/*,.idea/**/*,**/spring.schemas,**/*.svg,mvnw,mvnw.cmd,**/*.policy
+ ./
+
+
+
+
-
+
-
+
-
-
- spring-libs-snapshot
- https://repo.spring.io/libs-snapshot
-
-
+
+
+ spring-libs-snapshot
+ https://repo.spring.io/libs-snapshot
+
+
-
-
- spring-plugins-release
- https://repo.spring.io/plugins-release
-
-
+
+
+ spring-plugins-release
+ https://repo.spring.io/plugins-release
+
+
diff --git a/src/test/java/org/springframework/data/elasticsearch/core/RequestFactoryTests.java b/src/test/java/org/springframework/data/elasticsearch/core/RequestFactoryTests.java
index 550f4f84d..df8a9ef87 100644
--- a/src/test/java/org/springframework/data/elasticsearch/core/RequestFactoryTests.java
+++ b/src/test/java/org/springframework/data/elasticsearch/core/RequestFactoryTests.java
@@ -434,7 +434,7 @@ class RequestFactoryTests {
PutIndexTemplateRequest putIndexTemplateRequest = requestFactory.putIndexTemplateRequest(putTemplateRequest);
String json = requestToString(putIndexTemplateRequest);
-
+ System.out.println(json);
assertEquals(expected, json, false);
}
diff --git a/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderIntegrationTests.java b/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderIntegrationTests.java
deleted file mode 100644
index ffb412bfd..000000000
--- a/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderIntegrationTests.java
+++ /dev/null
@@ -1,624 +0,0 @@
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.data.elasticsearch.core.index;
-
-import static org.assertj.core.api.Assertions.*;
-import static org.elasticsearch.index.query.QueryBuilders.*;
-import static org.springframework.data.elasticsearch.annotations.FieldType.*;
-import static org.springframework.data.elasticsearch.annotations.FieldType.Object;
-import static org.springframework.data.elasticsearch.utils.IndexBuilder.*;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import java.lang.Integer;
-import java.math.BigDecimal;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-import org.assertj.core.data.Percentage;
-import org.elasticsearch.search.suggest.completion.context.ContextMapping;
-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;
-import org.springframework.data.annotation.Id;
-import org.springframework.data.elasticsearch.annotations.*;
-import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
-import org.springframework.data.elasticsearch.core.IndexOperations;
-import org.springframework.data.elasticsearch.core.SearchHits;
-import org.springframework.data.elasticsearch.core.completion.Completion;
-import org.springframework.data.elasticsearch.core.geo.GeoPoint;
-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.core.query.SeqNoPrimaryTerm;
-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;
-import org.springframework.data.geo.Point;
-import org.springframework.data.geo.Polygon;
-import org.springframework.lang.Nullable;
-import org.springframework.test.context.ContextConfiguration;
-
-/**
- * @author Stuart Stevenson
- * @author Jakub Vavrik
- * @author Mohsin Husen
- * @author Keivn Leturc
- * @author Nordine Bittich
- * @author Don Wellington
- * @author Sascha Woo
- * @author Peter-Josef Meisch
- * @author Xiao Yu
- * @author Roman Puchkovskiy
- */
-@SpringIntegrationTest
-@ContextConfiguration(classes = { ElasticsearchRestTemplateConfiguration.class })
-public class MappingBuilderIntegrationTests extends MappingContextBaseTests {
-
- @Autowired private ElasticsearchOperations operations;
- private IndexOperations indexOperations;
-
- @AfterEach
- @BeforeEach
- public void deleteIndices() {
- indexOperations = operations.indexOps(SimpleRecursiveEntity.class);
- indexOperations.delete();
- operations.indexOps(StockPrice.class).delete();
- operations.indexOps(SampleInheritedEntity.class).delete();
- operations.indexOps(User.class).delete();
- operations.indexOps(Group.class).delete();
- operations.indexOps(Book.class).delete();
- operations.indexOps(NormalizerEntity.class).delete();
- operations.indexOps(CopyToEntity.class).delete();
- }
-
- @Test
- public void shouldNotFailOnCircularReference() {
-
- operations.indexOps(SimpleRecursiveEntity.class).create();
- indexOperations.putMapping(SimpleRecursiveEntity.class);
- indexOperations.refresh();
- }
-
- @Test // DATAES-530
- public void shouldAddStockPriceDocumentToIndex() {
-
- // Given
- IndexOperations indexOps = operations.indexOps(StockPrice.class);
-
- // When
- indexOps.create();
- indexOps.putMapping(StockPrice.class);
- String symbol = "AU";
- double price = 2.34;
- String id = "abc";
-
- IndexCoordinates index = IndexCoordinates.of("test-index-stock-mapping-builder");
- operations.index(buildIndex(StockPrice.builder() //
- .id(id) //
- .symbol(symbol) //
- .price(BigDecimal.valueOf(price)) //
- .build()), index);
- operations.indexOps(StockPrice.class).refresh();
-
- NativeSearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
- SearchHits result = operations.search(searchQuery, StockPrice.class, index);
-
- // Then
- assertThat(result).hasSize(1);
- StockPrice entry = result.getSearchHit(0).getContent();
- assertThat(entry.getSymbol()).isEqualTo(symbol);
- assertThat(entry.getPrice()).isCloseTo(BigDecimal.valueOf(price), Percentage.withPercentage(0.01));
- }
-
- @Test // DATAES-76
- public void shouldAddSampleInheritedEntityDocumentToIndex() {
- // given
- IndexCoordinates index = IndexCoordinates.of("test-index-sample-inherited-mapping-builder");
- IndexOperations indexOps = operations.indexOps(index);
-
- // when
- indexOps.create();
- indexOps.putMapping(SampleInheritedEntity.class);
- Date createdDate = new Date();
- String message = "msg";
- String id = "abc";
- operations.index(new SampleInheritedEntityBuilder(id).createdDate(createdDate).message(message).buildIndex(),
- index);
- operations.indexOps(SampleInheritedEntity.class).refresh();
-
- NativeSearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
- SearchHits result = operations.search(searchQuery, SampleInheritedEntity.class, index);
-
- // then
- assertThat(result).hasSize(1);
-
- SampleInheritedEntity entry = result.getSearchHit(0).getContent();
- assertThat(entry.getCreatedDate()).isEqualTo(createdDate);
- assertThat(entry.getMessage()).isEqualTo(message);
- }
-
- @Test // DATAES-260 - StackOverflow when two reverse relationship.
- public void shouldHandleReverseRelationship() {
-
- // given
- IndexOperations indexOpsUser = operations.indexOps(User.class);
- indexOpsUser.create();
- indexOpsUser.putMapping(User.class);
-
- IndexOperations indexOpsGroup = operations.indexOps(Group.class);
- indexOpsGroup.create();
- indexOpsGroup.putMapping(Group.class);
-
- // when
-
- // then
- }
-
- @Test // DATAES-420
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public void shouldUseBothAnalyzer() {
-
- // given
- IndexOperations indexOps = this.operations.indexOps(Book.class);
- indexOps.create();
- indexOps.putMapping(Book.class);
-
- // when
- Map mapping = indexOps.getMapping();
- Map descriptionMapping = (Map) ((Map) mapping.get("properties")).get("description");
- Map prefixDescription = (Map) ((Map) descriptionMapping.get("fields")).get("prefix");
-
- // then
- assertThat(prefixDescription).hasSize(3);
- assertThat(prefixDescription.get("type")).isEqualTo("text");
- assertThat(prefixDescription.get("analyzer")).isEqualTo("stop");
- assertThat(prefixDescription.get("search_analyzer")).isEqualTo("standard");
- assertThat(descriptionMapping.get("type")).isEqualTo("text");
- assertThat(descriptionMapping.get("analyzer")).isEqualTo("whitespace");
- }
-
- @Test // DATAES-492
- @SuppressWarnings("rawtypes")
- public void shouldUseKeywordNormalizer() {
-
- // given
- operations.createIndex(NormalizerEntity.class);
- operations.putMapping(NormalizerEntity.class);
-
- // when
- Map mapping = operations.getMapping(NormalizerEntity.class);
- Map properties = (Map) mapping.get("properties");
- Map fieldName = (Map) properties.get("name");
- Map fieldDescriptionLowerCase = (Map) ((Map) ((Map) properties.get("description")).get("fields")).get("lower_case");
-
- // then
- assertThat(fieldName.get("type")).isEqualTo("keyword");
- assertThat(fieldName.get("normalizer")).isEqualTo("lower_case_normalizer");
- assertThat(fieldDescriptionLowerCase.get("type")).isEqualTo("keyword");
- assertThat(fieldDescriptionLowerCase.get("normalizer")).isEqualTo("lower_case_normalizer");
- }
-
- @Test // DATAES-503
- @SuppressWarnings("rawtypes")
- public void shouldUseCopyTo() {
-
- // given
- IndexOperations indexOps = operations.indexOps(CopyToEntity.class);
- indexOps.create();
- indexOps.putMapping(CopyToEntity.class);
-
- // when
- Map mapping = indexOps.getMapping();
- Map properties = (Map) mapping.get("properties");
- Map fieldFirstName = (Map) properties.get("firstName");
- Map fieldLastName = (Map) properties.get("lastName");
-
- // then
- List copyToValue = Collections.singletonList("name");
- assertThat(fieldFirstName.get("copy_to")).isEqualTo(copyToValue);
- assertThat(fieldLastName.get("copy_to")).isEqualTo(copyToValue);
- }
-
- /**
- * @author Xiao Yu
- */
- @Setter
- @Getter
- @NoArgsConstructor
- @AllArgsConstructor
- @Builder
- @Document(indexName = "ignore-above-index")
- static class IgnoreAboveEntity {
-
- @Id private String id;
-
- @Field(type = FieldType.Keyword, ignoreAbove = 10) private String message;
- }
-
- /**
- * @author Peter-Josef Meisch
- */
- static class FieldNameEntity {
-
- @Document(indexName = "fieldname-index")
- static class IdEntity {
- @Nullable @Id @Field("id-property") private String id;
- }
-
- @Document(indexName = "fieldname-index")
- static class TextEntity {
-
- @Nullable @Id @Field("id-property") private String id;
-
- @Field(name = "text-property", type = FieldType.Text) //
- @Nullable private String textProperty;
- }
-
- @Document(indexName = "fieldname-index")
- static class MappingEntity {
-
- @Nullable @Id @Field("id-property") private String id;
-
- @Field("mapping-property") @Mapping(mappingPath = "/mappings/test-field-analyzed-mappings.json") //
- @Nullable private byte[] mappingProperty;
- }
-
- @Document(indexName = "fieldname-index")
- static class GeoPointEntity {
-
- @Nullable @Id @Field("id-property") private String id;
-
- @Nullable @Field("geopoint-property") private GeoPoint geoPoint;
- }
-
- @Document(indexName = "fieldname-index")
- static class CircularEntity {
-
- @Nullable @Id @Field("id-property") private String id;
-
- @Nullable @Field(name = "circular-property", type = FieldType.Object, ignoreFields = { "circular-property" }) //
- private CircularEntity circularProperty;
- }
-
- @Document(indexName = "fieldname-index")
- static class CompletionEntity {
-
- @Nullable @Id @Field("id-property") private String id;
-
- @Nullable @Field("completion-property") @CompletionField(maxInputLength = 100) //
- private Completion suggest;
- }
-
- @Document(indexName = "fieldname-index")
- static class MultiFieldEntity {
-
- @Nullable @Id @Field("id-property") private String id;
-
- @Nullable //
- @MultiField(mainField = @Field(name = "main-field", type = FieldType.Text, analyzer = "whitespace"),
- otherFields = {
- @InnerField(suffix = "suff-ix", type = FieldType.Text, analyzer = "stop", searchAnalyzer = "standard") }) //
- private String description;
- }
- }
-
- /**
- * @author Rizwan Idrees
- * @author Mohsin Husen
- * @author Nordine Bittich
- */
- @Setter
- @Getter
- @NoArgsConstructor
- @AllArgsConstructor
- @Builder
- @Document(indexName = "test-index-book-mapping-builder", replicas = 0, refreshInterval = "-1")
- static class Book {
-
- @Id private String id;
- private String name;
- @Field(type = FieldType.Object) private Author author;
- @Field(type = FieldType.Nested) private Map> buckets = new HashMap<>();
- @MultiField(mainField = @Field(type = FieldType.Text, analyzer = "whitespace"),
- otherFields = { @InnerField(suffix = "prefix", type = FieldType.Text, analyzer = "stop",
- searchAnalyzer = "standard") }) private String description;
- }
-
- /**
- * @author Stuart Stevenson
- * @author Mohsin Husen
- */
- @Data
- @Document(indexName = "test-index-simple-recursive-mapping-builder", replicas = 0, refreshInterval = "-1")
- static class SimpleRecursiveEntity {
-
- @Nullable @Id private String id;
- @Nullable @Field(type = FieldType.Object,
- ignoreFields = { "circularObject" }) private SimpleRecursiveEntity circularObject;
- }
-
- /**
- * @author Sascha Woo
- */
- @Setter
- @Getter
- @NoArgsConstructor
- @AllArgsConstructor
- @Builder
- @Document(indexName = "test-copy-to-mapping-builder", replicas = 0, refreshInterval = "-1")
- static class CopyToEntity {
-
- @Id private String id;
-
- @Field(type = FieldType.Keyword, copyTo = "name") private String firstName;
-
- @Field(type = FieldType.Keyword, copyTo = "name") private String lastName;
-
- @Field(type = FieldType.Keyword) private String name;
- }
-
- /**
- * @author Sascha Woo
- */
- @Setter
- @Getter
- @NoArgsConstructor
- @AllArgsConstructor
- @Builder
- @Document(indexName = "test-index-normalizer-mapping-builder", replicas = 0, refreshInterval = "-1")
- @Setting(settingPath = "/settings/test-normalizer.json")
- static class NormalizerEntity {
-
- @Id private String id;
-
- @Field(type = FieldType.Keyword, normalizer = "lower_case_normalizer") private String name;
-
- @MultiField(mainField = @Field(type = FieldType.Text), otherFields = { @InnerField(suffix = "lower_case",
- type = FieldType.Keyword, normalizer = "lower_case_normalizer") }) private String description;
- }
-
- /**
- * @author Rizwan Idrees
- * @author Mohsin Husen
- */
- static class Author {
-
- @Nullable private String id;
- @Nullable private String name;
-
- @Nullable
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Nullable
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
- }
-
- /**
- * @author Kevin Leturc
- */
- @Document(indexName = "test-index-sample-inherited-mapping-builder", replicas = 0, refreshInterval = "-1")
- static class SampleInheritedEntity extends AbstractInheritedEntity {
-
- @Nullable @Field(type = Text, index = false, store = true, analyzer = "standard") private String message;
-
- @Nullable
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
- }
-
- /**
- * @author Kevin Leturc
- */
- static class SampleInheritedEntityBuilder {
-
- private final SampleInheritedEntity result;
-
- public SampleInheritedEntityBuilder(String id) {
- result = new SampleInheritedEntity();
- result.setId(id);
- }
-
- public SampleInheritedEntityBuilder createdDate(Date createdDate) {
- result.setCreatedDate(createdDate);
- return this;
- }
-
- public SampleInheritedEntityBuilder message(String message) {
- result.setMessage(message);
- return this;
- }
-
- public SampleInheritedEntity build() {
- return result;
- }
-
- public IndexQuery buildIndex() {
- IndexQuery indexQuery = new IndexQuery();
- indexQuery.setId(Objects.requireNonNull(result.getId()));
- indexQuery.setObject(result);
- return indexQuery;
- }
- }
-
- /**
- * @author Artur Konczak
- * @author Mohsin Husen
- */
- @Setter
- @Getter
- @NoArgsConstructor
- @AllArgsConstructor
- @Builder
- @Document(indexName = "test-index-stock-mapping-builder", replicas = 0, refreshInterval = "-1")
- static class StockPrice {
-
- @Id private String id;
-
- private String symbol;
-
- @Field(type = FieldType.Double) private BigDecimal price;
- }
-
- /**
- * @author Kevin Letur
- */
- static class AbstractInheritedEntity {
-
- @Nullable @Id private String id;
-
- @Nullable @Field(type = FieldType.Date, format = DateFormat.date_time, index = false) private Date createdDate;
-
- @Nullable
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @Nullable
- public Date getCreatedDate() {
- return createdDate;
- }
-
- public void setCreatedDate(Date createdDate) {
- this.createdDate = createdDate;
- }
- }
-
- @Setter
- @Getter
- @NoArgsConstructor
- @AllArgsConstructor
- @Builder
- @Document(indexName = "test-index-geo-mapping-builder", replicas = 0, refreshInterval = "-1")
- static class GeoEntity {
-
- @Id private String id;
-
- // geo shape - Spring Data
- private Box box;
- private Circle circle;
- private Polygon polygon;
-
- // geo point - Custom implementation + Spring Data
- @GeoPointField private Point pointA;
- private GeoPoint pointB;
- @GeoPointField private String pointC;
- @GeoPointField private double[] pointD;
-
- // geo shape, until e have the classes for this, us a strng
- @GeoShapeField private String shape1;
- @GeoShapeField(coerce = true, ignoreMalformed = true, ignoreZValue = false,
- orientation = GeoShapeField.Orientation.clockwise) private String shape2;
- }
-
- /**
- * Created by akonczak on 21/08/2016.
- */
- @Document(indexName = "test-index-user-mapping-builder")
- static class User {
- @Nullable @Id private String id;
-
- @Field(type = FieldType.Nested, ignoreFields = { "users" }) private Set groups = new HashSet<>();
- }
-
- /**
- * Created by akonczak on 21/08/2016.
- */
- @Document(indexName = "test-index-group-mapping-builder")
- static class Group {
-
- @Nullable @Id String id;
-
- @Field(type = FieldType.Nested, ignoreFields = { "groups" }) private Set users = new HashSet<>();
- }
-
- static class ValueObject {
- private String value;
-
- public ValueObject(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
- }
-
- @Getter
- @Setter
- @Document(indexName = "completion")
- static class CompletionDocument {
- @Id private String id;
-
- @CompletionField(contexts = { @CompletionContext(name = "location", type = ContextMapping.Type.GEO,
- path = "proppath") }) private Completion suggest;
- }
-
- @Data
- @Document(indexName = "test-index-entity-with-seq-no-primary-term-mapping-builder")
- static class EntityWithSeqNoPrimaryTerm {
-
- @Field(type = Object) private SeqNoPrimaryTerm seqNoPrimaryTerm;
- }
-
- @Data
- static class RankFeatureEntity {
- @Id private String id;
-
- @Field(type = FieldType.Rank_Feature) private Integer pageRank;
-
- @Field(type = FieldType.Rank_Feature, positiveScoreImpact = false) private Integer urlLength;
-
- @Field(type = FieldType.Rank_Features) private Map topics;
- }
-}
diff --git a/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderUnitTests.java b/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderTests.java
similarity index 76%
rename from src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderUnitTests.java
rename to src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderTests.java
index 9a7fadc1f..8fa6b8ded 100644
--- a/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderUnitTests.java
+++ b/src/test/java/org/springframework/data/elasticsearch/core/index/MappingBuilderTests.java
@@ -17,9 +17,11 @@
package org.springframework.data.elasticsearch.core.index;
import static org.assertj.core.api.Assertions.*;
+import static org.elasticsearch.index.query.QueryBuilders.*;
import static org.skyscreamer.jsonassert.JSONAssert.*;
import static org.springframework.data.elasticsearch.annotations.FieldType.*;
import static org.springframework.data.elasticsearch.annotations.FieldType.Object;
+import static org.springframework.data.elasticsearch.utils.IndexBuilder.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -34,27 +36,44 @@ import java.lang.Integer;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
+import java.util.Objects;
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.DisplayName;
import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.elasticsearch.annotations.*;
+import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
+import org.springframework.data.elasticsearch.core.IndexOperations;
+import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.completion.Completion;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
+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.core.query.SeqNoPrimaryTerm;
+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;
import org.springframework.data.geo.Point;
import org.springframework.data.geo.Polygon;
import org.springframework.lang.Nullable;
+import org.springframework.test.context.ContextConfiguration;
/**
* @author Stuart Stevenson
@@ -68,7 +87,34 @@ import org.springframework.lang.Nullable;
* @author Xiao Yu
* @author Roman Puchkovskiy
*/
-public class MappingBuilderUnitTests extends MappingContextBaseTests {
+@SpringIntegrationTest
+@ContextConfiguration(classes = { ElasticsearchRestTemplateConfiguration.class })
+public class MappingBuilderTests extends MappingContextBaseTests {
+
+ @Autowired private ElasticsearchOperations operations;
+ private IndexOperations indexOperations;
+
+ @AfterEach
+ @BeforeEach
+ public void deleteIndices() {
+ indexOperations = operations.indexOps(SimpleRecursiveEntity.class);
+ indexOperations.delete();
+ operations.indexOps(StockPrice.class).delete();
+ operations.indexOps(SampleInheritedEntity.class).delete();
+ operations.indexOps(User.class).delete();
+ operations.indexOps(Group.class).delete();
+ operations.indexOps(Book.class).delete();
+ operations.indexOps(NormalizerEntity.class).delete();
+ operations.indexOps(CopyToEntity.class).delete();
+ }
+
+ @Test
+ public void shouldNotFailOnCircularReference() {
+
+ operations.indexOps(SimpleRecursiveEntity.class).create();
+ indexOperations.putMapping(SimpleRecursiveEntity.class);
+ indexOperations.refresh();
+ }
@Test // DATAES-568
public void testInfiniteLoopAvoidance() throws JSONException {
@@ -94,6 +140,37 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
assertEquals(expected, mapping, false);
}
+ @Test // DATAES-530
+ public void shouldAddStockPriceDocumentToIndex() {
+
+ // Given
+ IndexOperations indexOps = operations.indexOps(StockPrice.class);
+
+ // When
+ indexOps.create();
+ indexOps.putMapping(StockPrice.class);
+ String symbol = "AU";
+ double price = 2.34;
+ String id = "abc";
+
+ IndexCoordinates index = IndexCoordinates.of("test-index-stock-mapping-builder");
+ operations.index(buildIndex(StockPrice.builder() //
+ .id(id) //
+ .symbol(symbol) //
+ .price(BigDecimal.valueOf(price)) //
+ .build()), index);
+ operations.indexOps(StockPrice.class).refresh();
+
+ NativeSearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
+ SearchHits result = operations.search(searchQuery, StockPrice.class, index);
+
+ // Then
+ assertThat(result).hasSize(1);
+ StockPrice entry = result.getSearchHit(0).getContent();
+ assertThat(entry.getSymbol()).isEqualTo(symbol);
+ assertThat(entry.getPrice()).isCloseTo(BigDecimal.valueOf(price), Percentage.withPercentage(0.01));
+ }
+
@Test // DATAES-76
public void shouldBuildMappingWithSuperclass() throws JSONException {
@@ -106,35 +183,31 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
assertEquals(expected, mapping, false);
}
- @Test // DATAES-285
- public void shouldMapBooks() throws JSONException {
+ @Test // DATAES-76
+ public void shouldAddSampleInheritedEntityDocumentToIndex() {
+ // given
+ IndexCoordinates index = IndexCoordinates.of("test-index-sample-inherited-mapping-builder");
+ IndexOperations indexOps = operations.indexOps(index);
- String expected = "{\n" + //
- " \"properties\": {\n" + //
- " \"author\": {\n" + //
- " \"type\": \"object\",\n" + //
- " \"properties\": {}\n" + //
- " },\n" + //
- " \"buckets\": {\n" + //
- " \"type\": \"nested\"\n" + //
- " },\n" + //
- " \"description\": {\n" + //
- " \"type\": \"text\",\n" + //
- " \"analyzer\": \"whitespace\",\n" + //
- " \"fields\": {\n" + //
- " \"prefix\": {\n" + //
- " \"type\": \"text\",\n" + //
- " \"analyzer\": \"stop\",\n" + //
- " \"search_analyzer\": \"standard\"\n" + //
- " }\n" + //
- " }\n" + //
- " }\n" + //
- " }\n" + //
- "}"; //
+ // when
+ indexOps.create();
+ indexOps.putMapping(SampleInheritedEntity.class);
+ Date createdDate = new Date();
+ String message = "msg";
+ String id = "abc";
+ operations.index(new SampleInheritedEntityBuilder(id).createdDate(createdDate).message(message).buildIndex(),
+ index);
+ operations.indexOps(SampleInheritedEntity.class).refresh();
- String mapping = getMappingBuilder().buildPropertyMapping(Book.class);
+ NativeSearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build();
+ SearchHits result = operations.search(searchQuery, SampleInheritedEntity.class, index);
- assertEquals(expected, mapping, false);
+ // then
+ assertThat(result).hasSize(1);
+
+ SampleInheritedEntity entry = result.getSearchHit(0).getContent();
+ assertThat(entry.getCreatedDate()).isEqualTo(createdDate);
+ assertThat(entry.getMessage()).isEqualTo(message);
}
@Test // DATAES-568, DATAES-929
@@ -177,6 +250,101 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
assertEquals(expected, mapping, false);
}
+ @Test // DATAES-260 - StackOverflow when two reverse relationship.
+ public void shouldHandleReverseRelationship() {
+
+ // given
+ IndexOperations indexOpsUser = operations.indexOps(User.class);
+ indexOpsUser.create();
+ indexOpsUser.putMapping(User.class);
+
+ IndexOperations indexOpsGroup = operations.indexOps(Group.class);
+ indexOpsGroup.create();
+ indexOpsGroup.putMapping(Group.class);
+
+ // when
+
+ // then
+ }
+
+ @Test // DATAES-285
+ public void shouldMapBooks() {
+
+ // given
+ IndexOperations indexOps = operations.indexOps(Book.class);
+ indexOps.create();
+ indexOps.putMapping(Book.class);
+
+ // when
+
+ // then
+ }
+
+ @Test // DATAES-420
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public void shouldUseBothAnalyzer() {
+
+ // given
+ IndexOperations indexOps = this.operations.indexOps(Book.class);
+ indexOps.create();
+ indexOps.putMapping(Book.class);
+
+ // when
+ Map mapping = indexOps.getMapping();
+ Map descriptionMapping = (Map) ((Map) mapping.get("properties")).get("description");
+ Map prefixDescription = (Map) ((Map) descriptionMapping.get("fields")).get("prefix");
+
+ // then
+ assertThat(prefixDescription).hasSize(3);
+ assertThat(prefixDescription.get("type")).isEqualTo("text");
+ assertThat(prefixDescription.get("analyzer")).isEqualTo("stop");
+ assertThat(prefixDescription.get("search_analyzer")).isEqualTo("standard");
+ assertThat(descriptionMapping.get("type")).isEqualTo("text");
+ assertThat(descriptionMapping.get("analyzer")).isEqualTo("whitespace");
+ }
+
+ @Test // DATAES-492
+ @SuppressWarnings("rawtypes")
+ public void shouldUseKeywordNormalizer() {
+
+ // given
+ operations.createIndex(NormalizerEntity.class);
+ operations.putMapping(NormalizerEntity.class);
+
+ // when
+ Map mapping = operations.getMapping(NormalizerEntity.class);
+ Map properties = (Map) mapping.get("properties");
+ Map fieldName = (Map) properties.get("name");
+ Map fieldDescriptionLowerCase = (Map) ((Map) ((Map) properties.get("description")).get("fields")).get("lower_case");
+
+ // then
+ assertThat(fieldName.get("type")).isEqualTo("keyword");
+ assertThat(fieldName.get("normalizer")).isEqualTo("lower_case_normalizer");
+ assertThat(fieldDescriptionLowerCase.get("type")).isEqualTo("keyword");
+ assertThat(fieldDescriptionLowerCase.get("normalizer")).isEqualTo("lower_case_normalizer");
+ }
+
+ @Test // DATAES-503
+ @SuppressWarnings("rawtypes")
+ public void shouldUseCopyTo() {
+
+ // given
+ IndexOperations indexOps = operations.indexOps(CopyToEntity.class);
+ indexOps.create();
+ indexOps.putMapping(CopyToEntity.class);
+
+ // when
+ Map mapping = indexOps.getMapping();
+ Map properties = (Map) mapping.get("properties");
+ Map fieldFirstName = (Map) properties.get("firstName");
+ Map fieldLastName = (Map) properties.get("lastName");
+
+ // then
+ List copyToValue = Collections.singletonList("name");
+ assertThat(fieldFirstName.get("copy_to")).isEqualTo(copyToValue);
+ assertThat(fieldLastName.get("copy_to")).isEqualTo(copyToValue);
+ }
+
@Test // DATAES-568
public void shouldUseFieldNameOnId() throws JSONException {
@@ -495,6 +663,7 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
/**
* @author Peter-Josef Meisch
*/
+ @SuppressWarnings("unused")
static class FieldNameEntity {
@Document(indexName = "fieldname-index")
@@ -680,6 +849,40 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
}
}
+ /**
+ * @author Kevin Leturc
+ */
+ static class SampleInheritedEntityBuilder {
+
+ private final SampleInheritedEntity result;
+
+ public SampleInheritedEntityBuilder(String id) {
+ result = new SampleInheritedEntity();
+ result.setId(id);
+ }
+
+ public SampleInheritedEntityBuilder createdDate(Date createdDate) {
+ result.setCreatedDate(createdDate);
+ return this;
+ }
+
+ public SampleInheritedEntityBuilder message(String message) {
+ result.setMessage(message);
+ return this;
+ }
+
+ public SampleInheritedEntity build() {
+ return result;
+ }
+
+ public IndexQuery buildIndex() {
+ IndexQuery indexQuery = new IndexQuery();
+ indexQuery.setId(Objects.requireNonNull(result.getId()));
+ indexQuery.setObject(result);
+ return indexQuery;
+ }
+ }
+
/**
* @author Artur Konczak
* @author Mohsin Husen
@@ -737,7 +940,7 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
@Nullable @Field(type = Text, index = false, store = true, analyzer = "standard") private String message;
- @Nullable @Transient private NestedEntity nested;
+ @Nullable @Transient private SampleTransientEntity.NestedEntity nested;
@Nullable
public String getId() {
@@ -759,14 +962,14 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
static class NestedEntity {
- @Field private static NestedEntity someField = new NestedEntity();
+ @Field private static SampleTransientEntity.NestedEntity someField = new SampleTransientEntity.NestedEntity();
@Nullable @Field private Boolean something;
- public NestedEntity getSomeField() {
+ public SampleTransientEntity.NestedEntity getSomeField() {
return someField;
}
- public void setSomeField(NestedEntity someField) {
+ public void setSomeField(SampleTransientEntity.NestedEntity someField) {
NestedEntity.someField = someField;
}
diff --git a/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/ElasticsearchRestTemplateConfiguration.java b/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/ElasticsearchRestTemplateConfiguration.java
index 2a6b54633..a3369cef3 100644
--- a/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/ElasticsearchRestTemplateConfiguration.java
+++ b/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/ElasticsearchRestTemplateConfiguration.java
@@ -55,8 +55,8 @@ public class ElasticsearchRestTemplateConfiguration extends AbstractElasticsearc
}
return RestClients.create(configurationBuilder //
- .withConnectTimeout(Duration.ofSeconds(20)) //
- .withSocketTimeout(Duration.ofSeconds(20)) //
+ .withConnectTimeout(Duration.ofSeconds(5)) //
+ .withSocketTimeout(Duration.ofSeconds(3)) //
.build()) //
.rest();
}
diff --git a/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/IntegrationTest.java b/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/IntegrationTest.java
index af3cc5920..4af516887 100644
--- a/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/IntegrationTest.java
+++ b/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/IntegrationTest.java
@@ -20,7 +20,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.extension.ExtendWith;
/**
@@ -31,6 +30,5 @@ import org.junit.jupiter.api.extension.ExtendWith;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@ExtendWith(SpringDataElasticsearchExtension.class)
-@Tag(Tags.INTEGRATION_TEST)
public @interface IntegrationTest {
}
diff --git a/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/ReactiveElasticsearchRestTemplateConfiguration.java b/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/ReactiveElasticsearchRestTemplateConfiguration.java
index a1761d125..df8533c44 100644
--- a/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/ReactiveElasticsearchRestTemplateConfiguration.java
+++ b/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/ReactiveElasticsearchRestTemplateConfiguration.java
@@ -15,8 +15,6 @@
*/
package org.springframework.data.elasticsearch.junit.jupiter;
-import java.time.Duration;
-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
@@ -47,9 +45,7 @@ public class ReactiveElasticsearchRestTemplateConfiguration extends AbstractReac
.usingSsl();
}
- return ReactiveRestClients.create(configurationBuilder //
- .withConnectTimeout(Duration.ofSeconds(20)) //
- .withSocketTimeout(Duration.ofSeconds(20)) //
- .build());
+ return ReactiveRestClients.create(configurationBuilder.build());
+
}
}
diff --git a/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/SpringIntegrationTest.java b/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/SpringIntegrationTest.java
index a1744d3ee..e23605523 100644
--- a/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/SpringIntegrationTest.java
+++ b/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/SpringIntegrationTest.java
@@ -20,7 +20,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -33,6 +32,5 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
@Target(ElementType.TYPE)
@ExtendWith(SpringDataElasticsearchExtension.class)
@ExtendWith(SpringExtension.class)
-@Tag(Tags.INTEGRATION_TEST)
public @interface SpringIntegrationTest {
}
diff --git a/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/Tags.java b/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/Tags.java
deleted file mode 100644
index ce16af720..000000000
--- a/src/test/java/org/springframework/data/elasticsearch/junit/jupiter/Tags.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 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.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.data.elasticsearch.junit.jupiter;
-
-/**
- * @author Peter-Josef Meisch
- */
-public interface Tags {
- String INTEGRATION_TEST = "integration-test";
-}
diff --git a/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/CdiRepositoryTests.java b/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/CdiRepositoryTests.java
index b69af81e9..b4e12beff 100644
--- a/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/CdiRepositoryTests.java
+++ b/src/test/java/org/springframework/data/elasticsearch/repositories/cdi/CdiRepositoryTests.java
@@ -35,13 +35,14 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.InnerField;
import org.springframework.data.elasticsearch.annotations.MultiField;
-import org.springframework.data.elasticsearch.junit.jupiter.IntegrationTest;
+import org.springframework.data.elasticsearch.junit.jupiter.SpringDataElasticsearchExtension;
import org.springframework.lang.Nullable;
/**
@@ -50,7 +51,7 @@ import org.springframework.lang.Nullable;
* @author Christoph Strobl
* @author Peter-Josef Meisch
*/
-@IntegrationTest
+@ExtendWith(SpringDataElasticsearchExtension.class)
public class CdiRepositoryTests {
@Nullable private static CdiTestContainer cdiContainer;