Package org.citrusframework.actions
Class AbstractDatabaseConnectingTestAction
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.jdbc.core.support.JdbcDaoSupport
org.citrusframework.actions.AbstractDatabaseConnectingTestAction
- All Implemented Interfaces:
Described,Named,TestAction,TestActorAware,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
ExecutePLSQLAction,ExecuteSQLAction,ExecuteSQLQueryAction
public abstract class AbstractDatabaseConnectingTestAction
extends org.springframework.jdbc.core.support.JdbcDaoSupport
implements TestAction, Named, Described, TestActorAware
Abstract base class for database connection test actions. Extends
JdbcDaoSupport providing
access to a DataSource.- Author:
- Christoph Deppisch
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAbstractDatabaseConnectingTestAction.Builder<T extends AbstractDatabaseConnectingTestAction,S extends AbstractDatabaseConnectingTestAction.Builder<T, S>> Action builder. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringSQL file resource pathList of SQL statementsFields inherited from class org.springframework.dao.support.DaoSupport
logger -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDatabaseConnectingTestAction(String name, AbstractDatabaseConnectingTestAction.Builder<?, ?> builder) -
Method Summary
Modifier and TypeMethodDescriptionReads SQL statements from external file resource.createStatementsFromFileResource(TestContext context, SqlUtils.LastScriptLineDecorator lineDecorator) Reads SQL statements from external file resource.abstract voiddoExecute(TestContext context) Subclasses may add custom execution logic here.voidexecute(TestContext context) Do basic logging and delegate execution to subclass.getActor()getName()Gets the sqlResource.Gets the statements.Gets the transactionIsolationLevel.org.springframework.transaction.PlatformTransactionManagerGets the transactionManager.Gets the transactionTimeout.booleanisDisabled(TestContext context) Checks if this test action is disabled.Sets the actor.setDescription(String description) voidMethods 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
-
sqlResourcePath
SQL file resource path -
statements
List of SQL statements
-
-
Constructor Details
-
AbstractDatabaseConnectingTestAction
protected AbstractDatabaseConnectingTestAction(String name, AbstractDatabaseConnectingTestAction.Builder<?, ?> builder)
-
-
Method Details
-
execute
Do basic logging and delegate execution to subclass.- Specified by:
executein interfaceTestAction
-
doExecute
Subclasses may add custom execution logic here. -
isDisabled
Checks if this test action is disabled. Delegates to test actor defined for this test action by default. Subclasses may add additional disabled logic here.- Specified by:
isDisabledin interfaceTestAction- Parameters:
context- the current test context.- Returns:
-
createStatementsFromFileResource
Reads SQL statements from external file resource. File resource can hold several multi-line statements and comments.- Parameters:
context- the current test context.- Returns:
- list of SQL statements.
-
createStatementsFromFileResource
protected List<String> createStatementsFromFileResource(TestContext context, SqlUtils.LastScriptLineDecorator lineDecorator) Reads SQL statements from external file resource. File resource can hold several multi-line statements and comments.- Parameters:
context- the current test context.- Returns:
- list of SQL statements.
-
getDescription
- Specified by:
getDescriptionin interfaceDescribed
-
setDescription
- Specified by:
setDescriptionin interfaceDescribed
-
getName
- Specified by:
getNamein interfaceTestAction
-
setName
-
getSqlResourcePath
Gets the sqlResource.- Returns:
- the sqlResource
-
getStatements
Gets the statements.- Returns:
- the statements
-
getTransactionManager
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()Gets the transactionManager.- Returns:
-
getTransactionTimeout
Gets the transactionTimeout.- Returns:
-
getTransactionIsolationLevel
Gets the transactionIsolationLevel.- Returns:
-
getActor
- Specified by:
getActorin interfaceTestAction
-
setActor
Sets the actor.- Specified by:
setActorin interfaceTestActorAware- Parameters:
actor- the actor to set
-