Package core.apiCore.helpers
Class SqlHelper
java.lang.Object
core.apiCore.helpers.SqlHelper
public class SqlHelper extends Object
-
Constructor Summary
Constructors Constructor Description SqlHelper() -
Method Summary
Modifier and Type Method Description static voidconfigMapSqlKeyValues(ResultSet resSet, String keyValue)map key value to config eg.features.features.id:1:<$id>static booleanisValidJson(String expected)is valid json based on key:value string splits the string by ":" Then validates if "value" is valid jsonstatic voidsaveOutboundJsonParameters(io.restassured.response.Response response, String outputParam)replaces output parameter with response values eg.static voidsaveOutboundSQLParameters(ResultSet resSet, String outputParam)replaces output parameter with response values eg.static StringsetRandomRowValue(ResultSet resSet, String outputParam)replaces RAND_DatabaseMaxRows variable with random numberstatic voidvalidateByJsonBody(String expectedJson, ResultSet resSet)validates expected json string against json body from responsestatic List<String>validateSqlKeywords(List<KeyValue> keywords, ResultSet resSet)* validates the maps agains the keyword requirements matcher.
-
Constructor Details
-
SqlHelper
public SqlHelper()
-
-
Method Details
-
saveOutboundJsonParameters
public static void saveOutboundJsonParameters(io.restassured.response.Response response, String outputParam)replaces output parameter with response values eg. $token with id form response- Parameters:
response-outputParam-
-
saveOutboundSQLParameters
public static void saveOutboundSQLParameters(ResultSet resSet, String outputParam) throws Exceptionreplaces output parameter with response values eg. $token with id form response eg. ASSET:1:<$asset_id_selected> -> column:row:variable- Parameters:
response-outputParam-- Throws:
Exception
-
configMapSqlKeyValues
map key value to config eg.features.features.id:1:<$id>- Parameters:
response-keyValue-- Throws:
SQLExceptionNumberFormatExceptionException
-
setRandomRowValue
replaces RAND_DatabaseMaxRows variable with random number- Parameters:
resSet-outputParam-- Returns:
- Throws:
SQLException
-
validateSqlKeywords
public static List<String> validateSqlKeywords(List<KeyValue> keywords, ResultSet resSet) throws SQLException* validates the maps agains the keyword requirements matcher. examples: "title": equalTo("Administrator"), "name": isNotEmpty, "name": contains("admin")- Parameters:
keywords-response-- Returns:
- Throws:
SQLException
-
validateByJsonBody
validates expected json string against json body from response- Parameters:
expectedJson-actualJson-- Throws:
SQLException
-
isValidJson
is valid json based on key:value string splits the string by ":" Then validates if "value" is valid json- Parameters:
expected-- Returns:
-