Class EmbeddedPostgres.Builder

java.lang.Object
com.opentable.db.postgres.embedded.EmbeddedPostgres.Builder
Enclosing class:
EmbeddedPostgres

public static class EmbeddedPostgres.Builder extends Object
  • Method Details

    • 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 - key
      value - value
      Returns:
      builder
    • setBindMount

      public EmbeddedPostgres.Builder setBindMount(String localFile, String remoteFile)
      Set up a readonly bind mount.
      Parameters:
      localFile - local file system reference
      remoteFile - 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 - key
      value - 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
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object