org.dbunit
Class JdbcDatabaseTester

java.lang.Object
  extended by org.dbunit.assertion.SimpleAssert
      extended by org.dbunit.AbstractDatabaseTester
          extended by org.dbunit.JdbcDatabaseTester
All Implemented Interfaces:
IDatabaseTester
Direct Known Subclasses:
PropertiesBasedJdbcDatabaseTester

public class JdbcDatabaseTester
extends AbstractDatabaseTester

DatabaseTester that uses JDBC's Driver Manager to create connections.

Since:
2.2
Version:
$Revision: 788 $
Author:
Andres Almiray (aalmiray@users.sourceforge.net), Felipe Leme (dbunit@felipeal.net)

Constructor Summary
JdbcDatabaseTester(String driverClass, String connectionUrl)
          Creates a new JdbcDatabaseTester with the specified properties.
Username and Password are set to null.
JdbcDatabaseTester(String driverClass, String connectionUrl, String username, String password)
          Creates a new JdbcDatabaseTester with the specified properties.
 
Method Summary
 IDatabaseConnection getConnection()
          Returns the test database connection.
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.
protected  void setConnectionUrl(String connectionUrl)
          Sets the value of the connection url.
protected  void setDriverClass(String driverClass)
          Sets the value of the JDBC driver classname.
 void setPassword(String password)
          Sets the value of the user's password.
 void setUsername(String username)
          Sets the value of the username from the connection.
 String toString()
           
 
Methods inherited from class org.dbunit.AbstractDatabaseTester
closeConnection, getDataSet, getSchema, getSetUpOperation, getTearDownOperation, onSetup, onTearDown, setDataSet, setSchema, setSetUpOperation, setTearDownOperation
 
Methods inherited from class org.dbunit.assertion.SimpleAssert
assertNotNull, assertNotNull, assertNotNullNorEmpty, assertTrue, assertTrue, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JdbcDatabaseTester

public JdbcDatabaseTester(String driverClass,
                          String connectionUrl)
Creates a new JdbcDatabaseTester with the specified properties.
Username and Password are set to null.

Parameters:
driverClass - the classname of the JDBC driver to use
connectionUrl - the connection url

JdbcDatabaseTester

public JdbcDatabaseTester(String driverClass,
                          String connectionUrl,
                          String username,
                          String password)
Creates a new JdbcDatabaseTester with the specified properties.

Parameters:
driverClass - the classname of the JDBC driver to use
connectionUrl - the connection url
username - a username that can has access to the database
password - the user's password
Method Detail

getConnection

public IDatabaseConnection getConnection()
                                  throws Exception
Description copied from interface: IDatabaseTester
Returns the test database connection.

Throws:
Exception

setPassword

public void setPassword(String password)
Sets the value of the user's password.


setUsername

public void setUsername(String username)
Sets the value of the username from the connection.


initialize

protected void initialize()
                   throws Exception
Verifies the configured properties and initializes the driver.
This method is called by getConnection() if the tester has not been initialized yet.

Throws:
Exception

setConnectionUrl

protected void setConnectionUrl(String connectionUrl)
Sets the value of the connection url.


setDriverClass

protected void setDriverClass(String driverClass)
Sets the value of the JDBC driver classname.


toString

public String toString()
Overrides:
toString in class AbstractDatabaseTester


Copyright © 2002-2012. All Rights Reserved.