Skip to content

Commit

Permalink
Update flapdoodle version and in memory mongo version (#706)
Browse files Browse the repository at this point in the history
* Simple change to trigger build

* Update flapdoodle version to 4.18.1

* Update mongo in memory version to V5_0

* Update mongo in memory version to V6_0
  • Loading branch information
stzanakis authored Dec 20, 2024
1 parent 43cf962 commit c5b42aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import de.flapdoodle.embed.mongo.commands.ImmutableMongodArguments;
import de.flapdoodle.embed.mongo.commands.MongodArguments;
import de.flapdoodle.embed.mongo.config.Net;
import de.flapdoodle.embed.mongo.distribution.Version;
import de.flapdoodle.embed.mongo.distribution.Version.Main;
import de.flapdoodle.embed.mongo.transitions.ImmutableMongod;
import de.flapdoodle.embed.mongo.transitions.Mongod;
import de.flapdoodle.embed.mongo.transitions.RunningMongodProcess;
Expand All @@ -15,11 +15,10 @@
import de.flapdoodle.reverse.TransitionWalker;
import de.flapdoodle.reverse.transitions.Start;
import eu.europeana.metis.network.NetworkUtil;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
* Starts an in memory Mongo database. This class is to be used for unit testing on localhost.
*/
Expand All @@ -29,15 +28,15 @@ public class EmbeddedLocalhostMongo {

private static final String DEFAULT_MONGO_HOST = "127.0.0.1";
private static final ImmutableProcessOutput processOutput = ProcessOutput.builder()
.commands(Processors.logTo(LOGGER, Slf4jLevel.DEBUG))
.output(Processors.logTo(LOGGER, Slf4jLevel.INFO))
.error(Processors.logTo(LOGGER, Slf4jLevel.ERROR))
.build();
.commands(Processors.logTo(LOGGER, Slf4jLevel.DEBUG))
.output(Processors.logTo(LOGGER, Slf4jLevel.INFO))
.error(Processors.logTo(LOGGER, Slf4jLevel.ERROR))
.build();

private static final ImmutableMongodArguments mongodArguments = MongodArguments.defaults()
.withSyncDelay(0)
.withStorageEngine("ephemeralForTest")
.withUseNoJournal(true);
.withSyncDelay(0)
.withStorageEngine("ephemeralForTest")
.withUseNoJournal(true);

private TransitionWalker.ReachedState<RunningMongodProcess> runningMongodProcessReachedState;
private int mongoPort;
Expand All @@ -57,11 +56,12 @@ public void start() {
try {
mongoPort = new NetworkUtil().getAvailableLocalPort();
ImmutableMongod mongod = Mongod.instance()
.withNet(Start.to(Net.class).initializedWith(Net.builder().bindIp(DEFAULT_MONGO_HOST).port(mongoPort).isIpv6(true).build()))
.withProcessOutput(Start.to(ProcessOutput.class).initializedWith(processOutput))
.withMongodArguments(Start.to(MongodArguments.class).initializedWith(mongodArguments));
.withNet(Start.to(Net.class).initializedWith(
Net.builder().bindIp(DEFAULT_MONGO_HOST).port(mongoPort).isIpv6(true).build()))
.withProcessOutput(Start.to(ProcessOutput.class).initializedWith(processOutput))
.withMongodArguments(Start.to(MongodArguments.class).initializedWith(mongodArguments));

runningMongodProcessReachedState = mongod.start(Version.Main.V4_4);
runningMongodProcessReachedState = mongod.start(Main.V6_0);

} catch (IOException e) {
LOGGER.error("Exception when starting embedded mongo", e);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<version.commons-compress>1.26.0</version.commons-compress>
<version.corelib>2.16.10-SNAPSHOT</version.corelib>
<version.gdcc.xoai>5.2.0</version.gdcc.xoai>
<version.embedded.mongo>4.17.0</version.embedded.mongo>
<version.embedded.mongo>4.18.1</version.embedded.mongo>
<version.hamcrest>1.3</version.hamcrest>
<version.hibernate.core>6.4.4.Final</version.hibernate.core>
<version.postgresql>42.7.2</version.postgresql>
Expand Down

0 comments on commit c5b42aa

Please sign in to comment.