Class DatabaseTestUtils
- java.lang.Object
-
- dk.netarkivet.harvester.datamodel.DatabaseTestUtils
-
public class DatabaseTestUtils extends Object
Utilities to allow testing databases. FIXME: Rename without Test as these are not specifically test related.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description DatabaseTestUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
createDatabase(String resourcePath, File dbCreationDir)
Get access to the database stored in the given file.static void
createDatabase(String resourcePath, String dbname, File dbCreationDir)
Get access to the database stored in the given file.static void
createHDDB(String resourcePath, String dbname, File dbCreationDir)
Get a connection to the given sample harvest definition database and fool the HD DB connect class into thinking it should use that one.static void
dropDatabase()
Drop access to the database that's currently taken.static void
dropHDDB()
Drop the connection to the harvest definition database.
-
-
-
Method Detail
-
createDatabase
public static void createDatabase(String resourcePath, String dbname, File dbCreationDir) throws Exception
Get access to the database stored in the given file. This will start a new transaction that will be rolled back with dropDatabase. Only one connection can be taken at a time.- Parameters:
resourcePath
- A file that contains a test database.dbCreationDir
-- Throws:
Exception
-
createDatabase
public static void createDatabase(String resourcePath, File dbCreationDir) throws Exception
Get access to the database stored in the given file. This will start a new transaction that will be rolled back with dropDatabase. Only one connection can be taken at a time.- Parameters:
resourcePath
- A file that contains a test database.dbCreationDir
-- Throws:
Exception
-
createHDDB
public static void createHDDB(String resourcePath, String dbname, File dbCreationDir) throws Exception
Get a connection to the given sample harvest definition database and fool the HD DB connect class into thinking it should use that one.- Parameters:
resourcePath
- Location of the sql files to create and populate the test DB.dbCreationDir
-- Throws:
Exception
-
dropDatabase
public static void dropDatabase() throws Exception
Drop access to the database that's currently taken.- Throws:
Exception
-
-