Class SqlHelper


  • public class SqlHelper
    extends Object
    • Constructor Detail

      • SqlHelper

        public SqlHelper()
    • 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
      • 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: