public class SqlInterface extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
SQL_CURRENT_DATABASE |
| Constructor and Description |
|---|
SqlInterface() |
| Modifier and Type | Method and Description |
|---|---|
static void |
connectDB()
connect to database based on the current database
|
static ResultSet |
DataBaseInterface(ServiceObject serviceObject)
interface for database calls
|
static ResultSet |
evaluateDbQuery(ServiceObject serviceObject)
evaluaes the sql statement
|
static void |
evaluateOption(ServiceObject serviceObject) |
static List<String> |
evaluateReponse(ServiceObject serviceObject,
ResultSet resSet)
evaluate the response
|
static ResultSet |
evaluateRequestAndValidateResponse(ServiceObject serviceObject)
evaluate request and validate response retry until validation timeout period
in seconds
|
static ResultSet |
executeAndWaitForDbResponse(PreparedStatement sqlStmt,
ServiceObject serviceObject)
executes And waits for response calls the query in each loop does not wait if
expected or partial expected response are empty
|
static void |
setDatabaseMap()
set database values from config into database object hashmap format:
db.1.driver = org.postgresql.Driver 1 is position driver is key (command)
org.postgresql.Driver is value
|
static void |
setDatabaseObject(String command,
int position,
String value)
set database object in hashmap key: position value: database object
|
static void |
setDefaultDatabase()
set default database to be from position 0 or 1 if db 0 is set, set as
default else set db 1 fail if no position 0 or 1 is not set
|
static List<String> |
validateExpectedResponse(String expected,
ResultSet resSet) |
public static final String SQL_CURRENT_DATABASE
public static ResultSet DataBaseInterface(ServiceObject serviceObject) throws Exception
serviceObject - Exceptionpublic static void connectDB()
public static void evaluateOption(ServiceObject serviceObject)
public static void setDatabaseMap()
public static void setDefaultDatabase()
public static void setDatabaseObject(String command, int position, String value)
command - position - value - public static ResultSet evaluateDbQuery(ServiceObject serviceObject) throws Exception
serviceObject - Exceptionpublic static List<String> evaluateReponse(ServiceObject serviceObject, ResultSet resSet) throws Exception
serviceObject - resSet - Exceptionpublic static ResultSet executeAndWaitForDbResponse(PreparedStatement sqlStmt, ServiceObject serviceObject) throws SQLException
sqlStmt - serviceObject - SQLExceptionpublic static List<String> validateExpectedResponse(String expected, ResultSet resSet) throws SQLException
SQLExceptionpublic static ResultSet evaluateRequestAndValidateResponse(ServiceObject serviceObject) throws Exception
serviceObject - ExceptionCopyright © 2022. All rights reserved.