Package com.consol.citrus.actions
Class ExecuteSQLQueryAction
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- org.springframework.jdbc.core.support.JdbcDaoSupport
-
- com.consol.citrus.actions.AbstractDatabaseConnectingTestAction
-
- com.consol.citrus.actions.ExecuteSQLQueryAction
-
- All Implemented Interfaces:
com.consol.citrus.common.Described,com.consol.citrus.common.Named,com.consol.citrus.TestAction,com.consol.citrus.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExecuteSQLQueryAction.BuilderAction builder.
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,List<String>>controlResultSetMap holding all column values to be validated, keys represent the column namesstatic StringDEFAULT_RESULT_SET_VALIDATOR-
Fields inherited from class com.consol.citrus.actions.AbstractDatabaseConnectingTestAction
sqlResourcePath, statements
-
-
Constructor Summary
Constructors Constructor Description ExecuteSQLQueryAction(ExecuteSQLQueryAction.Builder builder)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoExecute(com.consol.citrus.context.TestContext context)Subclasses may add custom execution logic here.protected voidexecuteStatements(List<String> statements, List<Map<String,Object>> allResultRows, Map<String,List<String>> columnValuesMap, com.consol.citrus.context.TestContext context)Run statements and validate result set.Map<String,List<String>>getControlResultSet()Gets the controlResultSet.Map<String,String>getExtractVariables()Gets the extractVariables.com.consol.citrus.validation.script.ScriptValidationContextgetScriptValidationContext()Gets the scriptValidationContext.com.consol.citrus.validation.script.sql.SqlResultSetScriptValidatorgetValidator()Gets the validator.protected voidvalidateSingleValue(String columnName, String controlValue, String resultValue, com.consol.citrus.context.TestContext context)protected voidvalidateSqlStatement(String stmt)Does some simple validation on the SQL statement.-
Methods inherited from class com.consol.citrus.actions.AbstractDatabaseConnectingTestAction
createStatementsFromFileResource, createStatementsFromFileResource, execute, getActor, getDescription, getName, getSqlResourcePath, getStatements, getTransactionIsolationLevel, getTransactionManager, getTransactionTimeout, isDisabled, setActor, setDescription, setName
-
-
-
-
Constructor Detail
-
ExecuteSQLQueryAction
public ExecuteSQLQueryAction(ExecuteSQLQueryAction.Builder builder)
Default constructor.
-
-
Method Detail
-
doExecute
public void doExecute(com.consol.citrus.context.TestContext context)
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, com.consol.citrus.context.TestContext context)
Run statements and validate result set.- Parameters:
statements-allResultRows-columnValuesMap-context-
-
validateSqlStatement
protected void validateSqlStatement(String stmt)
Does some simple validation on the SQL statement.- Parameters:
stmt- The statement which is to be validated.
-
validateSingleValue
protected void validateSingleValue(String columnName, String controlValue, String resultValue, com.consol.citrus.context.TestContext context)
-
getValidator
public com.consol.citrus.validation.script.sql.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 com.consol.citrus.validation.script.ScriptValidationContext getScriptValidationContext()
Gets the scriptValidationContext.- Returns:
- the scriptValidationContext
-
-