public class DatabaseUnitils extends Object
| 构造器和说明 |
|---|
DatabaseUnitils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
cleanSchemas()
Cleans all configured schema's.
|
static void |
cleanSchemas(String databaseName)
Cleans all configured schema's.
|
static void |
clearSchemas()
Clears all configured schema's.
|
static void |
clearSchemas(String databaseName)
Clears all configured schema's.
|
static void |
commitTransaction()
Commits the current unitils transaction
|
static void |
disableConstraints()
Disables all foreign key and not-null constraints on the configured schema's.
|
static void |
disableConstraints(String databaseName)
Disables all foreign key and not-null constraints on the configured schema's.
|
static void |
flushDatabaseUpdates()
Flushes all pending updates to the database.
|
static void |
generateDatasetDefinition()
Generates a definition file that defines the structure of dataset's, i.e. a XSD of DTD that
describes the structure of the database.
|
static void |
generateDatasetDefinition(String databaseName)
Generates a definition file that defines the structure of dataset's, i.e. a XSD of DTD that
describes the structure of the database.
|
static DataSource |
getDataSource()
Returns the DataSource that connects to the test database
|
static DataSource |
getDataSource(String databaseName)
Returns the DataSource that connects to the test database
|
static Connection |
getGoodConnection(Connection connection,
DataSource dataSource)
This method gets a
Connection from the DataSource and checks if it is a oracle.jdbc.driver.OracleConnection. |
static void |
resetDatabaseState()
Updates the database version to the current version, without issuing any other updates to the database.
|
static void |
resetDatabaseState(String databaseName)
Updates the database version to the current version, without issuing any other updates to the database.
|
static void |
restartSequences(String databaseName)
Sets all the sequences to the lowest acceptable value.
|
static void |
rollbackTransaction()
Performs a rollback of the current unitils transaction
|
static void |
startTransaction()
Starts a new transaction on the transaction manager configured in unitils
|
static void |
updateDatabase()
Determines whether the test database is outdated and, if that is the case, updates the database with the
latest changes.
|
static void |
updateDatabase(String databaseName)
Determines whether the test database is outdated and, if that is the case, updates the database with the
latest changes.
|
static void |
updateSequences()
Updates all sequences that have a value below a certain configurable treshold to become equal
to this treshold
|
static void |
updateSequences(String databaseName)
Updates all sequences that have a value below a certain configurable treshold to become equal
to this treshold
|
public static DataSource getDataSource(String databaseName)
public static DataSource getDataSource()
public static void flushDatabaseUpdates()
public static void startTransaction()
public static void commitTransaction()
public static void rollbackTransaction()
public static void updateDatabase()
DBMaintainer for more information.public static void updateDatabase(String databaseName)
DBMaintainer for more information.public static void resetDatabaseState()
public static void resetDatabaseState(String databaseName)
public static void clearSchemas()
public static void clearSchemas(String databaseName)
public static void cleanSchemas()
public static void cleanSchemas(String databaseName)
public static void disableConstraints()
public static void disableConstraints(String databaseName)
public static void updateSequences()
public static void updateSequences(String databaseName)
public static void restartSequences(String databaseName)
public static void generateDatasetDefinition()
public static void generateDatasetDefinition(String databaseName)
public static Connection getGoodConnection(Connection connection, DataSource dataSource)
Connection from the DataSource and checks if it is a oracle.jdbc.driver.OracleConnection.
There is a bug with commons-dbcp 1.4: if you want to create a oracle.sql.BLOB or a Clob than you must get the inner
Connection but you get another Connection.
This is fixed in this method.Copyright © 2008–2020 Matrix. All rights reserved.