org.dbunit.ant
Class DbUnitTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.dbunit.ant.DbUnitTask
All Implemented Interfaces:
Cloneable

public class DbUnitTask
extends org.apache.tools.ant.Task

DbUnitTask is the task definition for an Ant interface to DbUnit. DbUnit is a JUnit extension which sets your database to a known state before executing your tasks.

Since:
Jun 10, 2002
Version:
$Revision: 907 $
Author:
Timothy Ruppert, Ben Cox
See Also:
Task

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
DbUnitTask()
           
 
Method Summary
 void addCompare(Compare compare)
          Adds a Compare to the steps List.
 void addDbConfig(DbConfig dbConfig)
           
 void addExport(Export export)
          Adds an Export to the steps List.
 void addOperation(Operation operation)
          Adds an Operation.
 org.apache.tools.ant.types.Path createClasspath()
          Create the classpath for loading the driver.
protected  IDatabaseConnection createConnection()
           
protected  IDatabaseConnection createDatabaseConnection(Connection jdbcConnection, String dbSchema)
          Creates the dbunit connection using the two given arguments.
 void execute()
          Load the step and then execute it
 String getBatchSize()
           
 DbConfig getDbConfig()
           
 String getFetchSize()
           
 List getSteps()
          Gets the Steps.
 void setBatchSize(String batchSize)
          sets the size of batch inserts.
 void setClasspath(org.apache.tools.ant.types.Path classpath)
          Set the classpath for loading the driver.
 void setClasspathRef(org.apache.tools.ant.types.Reference r)
          Set the classpath for loading the driver using the classpath reference.
 void setDatatypeFactory(String datatypeFactory)
           
 void setDatatypeWarning(Boolean datatypeWarning)
           
 void setDriver(String driver)
          Set the JDBC driver to be used.
 void setEscapePattern(String escapePattern)
           
 void setFetchSize(String fetchSize)
           
 void setPassword(String password)
          Set the password for the DB connection.
 void setSchema(String schema)
          Set the schema for the DB connection.
 void setSkipOracleRecycleBinTables(Boolean skipOracleRecycleBinTables)
           
 void setSupportBatchStatement(Boolean supportBatchStatement)
          Set the flag for supporting batch statements.
 void setUrl(String url)
          Set the DB connection url.
 void setUseQualifiedTableNames(Boolean useQualifiedTableNames)
          Set the flag for using the qualified table names.
 void setUserid(String userId)
          Set the user name for the DB connection.
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbUnitTask

public DbUnitTask()
Method Detail

setDriver

public void setDriver(String driver)
Set the JDBC driver to be used.


setUrl

public void setUrl(String url)
Set the DB connection url.


setUserid

public void setUserid(String userId)
Set the user name for the DB connection.


setPassword

public void setPassword(String password)
Set the password for the DB connection.


setSchema

public void setSchema(String schema)
Set the schema for the DB connection.


setUseQualifiedTableNames

public void setUseQualifiedTableNames(Boolean useQualifiedTableNames)
Set the flag for using the qualified table names.


setSupportBatchStatement

public void setSupportBatchStatement(Boolean supportBatchStatement)
Set the flag for supporting batch statements. NOTE: This property cannot be used to force the usage of batch statement if your database does not support it.


setDatatypeWarning

public void setDatatypeWarning(Boolean datatypeWarning)

setDatatypeFactory

public void setDatatypeFactory(String datatypeFactory)

setEscapePattern

public void setEscapePattern(String escapePattern)

getDbConfig

public DbConfig getDbConfig()

addDbConfig

public void addDbConfig(DbConfig dbConfig)

setClasspath

public void setClasspath(org.apache.tools.ant.types.Path classpath)
Set the classpath for loading the driver.


createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Create the classpath for loading the driver.


setClasspathRef

public void setClasspathRef(org.apache.tools.ant.types.Reference r)
Set the classpath for loading the driver using the classpath reference.


getSteps

public List getSteps()
Gets the Steps.


addOperation

public void addOperation(Operation operation)
Adds an Operation.


addCompare

public void addCompare(Compare compare)
Adds a Compare to the steps List.


addExport

public void addExport(Export export)
Adds an Export to the steps List.


getBatchSize

public String getBatchSize()

setBatchSize

public void setBatchSize(String batchSize)
sets the size of batch inserts.

Parameters:
batchSize -

getFetchSize

public String getFetchSize()

setFetchSize

public void setFetchSize(String fetchSize)

setSkipOracleRecycleBinTables

public void setSkipOracleRecycleBinTables(Boolean skipOracleRecycleBinTables)

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Load the step and then execute it

Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException

createConnection

protected IDatabaseConnection createConnection()
                                        throws SQLException
Throws:
SQLException

createDatabaseConnection

protected IDatabaseConnection createDatabaseConnection(Connection jdbcConnection,
                                                       String dbSchema)
Creates the dbunit connection using the two given arguments. The configuration properties of the dbunit connection are initialized using the fields of this class.

Parameters:
jdbcConnection -
dbSchema -
Returns:
The dbunit connection


Copyright © 2002-2012. All Rights Reserved.