LocalServer
mongocamp supports LocalServer by mongo-java-server (since 2.0.1).
Useful for tests and small offline Apps. Dependency to mongo-java-server is marked as provided, you have to import the dependency by yourself.
scala
// Base dependency
libraryDependencies += "de.bwaldvogel" % "mongo-java-server" % "1.28.0"
// H2 Backend
libraryDependencies += "de.bwaldvogel" % "mongo-java-server-h2-backend" % "1.28.0"
LocalServer Modes
- InMemory
- H2 InMemory
- H2 file based
Setup
LocalServer is done by ServerConfig. For InMemory tests no special stup is needed.
scala
val LocalTestServer = LocalServer()
Setup with application config
json
unit.test.local.mongo.server {
host = "localhost"
port = 28028
serverName = "local-unit-test-server"
backend = "h2"
h2 {
inMemory = false
path = "" // without path set a random temp file is created
}
}
unit.test.mongo.local {
database = "mongocamp-unit-test"
host = "localhost"
port = 28028
userName = "testy"
password = ""
applicationName = "mongocamp-config-test"
}