|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.ken.test.ClearDatabaseUtil
public class ClearDatabaseUtil
Adapted from Rice ClearDatabaseLifecycle. This is a standalone utility class
that does not implement or depend on the Rice Lifecycle interface.
{clearTables(PlatformTransactionManager, DataSource, String, List, boolean, String)
can
be called directly on this class, or an instance can be created and used as a command.
Field Summary | |
---|---|
private DataSource |
dataSource
The datasource to use |
static String |
DEFAULT_TEST_TABLE_NAME
|
private boolean |
handleConstraints
Whether we should determine the constraints on tables, and drop them before deleting and then reapply them afterwards. |
private static org.apache.log4j.Logger |
LOG
|
private String |
schemaName
Schema name |
private List<String> |
tablesToClear
A list of regular expressions which should match names of tables to be cleared |
private String |
testTableNamePattern
The name of a table which serves as a marker to indicate that the database is in fact used for unit testing and that all data can be deleted |
private org.springframework.transaction.PlatformTransactionManager |
transactionManager
The PlatformTransactionManager under which to clear tables in a separate transaction |
Constructor Summary | |
---|---|
ClearDatabaseUtil(org.springframework.transaction.PlatformTransactionManager transactionManager,
DataSource dataSource,
String schema,
List<String> tablesToClear)
|
|
ClearDatabaseUtil(org.springframework.transaction.PlatformTransactionManager transactionManager,
DataSource dataSource,
String schema,
List<String> tablesToClear,
boolean handleConstraints)
|
|
ClearDatabaseUtil(org.springframework.transaction.PlatformTransactionManager transactionManager,
DataSource dataSource,
String schema,
List<String> tablesToClear,
boolean handleConstraints,
String testTable)
|
Method Summary | |
---|---|
void |
clearTables()
|
static void |
clearTables(org.springframework.transaction.PlatformTransactionManager transactionManager,
DataSource dataSource,
String schemaName,
List<String> tablesToClear,
boolean handleConstraints,
String testTable)
|
DataSource |
getDataSource()
|
String |
getSchemaName()
|
List<String> |
getTablesToClear()
|
String |
getTestTableNamePattern()
|
org.springframework.transaction.PlatformTransactionManager |
getTransactionManager()
|
boolean |
isHandleConstraints()
|
private static boolean |
isTestTableInSchema(DataSource dataSource,
String testTableNamePattern)
|
private static void |
verifyTestEnvironment(DataSource dataSource,
String testTableNamePattern)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.apache.log4j.Logger LOG
public static final String DEFAULT_TEST_TABLE_NAME
private final org.springframework.transaction.PlatformTransactionManager transactionManager
private final DataSource dataSource
private final String schemaName
private final List<String> tablesToClear
private final String testTableNamePattern
private final boolean handleConstraints
Constructor Detail |
---|
public ClearDatabaseUtil(org.springframework.transaction.PlatformTransactionManager transactionManager, DataSource dataSource, String schema, List<String> tablesToClear)
public ClearDatabaseUtil(org.springframework.transaction.PlatformTransactionManager transactionManager, DataSource dataSource, String schema, List<String> tablesToClear, boolean handleConstraints)
public ClearDatabaseUtil(org.springframework.transaction.PlatformTransactionManager transactionManager, DataSource dataSource, String schema, List<String> tablesToClear, boolean handleConstraints, String testTable)
Method Detail |
---|
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
public DataSource getDataSource()
public String getSchemaName()
public String getTestTableNamePattern()
public boolean isHandleConstraints()
public List<String> getTablesToClear()
public void clearTables()
public static void clearTables(org.springframework.transaction.PlatformTransactionManager transactionManager, DataSource dataSource, String schemaName, List<String> tablesToClear, boolean handleConstraints, String testTable)
private static boolean isTestTableInSchema(DataSource dataSource, String testTableNamePattern)
private static void verifyTestEnvironment(DataSource dataSource, String testTableNamePattern)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |