Class SqlHelper

java.lang.Object
core.apiCore.helpers.SqlHelper

public class SqlHelper
extends Object
  • 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 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:
      SQLException
      NumberFormatException
      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: