Class MongoDb.Builder<T extends MongoDb>

    • Field Detail

      • 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

        protected java.lang.String mongoDbUrlOverride
      • version

        protected de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion version
      • timeoutInMillis

        protected java.lang.Long timeoutInMillis
      • username

        protected java.lang.String username
      • password

        protected java.lang.String password
      • database

        protected java.lang.String database
      • scripting

        protected boolean scripting
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • withUsername

        public MongoDb.Builder<T> withUsername​(java.lang.String username)
        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

        public MongoDb.Builder<T> withPassword​(java.lang.String password)
        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

        public MongoDb.Builder<T> withDatabase​(java.lang.String database)
        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

        public MongoDb.Builder<T> withTimeoutInMillis​(long timeoutInMillis)
        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

        public MongoDb.Builder<T> 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

        public abstract T build()