Class DatabaseTestUtils


  • public class DatabaseTestUtils
    extends Object
    Utilities to allow testing databases. FIXME: Rename without Test as these are not specifically test related.
    • Field Detail

      • log

        protected static final org.slf4j.Logger log
    • Constructor Detail

      • DatabaseTestUtils

        public DatabaseTestUtils()
    • 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
      • dropHDDB

        public static void dropHDDB()
                             throws Exception
        Drop the connection to the harvest definition database.
        Throws:
        Exception