Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1a587692f | ||
|
|
48353d18ae | ||
|
|
651e5603a6 | ||
|
|
72170c3291 | ||
|
|
a8dbfb96cf | ||
|
|
82917db02f | ||
|
|
e581d9d208 | ||
|
|
d21dddf004 |
4
.mvn/wrapper/maven-wrapper.properties
vendored
4
.mvn/wrapper/maven-wrapper.properties
vendored
@@ -1,2 +1,2 @@
|
|||||||
#Tue Jun 13 08:52:05 CEST 2023
|
#Mon Jul 03 09:46:32 CEST 2023
|
||||||
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.2/apache-maven-3.9.2-bin.zip
|
distributionUrl=https\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Java versions
|
# Java versions
|
||||||
java.main.tag=17.0.6_10-jdk-focal
|
java.main.tag=17.0.7_7-jdk-focal
|
||||||
java.next.tag=20-jdk-jammy
|
java.next.tag=20-jdk-jammy
|
||||||
|
|
||||||
# Docker container images - standard
|
# Docker container images - standard
|
||||||
@@ -7,15 +7,15 @@ docker.java.main.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/ecli
|
|||||||
docker.java.next.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.next.tag}
|
docker.java.next.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.next.tag}
|
||||||
|
|
||||||
# Supported versions of MongoDB
|
# Supported versions of MongoDB
|
||||||
docker.mongodb.4.4.version=4.4.18
|
docker.mongodb.4.4.version=4.4.22
|
||||||
docker.mongodb.5.0.version=5.0.14
|
docker.mongodb.5.0.version=5.0.18
|
||||||
docker.mongodb.6.0.version=6.0.4
|
docker.mongodb.6.0.version=6.0.7
|
||||||
|
|
||||||
# Supported versions of Redis
|
# Supported versions of Redis
|
||||||
docker.redis.6.version=6.2.10
|
docker.redis.6.version=6.2.12
|
||||||
|
|
||||||
# Supported versions of Cassandra
|
# Supported versions of Cassandra
|
||||||
docker.cassandra.3.version=3.11.14
|
docker.cassandra.3.version=3.11.15
|
||||||
|
|
||||||
# Docker environment settings
|
# Docker environment settings
|
||||||
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
|
docker.java.inside.basic=-v $HOME:/tmp/jenkins-home
|
||||||
|
|||||||
6
pom.xml
6
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||||
<version>4.0.7</version>
|
<version>4.0.8</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>Spring Data MongoDB</name>
|
<name>Spring Data MongoDB</name>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data.build</groupId>
|
<groupId>org.springframework.data.build</groupId>
|
||||||
<artifactId>spring-data-parent</artifactId>
|
<artifactId>spring-data-parent</artifactId>
|
||||||
<version>3.0.7</version>
|
<version>3.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.type>multi</project.type>
|
<project.type>multi</project.type>
|
||||||
<dist.id>spring-data-mongodb</dist.id>
|
<dist.id>spring-data-mongodb</dist.id>
|
||||||
<springdata.commons>3.0.7</springdata.commons>
|
<springdata.commons>3.0.8</springdata.commons>
|
||||||
<mongo>4.8.2</mongo>
|
<mongo>4.8.2</mongo>
|
||||||
<mongo.reactivestreams>${mongo}</mongo.reactivestreams>
|
<mongo.reactivestreams>${mongo}</mongo.reactivestreams>
|
||||||
<jmh.version>1.19</jmh.version>
|
<jmh.version>1.19</jmh.version>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||||
<version>4.0.7</version>
|
<version>4.0.8</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||||
<version>4.0.7</version>
|
<version>4.0.8</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-mongodb-parent</artifactId>
|
<artifactId>spring-data-mongodb-parent</artifactId>
|
||||||
<version>4.0.7</version>
|
<version>4.0.8</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -1074,7 +1074,7 @@ public class QueryMapper {
|
|||||||
protected static class MetadataBackedField extends Field {
|
protected static class MetadataBackedField extends Field {
|
||||||
|
|
||||||
private static final Pattern POSITIONAL_PARAMETER_PATTERN = Pattern.compile("\\.\\$(\\[.*?\\])?");
|
private static final Pattern POSITIONAL_PARAMETER_PATTERN = Pattern.compile("\\.\\$(\\[.*?\\])?");
|
||||||
private static final Pattern DOT_POSITIONAL_PATTERN = Pattern.compile("\\.\\d+(?!$)");
|
private static final Pattern NUMERIC_SEGMENT = Pattern.compile("\\d+");
|
||||||
private static final String INVALID_ASSOCIATION_REFERENCE = "Invalid path reference %s; Associations can only be pointed to directly or via their id property";
|
private static final String INVALID_ASSOCIATION_REFERENCE = "Invalid path reference %s; Associations can only be pointed to directly or via their id property";
|
||||||
|
|
||||||
private final MongoPersistentEntity<?> entity;
|
private final MongoPersistentEntity<?> entity;
|
||||||
@@ -1216,14 +1216,13 @@ public class QueryMapper {
|
|||||||
private PersistentPropertyPath<MongoPersistentProperty> getPath(String pathExpression,
|
private PersistentPropertyPath<MongoPersistentProperty> getPath(String pathExpression,
|
||||||
@Nullable MongoPersistentProperty sourceProperty) {
|
@Nullable MongoPersistentProperty sourceProperty) {
|
||||||
|
|
||||||
String rawPath = removePlaceholders(POSITIONAL_OPERATOR,
|
|
||||||
removePlaceholders(DOT_POSITIONAL_PATTERN, pathExpression));
|
|
||||||
|
|
||||||
if (sourceProperty != null && sourceProperty.getOwner().equals(entity)) {
|
if (sourceProperty != null && sourceProperty.getOwner().equals(entity)) {
|
||||||
return mappingContext.getPersistentPropertyPath(
|
return mappingContext.getPersistentPropertyPath(
|
||||||
PropertyPath.from(Pattern.quote(sourceProperty.getName()), entity.getTypeInformation()));
|
PropertyPath.from(Pattern.quote(sourceProperty.getName()), entity.getTypeInformation()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String rawPath = resolvePath(pathExpression);
|
||||||
|
|
||||||
PropertyPath path = forName(rawPath);
|
PropertyPath path = forName(rawPath);
|
||||||
if (path == null || isPathToJavaLangClassProperty(path)) {
|
if (path == null || isPathToJavaLangClassProperty(path)) {
|
||||||
return null;
|
return null;
|
||||||
@@ -1318,6 +1317,38 @@ public class QueryMapper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String resolvePath(String source) {
|
||||||
|
|
||||||
|
String[] segments = source.split("\\.");
|
||||||
|
if (segments.length == 1) {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> path = new ArrayList<>(segments.length);
|
||||||
|
|
||||||
|
/* always start from a property, so we can skip the first segment.
|
||||||
|
from there remove any position placeholder */
|
||||||
|
for(int i=1; i < segments.length; i++) {
|
||||||
|
String segment = segments[i];
|
||||||
|
if (segment.startsWith("[") && segment.endsWith("]")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (NUMERIC_SEGMENT.matcher(segment).matches()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
path.add(segment);
|
||||||
|
}
|
||||||
|
|
||||||
|
// when property is followed only by placeholders eg. 'values.0.3.90'
|
||||||
|
// or when there is no difference in the number of segments
|
||||||
|
if (path.isEmpty() || segments.length == path.size() + 1) {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
path.add(0, segments[0]);
|
||||||
|
return StringUtils.collectionToDelimitedString(path, ".");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@link Converter} to be used to created the mapped key. Default implementation will use
|
* Return the {@link Converter} to be used to created the mapped key. Default implementation will use
|
||||||
* {@link PropertyToFieldNameConverter}.
|
* {@link PropertyToFieldNameConverter}.
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ import org.bson.types.ObjectId;
|
|||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
@@ -1213,24 +1215,26 @@ class UpdateMapperUnitTests {
|
|||||||
assertThat(mappedUpdate).isEqualTo(new org.bson.Document("$set", new org.bson.Document("levelOne.a.b.d", "e")));
|
assertThat(mappedUpdate).isEqualTo(new org.bson.Document("$set", new org.bson.Document("levelOne.a.b.d", "e")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // GH-3775
|
@ParameterizedTest // GH-3775, GH-4426
|
||||||
void mapNestedIntegerFieldCorrectly() {
|
@ValueSource(strings = {"levelOne.0.1.3", "levelOne.0.1.32", "levelOne2.0.1.32", "levelOne2.0.1.320"})
|
||||||
|
void mapNestedIntegerFieldCorrectly(String path) {
|
||||||
|
|
||||||
Update update = new Update().set("levelOne.0.1.3", "4");
|
Update update = new Update().set(path, "4");
|
||||||
Document mappedUpdate = mapper.getMappedObject(update.getUpdateObject(),
|
Document mappedUpdate = mapper.getMappedObject(update.getUpdateObject(),
|
||||||
context.getPersistentEntity(EntityWithNestedMap.class));
|
context.getPersistentEntity(EntityWithNestedMap.class));
|
||||||
|
|
||||||
assertThat(mappedUpdate).isEqualTo(new org.bson.Document("$set", new org.bson.Document("levelOne.0.1.3", "4")));
|
assertThat(mappedUpdate).isEqualTo(new org.bson.Document("$set", new org.bson.Document(path, "4")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // GH-3775
|
@ParameterizedTest // GH-3775, GH-4426
|
||||||
void mapNestedMixedStringIntegerFieldCorrectly() {
|
@ValueSource(strings = {"levelOne.0.1.c", "levelOne.0.1.c.32", "levelOne2.0.1.32.c", "levelOne2.0.1.c.320"})
|
||||||
|
void mapNestedMixedStringIntegerFieldCorrectly(String path) {
|
||||||
|
|
||||||
Update update = new Update().set("levelOne.0.1.c", "4");
|
Update update = new Update().set(path, "4");
|
||||||
Document mappedUpdate = mapper.getMappedObject(update.getUpdateObject(),
|
Document mappedUpdate = mapper.getMappedObject(update.getUpdateObject(),
|
||||||
context.getPersistentEntity(EntityWithNestedMap.class));
|
context.getPersistentEntity(EntityWithNestedMap.class));
|
||||||
|
|
||||||
assertThat(mappedUpdate).isEqualTo(new org.bson.Document("$set", new org.bson.Document("levelOne.0.1.c", "4")));
|
assertThat(mappedUpdate).isEqualTo(new org.bson.Document("$set", new org.bson.Document(path, "4")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // GH-3775
|
@Test // GH-3775
|
||||||
@@ -1720,6 +1724,7 @@ class UpdateMapperUnitTests {
|
|||||||
|
|
||||||
static class EntityWithNestedMap {
|
static class EntityWithNestedMap {
|
||||||
Map<String, Map<String, Map<String, Object>>> levelOne;
|
Map<String, Map<String, Map<String, Object>>> levelOne;
|
||||||
|
Map<String, Map<String, Map<String, Object>>> levelOne2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Customer {
|
static class Customer {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Spring Data MongoDB 4.0.7 (2022.0.7)
|
Spring Data MongoDB 4.0.8 (2022.0.8)
|
||||||
Copyright (c) [2010-2019] Pivotal Software, Inc.
|
Copyright (c) [2010-2019] Pivotal Software, Inc.
|
||||||
|
|
||||||
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||||
@@ -47,5 +47,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user