Package io.debezium.connector.mysql
Class MySqlTestConnection
java.lang.Object
io.debezium.jdbc.JdbcConnection
io.debezium.connector.mysql.MySqlTestConnection
- All Implemented Interfaces:
AutoCloseable
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 ClassesNested classes/interfaces inherited from class io.debezium.jdbc.JdbcConnection
JdbcConnection.BlockingMultiResultSetConsumer, JdbcConnection.BlockingResultSetConsumer, JdbcConnection.CallPreparer, JdbcConnection.ConnectionFactory, JdbcConnection.LogPositionValidator, JdbcConnection.MultiResultSetConsumer, JdbcConnection.Operations, JdbcConnection.ParameterResultSetConsumer, JdbcConnection.ResultSetConsumer, JdbcConnection.ResultSetExtractor<T extends Object>, JdbcConnection.ResultSetMapper<T extends Object>, JdbcConnection.StatementFactory, JdbcConnection.StatementPreparer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DatabaseDifferencesprotected static JdbcConnection.ConnectionFactoryprivate MySqlTestConnection.MySqlVersionFields inherited from class io.debezium.jdbc.JdbcConnection
logPositionValidator -
Constructor Summary
ConstructorsConstructorDescriptionMySqlTestConnection(JdbcConfiguration config) Create a new instance with the given configuration and connection factory. -
Method Summary
Modifier and TypeMethodDescriptionprivate static JdbcConfigurationaddDefaultSettings(JdbcConfiguration configuration) 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.static MySqlTestConnectionforTestReplicaDatabase(String databaseName) Obtain a connection instance to the named test replica database.static booleanCheck whether the database is MariaDB or MySQL.static booleanisMySQL5()Obtain whether the database source is MySQL 5.x or not.static booleanObtain whether the database source is the Percona Server fork.booleanbooleanChecks whether the database version string indicates MariaDB.Methods inherited from class io.debezium.jdbc.JdbcConnection
buildSelectWithRowLimits, call, chunkQueryBuilder, close, commit, config, connect, connection, connection, connectionString, createTableId, database, escapeEscapeSequence, execute, execute, executeWithoutCommitting, getAttributeDetails, getColumnsDetails, getColumnValue, getCurrentTimestamp, getQualifiedTableName, isConnected, isLogPositionAvailable, isNullable, isTableType, isTableUniqueIndexIncluded, isValid, loadKeyStore, nullsSortLast, overrideColumn, parseSqlStatementString, patternBasedFactory, patternBasedFactory, prepareQuery, prepareQuery, prepareQuery, prepareQuery, prepareQuery, prepareQueryAndMap, prepareQueryWithBlockingConsumer, prepareUpdate, print, print, query, query, queryAndMap, queryAndMap, querySingleValue, queryWithBlockingConsumer, quotedColumnIdString, quotedTableIdString, readAllCatalogNames, readAllSchemaNames, readAllTableNames, readPrimaryKeyNames, readPrimaryKeyOrUniqueIndexNames, readSchema, readTableColumn, readTableNames, readTablePreparedStatement, readTableStatement, readTableUniqueIndices, reselectColumns, reselectColumns, resolveCatalogName, resolveJdbcType, resolveNativeType, rollback, rowToArray, setAutoCommit, setQueryColumnValue, singleResultMapper, supportedTableTypes, tableTypes, username
-
Field Details
-
databaseAsserts
-
mySqlVersion
-
FACTORY
-
-
Constructor Details
-
MySqlTestConnection
Create a new instance with the given configuration and connection factory.- Parameters:
config- the configuration; may not be null
-
-
Method Details
-
forTestDatabase
Obtain a connection instance to the named test database.- Parameters:
databaseName- the name of the test database- Returns:
- the MySQLConnection instance; never null
-
forTestReplicaDatabase
Obtain a connection instance to the named test replica database. if no replica, obtain same connection withforTestDatabase- Parameters:
databaseName- the name of the test replica 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.
-
isMariaDb
public static boolean isMariaDb()Check whether the database is MariaDB or MySQL.- Returns:
- true if the database is MariaDB; otherwise false
-
isVersionCommentMariaDb
public boolean isVersionCommentMariaDb()Checks whether the database version string indicates MariaDB.- Returns:
- true if the database is MariaDB; otherwise false
-
addDefaultSettings
-
getMySqlVersion
-
getMySqlVersionString
-
getMySqlVersionComment
-
isTableIdCaseSensitive
public boolean isTableIdCaseSensitive() -
databaseAsserts
-