Skip to content

Commit 51e2e7e

Browse files
committed
Polishing.
Reformat code. Add missing hints for reflective version detection. Original pull request: #4624 See: #4578
1 parent c26c054 commit 51e2e7e

13 files changed

+100
-76
lines changed

Diff for: Jenkinsfile

+26-26
Original file line numberDiff line numberDiff line change
@@ -266,32 +266,32 @@ pipeline {
266266
}
267267

268268
stage("test: MongoDB 7.0 (driver-next)") {
269-
agent {
270-
label 'data'
271-
}
272-
options { timeout(time: 30, unit: 'MINUTES') }
273-
environment {
274-
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
275-
DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}")
276-
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
277-
}
278-
steps {
279-
script {
280-
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-mongodb-7.0:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
281-
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
282-
sh 'mongod --setParameter transactionLifetimeLimitSeconds=90 --setParameter maxTransactionLockRequestTimeoutMillis=10000 --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
283-
sh 'sleep 10'
284-
sh 'mongosh --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
285-
sh 'sleep 15'
286-
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
287-
"DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} " +
288-
"DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} " +
289-
"GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} " +
290-
"./mvnw -s settings.xml -Pmongo-5.0 clean dependency:list test -Dsort -U -B -Dgradle.cache.local.enabled=false -Dgradle.cache.remote.enabled=false"
291-
}
292-
}
293-
}
294-
}
269+
agent {
270+
label 'data'
271+
}
272+
options { timeout(time: 30, unit: 'MINUTES') }
273+
environment {
274+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
275+
DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}")
276+
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
277+
}
278+
steps {
279+
script {
280+
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-mongodb-7.0:${p['java.main.tag']}").inside(p['docker.java.inside.basic']) {
281+
sh 'mkdir -p /tmp/mongodb/db /tmp/mongodb/log'
282+
sh 'mongod --setParameter transactionLifetimeLimitSeconds=90 --setParameter maxTransactionLockRequestTimeoutMillis=10000 --dbpath /tmp/mongodb/db --replSet rs0 --fork --logpath /tmp/mongodb/log/mongod.log &'
283+
sh 'sleep 10'
284+
sh 'mongosh --eval "rs.initiate({_id: \'rs0\', members:[{_id: 0, host: \'127.0.0.1:27017\'}]});"'
285+
sh 'sleep 15'
286+
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
287+
"DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} " +
288+
"DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} " +
289+
"GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} " +
290+
"./mvnw -s settings.xml -Pmongo-5.0 clean dependency:list test -Dsort -U -B -Dgradle.cache.local.enabled=false -Dgradle.cache.remote.enabled=false"
291+
}
292+
}
293+
}
294+
}
295295

296296
stage("test: MongoDB 7.0 (next)") {
297297
agent {

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/aot/MongoAotPredicates.java

+11-5
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,25 @@
2525
import org.springframework.util.ClassUtils;
2626

2727
/**
28-
* Collection of {@link Predicate predicates} to determine dynamic library aspects during AOT computation.
29-
* Intended for internal usage only.
28+
* Collection of {@link Predicate predicates} to determine dynamic library aspects during AOT computation. Intended for
29+
* internal usage only.
3030
*
3131
* @author Christoph Strobl
3232
* @since 4.0
3333
*/
3434
public class MongoAotPredicates {
3535

36-
public static final Predicate<Class<?>> IS_SIMPLE_TYPE = (type) -> MongoSimpleTypes.HOLDER.isSimpleType(type) || TypeUtils.type(type).isPartOf("org.bson");
36+
public static final Predicate<Class<?>> IS_SIMPLE_TYPE = (type) -> MongoSimpleTypes.HOLDER.isSimpleType(type)
37+
|| TypeUtils.type(type).isPartOf("org.bson");
3738
public static final Predicate<ReactiveLibrary> IS_REACTIVE_LIBARARY_AVAILABLE = ReactiveWrappers::isAvailable;
38-
public static final Predicate<ClassLoader> IS_SYNC_CLIENT_PRESENT = (classLoader) -> ClassUtils.isPresent("com.mongodb.client.MongoClient", classLoader);
39-
public static final Predicate<ClassLoader> IS_REACTIVE_CLIENT_PRESENT = (classLoader) -> ClassUtils.isPresent("com.mongodb.reactivestreams.client.MongoClient", classLoader);
39+
public static final Predicate<ClassLoader> IS_SYNC_CLIENT_PRESENT = (classLoader) -> ClassUtils
40+
.isPresent("com.mongodb.client.MongoClient", classLoader);
41+
public static final Predicate<ClassLoader> IS_REACTIVE_CLIENT_PRESENT = (classLoader) -> ClassUtils
42+
.isPresent("com.mongodb.reactivestreams.client.MongoClient", classLoader);
4043

44+
/**
45+
* @return {@literal true} if the Project Reactor is present.
46+
*/
4147
public static boolean isReactorPresent() {
4248
return IS_REACTIVE_LIBARARY_AVAILABLE.test(ReactiveWrappers.ReactiveLibrary.PROJECT_REACTOR);
4349
}

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/aot/MongoRuntimeHints.java

+25-17
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@
1919

2020
import java.util.Arrays;
2121

22-
import com.mongodb.MongoClientSettings;
23-
import com.mongodb.ServerAddress;
24-
import com.mongodb.UnixServerAddress;
25-
import com.mongodb.client.MapReduceIterable;
26-
import com.mongodb.client.MongoDatabase;
27-
import com.mongodb.client.model.IndexOptions;
28-
import com.mongodb.reactivestreams.client.MapReducePublisher;
2922
import org.springframework.aot.hint.MemberCategory;
3023
import org.springframework.aot.hint.RuntimeHints;
3124
import org.springframework.aot.hint.RuntimeHintsRegistrar;
@@ -38,10 +31,17 @@
3831
import org.springframework.data.mongodb.core.mapping.event.ReactiveAfterSaveCallback;
3932
import org.springframework.data.mongodb.core.mapping.event.ReactiveBeforeConvertCallback;
4033
import org.springframework.data.mongodb.core.mapping.event.ReactiveBeforeSaveCallback;
41-
import org.springframework.data.mongodb.util.MongoClientVersion;
4234
import org.springframework.lang.Nullable;
4335
import org.springframework.util.ClassUtils;
4436

37+
import com.mongodb.MongoClientSettings;
38+
import com.mongodb.ServerAddress;
39+
import com.mongodb.UnixServerAddress;
40+
import com.mongodb.client.MapReduceIterable;
41+
import com.mongodb.client.MongoDatabase;
42+
import com.mongodb.client.model.IndexOptions;
43+
import com.mongodb.reactivestreams.client.MapReducePublisher;
44+
4545
/**
4646
* {@link RuntimeHintsRegistrar} for repository types and entity callbacks.
4747
*
@@ -72,7 +72,6 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
7272
builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
7373
MemberCategory.INVOKE_PUBLIC_METHODS));
7474
}
75-
7675
}
7776

7877
private static void registerTransactionProxyHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
@@ -89,32 +88,41 @@ private static void registerTransactionProxyHints(RuntimeHints hints, @Nullable
8988
}
9089
}
9190

91+
@SuppressWarnings("deprecation")
9292
private static void registerMongoCompatibilityAdapterHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
9393

9494
hints.reflection() //
9595
.registerType(MongoClientSettings.class, MemberCategory.INVOKE_PUBLIC_METHODS)
9696
.registerType(MongoClientSettings.Builder.class, MemberCategory.INVOKE_PUBLIC_METHODS)
9797
.registerType(IndexOptions.class, MemberCategory.INVOKE_PUBLIC_METHODS)
9898
.registerType(ServerAddress.class, MemberCategory.INVOKE_PUBLIC_METHODS)
99-
.registerType(UnixServerAddress.class, MemberCategory.INVOKE_PUBLIC_METHODS)
100-
.registerType(TypeReference.of("com.mongodb.connection.StreamFactoryFactory"), MemberCategory.INTROSPECT_PUBLIC_METHODS);
99+
.registerType(UnixServerAddress.class, MemberCategory.INVOKE_PUBLIC_METHODS) //
100+
.registerType(TypeReference.of("com.mongodb.connection.StreamFactoryFactory"),
101+
MemberCategory.INTROSPECT_PUBLIC_METHODS)
102+
.registerType(TypeReference.of("com.mongodb.internal.connection.StreamFactoryFactory"),
103+
MemberCategory.INTROSPECT_PUBLIC_METHODS)
104+
.registerType(TypeReference.of("com.mongodb.internal.build.MongoDriverVersion"), MemberCategory.PUBLIC_FIELDS);
101105

102-
if(MongoAotPredicates.isSyncClientPresent(classLoader)) {
106+
if (MongoAotPredicates.isSyncClientPresent(classLoader)) {
103107

104108
hints.reflection() //
105109
.registerType(MongoDatabase.class, MemberCategory.INVOKE_PUBLIC_METHODS)
106-
.registerType(TypeReference.of("com.mongodb.client.internal.MongoDatabaseImpl"), MemberCategory.INVOKE_PUBLIC_METHODS)
110+
.registerType(TypeReference.of("com.mongodb.client.internal.MongoDatabaseImpl"),
111+
MemberCategory.INVOKE_PUBLIC_METHODS)
107112
.registerType(MapReduceIterable.class, MemberCategory.INVOKE_PUBLIC_METHODS)
108-
.registerType(TypeReference.of("com.mongodb.client.internal.MapReduceIterableImpl"), MemberCategory.INVOKE_PUBLIC_METHODS);
113+
.registerType(TypeReference.of("com.mongodb.client.internal.MapReduceIterableImpl"),
114+
MemberCategory.INVOKE_PUBLIC_METHODS);
109115
}
110116

111-
if(MongoAotPredicates.isReactiveClientPresent(classLoader)) {
117+
if (MongoAotPredicates.isReactiveClientPresent(classLoader)) {
112118

113119
hints.reflection() //
114120
.registerType(com.mongodb.reactivestreams.client.MongoDatabase.class, MemberCategory.INVOKE_PUBLIC_METHODS)
115-
.registerType(TypeReference.of("com.mongodb.reactivestreams.client.internal.MongoDatabaseImpl"), MemberCategory.INVOKE_PUBLIC_METHODS)
121+
.registerType(TypeReference.of("com.mongodb.reactivestreams.client.internal.MongoDatabaseImpl"),
122+
MemberCategory.INVOKE_PUBLIC_METHODS)
116123
.registerType(MapReducePublisher.class, MemberCategory.INVOKE_PUBLIC_METHODS)
117-
.registerType(TypeReference.of("com.mongodb.reactivestreams.client.internal.MapReducePublisherImpl"), MemberCategory.INVOKE_PUBLIC_METHODS);
124+
.registerType(TypeReference.of("com.mongodb.reactivestreams.client.internal.MapReducePublisherImpl"),
125+
MemberCategory.INVOKE_PUBLIC_METHODS);
118126
}
119127
}
120128

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoClientSettingsFactoryBean.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ public class MongoClientSettingsFactoryBean extends AbstractFactoryBean<MongoCli
123123

124124
/**
125125
* @param socketConnectTimeoutMS in msec
126-
* @see com.mongodb.connection.SocketSettings.Builder#connectTimeout(long, TimeUnit)
126+
* @see com.mongodb.connection.SocketSettings.Builder#connectTimeout(int, TimeUnit)
127127
*/
128128
public void setSocketConnectTimeoutMS(int socketConnectTimeoutMS) {
129129
this.socketConnectTimeoutMS = socketConnectTimeoutMS;
130130
}
131131

132132
/**
133133
* @param socketReadTimeoutMS in msec
134-
* @see com.mongodb.connection.SocketSettings.Builder#readTimeout(long, TimeUnit)
134+
* @see com.mongodb.connection.SocketSettings.Builder#readTimeout(int, TimeUnit)
135135
*/
136136
public void setSocketReadTimeoutMS(int socketReadTimeoutMS) {
137137
this.socketReadTimeoutMS = socketReadTimeoutMS;

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeospatialIndex.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class GeospatialIndex implements IndexDefinition {
4141
private @Nullable Integer max;
4242
private @Nullable Integer bits;
4343
private GeoSpatialIndexType type = GeoSpatialIndexType.GEO_2D;
44-
private Double bucketSize = MongoClientVersion.isVersion5OrNewer() ? null : 1.0;
44+
private Double bucketSize = MongoClientVersion.isVersion5orNewer() ? null : 1.0;
4545
private @Nullable String additionalField;
4646
private Optional<IndexFilter> filter = Optional.empty();
4747
private Optional<Collation> collation = Optional.empty();

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexResolver.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -710,14 +710,17 @@ protected IndexDefinitionHolder createGeoSpatialIndexDefinition(String dotPath,
710710
.named(pathAwareIndexName(index.name(), dotPath, persistentProperty.getOwner(), persistentProperty));
711711
}
712712

713-
if(MongoClientVersion.isVersion5OrNewer()) {
713+
if (MongoClientVersion.isVersion5orNewer()) {
714714

715-
Optional<Double> defaultBucketSize = MergedAnnotation.of(GeoSpatialIndexed.class).getDefaultValue("bucketSize", Double.class);
715+
Optional<Double> defaultBucketSize = MergedAnnotation.of(GeoSpatialIndexed.class).getDefaultValue("bucketSize",
716+
Double.class);
716717
if (!defaultBucketSize.isPresent() || index.bucketSize() != defaultBucketSize.get()) {
717718
indexDefinition.withBucketSize(index.bucketSize());
718719
} else {
719-
if(LOGGER.isInfoEnabled()) {
720-
LOGGER.info("Ignoring no longer supported default GeoSpatialIndexed.bucketSize on %s for Mongo Client 5 or newer.".formatted(dotPath));
720+
if (LOGGER.isInfoEnabled()) {
721+
LOGGER.info(
722+
"GeoSpatialIndexed.bucketSize no longer supported by Mongo Client 5 or newer. Ignoring bucketSize for path %s."
723+
.formatted(dotPath));
721724
}
722725
}
723726
} else {

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/util/MongoClientVersion.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ public class MongoClientVersion {
4848
static {
4949

5050
ClassLoader classLoader = MongoClientVersion.class.getClassLoader();
51-
Version version = readVersionFromClass(classLoader);
52-
if (version == null) {
53-
version = guessDriverVersionFromClassPath(classLoader);
54-
}
51+
Version version = getMongoDbDriverVersion(classLoader);
5552

5653
CLIENT_VERSION = version;
5754
IS_VERSION_5_OR_NEWER = CLIENT_VERSION.isGreaterThanOrEqualTo(Version.parse("5.0"));
@@ -84,12 +81,18 @@ public static boolean isReactiveClientPresent() {
8481
* @return {@literal true} if the MongoDB Java driver version is 5 or newer.
8582
* @since 4.3
8683
*/
87-
public static boolean isVersion5OrNewer() {
84+
public static boolean isVersion5orNewer() {
8885
return IS_VERSION_5_OR_NEWER;
8986
}
9087

88+
private static Version getMongoDbDriverVersion(ClassLoader classLoader) {
89+
90+
Version version = getVersionFromPackage(classLoader);
91+
return version == null ? guessDriverVersionFromClassPath(classLoader) : version;
92+
}
93+
9194
@Nullable
92-
private static Version readVersionFromClass(ClassLoader classLoader) {
95+
private static Version getVersionFromPackage(ClassLoader classLoader) {
9396

9497
if (ClassUtils.isPresent("com.mongodb.internal.build.MongoDriverVersion", classLoader)) {
9598
try {

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/util/MongoCompatibilityAdapter.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static ClientSettingsAdapter clientSettingsAdapter(MongoClientSettings cl
7575
@Override
7676
public <T> T getStreamFactoryFactory() {
7777

78-
if (MongoClientVersion.isVersion5OrNewer() || getStreamFactoryFactory == null) {
78+
if (MongoClientVersion.isVersion5orNewer() || getStreamFactoryFactory == null) {
7979
return null;
8080
}
8181

@@ -93,7 +93,7 @@ public <T> T getStreamFactoryFactory() {
9393
public static IndexOptionsAdapter indexOptionsAdapter(IndexOptions options) {
9494
return bucketSize -> {
9595

96-
if (MongoClientVersion.isVersion5OrNewer() || setBucketSize == null) {
96+
if (MongoClientVersion.isVersion5orNewer() || setBucketSize == null) {
9797
throw new UnsupportedOperationException(NO_LONGER_SUPPORTED.formatted("IndexOptions.bucketSize"));
9898
}
9999

@@ -111,7 +111,7 @@ public static IndexOptionsAdapter indexOptionsAdapter(IndexOptions options) {
111111
public static MapReduceIterableAdapter mapReduceIterableAdapter(Object iterable) {
112112
return sharded -> {
113113

114-
if (MongoClientVersion.isVersion5OrNewer()) {
114+
if (MongoClientVersion.isVersion5orNewer()) {
115115
throw new UnsupportedOperationException(NO_LONGER_SUPPORTED.formatted("sharded"));
116116
}
117117

@@ -132,7 +132,7 @@ public static MapReduceIterableAdapter mapReduceIterableAdapter(Object iterable)
132132
public static MapReducePublisherAdapter mapReducePublisherAdapter(Object publisher) {
133133
return sharded -> {
134134

135-
if (MongoClientVersion.isVersion5OrNewer()) {
135+
if (MongoClientVersion.isVersion5orNewer()) {
136136
throw new UnsupportedOperationException(NO_LONGER_SUPPORTED.formatted("sharded"));
137137
}
138138

@@ -151,7 +151,7 @@ public static MapReducePublisherAdapter mapReducePublisherAdapter(Object publish
151151
public static ServerAddressAdapter serverAddressAdapter(ServerAddress serverAddress) {
152152
return () -> {
153153

154-
if (MongoClientVersion.isVersion5OrNewer()) {
154+
if (MongoClientVersion.isVersion5orNewer()) {
155155
return null;
156156
}
157157

@@ -199,6 +199,7 @@ public interface MongoDatabaseAdapterBuilder {
199199
MongoDatabaseAdapter forDb(com.mongodb.client.MongoDatabase db);
200200
}
201201

202+
@SuppressWarnings({ "unchecked", "DataFlowIssue" })
202203
public static class MongoDatabaseAdapter {
203204

204205
@Nullable //
@@ -219,7 +220,7 @@ public static class MongoDatabaseAdapter {
219220
LIST_COLLECTION_NAMES_METHOD_SESSION = ReflectionUtils.findMethod(MongoDatabase.class, "listCollectionNames",
220221
ClientSession.class);
221222

222-
if (MongoClientVersion.isVersion5OrNewer()) {
223+
if (MongoClientVersion.isVersion5orNewer()) {
223224
try {
224225
collectionNamesReturnType = ClassUtils.forName("com.mongodb.client.ListCollectionNamesIterable",
225226
MongoDatabaseAdapter.class.getClassLoader());
@@ -267,6 +268,7 @@ public interface ReactiveMongoDatabaseAdapterBuilder {
267268
ReactiveMongoDatabaseAdapter forDb(com.mongodb.reactivestreams.client.MongoDatabase db);
268269
}
269270

271+
@SuppressWarnings({ "unchecked", "DataFlowIssue" })
270272
public static class ReactiveMongoDatabaseAdapter {
271273

272274
@Nullable //
@@ -289,7 +291,7 @@ public static class ReactiveMongoDatabaseAdapter {
289291
com.mongodb.reactivestreams.client.MongoDatabase.class, "listCollectionNames",
290292
com.mongodb.reactivestreams.client.ClientSession.class);
291293

292-
if (MongoClientVersion.isVersion5OrNewer()) {
294+
if (MongoClientVersion.isVersion5orNewer()) {
293295
try {
294296
collectionNamesReturnType = ClassUtils.forName(
295297
"com.mongodb.reactivestreams.client.ListCollectionNamesPublisher",
@@ -352,7 +354,7 @@ public MongoStreamFactoryFactorySettingsConfigurer(Builder settingsBuilder) {
352354

353355
void setStreamFactory(Object streamFactory) {
354356

355-
if (MongoClientVersion.isVersion5OrNewer() && isStreamFactoryPresent()) {
357+
if (MongoClientVersion.isVersion5orNewer() && isStreamFactoryPresent()) {
356358
logger.warn("StreamFactoryFactory is no longer available. Use TransportSettings instead.");
357359
return;
358360
}

Diff for: spring-data-mongodb/src/test/java/org/springframework/data/mongodb/aot/MongoRuntimeHintsUnitTests.java

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
*
3939
* @author Christoph Strobl
4040
*/
41+
@SuppressWarnings("deprecation")
4142
class MongoRuntimeHintsUnitTests {
4243

4344
@Test // GH-4578

Diff for: spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/geo/GeoSpatialIndexTests.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.assertj.core.api.Assumptions;
2525
import org.junit.jupiter.api.BeforeEach;
2626
import org.junit.jupiter.api.Test;
27+
2728
import org.springframework.beans.factory.annotation.Autowired;
2829
import org.springframework.dao.DataAccessException;
2930
import org.springframework.data.geo.Point;
@@ -37,11 +38,11 @@
3738
import org.springframework.data.mongodb.core.index.IndexOperations;
3839
import org.springframework.data.mongodb.core.mapping.Document;
3940
import org.springframework.data.mongodb.test.util.EnableIfMongoServerVersion;
41+
import org.springframework.data.mongodb.util.MongoClientVersion;
4042

4143
import com.mongodb.MongoException;
4244
import com.mongodb.WriteConcern;
4345
import com.mongodb.client.MongoCollection;
44-
import org.springframework.data.mongodb.util.MongoClientVersion;
4546

4647
/**
4748
* Integration tests for geo-spatial indexing.
@@ -88,7 +89,7 @@ public void test2dSphereIndex() {
8889
@EnableIfMongoServerVersion(isLessThan = "5.0")
8990
public void testHaystackIndex() {
9091

91-
Assumptions.assumeThat(MongoClientVersion.isVersion5OrNewer()).isFalse();
92+
Assumptions.assumeThat(MongoClientVersion.isVersion5orNewer()).isFalse();
9293

9394
try {
9495
template.save(new GeoSpatialEntityHaystack(45.2, 4.6, "Paris"));

Diff for: spring-data-mongodb/src/test/java/org/springframework/data/mongodb/observability/ImperativeIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public SampleTestRunnerConsumer yourCode() {
8383

8484
assertThat(span.getTags()).containsEntry("db.system", "mongodb").containsEntry("net.transport", "IP.TCP");
8585

86-
if (MongoClientVersion.isVersion5OrNewer()) {
86+
if (MongoClientVersion.isVersion5orNewer()) {
8787
assertThat(span.getTags()).containsKeys("db.connection_string", "db.name", "db.operation",
8888
"db.mongodb.collection", "net.peer.name", "net.peer.port");
8989
} else {

0 commit comments

Comments
 (0)