org.dbunit
Class PropertiesBasedJdbcDatabaseTester

java.lang.Object
  extended by org.dbunit.AbstractDatabaseTester
      extended by org.dbunit.JdbcDatabaseTester
          extended by org.dbunit.PropertiesBasedJdbcDatabaseTester
All Implemented Interfaces:
IDatabaseTester

public class PropertiesBasedJdbcDatabaseTester
extends JdbcDatabaseTester

DatabaseTester that configures a DriverManager from environment properties.
This class defines a set of keys for system properties that need to be present in the environment before using it. Example:

System.setProperty( PropertiesBasedJdbcDatabaseTester.DBUNIT_DRIVER_CLASS, "com.mycompany.myDriver" ); System.setProperty( PropertiesBasedJdbcDatabaseTester.DBUNIT_CONNECTION_URL, "jdbc:mydb://host/dbname" ); System.setProperty( PropertiesBasedJdbcDatabaseTester.DBUNIT_USERNAME, "myuser" ); System.setProperty( PropertiesBasedJdbcDatabaseTester.DBUNIT_PASSWORD, "mypasswd" ); System.setProperty( PropertiesBasedJdbcDatabaseTester.DBUNIT_SCHEMA, "myschema" );

Author:
Andres Almiray , Felipe Leme

Nested Class Summary
 
Nested classes/interfaces inherited from class org.dbunit.AbstractDatabaseTester
AbstractDatabaseTester.AssertionFailedError
 
Field Summary
static java.lang.String DBUNIT_CONNECTION_URL
          A key for property that defines the connection url
static java.lang.String DBUNIT_DRIVER_CLASS
          A key for property that defines the driver classname
static java.lang.String DBUNIT_PASSWORD
          A key for property that defines the user's password
static java.lang.String DBUNIT_SCHEMA
          A key for property that defines the database schema
static java.lang.String DBUNIT_USERNAME
          A key for property that defines the username
 
Constructor Summary
PropertiesBasedJdbcDatabaseTester()
          A key for property that defines the connection url
 
Method Summary
protected  void initialize()
          Verifies the configured properties and initializes the driver.
This method is called by getConnection if the tester has not been initialized yet.
 
Methods inherited from class org.dbunit.JdbcDatabaseTester
getConnection, setConnectionUrl, setDriverClass, setPassword, setUsername
 
Methods inherited from class org.dbunit.AbstractDatabaseTester
assertNotNullNorEmpty, assertTrue, closeConnection, getDataSet, getSchema, getSetUpOperation, getTearDownOperation, onSetup, onTearDown, setDataSet, setSchema, setSetUpOperation, setTearDownOperation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBUNIT_CONNECTION_URL

public static final java.lang.String DBUNIT_CONNECTION_URL
A key for property that defines the connection url

See Also:
Constant Field Values

DBUNIT_DRIVER_CLASS

public static final java.lang.String DBUNIT_DRIVER_CLASS
A key for property that defines the driver classname

See Also:
Constant Field Values

DBUNIT_PASSWORD

public static final java.lang.String DBUNIT_PASSWORD
A key for property that defines the user's password

See Also:
Constant Field Values

DBUNIT_USERNAME

public static final java.lang.String DBUNIT_USERNAME
A key for property that defines the username

See Also:
Constant Field Values

DBUNIT_SCHEMA

public static final java.lang.String DBUNIT_SCHEMA
A key for property that defines the database schema

See Also:
Constant Field Values
Constructor Detail

PropertiesBasedJdbcDatabaseTester

public PropertiesBasedJdbcDatabaseTester()
A key for property that defines the connection url

Method Detail

initialize

protected void initialize()
                   throws java.lang.Exception
Description copied from class: JdbcDatabaseTester
Verifies the configured properties and initializes the driver.
This method is called by getConnection if the tester has not been initialized yet.

Overrides:
initialize in class JdbcDatabaseTester
Throws:
java.lang.Exception