Skip to content
Snippets Groups Projects
Commit 3006710e authored by Joe Littlejohn's avatar Joe Littlejohn
Browse files

Update to embedmongo 1.21, refactoring to new api

parent cb927767
No related merge requests found
...@@ -103,9 +103,9 @@ ...@@ -103,9 +103,9 @@
<version>2.0</version> <version>2.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>de.flapdoodle.embedmongo</groupId> <groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embedmongo</artifactId> <artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>1.17</version> <version>1.21</version>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -35,17 +35,17 @@ import org.apache.maven.plugin.MojoFailureException; ...@@ -35,17 +35,17 @@ import org.apache.maven.plugin.MojoFailureException;
import com.github.joelittlejohn.embedmongo.log.Loggers; import com.github.joelittlejohn.embedmongo.log.Loggers;
import com.github.joelittlejohn.embedmongo.log.Loggers.LoggingStyle; import com.github.joelittlejohn.embedmongo.log.Loggers.LoggingStyle;
import de.flapdoodle.embedmongo.MongoDBRuntime; import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embedmongo.MongodExecutable; import de.flapdoodle.embed.mongo.MongodProcess;
import de.flapdoodle.embedmongo.MongodProcess; import de.flapdoodle.embed.mongo.MongodStarter;
import de.flapdoodle.embedmongo.config.MongodConfig; import de.flapdoodle.embed.mongo.config.MongodConfig;
import de.flapdoodle.embedmongo.config.MongodProcessOutputConfig; import de.flapdoodle.embed.mongo.config.RuntimeConfig;
import de.flapdoodle.embedmongo.config.RuntimeConfig; import de.flapdoodle.embed.mongo.distribution.Version;
import de.flapdoodle.embedmongo.distribution.GenericVersion; import de.flapdoodle.embed.process.config.io.ProcessOutput;
import de.flapdoodle.embedmongo.distribution.IVersion; import de.flapdoodle.embed.process.distribution.GenericVersion;
import de.flapdoodle.embedmongo.distribution.Version; import de.flapdoodle.embed.process.distribution.IVersion;
import de.flapdoodle.embedmongo.exceptions.MongodException; import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embedmongo.runtime.Network; import de.flapdoodle.embed.process.runtime.Network;
/** /**
* When invoked, this goal starts an instance of mongo. The required binaries * When invoked, this goal starts an instance of mongo. The required binaries
...@@ -128,12 +128,12 @@ public class StartEmbeddedMongoMojo extends AbstractMojo { ...@@ -128,12 +128,12 @@ public class StartEmbeddedMongoMojo extends AbstractMojo {
MongodExecutable executable; MongodExecutable executable;
try { try {
RuntimeConfig config = new RuntimeConfig(); RuntimeConfig config = new RuntimeConfig();
config.setMongodOutputConfig(getOutputConfig()); config.setProcessOutput(getOutputConfig());
executable = MongoDBRuntime.getInstance(config).prepare(new MongodConfig(getVersion(), port, Network.localhostIsIPv6(), getDataDirectory())); executable = MongodStarter.getInstance(config).prepare(new MongodConfig(getVersion(), port, Network.localhostIsIPv6(), getDataDirectory()));
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
throw new MojoExecutionException("Unable to determine if localhost is ipv6", e); throw new MojoExecutionException("Unable to determine if localhost is ipv6", e);
} catch (MongodException e) { } catch (DistributionException e) {
throw new MojoExecutionException("Failed to download MongoDB distribution: " + e.withDistribution(), e); throw new MojoExecutionException("Failed to download MongoDB distribution: " + e.withDistribution(), e);
} }
...@@ -156,7 +156,7 @@ public class StartEmbeddedMongoMojo extends AbstractMojo { ...@@ -156,7 +156,7 @@ public class StartEmbeddedMongoMojo extends AbstractMojo {
} }
} }
private MongodProcessOutputConfig getOutputConfig() throws MojoFailureException { private ProcessOutput getOutputConfig() throws MojoFailureException {
LoggingStyle loggingStyle = LoggingStyle.valueOf(logging.toUpperCase()); LoggingStyle loggingStyle = LoggingStyle.valueOf(logging.toUpperCase());
......
...@@ -19,7 +19,7 @@ import org.apache.maven.plugin.AbstractMojo; ...@@ -19,7 +19,7 @@ import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.MojoFailureException;
import de.flapdoodle.embedmongo.MongodProcess; import de.flapdoodle.embed.mongo.MongodProcess;
/** /**
* When invoked, this goal stops an instance of mojo that was started by this * When invoked, this goal stops an instance of mojo that was started by this
......
...@@ -19,7 +19,7 @@ import java.io.FileOutputStream; ...@@ -19,7 +19,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import de.flapdoodle.embedmongo.io.IStreamProcessor; import de.flapdoodle.embed.process.io.IStreamProcessor;
public class FileOutputStreamProcessor implements IStreamProcessor { public class FileOutputStreamProcessor implements IStreamProcessor {
......
...@@ -15,10 +15,9 @@ ...@@ -15,10 +15,9 @@
*/ */
package com.github.joelittlejohn.embedmongo.log; package com.github.joelittlejohn.embedmongo.log;
import static de.flapdoodle.embedmongo.io.Processors.*; import de.flapdoodle.embed.mongo.config.MongodProcessOutputConfig;
import de.flapdoodle.embedmongo.config.MongodProcessOutputConfig; import de.flapdoodle.embed.process.config.io.ProcessOutput;
import de.flapdoodle.embedmongo.io.NamedOutputStreamProcessor; import de.flapdoodle.embed.process.io.NamedOutputStreamProcessor;
import de.flapdoodle.embedmongo.io.Processors;
public class Loggers { public class Loggers {
...@@ -26,24 +25,21 @@ public class Loggers { ...@@ -26,24 +25,21 @@ public class Loggers {
FILE, CONSOLE, NONE FILE, CONSOLE, NONE
} }
public static MongodProcessOutputConfig file() { public static ProcessOutput file() {
FileOutputStreamProcessor file = new FileOutputStreamProcessor(); FileOutputStreamProcessor file = new FileOutputStreamProcessor();
return new MongodProcessOutputConfig( return new ProcessOutput(
new NamedOutputStreamProcessor("[mongod output]", file), new NamedOutputStreamProcessor("[mongod output]", file),
new NamedOutputStreamProcessor("[mongod error]", file), file); new NamedOutputStreamProcessor("[mongod error]", file),
new NamedOutputStreamProcessor("[mongod commands]", file));
} }
public static MongodProcessOutputConfig console() { public static ProcessOutput console() {
return MongodProcessOutputConfig.getDefaultInstance();
return new MongodProcessOutputConfig(
namedConsole("[mongod output]"),
namedConsole("[mongod error]"), Processors.console());
} }
public static MongodProcessOutputConfig none() { public static ProcessOutput none() {
NoopStreamProcessor noop = new NoopStreamProcessor(); NoopStreamProcessor noop = new NoopStreamProcessor();
return new MongodProcessOutputConfig(noop, noop, noop); return new ProcessOutput(noop, noop, noop);
} }
} }
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package com.github.joelittlejohn.embedmongo.log; package com.github.joelittlejohn.embedmongo.log;
import de.flapdoodle.embedmongo.io.IStreamProcessor; import de.flapdoodle.embed.process.io.IStreamProcessor;
public class NoopStreamProcessor implements IStreamProcessor { public class NoopStreamProcessor implements IStreamProcessor {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<plugin> <plugin>
<groupId>com.github.joelittlejohn.embedmongo</groupId> <groupId>com.github.joelittlejohn.embedmongo</groupId>
<artifactId>embedmongo-maven-plugin</artifactId> <artifactId>embedmongo-maven-plugin</artifactId>
<version>0.1.3-SNAPSHOT</version> <version>0.1.4-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<id>start</id> <id>start</id>
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
</goals> </goals>
<configuration> <configuration>
<port>37017</port> <port>37017</port>
<version>2.1.1</version> <version>2.0.8</version>
<databaseDirectory>/tmp/mongotest</databaseDirectory> <databaseDirectory>/tmp/mongotest</databaseDirectory>
<logging>file</logging>
</configuration> </configuration>
</execution> </execution>
<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