Package de.svenkubiak.embeddedmongodb
Class EmbeddedMongoDB
java.lang.Object
de.svenkubiak.embeddedmongodb.EmbeddedMongoDB
- Author:
- svenkubiak
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic EmbeddedMongoDB
create()
Creates a new EmbeddedMongoDB instancegetHost()
int
getPort()
de.flapdoodle.embed.mongo.distribution.Version.Main
boolean
isActive()
start()
Starts the EmbeddedMongoDB instancevoid
stop()
Stops the EmbeddedMongoDB instanceSets the host for the EmbeddedMongoDB instance Default is localhostwithPort
(int port) Sets the port for the EmbeddedMongoDB instance Default is 29019withVersion
(de.flapdoodle.embed.mongo.distribution.Version.Main version) Sets the version for the EmbeddedMongoDB instance Default is Version.Main.PRODUCTION
-
Constructor Details
-
EmbeddedMongoDB
public EmbeddedMongoDB()
-
-
Method Details
-
create
Creates a new EmbeddedMongoDB instance- Returns:
- EmbeddedMongoDB instance
-
withPort
Sets the port for the EmbeddedMongoDB instance Default is 29019- Parameters:
port
- The port to set- Returns:
- EmbeddedMongoDB instance
-
withHost
Sets the host for the EmbeddedMongoDB instance Default is localhost- Parameters:
host
- The host to set- Returns:
- EmbeddedMongoDB instance
-
withVersion
Sets the version for the EmbeddedMongoDB instance Default is Version.Main.PRODUCTION- Parameters:
version
- The version to set- Returns:
- EmbeddedMongoDB instance
-
start
Starts the EmbeddedMongoDB instance- Returns:
- EmbeddedMongoDB instance
-
stop
public void stop()Stops the EmbeddedMongoDB instance -
getHost
- Returns:
- The configured host name
-
getVersion
public de.flapdoodle.embed.mongo.distribution.Version.Main getVersion()- Returns:
- The mongod version in use
-
getPort
public int getPort()- Returns:
- The configured port
-
isActive
public boolean isActive()- Returns:
- True if embedded database is up and running, false otherwise
-