org.dbunit
Class AbstractDatabaseTester

java.lang.Object
  extended by org.dbunit.AbstractDatabaseTester
All Implemented Interfaces:
IDatabaseTester
Direct Known Subclasses:
DataSourceDatabaseTester, DefaultDatabaseTester, JdbcDatabaseTester, JndiDatabaseTester

public abstract class AbstractDatabaseTester
extends java.lang.Object
implements IDatabaseTester

Basic implementation of IDatabaseTester.
Implementations of IDatabaseTester may use this class as a starting point.

Since:
2.2.0
Version:
$Revision: 766 $ $Date: 2008-08-01 13:05:20 +0200 (ven, 01 ago 2008) $
Author:
Andres Almiray (aalmiray@users.sourceforge.net), Last changed by: $Author: gommma $

Nested Class Summary
static class AbstractDatabaseTester.AssertionFailedError
          Exception used to avoid JUnit dependency.
 
Constructor Summary
AbstractDatabaseTester()
           
 
Method Summary
protected  void assertNotNullNorEmpty(java.lang.String propertyName, java.lang.String property)
          Asserts that propertyName is not a null String and has a length greater than zero.
protected  void assertTrue(java.lang.String message, boolean condition)
          Method used to avoid JUnit dependency
 void closeConnection(IDatabaseConnection connection)
          Close the specified connection.
 IDataSet getDataSet()
          Returns the test dataset.
protected  java.lang.String getSchema()
          Returns the schema value.
protected  DatabaseOperation getSetUpOperation()
          Returns the DatabaseOperation to call when starting the test.
protected  DatabaseOperation getTearDownOperation()
          Returns the DatabaseOperation to call when ending the test.
 void onSetup()
          TestCases must call this method inside setUp()
 void onTearDown()
          TestCases must call this method inside tearDown()
 void setDataSet(IDataSet dataSet)
          Sets the test dataset to use.
 void setSchema(java.lang.String schema)
          Sets the schema value.
 void setSetUpOperation(DatabaseOperation setUpOperation)
          Sets the DatabaseOperation to call when starting the test.
 void setTearDownOperation(DatabaseOperation tearDownOperation)
          Sets the DatabaseOperation to call when ending the test.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.dbunit.IDatabaseTester
getConnection
 

Constructor Detail

AbstractDatabaseTester

public AbstractDatabaseTester()
Method Detail

closeConnection

public void closeConnection(IDatabaseConnection connection)
                     throws java.lang.Exception
Description copied from interface: IDatabaseTester
Close the specified connection.

Specified by:
closeConnection in interface IDatabaseTester
Throws:
java.lang.Exception

getDataSet

public IDataSet getDataSet()
Description copied from interface: IDatabaseTester
Returns the test dataset.

Specified by:
getDataSet in interface IDatabaseTester

onSetup

public void onSetup()
             throws java.lang.Exception
Description copied from interface: IDatabaseTester
TestCases must call this method inside setUp()

Specified by:
onSetup in interface IDatabaseTester
Throws:
java.lang.Exception

onTearDown

public void onTearDown()
                throws java.lang.Exception
Description copied from interface: IDatabaseTester
TestCases must call this method inside tearDown()

Specified by:
onTearDown in interface IDatabaseTester
Throws:
java.lang.Exception

setDataSet

public void setDataSet(IDataSet dataSet)
Description copied from interface: IDatabaseTester
Sets the test dataset to use.

Specified by:
setDataSet in interface IDatabaseTester

setSchema

public void setSchema(java.lang.String schema)
Description copied from interface: IDatabaseTester
Sets the schema value.

Specified by:
setSchema in interface IDatabaseTester

setSetUpOperation

public void setSetUpOperation(DatabaseOperation setUpOperation)
Description copied from interface: IDatabaseTester
Sets the DatabaseOperation to call when starting the test.

Specified by:
setSetUpOperation in interface IDatabaseTester

setTearDownOperation

public void setTearDownOperation(DatabaseOperation tearDownOperation)
Description copied from interface: IDatabaseTester
Sets the DatabaseOperation to call when ending the test.

Specified by:
setTearDownOperation in interface IDatabaseTester

assertNotNullNorEmpty

protected void assertNotNullNorEmpty(java.lang.String propertyName,
                                     java.lang.String property)
Asserts that propertyName is not a null String and has a length greater than zero.


assertTrue

protected void assertTrue(java.lang.String message,
                          boolean condition)
Method used to avoid JUnit dependency

Parameters:
message - message displayed if assertion is false
condition - condition to be tested

getSchema

protected java.lang.String getSchema()
Returns the schema value.


getSetUpOperation

protected DatabaseOperation getSetUpOperation()
Returns the DatabaseOperation to call when starting the test.


getTearDownOperation

protected DatabaseOperation getTearDownOperation()
Returns the DatabaseOperation to call when ending the test.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2008. All Rights Reserved.