From 7d92e525f8bfbd998a78b42b6eb682e986b5c522 Mon Sep 17 00:00:00 2001 From: Matthew Davis Date: Thu, 6 Jul 2023 20:03:26 -0400 Subject: [PATCH] upgrade flapdoodle to 4.7.0 from 3.5.2 --- zulia-server/build.gradle.kts | 2 +- .../server/test/mongo/MongoTestInstance.java | 26 +++++++------------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/zulia-server/build.gradle.kts b/zulia-server/build.gradle.kts index 09d90769..19785bfb 100644 --- a/zulia-server/build.gradle.kts +++ b/zulia-server/build.gradle.kts @@ -67,7 +67,7 @@ dependencies { testImplementation(platform("io.micronaut:micronaut-bom:$micronautVersion")) testImplementation("org.junit.jupiter:junit-jupiter-api") testImplementation("io.micronaut.test:micronaut-test-junit5") - testImplementation("de.flapdoodle.embed:de.flapdoodle.embed.mongo:3.5.2") + testImplementation("de.flapdoodle.embed:de.flapdoodle.embed.mongo:4.7.0") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") api("org.yaml:snakeyaml:$snakeYamlVersion") diff --git a/zulia-server/src/test/java/io/zulia/server/test/mongo/MongoTestInstance.java b/zulia-server/src/test/java/io/zulia/server/test/mongo/MongoTestInstance.java index ac82ece2..80f7172a 100644 --- a/zulia-server/src/test/java/io/zulia/server/test/mongo/MongoTestInstance.java +++ b/zulia-server/src/test/java/io/zulia/server/test/mongo/MongoTestInstance.java @@ -1,21 +1,21 @@ package io.zulia.server.test.mongo; -import de.flapdoodle.embed.mongo.MongodExecutable; -import de.flapdoodle.embed.mongo.MongodProcess; -import de.flapdoodle.embed.mongo.MongodStarter; -import de.flapdoodle.embed.mongo.config.MongodConfig; import de.flapdoodle.embed.mongo.config.Net; import de.flapdoodle.embed.mongo.distribution.Version; +import de.flapdoodle.embed.mongo.transitions.Mongod; +import de.flapdoodle.embed.mongo.transitions.RunningMongodProcess; import de.flapdoodle.embed.process.runtime.Network; +import de.flapdoodle.reverse.TransitionWalker; +import de.flapdoodle.reverse.transitions.Start; public class MongoTestInstance { private static final String LOCAL_INSTANCE_URL_HOST = "mongodb://127.0.0.1"; - private static MongodStarter mongodStarter = MongodStarter.getDefaultInstance(); private Integer port; private String testInstanceUrl; - private MongodProcess mongodProcess; + + private TransitionWalker.ReachedState running; public MongoTestInstance() { } @@ -25,22 +25,16 @@ public String getInstanceUrl() { } public void shutdown() { - if (mongodProcess != null) { - mongodProcess.stop(); + if (running != null) { + running.close(); } } public void start() { try { - - port = Network.freeServerPort(Network.getLocalHost()); - - MongodConfig mongodConfig = MongodConfig.builder().version(Version.Main.PRODUCTION).net(new Net(port, Network.localhostIsIPv6())).build(); - - MongodExecutable mongodExecutable = mongodStarter.prepare(mongodConfig); - mongodProcess = mongodExecutable.start(); - + port = Network.freeServerPort(de.flapdoodle.net.Net.getLocalHost()); + running = Mongod.builder().net(Start.to(Net.class).initializedWith(Net.defaults().withPort(port))).build().start(Version.Main.V6_0); testInstanceUrl = buildTestInstanceUrl(); }