Package org.dbunit

Interface IDatabaseTester

All Known Implementing Classes:
AbstractDatabaseTester, DataSourceDatabaseTester, DefaultDatabaseTester, JdbcDatabaseTester, JndiDatabaseTester, PropertiesBasedJdbcDatabaseTester

public interface IDatabaseTester
This interface defines the behavior of a DatabaseTester, which is responsible for adding DBUnit features as composition on existing test cases (instead of extending DBTestCase directly).
Since:
2.2.0
Version:
$Revision$ $Date$
Author:
Andres Almiray (aalmiray@users.sourceforge.net), Last changed by: $Author$
  • Method Details

    • closeConnection

      @Deprecated void closeConnection(IDatabaseConnection connection) throws Exception
      Deprecated.
      since 2.4.4 define a user defined setOperationListener(IOperationListener) in advance
      Close the specified connection.
      Parameters:
      connection - the connection to close.
      Throws:
      Exception - if the connection cannot be closed.
    • getConnection

      IDatabaseConnection getConnection() throws Exception
      Returns the test database connection.
      Returns:
      the test database connection.
      Throws:
      Exception - if the connection cannot be retrieved or created.
    • getDataSet

      IDataSet getDataSet()
      Returns the test dataset.
      Returns:
      the test dataset.
    • getSetUpOperation

      DatabaseOperation getSetUpOperation()
      Gets the DatabaseOperation to call when starting the test.
      Returns:
      the setup DatabaseOperation.
    • getTearDownOperation

      DatabaseOperation getTearDownOperation()
      Gets the DatabaseOperation to call when ending the test.
      Returns:
      the tear-down DatabaseOperation.
    • setDataSet

      void setDataSet(IDataSet dataSet)
      Sets the test dataset to use.
      Parameters:
      dataSet - the test dataset to use.
    • setSchema

      @Deprecated void setSchema(String schema)
      Deprecated.
      since 2.4.3 Should not be used anymore. Every concrete IDatabaseTester implementation that needs a schema has the possibility to set it somehow in the constructor
      Sets the schema value.
      Parameters:
      schema - the schema name.
    • setSetUpOperation

      void setSetUpOperation(DatabaseOperation setUpOperation)
      Sets the DatabaseOperation to call when starting the test.
      Parameters:
      setUpOperation - the setup DatabaseOperation.
    • setTearDownOperation

      void setTearDownOperation(DatabaseOperation tearDownOperation)
      Sets the DatabaseOperation to call when ending the test.
      Parameters:
      tearDownOperation - the tear-down DatabaseOperation.
    • onSetup

      void onSetup() throws Exception
      TestCases must call this method inside setUp()
      Throws:
      Exception - if the setup operation fails.
    • onTearDown

      void onTearDown() throws Exception
      TestCases must call this method inside tearDown()
      Throws:
      Exception - if the tear-down operation fails.
    • setOperationListener

      void setOperationListener(IOperationListener operationListener)
      Sets the listener notified of connection-retrieval and setup/tear-down events.
      Parameters:
      operationListener - The operation listener that is invoked on specific events in the IDatabaseTester.
      Since:
      2.4.4