Package core.apiCore.helpers
Class SqlHelper
java.lang.Object
core.apiCore.helpers.SqlHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigMapSqlKeyValues(ResultSet resSet, String keyValue) map key value to config eg.features.features.id:1:invalid input: '<'$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 responsevalidateSqlKeywords(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
replaces output parameter with response values eg. $token with id form response eg. ASSET:1:invalid input: '<'$asset_id_selected> -> column:row:variable- Parameters:
outputParam-response-- Throws:
Exception
-
configMapSqlKeyValues
map key value to config eg.features.features.id:1:invalid input: '<'$id>- Parameters:
keyValue-response-- 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:
-