diff --git a/Jenkinsfile b/Jenkinsfile index 1d2500ed1e..2cff32bd73 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { triggers { pollSCM 'H/10 * * * *' - upstream(upstreamProjects: "spring-data-commons/main", threshold: hudson.model.Result.SUCCESS) + upstream(upstreamProjects: "spring-data-commons/4.0.x", threshold: hudson.model.Result.SUCCESS) } options { diff --git a/ci/pipeline.properties b/ci/pipeline.properties index ed898052b1..9ce2972a2e 100644 --- a/ci/pipeline.properties +++ b/ci/pipeline.properties @@ -14,11 +14,12 @@ docker.mongodb.8.0.version=8.0.9 # Supported versions of Redis docker.redis.6.version=6.2.13 docker.redis.7.version=7.2.4 +docker.redis.8.version=8.2.2 docker.valkey.8.version=8.1.1 # Docker environment settings -docker.java.inside.basic=-v $HOME:/tmp/jenkins-home -docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home +docker.java.inside.basic=-v $HOME:/tmp/jenkins-home --ulimit nofile=32000:32000 +docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v $HOME:/tmp/jenkins-home --ulimit nofile=32000:32000 # Credentials docker.registry= diff --git a/pom.xml b/pom.xml index c81bc28cc1..bed7844eec 100644 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ org.springframework.data spring-data-elasticsearch - 6.0.0 + 6.0.2-SNAPSHOT org.springframework.data.build spring-data-parent - 4.0.0 + 4.0.2-SNAPSHOT Spring Data Elasticsearch @@ -18,11 +18,11 @@ https://github.com/spring-projects/spring-data-elasticsearch - 4.0.0 + 4.0.2-SNAPSHOT - 9.2.1 - 9.2.1 + 9.2.2 + 9.2.2 0.20.2 2.25.1 @@ -91,6 +91,27 @@ https://github.com/spring-projects/spring-data-elasticsearch/issues + + + + + + org.apache.commons + commons-lang3 + 3.19.0 + test + + + + commons-io + commons-io + 2.20.0 + test + + + + + @@ -301,21 +322,6 @@ test - - - org.apache.xbean - xbean-asm5-shaded - 4.5 - test - - - - javax.servlet - javax.servlet-api - 3.1.0 - test - - org.mockito mockito-junit-jupiter @@ -323,27 +329,12 @@ test - - org.apache.commons - commons-lang3 - 3.19.0 - test - - org.testcontainers testcontainers-elasticsearch test - - - commons-codec - commons-codec - 1.15 - test - - com.tngtech.archunit archunit-junit5 @@ -489,8 +480,20 @@ - - + + spring-snapshot + https://repo.spring.io/snapshot + + true + + + false + + + + spring-milestone + https://repo.spring.io/milestone + diff --git a/src/main/antora/modules/ROOT/pages/elasticsearch/clients.adoc b/src/main/antora/modules/ROOT/pages/elasticsearch/clients.adoc index 40cd834484..a44ea36494 100644 --- a/src/main/antora/modules/ROOT/pages/elasticsearch/clients.adoc +++ b/src/main/antora/modules/ROOT/pages/elasticsearch/clients.adoc @@ -461,7 +461,7 @@ To see what is actually sent to and received from the server `Request` / `Respon This can be enabled in the Elasticsearch client by setting the level of the `co.elastic.clients.transport.rest5_client.low_level.Request` package to "trace" (see https://www.elastic.co/docs/reference/elasticsearch/clients/java/transport/rest5-client/usage/logging) -.Enable transport layer logging +.Enable transport layer logging [tabs] ====== XML:: @@ -485,4 +485,4 @@ ini:: ---- logging.level.co.elastic.clients.transport.rest5_client.low_level.Request=trace ---- -===== +====== diff --git a/src/main/antora/modules/ROOT/pages/elasticsearch/elasticsearch-new.adoc b/src/main/antora/modules/ROOT/pages/elasticsearch/elasticsearch-new.adoc index 8d187634a0..e04b6dfb36 100644 --- a/src/main/antora/modules/ROOT/pages/elasticsearch/elasticsearch-new.adoc +++ b/src/main/antora/modules/ROOT/pages/elasticsearch/elasticsearch-new.adoc @@ -6,7 +6,7 @@ * Upgrade to Spring 7 * Switch to jspecify nullability annotations -* Upgrade to Elasticsearch 9.2.1 +* Upgrade to Elasticsearch 9.2.2 * Use the new Elasticsearch Rest5Client as default * Add support for SpEL expressions in the `settingPath` parameter of the `@Setting` annotation diff --git a/src/main/antora/modules/ROOT/pages/elasticsearch/versions.adoc b/src/main/antora/modules/ROOT/pages/elasticsearch/versions.adoc index 9af35a7749..93bdc14bfc 100644 --- a/src/main/antora/modules/ROOT/pages/elasticsearch/versions.adoc +++ b/src/main/antora/modules/ROOT/pages/elasticsearch/versions.adoc @@ -6,7 +6,7 @@ The following table shows the Elasticsearch and Spring versions that are used by [cols="^,^,^,^",options="header"] |=== | Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework -| 2025.1 | 6.0.x | 9.2.1 | 7.0.x +| 2025.1 | 6.0.x | 9.2.2 | 7.0.x | 2025.0 | 5.5.x | 8.18.1 | 6.2.x | 2024.1 | 5.4.xfootnote:oom[Out of maintenance] | 8.15.5 | 6.1.x | 2024.0 | 5.3.xfootnote:oom[] | 8.13.4 | 6.1.x diff --git a/src/main/java/org/springframework/data/elasticsearch/client/elc/aot/ElasticsearchClientRuntimeHints.java b/src/main/java/org/springframework/data/elasticsearch/client/elc/aot/ElasticsearchClientRuntimeHints.java index 2c177a13ac..8c6bc14c52 100644 --- a/src/main/java/org/springframework/data/elasticsearch/client/elc/aot/ElasticsearchClientRuntimeHints.java +++ b/src/main/java/org/springframework/data/elasticsearch/client/elc/aot/ElasticsearchClientRuntimeHints.java @@ -24,6 +24,7 @@ import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.aot.hint.TypeReference; +import org.springframework.util.ClassUtils; /** * runtime hints for the Elasticsearch client libraries, as these do not provide any of their own. @@ -37,20 +38,20 @@ public class ElasticsearchClientRuntimeHints implements RuntimeHintsRegistrar { public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { hints.reflection() - .registerType(TypeReference.of(IndexSettings.class), builder -> builder.withField("_DESERIALIZER")) // - .registerType(TypeReference.of(PutMappingRequest.class), builder -> builder.withField("_DESERIALIZER")) // - .registerType(TypeReference.of(RuntimeFieldType.class), builder -> builder.withField("_DESERIALIZER"))// - .registerType(TypeReference.of(TypeMapping.class), builder -> builder.withField("_DESERIALIZER")) // - ; + .registerType(TypeReference.of(IndexSettings.class), builder -> builder.withField("_DESERIALIZER")) + .registerType(TypeReference.of(PutMappingRequest.class), builder -> builder.withField("_DESERIALIZER")) + .registerType(TypeReference.of(RuntimeFieldType.class), builder -> builder.withField("_DESERIALIZER")) + .registerType(TypeReference.of(TypeMapping.class), builder -> builder.withField("_DESERIALIZER")); - hints.serialization() // - .registerType(org.apache.http.impl.auth.BasicScheme.class) // - .registerType(org.apache.http.impl.auth.RFC2617Scheme.class) // - .registerType(java.util.HashMap.class) // - ; + if (ClassUtils.isPresent("org.apache.http.impl.auth.BasicScheme", + ElasticsearchClientRuntimeHints.class.getClassLoader())) { + hints.serialization() + .registerType(org.apache.http.impl.auth.BasicScheme.class) + .registerType(org.apache.http.impl.auth.RFC2617Scheme.class) + .registerType(java.util.HashMap.class); + } hints.resources() // - .registerPattern("co/elastic/clients/version.properties") // - ; + .registerPattern("co/elastic/clients/version.properties"); } } diff --git a/src/main/java/org/springframework/data/elasticsearch/core/query/UpdateQuery.java b/src/main/java/org/springframework/data/elasticsearch/core/query/UpdateQuery.java index e3e0db6220..7e2dcfdab9 100644 --- a/src/main/java/org/springframework/data/elasticsearch/core/query/UpdateQuery.java +++ b/src/main/java/org/springframework/data/elasticsearch/core/query/UpdateQuery.java @@ -438,8 +438,8 @@ public Builder withScriptName(String scriptName) { public UpdateQuery build() { - if (script == null && document == null && query == null) { - throw new IllegalArgumentException("either script, document or query must be set"); + if (script == null && scriptName == null && document == null && query == null) { + throw new IllegalArgumentException("either script, scriptName, document or query must be set"); } return new UpdateQuery(id, script, params, document, upsert, lang, routing, scriptedUpsert, docAsUpsert, diff --git a/src/main/resources/notice.txt b/src/main/resources/notice.txt index eeb29799e7..27985bb3fe 100644 --- a/src/main/resources/notice.txt +++ b/src/main/resources/notice.txt @@ -1,4 +1,4 @@ -Spring Data Elasticsearch 6.0 GA (2025.1.0) +Spring Data Elasticsearch 6.0.1 (2025.1.1) Copyright (c) [2013-2022] Pivotal Software, Inc. This product is licensed to you under the Apache License, Version 2.0 (the "License"). @@ -16,3 +16,4 @@ conditions of the subcomponent's license, as noted in the LICENSE file. + diff --git a/src/test/java/org/springframework/data/elasticsearch/client/elc/ElasticsearchPartQueryELCIntegrationTests.java b/src/test/java/org/springframework/data/elasticsearch/client/elc/ElasticsearchPartQueryELCIntegrationTests.java index 40f7dd7cee..777e77a77d 100644 --- a/src/test/java/org/springframework/data/elasticsearch/client/elc/ElasticsearchPartQueryELCIntegrationTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/client/elc/ElasticsearchPartQueryELCIntegrationTests.java @@ -21,14 +21,16 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates; -import org.springframework.data.elasticsearch.core.query.RepositoryPartQueryIntegrationTests; import org.springframework.data.elasticsearch.core.query.Query; +import org.springframework.data.elasticsearch.core.query.RepositoryPartQueryIntegrationTests; import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchTemplateConfiguration; +import org.springframework.test.context.ContextConfiguration; /** * @author Peter-Josef Meisch * @since 4.4 */ +@ContextConfiguration(classes = ElasticsearchPartQueryELCIntegrationTests.Config.class) public class ElasticsearchPartQueryELCIntegrationTests extends RepositoryPartQueryIntegrationTests { @Configuration diff --git a/src/test/java/org/springframework/data/elasticsearch/config/notnested/EnableRepositoriesELCIntegrationTests.java b/src/test/java/org/springframework/data/elasticsearch/config/notnested/EnableRepositoriesELCIntegrationTests.java index 9a56b59526..df0a02e9ee 100644 --- a/src/test/java/org/springframework/data/elasticsearch/config/notnested/EnableRepositoriesELCIntegrationTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/config/notnested/EnableRepositoriesELCIntegrationTests.java @@ -21,11 +21,13 @@ import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchTemplateConfiguration; import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; import org.springframework.data.elasticsearch.utils.IndexNameProvider; +import org.springframework.test.context.ContextConfiguration; /** * @author Peter-Josef Meisch * @since 4.4 */ +@ContextConfiguration(classes = EnableRepositoriesELCIntegrationTests.Config.class) public class EnableRepositoriesELCIntegrationTests extends EnableRepositoriesIntegrationTests { @Configuration diff --git a/src/test/java/org/springframework/data/elasticsearch/core/IndexSettingsELCIntegrationTests.java b/src/test/java/org/springframework/data/elasticsearch/core/IndexSettingsELCIntegrationTests.java index d9d043b31a..6e72839894 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/IndexSettingsELCIntegrationTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/IndexSettingsELCIntegrationTests.java @@ -4,8 +4,11 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchTemplateConfiguration; +import org.springframework.test.context.ContextConfiguration; +@ContextConfiguration(classes = { IndexSettingsELCIntegrationTests.Config.class }) public class IndexSettingsELCIntegrationTests extends IndexSettingsIntegrationTests { + @Configuration @Import({ ElasticsearchTemplateConfiguration.class }) static class Config { @@ -14,4 +17,5 @@ public SpelSettingPath spelSettingPath() { return new SpelSettingPath(); } } + } diff --git a/src/test/java/org/springframework/data/elasticsearch/core/query/UpdateQueryTest.java b/src/test/java/org/springframework/data/elasticsearch/core/query/UpdateQueryTest.java new file mode 100644 index 0000000000..2f4a780d13 --- /dev/null +++ b/src/test/java/org/springframework/data/elasticsearch/core/query/UpdateQueryTest.java @@ -0,0 +1,45 @@ +package org.springframework.data.elasticsearch.core.query; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.data.elasticsearch.core.document.Document; + +class UpdateQueryTest { + + @Test // #3205 + @DisplayName("should build query with only a script") + void shouldBuildQueryWithOnlyAScript() { + + UpdateQuery.builder("id") + .withScript("script") + .build(); + } + + @Test // #3205 + @DisplayName("should build query with only a scriptname") + void shouldBuildQueryWithOnlyAScriptName() { + + UpdateQuery.builder("id") + .withScriptName("scriptname") + .build(); + } + + @Test // #3205 + @DisplayName("should build query with only a document") + void shouldBuildQueryWithOnlyASDocument() { + + UpdateQuery.builder("id") + .withDocument(Document.create()) + .build(); + } + + @Test // #3205 + @DisplayName("should build query with only a query") + void shouldBuildQueryWithOnlyAQuery() { + + Query query = StringQuery.builder("StrignQuery").build(); + + UpdateQuery.builder(query) + .build(); + } +} diff --git a/src/test/resources/testcontainers-elasticsearch.properties b/src/test/resources/testcontainers-elasticsearch.properties index 50a4672066..5812e2c9a8 100644 --- a/src/test/resources/testcontainers-elasticsearch.properties +++ b/src/test/resources/testcontainers-elasticsearch.properties @@ -15,7 +15,7 @@ # # sde.testcontainers.image-name=docker.elastic.co/elasticsearch/elasticsearch -sde.testcontainers.image-version=9.2.1 +sde.testcontainers.image-version=9.2.2 # # # needed as we do a DELETE /* at the end of the tests, will be required from 8.0 on, produces a warning since 7.13