Package net.bugreaper.modules.db
Class OracleDb
OracleDb helper that provides a common API for operating with OracleDb.
It is recommended to use a single instance:
OracleDb db = OracleDb.getInstance();
Provides:
- Assertions with await support
- Data manipulation operations such as create, update, and clean
For more information, see JdbcExecutor.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertCountInTableBuilder(String tableName, String conditions, Object[][] conditionsArray, String expectedCount, int awaitMs) static OracleDbReturns the instance ofOracleDbwith config builderOracleDb().protected String[]getTableColumns(String tableName) Returns the list of columns in the table.protected voidrecordExistsBuilder(String tableName, String conditions, Object[][] conditionsArray, int awaitMs) voidrenameTable(String tableName) Renames the specified table by adding the"_X_"suffix.voidrollbackTable(String tableName) Rolls back the table name by removing the"_X_"suffix added bySqlPost.renameTable(java.lang.String).protected voidseeInDbByCondMethod(String tableName, String conditions) protected voidshowDataFromTableMethod(String tableName) Methods 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, seeTableIsEmpty, seeTableIsNotEmpty, 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
-
OracleDb
Creates a new Oracle database helper instance with the specified connection parameters.- Parameters:
dbUrl- the JDBC connection URL for the Oracle 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
-
OracleDb
public OracleDb()Constructs an OracleDb client using YAML configuration.Loads configuration values from a YAML file.
Example:OracleDb db = new OracleDb();oracle: url: 'jdbc:oracle:thin:@localhost:1521/xepdb1' username: user password: pass await: 1000 (optional)
- See Also:
-
-
Method Details
-
getInstance
Returns the instance ofOracleDbwith config builderOracleDb().This implementation is thread-safe using method-level synchronization.
- Returns:
- the shared instance of
OracleDb - Throws:
IllegalArgumentException- if the configuration contains invalid values- See Also:
-
renameTable
Description copied from interface:SqlPostRenames the specified table by adding the"_X_"suffix.Note: Roll back the table name after the test using
SqlPost.rollbackTable(java.lang.String).- Specified by:
renameTablein interfaceSqlPost- Overrides:
renameTablein classJdbcExecutor<OracleDb>- Parameters:
tableName- table name in the formatschema_name.table_name
-
rollbackTable
Description copied from interface:SqlPostRolls back the table name by removing the"_X_"suffix added bySqlPost.renameTable(java.lang.String).- Specified by:
rollbackTablein interfaceSqlPost- Overrides:
rollbackTablein classJdbcExecutor<OracleDb>- Parameters:
tableName- table name in the formatschema_name.table_name
-
assertCountInTableBuilder
-
recordExistsBuilder
-
showDataFromTableMethod
-
seeInDbByCondMethod
-
getTableColumns
Returns the list of columns in the table.- Parameters:
tableName- table name in the formatschema_name.table_name- Returns:
- array containing column names
-