Class PostgresClient
java.lang.Object
dev.lydtech.component.framework.client.database.PostgresClient
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclose(Connection connection) Close the Postgres connection.static ConnectionConnect to Postgres with the database properties as set in System properties.static ConnectiongetConnection(String databaseName, String schemaName, String username, String password) Connect to Postgres with the database properties passed in.static StringGet the URL of the database with the host and port.static PostgresClient
-
Method Details
-
getInstance
-
getConnection
Connect to Postgres with the database properties as set in System properties.- Throws:
Exception
-
getConnection
public static Connection getConnection(String databaseName, String schemaName, String username, String password) throws Exception Connect to Postgres with the database properties passed in. This is useful when re-running component tests with the containers left up between runs and not wanting to set the system properties for each test run.- Throws:
Exception
-
close
Close the Postgres connection.- Throws:
Exception
-
getDbHostAndPortUrl
Get the URL of the database with the host and port. The port is the mapped port of the docker container, such that this can be used to connect to from the tests.
-