Class DatabaseInfo

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 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 occurred trying to connect to the database.