1
0
mirror of synced 2026-05-23 12:43:17 +00:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Jens Schauder 167f2246d3 Release version 5.2.10 (2023.1.10).
See #2965
2024-09-13 10:50:08 +02:00
Jens Schauder f09ce87f0e Prepare 5.2.10 (2023.1.10).
See #2965
2024-09-13 10:49:51 +02:00
Peter-Josef Meisch 1d5c78a06a Remove Blockhound
Original Pull Request #2978
Closes #2977

(cherry picked from commit d06c122fd5)
(cherry picked from commit 8117e5a174)
2024-09-04 18:19:22 +02:00
Peter-Josef Meisch 5a2dcd3b01 Add excludeFromSource handling to multifield.
Original Pull Request #2975
Closes #2971

(cherry picked from commit 555b570246)
(cherry picked from commit a179dd0643)
2024-08-31 21:36:11 +02:00
Jens Schauder 74b05d21b5 After release cleanups.
See #2938
2024-08-16 09:01:34 +02:00
Jens Schauder 1895219322 Prepare next development iteration.
See #2938
2024-08-16 09:01:33 +02:00
7 changed files with 57 additions and 159 deletions
+3 -30
View File
@@ -5,12 +5,12 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>5.2.9</version>
<version>5.2.10</version>
<parent>
<groupId>org.springframework.data.build</groupId>
<artifactId>spring-data-parent</artifactId>
<version>3.2.9</version>
<version>3.2.10</version>
</parent>
<name>Spring Data Elasticsearch</name>
@@ -18,12 +18,11 @@
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
<properties>
<springdata.commons>3.2.9</springdata.commons>
<springdata.commons>3.2.10</springdata.commons>
<!-- version of the ElasticsearchClient -->
<elasticsearch-java>8.11.4</elasticsearch-java>
<blockhound-junit>1.0.8.RELEASE</blockhound-junit>
<hoverfly>0.14.4</hoverfly>
<log4j>2.18.0</log4j>
<jsonassert>1.5.1</jsonassert>
@@ -248,13 +247,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor.tools</groupId>
<artifactId>blockhound-junit-platform</artifactId>
<version>${blockhound-junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
@@ -436,25 +428,6 @@
</build>
</profile>
<profile>
<id>jdk13+</id>
<!-- on jDK13+, Blockhound needs this JVM flag set -->
<activation>
<jdk>[13,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-XX:+AllowRedefinitionToAddDeleteMethods</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>antora-process-resources</id>
<build>
@@ -334,8 +334,10 @@ public class MappingBuilder {
: nestedPropertyPrefix + '.' + property.getFieldName();
Field fieldAnnotation = property.findAnnotation(Field.class);
MultiField multiFieldAnnotation = property.findAnnotation(MultiField.class);
if (fieldAnnotation != null && fieldAnnotation.excludeFromSource()) {
if ((fieldAnnotation != null && fieldAnnotation.excludeFromSource()) ||
multiFieldAnnotation != null && multiFieldAnnotation.mainField().excludeFromSource()) {
excludeFromSource.add(nestedPropertyPath);
}
@@ -366,8 +368,6 @@ public class MappingBuilder {
}
}
MultiField multiField = property.findAnnotation(MultiField.class);
if (isCompletionProperty) {
CompletionField completionField = property.findAnnotation(CompletionField.class);
applyCompletionFieldMapping(propertiesNode, property, completionField);
@@ -375,8 +375,8 @@ public class MappingBuilder {
if (isRootObject && fieldAnnotation != null && property.isIdProperty()) {
applyDefaultIdFieldMapping(propertiesNode, property);
} else if (multiField != null) {
addMultiFieldMapping(propertiesNode, property, multiField, isNestedOrObjectProperty, dynamicMapping);
} else if (multiFieldAnnotation != null) {
addMultiFieldMapping(propertiesNode, property, multiFieldAnnotation, isNestedOrObjectProperty, dynamicMapping);
} else if (fieldAnnotation != null) {
addSingleFieldMapping(propertiesNode, property, fieldAnnotation, isNestedOrObjectProperty, dynamicMapping);
}
+2 -1
View File
@@ -1,4 +1,4 @@
Spring Data Elasticsearch 5.2.9 (2023.1.9)
Spring Data Elasticsearch 5.2.10 (2023.1.10)
Copyright (c) [2013-2022] Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").
@@ -27,3 +27,4 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
@@ -1,43 +0,0 @@
/*
* Copyright 2021-2024 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.blockhound;
import reactor.blockhound.BlockHound;
import reactor.blockhound.BlockingOperationError;
import reactor.blockhound.integration.BlockHoundIntegration;
/**
* @author Peter-Josef Meisch
*/
public class BlockHoundIntegrationCustomizer implements BlockHoundIntegration {
@Override
public void applyTo(BlockHound.Builder builder) {
// Elasticsearch classes reading from the classpath on initialization, needed for parsing Elasticsearch responses
builder //
.allowBlockingCallsInside("org.elasticsearch.Build", "<clinit>") //
.allowBlockingCallsInside("org.elasticsearch.common.xcontent.XContentBuilder", "<clinit>") // pre 7.16
.allowBlockingCallsInside("org.elasticsearch.common.XContentBuilder", "<clinit>") // from 7.16 on
.allowBlockingCallsInside("org.elasticsearch.xcontent.json.JsonXContent", "contentBuilder") // from 7.16 on
.allowBlockingCallsInside("jakarta.json.spi.JsonProvider", "provider") //
;
builder.blockingMethodCallback(it -> {
new Error(it.toString()).printStackTrace();
throw new BlockingOperationError(it);
});
}
}
@@ -1,47 +0,0 @@
/*
* Copyright 2021-2024 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.blockhound;
import static org.assertj.core.api.Assertions.*;
import reactor.blockhound.BlockingOperationError;
import reactor.core.publisher.Mono;
import java.time.Duration;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
/**
* @author Peter-Josef Meisch
*/
public class BlockHoundTests {
@Test // #1822
@DisplayName("should fail if BlockHound is not installed")
void shouldFailIfBlockHoundIsNotInstalled() {
assertThatThrownBy(() -> {
Mono.delay(Duration.ofMillis(1)).doOnNext(it -> {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}).block(); // should throw an exception about Thread.sleep
}).hasCauseInstanceOf(BlockingOperationError.class);
}
}
@@ -1095,38 +1095,49 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
String expected = """
{
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"excluded-date": {
"type": "date",
"format": "date"
},
"nestedEntity": {
"type": "nested",
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"excluded-text": {
"type": "text"
}
}
}
},
"_source": {
"excludes": [
"excluded-date",
"nestedEntity.excluded-text"
]
}
}
"""; //
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"excluded-date": {
"type": "date",
"format": "date"
},
"nestedEntity": {
"type": "nested",
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"excluded-text": {
"type": "text"
}
}
},
"excluded-multifield": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
},
"_source": {
"excludes": [
"excluded-date",
"nestedEntity.excluded-text",
"excluded-multifield"
]
}
}
"""; //
String mapping = getMappingBuilder().buildPropertyMapping(ExcludedFieldEntity.class);
@@ -2367,6 +2378,10 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
excludeFromSource = true) private LocalDate excludedDate;
@Nullable
@Field(type = Nested) private NestedExcludedFieldEntity nestedEntity;
@Nullable
@MultiField(mainField = @Field(name = "excluded-multifield", type = Text, excludeFromSource = true), otherFields = {
@InnerField(suffix = "keyword", type = Keyword)
}) private String excludedMultifield;
}
@SuppressWarnings("unused")
@@ -1 +0,0 @@
org.springframework.data.elasticsearch.blockhound.BlockHoundIntegrationCustomizer