Class AbstractStep

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.dbunit.ant.AbstractStep
All Implemented Interfaces:
Cloneable, DbUnitTaskStep
Direct Known Subclasses:
Compare, Export, Operation

public abstract class AbstractStep extends org.apache.tools.ant.ProjectComponent implements DbUnitTaskStep
Abstract base implementation of a DbUnitTaskStep executed by the DbUnit Ant task.
Since:
2.1 (Apr 3, 2004)
Version:
$Revision$ $Date$
Author:
Manuel Laflamme, Last changed by: $Author$
  • Field Details

  • Constructor Details

    • AbstractStep

      public AbstractStep()
  • Method Details

    • getDatabaseDataSet

      protected IDataSet getDatabaseDataSet(IDatabaseConnection connection, List tables) throws DatabaseUnitException
      Builds a dataset from the given connection, restricted to the given tables and queries.
      Parameters:
      connection - the database connection.
      tables - the list of Table, Query, and QuerySet elements configuring which tables/queries to include; the whole database is used if empty.
      Returns:
      the assembled dataset.
      Throws:
      DatabaseUnitException - if building the dataset fails.
    • getSrcDataSet

      protected IDataSet getSrcDataSet(File src, String format, boolean forwardonly) throws DatabaseUnitException
      Loads a dataset from the given source file in the given format.
      Parameters:
      src - the source file.
      format - the data format, one of the FORMAT_* constants.
      forwardonly - true to stream the dataset forward-only instead of caching it.
      Returns:
      the loaded dataset.
      Throws:
      DatabaseUnitException - if loading the dataset fails.
    • isDataFormat

      public boolean isDataFormat(String format)
      Checks if the given format is a format which contains tabular data.
      Parameters:
      format - The format to check
      Returns:
      true if the given format is a data format. A data format is a format which holds tabular data that can be loaded via dbunit. An example for a data format is "xml" or "flat". A non-data format is "dtd" which holds only metadata information.
      Since:
      2.4
    • checkDataFormat

      protected void checkDataFormat(String format)
      Checks if the given data format is a valid one according to the method isDataFormat(String). If it is not an IllegalArgumentException is thrown.
      Parameters:
      format - The format to check
      Throws:
      IllegalArgumentException - If the given format is not a valid data format
      Since:
      2.4
    • getInputSource

      public static InputSource getInputSource(File file) throws MalformedURLException
      Creates and returns an InputSource
      Parameters:
      file - The file for which an InputSource should be created
      Returns:
      The input source for the given file
      Throws:
      MalformedURLException - if the file's path cannot be converted to a URL.
    • isOrdered

      public boolean isOrdered()
      Returns whether the resulting dataset's tables must be ordered.
      Returns:
      true if the resulting dataset's tables must be ordered.
    • setOrdered

      public void setOrdered(boolean ordered)
      Sets whether the resulting dataset's tables must be ordered.
      Parameters:
      ordered - true if the resulting dataset's tables must be ordered.
    • toString

      public String toString()
      Overrides:
      toString in class Object