Package org.citrusframework.actions
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
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAction builder. -
Field Summary
FieldsModifier and TypeFieldDescriptionMap holding all column values to be validated, keys represent the column namesstatic final StringFields inherited from class org.citrusframework.actions.AbstractDatabaseConnectingTestAction
sqlResourcePath, statements -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoiddoExecute(TestContext context) Subclasses may add custom execution logic here.protected voidexecuteStatements(List<String> statements, List<Map<String, Object>> allResultRows, Map<String, List<String>> columnValuesMap, TestContext context) Run statements and validate result set.Gets the controlResultSet.Gets the extractVariables.Gets the scriptValidationContext.Gets the validator.protected voidvalidateSingleValue(String columnName, String controlValue, String resultValue, TestContext context) protected voidvalidateSqlStatement(String statement) Does some simple validation on the SQL statement.Methods inherited from class org.citrusframework.actions.AbstractDatabaseConnectingTestAction
createStatementsFromFileResource, createStatementsFromFileResource, execute, getActor, getDescription, getName, getSqlResourcePath, getStatements, getTransactionIsolationLevel, getTransactionManager, getTransactionTimeout, isDisabled, setActor, setDescription, setNameMethods inherited from class org.springframework.jdbc.core.support.JdbcDaoSupport
checkDaoConfig, createJdbcTemplate, getConnection, getDataSource, getExceptionTranslator, getJdbcTemplate, initTemplateConfig, releaseConnection, setDataSource, setJdbcTemplateMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
Field Details
-
controlResultSet
Map holding all column values to be validated, keys represent the column names -
DEFAULT_RESULT_SET_VALIDATOR
- See Also:
-
-
Constructor Details
-
ExecuteSQLQueryAction
Default constructor.
-
-
Method Details
-
doExecute
Description copied from class:AbstractDatabaseConnectingTestActionSubclasses may add custom execution logic here.- Specified by:
doExecutein classAbstractDatabaseConnectingTestAction
-
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
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
Gets the validator.- Returns:
- the validator
-
getControlResultSet
Gets the controlResultSet.- Returns:
- the controlResultSet
-
getExtractVariables
Gets the extractVariables.- Returns:
- the extractVariables
-
getScriptValidationContext
Gets the scriptValidationContext.- Returns:
- the scriptValidationContext
-