Package io.debezium.connector.mysql
Class MySqlTestConnection
- java.lang.Object
-
- io.debezium.jdbc.JdbcConnection
-
- io.debezium.connector.mysql.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMySqlTestConnection.MySqlVersion-
Nested classes/interfaces inherited from class io.debezium.jdbc.JdbcConnection
JdbcConnection.BlockingMultiResultSetConsumer, JdbcConnection.BlockingResultSetConsumer, JdbcConnection.CallPreparer, JdbcConnection.ConnectionFactory, JdbcConnection.MultiResultSetConsumer, JdbcConnection.Operations, JdbcConnection.ParameterResultSetConsumer, JdbcConnection.ResultSetConsumer, JdbcConnection.ResultSetExtractor<T extends Object>, JdbcConnection.ResultSetMapper<T extends Object>, JdbcConnection.StatementFactory, JdbcConnection.StatementPreparer
-
-
Field Summary
Fields Modifier and Type Field Description private DatabaseDifferencesdatabaseAssertsprotected static JdbcConnection.ConnectionFactoryFACTORYprivate MySqlTestConnection.MySqlVersionmySqlVersion
-
Constructor Summary
Constructors Constructor Description MySqlTestConnection(Configuration config)Create a new instance with the given configuration and connection factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidaddDefaults(Configuration.Builder builder)DatabaseDifferencesdatabaseAsserts()static MySqlTestConnectionforTestDatabase(String databaseName)Obtain a connection instance to the named test database.static MySqlTestConnectionforTestDatabase(String databaseName, String username, String password)Obtain a connection instance to the named test database.static MySqlTestConnectionforTestDatabase(String databaseName, Map<String,Object> urlProperties)Obtain a connection instance to the named test database.MySqlTestConnection.MySqlVersiongetMySqlVersion()StringgetMySqlVersionComment()StringgetMySqlVersionString()static booleanisMySQL5()Obtain whether the database source is MySQL 5.x or not.static booleanisPerconaServer()Obtain whether the database source is the Percona Server fork.booleanisTableIdCaseSensitive()-
Methods inherited from class io.debezium.jdbc.JdbcConnection
call, close, commit, config, connect, connection, connection, connectionString, database, execute, execute, executeWithoutCommitting, getDefaultValue, isConnected, isNullable, isTableUniqueIndexIncluded, parseSqlStatementString, patternBasedFactory, patternBasedFactory, prepareQuery, prepareQuery, prepareQuery, prepareQuery, prepareQueryAndMap, prepareQueryWithBlockingConsumer, prepareUpdate, print, print, query, query, queryAndMap, queryAndMap, querySingleValue, queryWithBlockingConsumer, readAllCatalogNames, readAllSchemaNames, readAllTableNames, readPrimaryKeyNames, readPrimaryKeyOrUniqueIndexNames, readSchema, readTableColumn, readTableNames, readTableUniqueIndices, resolveJdbcType, resolveNativeType, rollback, setAutoCommit, singleResultMapper, tableTypes, username
-
-
-
-
Field Detail
-
databaseAsserts
private DatabaseDifferences databaseAsserts
-
mySqlVersion
private MySqlTestConnection.MySqlVersion mySqlVersion
-
FACTORY
protected static JdbcConnection.ConnectionFactory FACTORY
-
-
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 databaseurlProperties- 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 databaseusername- the usernamepassword- 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.
-
addDefaults
protected static void addDefaults(Configuration.Builder builder)
-
getMySqlVersion
public MySqlTestConnection.MySqlVersion getMySqlVersion()
-
getMySqlVersionString
public String getMySqlVersionString()
-
getMySqlVersionComment
public String getMySqlVersionComment()
-
isTableIdCaseSensitive
public boolean isTableIdCaseSensitive()
-
databaseAsserts
public DatabaseDifferences databaseAsserts()
-
-