Class MongoDb.Builder<T extends MongoDb>
java.lang.Object
org.sdase.commons.server.mongo.testing.MongoDb.Builder<T>
- Direct Known Subclasses:
MongoDbClassExtension.Builder
- Enclosing interface:
- MongoDb
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected static final long
static final de.flapdoodle.embed.mongo.distribution.Version.Main
protected String
protected String
protected boolean
protected Long
protected String
protected de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion
static final de.flapdoodle.embed.mongo.distribution.Version.Main
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract T
build()
protected de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion
Allows to enable scripting using JavaScript, which is disabled by default.protected long
withDatabase
(String database) Configure the database that can be used to connect to the MongoDB instance.withPassword
(String password) Configure the password that can be used to connect to the MongoDB instance.withTimeoutInMillis
(long timeoutInMillis) Configures the timeout for database startup, the default value is one minute (DEFAULT_TIMEOUT_MS
).withUsername
(String username) Configure the username that can be used to connect to the MongoDB instance.withVersion
(de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion version) Configure the MongoDB version to start, by default the latest production version is used (DEFAULT_VERSION
).
-
Field Details
-
DEFAULT_VERSION
public static final de.flapdoodle.embed.mongo.distribution.Version.Main DEFAULT_VERSION -
WINDOWS_VERSION
public static final de.flapdoodle.embed.mongo.distribution.Version.Main WINDOWS_VERSION -
DEFAULT_TIMEOUT_MS
protected static final long DEFAULT_TIMEOUT_MS -
mongoDbUrlOverride
-
version
protected de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion version -
timeoutInMillis
-
username
-
password
-
database
-
scripting
protected boolean scripting
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withUsername
Configure the username that can be used to connect to the MongoDB instance.- Parameters:
username
- the username- Returns:
- a builder instance for further configuration
-
withPassword
Configure the password that can be used to connect to the MongoDB instance.- Parameters:
password
- the password- Returns:
- a builder instance for further configuration
-
withDatabase
Configure the database that can be used to connect to the MongoDB instance.- Parameters:
database
- the database- Returns:
- a builder instance for further configuration
-
withVersion
public MongoDb.Builder<T> withVersion(de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion version) Configure the MongoDB version to start, by default the latest production version is used (DEFAULT_VERSION
).- Parameters:
version
- the version- Returns:
- a builder instance for further configuration
-
withTimeoutInMillis
Configures the timeout for database startup, the default value is one minute (DEFAULT_TIMEOUT_MS
).- Parameters:
timeoutInMillis
- the timeout in milliseconds- Returns:
- a builder instance for further configuration
-
enableScripting
Allows to enable scripting using JavaScript, which is disabled by default. Avoid this option, as it expose your application to security risks.- Returns:
- a builder instance for further configuration
-
determineMongoDbVersion
protected de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion determineMongoDbVersion() -
getTimeoutMs
protected long getTimeoutMs() -
build
-