|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.configuration.DatabaseConfigurationTestHelper
public class DatabaseConfigurationTestHelper
A helper class for performing tests for DatabaseConfiguration. This
class maintains an in-process database that stores configuration data and can
be accessed from a DatabaseConfiguration instance. Constants for
table and column names and database connection settings are provided, too.
| Field Summary | |
|---|---|
static String |
COL_KEY
Constant for the column with the keys. |
static String |
COL_NAME
Constant for the column with the configuration name. |
static String |
COL_VALUE
Constant for the column with the values. |
static String |
CONFIG_NAME
Constant for the name of the test configuration. |
String |
DATABASE_DRIVER
Constant for the JDBC driver class. |
String |
DATABASE_PASSWORD
Constant for the DB password. |
String |
DATABASE_URL
Constant for the connection URL. |
String |
DATABASE_USERNAME
Constant for the DB user name. |
static String |
TABLE
Constant for the configuration table. |
static String |
TABLE_MULTI
Constant for the multi configuration table. |
| Constructor Summary | |
|---|---|
DatabaseConfigurationTestHelper()
|
|
| Method Summary | |
|---|---|
DataSource |
getDatasource()
Returns the DataSource managed by this class. |
boolean |
isAutoCommit()
Returns the auto-commit mode of the connections created by the managed data source. |
void |
setAutoCommit(boolean autoCommit)
Sets the auto-commit mode of the connections created by the managed data source. |
void |
setUp()
Initializes this helper object. |
org.apache.commons.configuration.DatabaseConfiguration |
setUpConfig()
Creates a database configuration with default values. |
org.apache.commons.configuration.DatabaseConfiguration |
setUpMultiConfig()
Creates a database configuration that supports multiple configurations in a table with default values. |
org.apache.commons.configuration.DatabaseConfiguration |
setUpMultiConfig(String configName)
Creates a database configuration that supports multiple configurations in a table and sets the specified configuration name. |
void |
tearDown()
Frees the resources used by this helper class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final String DATABASE_DRIVER
public final String DATABASE_URL
public final String DATABASE_USERNAME
public final String DATABASE_PASSWORD
public static final String TABLE
public static final String TABLE_MULTI
public static final String COL_KEY
public static final String COL_VALUE
public static final String COL_NAME
public static final String CONFIG_NAME
| Constructor Detail |
|---|
public DatabaseConfigurationTestHelper()
| Method Detail |
|---|
public boolean isAutoCommit()
public void setAutoCommit(boolean autoCommit)
autoCommit - the auto-commit mode
public void setUp()
throws Exception
setUp() method of a unit test class. It creates the database
instance if necessary.
Exception - if an error occurs
public void tearDown()
throws Exception
tearDown() method of a unit test class.
Exception - if an error occurspublic org.apache.commons.configuration.DatabaseConfiguration setUpConfig()
public org.apache.commons.configuration.DatabaseConfiguration setUpMultiConfig()
public org.apache.commons.configuration.DatabaseConfiguration setUpMultiConfig(String configName)
configName - the name of the configuration
public DataSource getDatasource()
DataSource managed by this class. The data
source is created on first access.
DataSource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||