Package com.consol.citrus.actions
Class AbstractDatabaseConnectingTestAction
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- org.springframework.jdbc.core.support.JdbcDaoSupport
-
- com.consol.citrus.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. ExtendsJdbcDaoSupportproviding access to aDataSource.- Author:
- Christoph Deppisch
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractDatabaseConnectingTestAction.Builder<T extends AbstractDatabaseConnectingTestAction,S extends AbstractDatabaseConnectingTestAction.Builder<T,S>>Action builder.
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.LoggerlogLoggerprotected StringsqlResourcePathSQL file resource pathprotected List<String>statementsList of SQL statements
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDatabaseConnectingTestAction(String name, AbstractDatabaseConnectingTestAction.Builder<?,?> builder)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected List<String>createStatementsFromFileResource(TestContext context)Reads SQL statements from external file resource.protected List<String>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.TestActorgetActor()StringgetDescription()StringgetName()StringgetSqlResourcePath()Gets the sqlResource.List<String>getStatements()Gets the statements.StringgetTransactionIsolationLevel()Gets the transactionIsolationLevel.org.springframework.transaction.PlatformTransactionManagergetTransactionManager()Gets the transactionManager.StringgetTransactionTimeout()Gets the transactionTimeout.booleanisDisabled(TestContext context)Checks if this test action is disabled.AbstractDatabaseConnectingTestActionsetActor(TestActor actor)Sets the actor.AbstractDatabaseConnectingTestActionsetDescription(String description)voidsetName(String name)
-
-
-
Constructor Detail
-
AbstractDatabaseConnectingTestAction
protected AbstractDatabaseConnectingTestAction(String name, AbstractDatabaseConnectingTestAction.Builder<?,?> builder)
-
-
Method Detail
-
execute
public void execute(TestContext context)
Do basic logging and delegate execution to subclass.- Specified by:
executein interfaceTestAction
-
doExecute
public abstract void doExecute(TestContext context)
Subclasses may add custom execution logic here.
-
isDisabled
public boolean isDisabled(TestContext context)
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
protected List<String> createStatementsFromFileResource(TestContext context)
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
public String getDescription()
- Specified by:
getDescriptionin interfaceDescribed
-
setDescription
public AbstractDatabaseConnectingTestAction setDescription(String description)
- Specified by:
setDescriptionin interfaceDescribed
-
getName
public String getName()
- Specified by:
getNamein interfaceTestAction
-
getSqlResourcePath
public String getSqlResourcePath()
Gets the sqlResource.- Returns:
- the sqlResource
-
getTransactionManager
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
Gets the transactionManager.- Returns:
-
getTransactionTimeout
public String getTransactionTimeout()
Gets the transactionTimeout.- Returns:
-
getTransactionIsolationLevel
public String getTransactionIsolationLevel()
Gets the transactionIsolationLevel.- Returns:
-
getActor
public TestActor getActor()
- Specified by:
getActorin interfaceTestAction
-
setActor
public AbstractDatabaseConnectingTestAction setActor(TestActor actor)
Sets the actor.- Specified by:
setActorin interfaceTestActorAware- Parameters:
actor- the actor to set
-
-