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
All Methods Static Methods Concrete Methods 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.
-
-
-
Method Detail
-
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 Exception
replaces 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
public static void configMapSqlKeyValues(ResultSet resSet, String keyValue) throws Exception
map key value to config eg.features.features.id:1:<$id>- Parameters:
response-keyValue-- Throws:
SQLExceptionNumberFormatExceptionException
-
setRandomRowValue
public static String setRandomRowValue(ResultSet resSet, String outputParam) throws SQLException
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
public static void validateByJsonBody(String expectedJson, ResultSet resSet) throws SQLException
validates expected json string against json body from response- Parameters:
expectedJson-actualJson-- Throws:
SQLException
-
isValidJson
public static boolean isValidJson(String expected)
is valid json based on key:value string splits the string by ":" Then validates if "value" is valid json- Parameters:
expected-- Returns:
-
-