Class EmbeddedPostgres.Builder
- java.lang.Object
-
- com.opentable.db.postgres.embedded.EmbeddedPostgres.Builder
-
- Enclosing class:
- EmbeddedPostgres
public static class EmbeddedPostgres.Builder extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)inthashCode()EmbeddedPostgres.BuildersetBindMount(BindMount bindMount)Set up a bind mount between the local file system and the remoteEmbeddedPostgres.BuildersetBindMount(String localFile, String remoteFile)Set up a readonly bind mount.EmbeddedPostgres.BuildersetDatabaseName(String databaseName)Override the default databaseName of postgresEmbeddedPostgres.BuildersetImage(org.testcontainers.utility.DockerImageName image)Set a default image.EmbeddedPostgres.BuildersetLocaleConfig(String key, String value)Set up arguments to initDB processEmbeddedPostgres.BuildersetNetwork(org.testcontainers.containers.Network network, String networkAlias)Set up a shared network and the alias.EmbeddedPostgres.BuildersetPGStartupWait(Duration pgStartupWait)Override the default startup wait for the container to start and be readyEmbeddedPostgres.BuildersetServerConfig(String key, String value)Arguments passed to the postgres process itselfEmbeddedPostgres.BuildersetTag(String tag)Add the tag to an existing imageEmbeddedPostgresstart()
-
-
-
Method Detail
-
setPGStartupWait
public EmbeddedPostgres.Builder setPGStartupWait(Duration pgStartupWait)
Override the default startup wait for the container to start and be ready- Parameters:
pgStartupWait- time to wait- Returns:
- builder
-
setServerConfig
public EmbeddedPostgres.Builder setServerConfig(String key, String value)
Arguments passed to the postgres process itself- Parameters:
key- keyvalue- value- Returns:
- builder
-
setBindMount
public EmbeddedPostgres.Builder setBindMount(String localFile, String remoteFile)
Set up a readonly bind mount.- Parameters:
localFile- local file system referenceremoteFile- remote file system reference- Returns:
- builder
-
setBindMount
public EmbeddedPostgres.Builder setBindMount(BindMount bindMount)
Set up a bind mount between the local file system and the remote- Parameters:
bindMount- object representing this bind- Returns:
- builder
-
setNetwork
public EmbeddedPostgres.Builder setNetwork(org.testcontainers.containers.Network network, String networkAlias)
Set up a shared network and the alias. This is useful if you have multiple containers, and they need to communicate with each other.- Parameters:
network- The Network. Usually Network.Shared.networkAlias- an alias by which other containers in the network can refer to this container- Returns:
- builder
-
setDatabaseName
public EmbeddedPostgres.Builder setDatabaseName(String databaseName)
Override the default databaseName of postgres- Parameters:
databaseName- the name- Returns:
- builder
-
setLocaleConfig
public EmbeddedPostgres.Builder setLocaleConfig(String key, String value)
Set up arguments to initDB process- Parameters:
key- keyvalue- value- Returns:
- builder
-
setImage
public EmbeddedPostgres.Builder setImage(org.testcontainers.utility.DockerImageName image)
Set a default image. This may be with or without a tag- Parameters:
image- Docker image- Returns:
- builder
-
setTag
public EmbeddedPostgres.Builder setTag(String tag)
Add the tag to an existing image- Parameters:
tag- Tag- Returns:
- builder
-
start
public EmbeddedPostgres start() throws IOException
- Throws:
IOException
-
-