Package net.bugreaper.modules.db
Class PostgreSQL
- All Implemented Interfaces:
SqlConfig<PostgreSQL>,SqlGet,SqlPost
Class for interacting with PostgreSQL
more info
For one instance run recommended: PostgreSQL db = PostgreSQL.getInstance()
Contains methods for:
asserts with await, change data (create, update, clean)more info
JdbcExecutor-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs PostgreSQL client configuration.PostgreSQL(String dbUrl, String username, String passwd) Creates a new PostgreSQL database helper instance with the specified connection parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertCountInTableBuilder(String tableName, String conditions, Object[][] conditionsArray, String expectedCount, int awaitMs) static PostgreSQLReturns the singleton instance ofPostgreSQLwith config builderPostgreSQL().protected String[]getTableColumns(String tableName) Get array with table column listprotected voidrecordExistsBuilder(String tableName, String conditions, Object[][] conditionsArray, int awaitMs) voidrenameTable(String tableName) Rename table(add suffix "_X_")voidrollbackTable(String tableName) Rollback table(remove suffix "_X_") afterSqlPost.renameTable(java.lang.String)protected voidseeInDbByCondMethod(String tableName, String conditions) protected voidshowDataFromTableMethod(String tableName) voidtruncateTableCascade(String tableName) Truncate(clean) table and all connected by foreign keys tablesMethods inherited from class net.bugreaper.modules.db.jdbc.JdbcExecutor
deleteFromTable, deleteFromTable, deleteFromTable, getConfigSummary, insertIntoTable, insertIntoTable, insertIntoTable, runScript, runScriptFromFile, seeRecordExistsInTable, seeRecordExistsInTable, seeRecordExistsInTableCustom, seeRowsCountInTableExactly, seeRowsCountInTableExactly, seeRowsCountInTableExactly, seeRowsCountInTableExactlyCustom, seeTableDoesNotEmpty, seeTableIsEmpty, self, setAwaitMs, setTemplatesDirectory, showDataByCondition, showDataFromTable, truncateTable, truncateTables, updateTable, updateTable, updateTable, withAwaitMs
-
Field Details
-
jdbc
-
getColumnsQuery
-
url
-
username
-
password
-
SELECT_ALL
- See Also:
-
COUNT
- See Also:
-
-
Constructor Details
-
PostgreSQL
Creates a new PostgreSQL database helper instance with the specified connection parameters.- Parameters:
dbUrl- the JDBC connection URL for the PostgreSQL databaseusername- the username used to authenticate with the databasepasswd- the password used to authenticate with the database- Throws:
IllegalArgumentException- if any of the required parameters are null or empty
-
PostgreSQL
public PostgreSQL()Constructs PostgreSQL client configuration.Loads configuration values from a YAML file.
more infoJdbcExecutor(String dbType, String getColumnsQuery)
-
-
Method Details
-
getInstance
Returns the singleton instance ofPostgreSQLwith config builderPostgreSQL().This implementation is thread-safe using method-level synchronization.
- Returns:
- the singleton instance of
PostgreSQL
-
truncateTableCascade
Truncate(clean) table and all connected by foreign keys tables- Parameters:
tableName- schema_name.table_name
-
renameTable
Description copied from interface:SqlPostRename table(add suffix "_X_")Note: After test rollback with
SqlPost.rollbackTable(java.lang.String).- Specified by:
renameTablein interfaceSqlPost- Overrides:
renameTablein classJdbcExecutor<PostgreSQL>- Parameters:
tableName- schema_name.table_name
-
rollbackTable
Description copied from interface:SqlPostRollback table(remove suffix "_X_") afterSqlPost.renameTable(java.lang.String)- Specified by:
rollbackTablein interfaceSqlPost- Overrides:
rollbackTablein classJdbcExecutor<PostgreSQL>- Parameters:
tableName- schema_name.table_name
-
assertCountInTableBuilder
-
recordExistsBuilder
-
showDataFromTableMethod
-
seeInDbByCondMethod
-
getTableColumns
Get array with table column list- Parameters:
tableName- table name- Returns:
- Strings... with columns names
-