java.lang.Object
de.softwareforge.testing.postgres.embedded.DatabaseInfo

public abstract class DatabaseInfo extends Object
Information about a database located on a PostgreSQL server connected to an EmbeddedPostgres instance.
  • Method Details

    • dbName

      @NonNull public abstract String dbName()
      Returns the name of the database.
      Returns:
      Name of the database. Is never null.
    • port

      public abstract int port()
      Returns the TCP port for the database server.
      Returns:
      A port number. May be -1 if this objects represents an error connection.
    • user

      @NonNull public abstract String user()
      Returns the user that can connect to this database.
      Returns:
      The user name. Is never null.
    • connectionProperties

      @NonNull public abstract com.google.common.collect.ImmutableMap<String,String> connectionProperties()
      Returns all properties that are be applied to a new data source connection to this database. See the PostgreSQL JDBC driver documentation for a comprehensive list.
      Returns:
      Map of key-value pairs representing data source connection properties.
      Since:
      3.0
    • asJdbcUrl

      @NonNull public String asJdbcUrl()
      Returns a JDBC url to connect to the described database.
      Returns:
      A JDBC url that can be used to connect to the database. Never null.
    • asDataSource

      @NonNull public DataSource asDataSource() throws SQLException
      Returns a DataSource instance connected to the described database.
      Returns:
      An initialized DataSource object. Never null.
      Throws:
      SQLException - A problem occured trying to connect to the database.