Package net.officefloor.jdbc.test
Class DatabaseTestUtil
- java.lang.Object
-
- net.officefloor.jdbc.test.DatabaseTestUtil
-
public class DatabaseTestUtil extends java.lang.ObjectProvide utility functionality for database testing.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDatabaseTestUtil.DatabaseValidatorValidates the database.static interfaceDatabaseTestUtil.DataSourceCleanupCleans up theDataSourcecreation attempt.static interfaceDatabaseTestUtil.DataSourceCreatorCreates theDataSource.static interfaceDatabaseTestUtil.DataSourceCreatorContextContext for theDatabaseTestUtil.DataSourceCreator.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.sql.ConnectionwaitForAvailableConnection(java.lang.Object lock, DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator)Waits forConnectionto be available.static java.sql.ConnectionwaitForAvailableConnection(DatabaseTestUtil.DataSourceCreator dataSourceCreator)Waits forConnectionto be available.static java.sql.ConnectionwaitForAvailableConnection(DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator)Waits forConnectionto be available.static voidwaitForAvailableDatabase(java.lang.Object lock, DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator)Waits for the database to be available.static voidwaitForAvailableDatabase(DatabaseTestUtil.DataSourceCreator dataSourceCreator)Waits for the database to be available.static voidwaitForAvailableDatabase(DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator)Waits for the database to be available.
-
-
-
Method Detail
-
waitForAvailableDatabase
public static void waitForAvailableDatabase(DatabaseTestUtil.DataSourceCreator dataSourceCreator) throws java.lang.Exception
Waits for the database to be available.- Parameters:
dataSourceCreator-DatabaseTestUtil.DataSourceCreator.- Throws:
java.lang.Exception- If failed waiting on database orConnectionissue.
-
waitForAvailableDatabase
public static void waitForAvailableDatabase(DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator) throws java.lang.Exception
Waits for the database to be available.- Parameters:
dataSourceCreator-DatabaseTestUtil.DataSourceCreator.validator-DatabaseTestUtil.DatabaseValidator.- Throws:
java.lang.Exception- If failed waiting on database orConnectionissue.
-
waitForAvailableDatabase
public static void waitForAvailableDatabase(java.lang.Object lock, DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator) throws java.lang.ExceptionWaits for the database to be available.- Parameters:
lock- To wait on to allow locking setup.dataSourceCreator-DatabaseTestUtil.DataSourceCreator.validator-DatabaseTestUtil.DatabaseValidator.- Throws:
java.lang.Exception- If failed waiting on database orConnectionissue.
-
waitForAvailableConnection
public static java.sql.Connection waitForAvailableConnection(DatabaseTestUtil.DataSourceCreator dataSourceCreator) throws java.lang.Exception
Waits forConnectionto be available.- Parameters:
dataSourceCreator-DatabaseTestUtil.DataSourceCreator.- Returns:
- Available
Connection. - Throws:
java.lang.Exception- If failed waiting on database orConnectionissue.
-
waitForAvailableConnection
public static java.sql.Connection waitForAvailableConnection(DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator) throws java.lang.Exception
Waits forConnectionto be available.- Parameters:
dataSourceCreator-DatabaseTestUtil.DataSourceCreator.validator-DatabaseTestUtil.DatabaseValidator.- Returns:
- Available
Connection. - Throws:
java.lang.Exception- If failed waiting on database orConnectionissue.
-
waitForAvailableConnection
public static java.sql.Connection waitForAvailableConnection(java.lang.Object lock, DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator) throws java.lang.ExceptionWaits forConnectionto be available.- Parameters:
lock- To wait on to allow locking setup.dataSourceCreator-DatabaseTestUtil.DataSourceCreator.validator-DatabaseTestUtil.DatabaseValidator.- Returns:
- Available
Connection. - Throws:
java.lang.Exception- If failed waiting on database orConnectionissue.
-
-