Package net.officefloor.jdbc.test
Class DatabaseTestUtil
- java.lang.Object
-
- net.officefloor.jdbc.test.DatabaseTestUtil
-
public class DatabaseTestUtil extends java.lang.Object
Provide utility functionality for database testing.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DatabaseTestUtil.DatabaseValidator
Validates the database.static interface
DatabaseTestUtil.DataSourceCleanup
Cleans up theDataSource
creation attempt.static interface
DatabaseTestUtil.DataSourceCreator
Creates theDataSource
.static interface
DatabaseTestUtil.DataSourceCreatorContext
Context for theDatabaseTestUtil.DataSourceCreator
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.sql.Connection
waitForAvailableConnection(java.lang.Object lock, DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator)
Waits forConnection
to be available.static java.sql.Connection
waitForAvailableConnection(DatabaseTestUtil.DataSourceCreator dataSourceCreator)
Waits forConnection
to be available.static java.sql.Connection
waitForAvailableConnection(DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator)
Waits forConnection
to be available.static void
waitForAvailableDatabase(java.lang.Object lock, DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator)
Waits for the database to be available.static void
waitForAvailableDatabase(DatabaseTestUtil.DataSourceCreator dataSourceCreator)
Waits for the database to be available.static void
waitForAvailableDatabase(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 orConnection
issue.
-
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 orConnection
issue.
-
waitForAvailableDatabase
public static void waitForAvailableDatabase(java.lang.Object lock, DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator) throws java.lang.Exception
Waits 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 orConnection
issue.
-
waitForAvailableConnection
public static java.sql.Connection waitForAvailableConnection(DatabaseTestUtil.DataSourceCreator dataSourceCreator) throws java.lang.Exception
Waits forConnection
to be available.- Parameters:
dataSourceCreator
-DatabaseTestUtil.DataSourceCreator
.- Returns:
- Available
Connection
. - Throws:
java.lang.Exception
- If failed waiting on database orConnection
issue.
-
waitForAvailableConnection
public static java.sql.Connection waitForAvailableConnection(DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator) throws java.lang.Exception
Waits forConnection
to be available.- Parameters:
dataSourceCreator
-DatabaseTestUtil.DataSourceCreator
.validator
-DatabaseTestUtil.DatabaseValidator
.- Returns:
- Available
Connection
. - Throws:
java.lang.Exception
- If failed waiting on database orConnection
issue.
-
waitForAvailableConnection
public static java.sql.Connection waitForAvailableConnection(java.lang.Object lock, DatabaseTestUtil.DataSourceCreator dataSourceCreator, DatabaseTestUtil.DatabaseValidator validator) throws java.lang.Exception
Waits forConnection
to 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 orConnection
issue.
-
-