Package org.dbunit.ant
Class Operation
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.dbunit.ant.AbstractStep
org.dbunit.ant.Operation
- All Implemented Interfaces:
Cloneable,DbUnitTaskStep
The
Operation class is the step that defines which
operation will be performed in the execution of the DbUnitTask
task.- Since:
- Jun 10, 2002
- Version:
- $Revision$
- Author:
- Timothy Ruppert, Ben Cox
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe name of theDatabaseOperationto execute, e.g.Fields inherited from class org.dbunit.ant.AbstractStep
FORMAT_CSV, FORMAT_DTD, FORMAT_FLAT, FORMAT_JSON, FORMAT_XLS, FORMAT_XML, FORMAT_YMLFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfiguredFileset(org.apache.tools.ant.types.FileSet fileSet) Adds the files matched by the given Ant fileset to the operation's dataset sources.voidexecute(IDatabaseConnection connection) Executes this step using the given database connection.Returns the database operation resolved fromsetType(String).Returns the dataset format, defaulting to "flat" when not set.Returns a message describing this step, for logging purposes.Returns the token replaced with a null value in the dataset.File[]getSrc()Returns the source files holding the operation's dataset.getType()Returns the operation type name.booleanReturns whether multiple sources are combined into a single dataset.booleanReturns whether the operation runs within a transaction.voidsetCombine(boolean combine) Sets whether multiple sources are combined into a single dataset.voidSets the dataset format.voidsetNullToken(String nullToken) Sets the token to replace with a null value in the dataset.voidSets the single source file holding the operation's dataset.voidSets the source files holding the operation's dataset.voidsetTransaction(boolean transaction) Sets whether the operation runs within a transaction.voidSets the operation type, resolving it to the correspondingDatabaseOperation.toString()Methods inherited from class org.dbunit.ant.AbstractStep
checkDataFormat, getDatabaseDataSet, getInputSource, getSrcDataSet, isDataFormat, isOrdered, setOrderedMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
-
Field Details
-
_type
The name of theDatabaseOperationto execute, e.g."CLEAN_INSERT".
-
-
Constructor Details
-
Operation
public Operation()
-
-
Method Details
-
getSrc
Returns the source files holding the operation's dataset.- Returns:
- the source files holding the operation's dataset.
-
setSrc
Sets the source files holding the operation's dataset.- Parameters:
sources- the source files holding the operation's dataset.
-
setSrc
Sets the single source file holding the operation's dataset.- Parameters:
src- the source file holding the operation's dataset.
-
addConfiguredFileset
public void addConfiguredFileset(org.apache.tools.ant.types.FileSet fileSet) Adds the files matched by the given Ant fileset to the operation's dataset sources.- Parameters:
fileSet- the Ant fileset to add.
-
getFormat
Returns the dataset format, defaulting to "flat" when not set.- Returns:
- the dataset format.
-
setFormat
Sets the dataset format.- Parameters:
format- the dataset format.
-
isCombine
public boolean isCombine()Returns whether multiple sources are combined into a single dataset.- Returns:
trueif multiple sources are combined into a single dataset.
-
setCombine
public void setCombine(boolean combine) Sets whether multiple sources are combined into a single dataset.- Parameters:
combine-trueto combine multiple sources into a single dataset.
-
isTransaction
public boolean isTransaction()Returns whether the operation runs within a transaction.- Returns:
trueif the operation runs within a transaction.
-
setTransaction
public void setTransaction(boolean transaction) Sets whether the operation runs within a transaction.- Parameters:
transaction-trueto run the operation within a transaction.
-
getNullToken
Returns the token replaced with a null value in the dataset.- Returns:
- the token replaced with a null value in the dataset.
-
setNullToken
Sets the token to replace with a null value in the dataset.- Parameters:
nullToken- the token to replace with a null value in the dataset.
-
getDbOperation
Returns the database operation resolved fromsetType(String).- Returns:
- the database operation resolved from
setType(String).
-
getType
Returns the operation type name.- Returns:
- the operation type name.
-
setType
Sets the operation type, resolving it to the correspondingDatabaseOperation.- Parameters:
type- one of: UPDATE, INSERT, REFRESH, DELETE, DELETE_ALL, CLEAN_INSERT, NONE, MSSQL_CLEAN_INSERT, MSSQL_INSERT, or MSSQL_REFRESH.
-
execute
Description copied from interface:DbUnitTaskStepExecutes this step using the given database connection.- Parameters:
connection- the database connection to use.- Throws:
DatabaseUnitException- if the step fails.
-
getLogMessage
Description copied from interface:DbUnitTaskStepReturns a message describing this step, for logging purposes.- Returns:
- a message describing this step.
-
toString
- Overrides:
toStringin classAbstractStep
-