Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update flapdoodle version and in memory mongo version #706

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading