From 679231c120c6e37ee1ec1e722e477869cc6173c9 Mon Sep 17 00:00:00 2001 From: Julien Herr Date: Fri, 5 Nov 2021 19:03:05 +0100 Subject: [PATCH 1/2] Upgrade to Embedded Mongo 3.2.5 See gh-28543 --- .../mongo/embedded/EmbeddedMongoAutoConfiguration.java | 8 +++++--- .../embedded/EmbeddedMongoAutoConfigurationTests.java | 10 +--------- .../spring-boot-dependencies/build.gradle | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java index 4eb20a8d5d..9739fd25f7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java @@ -204,9 +204,11 @@ public class EmbeddedMongoAutoConfiguration { RuntimeConfig embeddedMongoRuntimeConfig( ObjectProvider downloadConfigBuilderCustomizers) { Logger logger = LoggerFactory.getLogger(getClass().getPackage().getName() + ".EmbeddedMongo"); - ProcessOutput processOutput = new ProcessOutput(Processors.logTo(logger, Slf4jLevel.INFO), - Processors.logTo(logger, Slf4jLevel.ERROR), - Processors.named("[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG))); + ProcessOutput processOutput = ProcessOutput.builder() + .output(Processors.logTo(logger, Slf4jLevel.INFO)) + .error(Processors.logTo(logger, Slf4jLevel.ERROR)) + .commands(Processors.named("[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG))) + .build(); return Defaults.runtimeConfigFor(Command.MongoD, logger).processOutput(processOutput) .artifactStore(getArtifactStore(logger, downloadConfigBuilderCustomizers.orderedStream())) .isDaemonProcess(false).build(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java index f0d577d4af..ebeed2c635 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java @@ -98,11 +98,7 @@ class EmbeddedMongoAutoConfigurationTests { @Test void customFeatures() { - EnumSet features = EnumSet.of(Feature.TEXT_SEARCH, Feature.SYNC_DELAY, Feature.ONLY_WITH_SSL, - Feature.NO_HTTP_INTERFACE_ARG); - if (isWindows()) { - features.add(Feature.ONLY_WINDOWS_2008_SERVER); - } + EnumSet features = EnumSet.of(Feature.TEXT_SEARCH, Feature.SYNC_DELAY, Feature.NO_HTTP_INTERFACE_ARG); loadWithValidVersion("spring.mongodb.embedded.features=" + features.stream().map(Feature::name).collect(Collectors.joining(", "))); assertThat(this.context.getBean(EmbeddedMongoProperties.class).getFeatures()) @@ -242,10 +238,6 @@ class EmbeddedMongoAutoConfigurationTests { this.context = ctx; } - private boolean isWindows() { - return File.separatorChar == '\\'; - } - private int getPort(MongoClient client) { return client.getClusterDescription().getClusterSettings().getHosts().get(0).getPort(); } diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 2159ab2eee..c1ceeebada 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -307,7 +307,7 @@ bom { ] } } - library("Embedded Mongo", "3.0.0") { + library("Embedded Mongo", "3.2.0") { group("de.flapdoodle.embed") { modules = [ "de.flapdoodle.embed.mongo" From f26bee1196f397a85068dee232c2f709e4cc956c Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 4 Jan 2022 08:39:03 +0100 Subject: [PATCH 2/2] Polish "Upgrade to Embedded Mongo 3.2.5" See gh-28543 --- .../embedded/EmbeddedMongoAutoConfiguration.java | 14 ++++++-------- .../EmbeddedMongoAutoConfigurationTests.java | 2 +- .../spring-boot-dependencies/build.gradle | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java index 9739fd25f7..f0549d75d0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -37,7 +37,7 @@ import de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion; import de.flapdoodle.embed.mongo.distribution.Version; import de.flapdoodle.embed.mongo.distribution.Versions; import de.flapdoodle.embed.process.config.RuntimeConfig; -import de.flapdoodle.embed.process.config.io.ProcessOutput; +import de.flapdoodle.embed.process.config.process.ProcessOutput; import de.flapdoodle.embed.process.config.store.DownloadConfig; import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig; import de.flapdoodle.embed.process.distribution.Version.GenericVersion; @@ -138,8 +138,8 @@ public class EmbeddedMongoAutoConfiguration { builder.net(new Net(getHost().getHostAddress(), configuredPort, Network.localhostIsIPv6())); } else { - builder.net(new Net(getHost().getHostAddress(), Network.getFreeServerPort(getHost()), - Network.localhostIsIPv6())); + builder.net( + new Net(getHost().getHostAddress(), Network.freeServerPort(getHost()), Network.localhostIsIPv6())); } return builder.build(); } @@ -204,11 +204,9 @@ public class EmbeddedMongoAutoConfiguration { RuntimeConfig embeddedMongoRuntimeConfig( ObjectProvider downloadConfigBuilderCustomizers) { Logger logger = LoggerFactory.getLogger(getClass().getPackage().getName() + ".EmbeddedMongo"); - ProcessOutput processOutput = ProcessOutput.builder() - .output(Processors.logTo(logger, Slf4jLevel.INFO)) + ProcessOutput processOutput = ProcessOutput.builder().output(Processors.logTo(logger, Slf4jLevel.INFO)) .error(Processors.logTo(logger, Slf4jLevel.ERROR)) - .commands(Processors.named("[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG))) - .build(); + .commands(Processors.named("[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG))).build(); return Defaults.runtimeConfigFor(Command.MongoD, logger).processOutput(processOutput) .artifactStore(getArtifactStore(logger, downloadConfigBuilderCustomizers.orderedStream())) .isDaemonProcess(false).build(); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java index ebeed2c635..eb56574b9e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index c1ceeebada..587a5f7ab0 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -307,7 +307,7 @@ bom { ] } } - library("Embedded Mongo", "3.2.0") { + library("Embedded Mongo", "3.2.5") { group("de.flapdoodle.embed") { modules = [ "de.flapdoodle.embed.mongo"