Class MySqlTestConnection

  • All Implemented Interfaces:
    AutoCloseable

    public class MySqlTestConnection
    extends JdbcConnection
    A utility for integration test cases to connect the MySQL server running in the Docker container created by this module's build.
    Author:
    Randall Hauch
    • Constructor Detail

      • MySqlTestConnection

        public MySqlTestConnection​(Configuration config)
        Create a new instance with the given configuration and connection factory.
        Parameters:
        config - the configuration; may not be null
    • Method Detail

      • forTestDatabase

        public static MySqlTestConnection forTestDatabase​(String databaseName)
        Obtain a connection instance to the named test database.
        Parameters:
        databaseName - the name of the test database
        Returns:
        the MySQLConnection instance; never null
      • forTestDatabase

        public static MySqlTestConnection forTestDatabase​(String databaseName,
                                                          Map<String,​Object> urlProperties)
        Obtain a connection instance to the named test database.
        Parameters:
        databaseName - the name of the test database
        urlProperties - url properties
        Returns:
        the MySQLConnection instance; never null
      • forTestDatabase

        public static MySqlTestConnection forTestDatabase​(String databaseName,
                                                          String username,
                                                          String password)
        Obtain a connection instance to the named test database.
        Parameters:
        databaseName - the name of the test database
        username - the username
        password - the password
        Returns:
        the MySQLConnection instance; never null
      • isMySQL5

        public static boolean isMySQL5()
        Obtain whether the database source is MySQL 5.x or not.
        Returns:
        true if the database version is 5.x; otherwise false.
      • isPerconaServer

        public static boolean isPerconaServer()
        Obtain whether the database source is the Percona Server fork.
        Returns:
        true if the database is Percona Server; otherwise false.
      • getMySqlVersionString

        public String getMySqlVersionString()
      • getMySqlVersionComment

        public String getMySqlVersionComment()
      • isTableIdCaseSensitive

        public boolean isTableIdCaseSensitive()