Skip to content

Commit

Permalink
upgrade flapdoodle to 4.7.0 from 3.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavis95 committed Jul 7, 2023
1 parent deb0c0a commit 7d92e52
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion zulia-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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<RunningMongodProcess> running;

public MongoTestInstance() {
}
Expand All @@ -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();

}
Expand Down

0 comments on commit 7d92e52

Please sign in to comment.