Class ExecuteSQLQueryAction

java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.jdbc.core.support.JdbcDaoSupport
org.citrusframework.actions.AbstractDatabaseConnectingTestAction
org.citrusframework.actions.ExecuteSQLQueryAction
All Implemented Interfaces:
Described, Named, TestAction, TestActorAware, org.springframework.beans.factory.InitializingBean

public class ExecuteSQLQueryAction extends AbstractDatabaseConnectingTestAction
Action executes SQL queries and offers result set validation. The class enables you to query data result sets from a database. Validation will happen on column basis inside the result set.
Since:
2008
Author:
Christoph Deppisch, Jan Zahalka
  • Field Details

    • controlResultSet

      protected final Map<String,List<String>> controlResultSet
      Map holding all column values to be validated, keys represent the column names
    • DEFAULT_RESULT_SET_VALIDATOR

      public static final String DEFAULT_RESULT_SET_VALIDATOR
      See Also:
  • Constructor Details

  • Method Details

    • doExecute

      public void doExecute(TestContext context)
      Description copied from class: AbstractDatabaseConnectingTestAction
      Subclasses may add custom execution logic here.
      Specified by:
      doExecute in class AbstractDatabaseConnectingTestAction
    • executeStatements

      protected void executeStatements(List<String> statements, List<Map<String,Object>> allResultRows, Map<String,List<String>> columnValuesMap, TestContext context)
      Run statements and validate result set.
      Parameters:
      statements -
      allResultRows -
      columnValuesMap -
      context -
    • validateSqlStatement

      protected void validateSqlStatement(String statement)
      Does some simple validation on the SQL statement.
      Parameters:
      statement - The statement which is to be validated.
    • validateSingleValue

      protected void validateSingleValue(String columnName, String controlValue, String resultValue, TestContext context)
    • getValidator

      public SqlResultSetScriptValidator getValidator()
      Gets the validator.
      Returns:
      the validator
    • getControlResultSet

      public Map<String,List<String>> getControlResultSet()
      Gets the controlResultSet.
      Returns:
      the controlResultSet
    • getExtractVariables

      public Map<String,String> getExtractVariables()
      Gets the extractVariables.
      Returns:
      the extractVariables
    • getScriptValidationContext

      public ScriptValidationContext getScriptValidationContext()
      Gets the scriptValidationContext.
      Returns:
      the scriptValidationContext