Skip to content
Snippets Groups Projects
Commit dba09d84 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman :boom:
Browse files

Added replication set support.

parent e5eb6afc
No related branches found
No related tags found
No related merge requests found
...@@ -65,7 +65,7 @@ import de.flapdoodle.embed.process.store.IArtifactStore; ...@@ -65,7 +65,7 @@ import de.flapdoodle.embed.process.store.IArtifactStore;
/** /**
* When invoked, this goal starts an instance of mongo. The required binaries * When invoked, this goal starts an instance of mongo. The required binaries
* are downloaded if no mongo release is found in <code>~/.mongodb</code>. * are downloaded if no mongo release is found in <code>~/.embedmongo</code>.
* *
* @goal start * @goal start
* @phase pre-integration-test * @phase pre-integration-test
...@@ -155,7 +155,7 @@ public class StartMongoMojo extends AbstractMojo { ...@@ -155,7 +155,7 @@ public class StartMongoMojo extends AbstractMojo {
/** /**
* @parameter expression="${mongodb.logFile}" * @parameter expression="${mongodb.logFile}"
* default-value="embedmongo.log" * default-value="mongodb.log"
* @since 1.0.0 * @since 1.0.0
*/ */
private String logFile; private String logFile;
...@@ -199,6 +199,13 @@ public class StartMongoMojo extends AbstractMojo { ...@@ -199,6 +199,13 @@ public class StartMongoMojo extends AbstractMojo {
*/ */
private boolean authEnabled; private boolean authEnabled;
/**
* Sets a value for the --replSet
*
* @parameter expression="${mongodb.replSet}"
*/
private String replSet;
/** /**
* The maven project. * The maven project.
* *
...@@ -217,7 +224,7 @@ public class StartMongoMojo extends AbstractMojo { ...@@ -217,7 +224,7 @@ public class StartMongoMojo extends AbstractMojo {
public void execute() throws MojoExecutionException, MojoFailureException { public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) { if (skip) {
getLog().debug("skip=true, not starting embedmongo"); getLog().debug("skip=true, not starting mongodb");
return; return;
} }
...@@ -256,7 +263,7 @@ public class StartMongoMojo extends AbstractMojo { ...@@ -256,7 +263,7 @@ public class StartMongoMojo extends AbstractMojo {
IMongodConfig config = new MongodConfigBuilder() IMongodConfig config = new MongodConfigBuilder()
.version(getVersion()).net(new Net(bindIp, port, Network.localhostIsIPv6())) .version(getVersion()).net(new Net(bindIp, port, Network.localhostIsIPv6()))
.replication(new Storage(getDataDirectory(), null, 0)) .replication(new Storage(getDataDirectory(), replSet, 0))
.build(); .build();
executable = MongodStarter.getInstance(runtimeConfig).prepare(config); executable = MongodStarter.getInstance(runtimeConfig).prepare(config);
...@@ -289,11 +296,11 @@ public class StartMongoMojo extends AbstractMojo { ...@@ -289,11 +296,11 @@ public class StartMongoMojo extends AbstractMojo {
/** /**
* Saves port to the {@link MavenProject#getProperties()} (with the property * Saves port to the {@link MavenProject#getProperties()} (with the property
* name {@code embedmongo.port}) to allow others (plugins, tests, etc) to * name {@code mongodb.port}) to allow others (plugins, tests, etc) to
* find the randomly allocated port. * find the randomly allocated port.
*/ */
private void savePortToProjectProperties() { private void savePortToProjectProperties() {
project.getProperties().put("embedmongo.port", String.valueOf(port)); project.getProperties().put("mongodb.port", String.valueOf(port));
} }
private ProcessOutput getOutputConfig() throws MojoFailureException { private ProcessOutput getOutputConfig() throws MojoFailureException {
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<port>37017</port> <port>37017</port>
<databaseDirectory>/tmp/mongotest</databaseDirectory> <databaseDirectory>/tmp/mongotest</databaseDirectory>
<logging>console</logging> <logging>console</logging>
<version>v2.2.0</version> <version>v3.0.2</version>
<authEnabled>true</authEnabled> <authEnabled>true</authEnabled>
</configuration> </configuration>
</execution> </execution>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment