diff --git a/transponder-mongodb/pom.xml b/transponder-mongodb/pom.xml
index 6fb9ebc..d9e2713 100644
--- a/transponder-mongodb/pom.xml
+++ b/transponder-mongodb/pom.xml
@@ -19,13 +19,13 @@
org.mongodb
- mongo-java-driver
- 3.12.10
+ mongodb-driver-sync
+ 4.11.1
de.flapdoodle.embed
de.flapdoodle.embed.mongo
- 3.2.0
+ 4.11.1
test
diff --git a/transponder-mongodb/src/test/java/org/orienteer/transponder/mongodb/MongoDBUniversalTest.java b/transponder-mongodb/src/test/java/org/orienteer/transponder/mongodb/MongoDBUniversalTest.java
index 49614dc..d62f9b5 100644
--- a/transponder-mongodb/src/test/java/org/orienteer/transponder/mongodb/MongoDBUniversalTest.java
+++ b/transponder-mongodb/src/test/java/org/orienteer/transponder/mongodb/MongoDBUniversalTest.java
@@ -4,46 +4,37 @@
import org.junit.BeforeClass;
import org.orienteer.transponder.AbstractUniversalTest;
-import com.mongodb.MongoClient;
+import com.mongodb.client.MongoClient;
+import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoDatabase;
-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.tests.MongodForTestsFactory;
-import de.flapdoodle.embed.process.runtime.Network;
+import de.flapdoodle.embed.mongo.transitions.Mongod;
+import de.flapdoodle.embed.mongo.transitions.MongodStarter;
+import de.flapdoodle.embed.mongo.transitions.RunningMongodProcess;
+import de.flapdoodle.reverse.TransitionWalker.ReachedState;
public class MongoDBUniversalTest extends AbstractUniversalTest {
- private static MongodExecutable mongodExecutable;
+ private static ReachedState running;
private static MongoClient mongo;
- private static MongodForTestsFactory mongoFactory;
private static MongoDatabase mongoDb;
@BeforeClass
public static void initMongoDB() throws Exception {
- MongodStarter starter = MongodStarter.getDefaultInstance();
-
- int port = Network.freeServerPort(Network.getLocalHost());
- MongodConfig mongodConfig = MongodConfig.builder()
- .version(Version.Main.PRODUCTION)
- .net(new Net(port, Network.localhostIsIPv6()))
- .build();
-
- mongodExecutable = starter.prepare(mongodConfig);
- MongodProcess mongod = mongodExecutable.start();
- mongo = new MongoClient("localhost", port);
- mongoFactory = MongodForTestsFactory.with(Version.Main.PRODUCTION);
- mongoDb = mongoFactory.newDatabase(mongo);
+ running = Mongod.instance().start(Version.Main.V5_0);
+
+ mongo = MongoClients.create("mongodb://"+running.current().getServerAddress());
+
+ mongoDb = mongo.getDatabase("test-db");
}
@AfterClass
public static void shutdownMongoDB() throws Exception {
- if(mongoFactory!=null) mongoFactory.shutdown();
- if(mongodExecutable!=null) mongodExecutable.stop();
+ if(mongoDb!=null) mongoDb.drop();
+ if(mongo!=null) mongo.close();
+ if(running!=null) running.close();
}
public MongoDBUniversalTest() {