Class DatabaseManager.Builder<T>
java.lang.Object
de.softwareforge.testing.postgres.embedded.DatabaseManager.Builder<T>
- Type Parameters:
T
- Object to create.
- Direct Known Subclasses:
DatabaseManager.DatabaseManagerBuilder
,EmbeddedPgExtension.EmbeddedPgExtensionBuilder
- Enclosing class:
- DatabaseManager
Builder template.
-
Field Summary
Modifier and TypeFieldDescriptionprotected ImmutableSet.Builder<EmbeddedPostgresPreparer<DataSource>>
protected final boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract T
build()
Creates a new instance.withCustomizer
(EmbeddedPostgres.BuilderCustomizer customizer) Deprecated.withDatabasePreparer
(EmbeddedPostgresPreparer<DataSource> databasePreparer) Add a preparer for the template database.withDatabasePreparers
(Set<EmbeddedPostgresPreparer<DataSource>> databasePreparers) Add preparers for the template database.withInstancePreparer
(EmbeddedPostgresPreparer<EmbeddedPostgres.Builder> instancePreparer) Add a preparer for theEmbeddedPostgres.Builder
object.withInstancePreparers
(Set<EmbeddedPostgresPreparer<EmbeddedPostgres.Builder>> instancePreparers) Add preparers for theEmbeddedPostgres.Builder
object.withPreparer
(DatabasePreparer databasePreparer) Deprecated.
-
Field Details
-
databasePreparers
-
instancePreparers
-
multiMode
-
-
Constructor Details
-
Builder
Creates a new builder.- Parameters:
multiMode
- True if the resulting object should be in multi mode (create multiple database instances) or single mode (use only one instance).
-
-
Method Details
-
withPreparer
@Deprecated @NonNull public DatabaseManager.Builder<T> withPreparer(@NonNull DatabasePreparer databasePreparer) Deprecated. -
withDatabasePreparer
@NonNull public DatabaseManager.Builder<T> withDatabasePreparer(@NonNull EmbeddedPostgresPreparer<DataSource> databasePreparer) Add a preparer for the template database. Each preparer is called once when the database manager starts to prepare the template database. This can be used to create tables, sequences etc. or preload the databases with information. In multi database mode, the template database is used and each created database will have this information cloned.- Parameters:
databasePreparer
- AEmbeddedPostgresPreparer<DataSource>
instance. Must not be null.- Returns:
- This object instance.
-
withDatabasePreparers
@NonNull public DatabaseManager.Builder<T> withDatabasePreparers(@NonNull Set<EmbeddedPostgresPreparer<DataSource>> databasePreparers) Add preparers for the template database. Each preparer is called once when the database manager starts to prepare the template database. This can be used to create tables, sequences etc. or preload the databases with information. In multi database mode, the template database is used and each created database will have this information cloned.- Parameters:
databasePreparers
- A set ofEmbeddedPostgresPreparer<DataSource>
instances. Must not be null.- Returns:
- This object instance.
-
withInstancePreparer
@NonNull public DatabaseManager.Builder<T> withInstancePreparer(@NonNull EmbeddedPostgresPreparer<EmbeddedPostgres.Builder> instancePreparer) Add a preparer for theEmbeddedPostgres.Builder
object. Each preparer is called once when theEmbeddedPostgres
instance that manages the server is created.- Parameters:
instancePreparer
- AEmbeddedPostgresPreparer<EmbeddedPostgres.Builder>
instance. Must not be null.- Returns:
- This object instance.
-
withInstancePreparers
@NonNull public DatabaseManager.Builder<T> withInstancePreparers(@NonNull Set<EmbeddedPostgresPreparer<EmbeddedPostgres.Builder>> instancePreparers) Add preparers for theEmbeddedPostgres.Builder
object. Each preparer is called once when theEmbeddedPostgres
instance that manages the server is created.- Parameters:
instancePreparers
- A set ofEmbeddedPostgresPreparer<EmbeddedPostgres.Builder>
instances. Must not be null.- Returns:
- This object instance.
-
withCustomizer
@Deprecated @NonNull public DatabaseManager.Builder<T> withCustomizer(@NonNull EmbeddedPostgres.BuilderCustomizer customizer) Deprecated. -
build
Creates a new instance.- Returns:
- The instance to create.
-
withInstancePreparer(EmbeddedPostgresPreparer)
.