Package io.debezium.connector.mysql
Class AbstractMySqlConnectorOutputTest
- java.lang.Object
-
- io.debezium.embedded.ConnectorOutputTest
-
- io.debezium.connector.mysql.AbstractMySqlConnectorOutputTest
-
public class AbstractMySqlConnectorOutputTest extends ConnectorOutputTest
Run theMySqlConnectorin various configurations and against different MySQL server instances and verify the output is as expected.- Author:
- Randall Hauch
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.debezium.embedded.ConnectorOutputTest
ConnectorOutputTest.InputStreamSupplier, ConnectorOutputTest.OutputStreamSupplier, ConnectorOutputTest.TestData, ConnectorOutputTest.TestSpecification, ConnectorOutputTest.VariableSupplier
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.Loggerlogger-
Fields inherited from class io.debezium.embedded.ConnectorOutputTest
CONNECTOR_OUTPUT_PATH, CONTROL_END, CONTROL_KEY, CONTROL_RESTART, CONTROL_STOP, DEFAULT_CONNECTOR_PROPERTIES_FILENAME, DEFAULT_ENV_PROPERTIES_FILENAME, DEFAULT_EXPECTED_RECORDS_FILENAME, ENV_CONNECTOR_TIMEOUT_IN_SECONDS, ENV_IGNORE_FIELDS, OFFSET_STORE_PATH
-
-
Constructor Summary
Constructors Constructor Description AbstractMySqlConnectorOutputTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddValueComparatorsByFieldPath(BiConsumer<String,VerifyRecord.RecordValueComparator> comparatorsByPath)protected voidassertSameGtidSet(String pathToField, Object actual, Object expected)protected String[]globallyIgnorableFieldNames()private static io.debezium.connector.mysql.GtidSetreadAvailableGtidSet(Configuration config)protected Map<String,String>readSystemVariables(Configuration config)Read the system variables and master status using the given connector configuration.protected static voidwaitForGtidSetsToMatch(Configuration master, Configuration replica)Wait up to 10 seconds until the replica catches up with the master.protected static voidwaitForGtidSetsToMatch(Configuration master, Configuration replica, long timeout, TimeUnit unit)Wait a maximum amount of time until the replica catches up with the master.-
Methods inherited from class io.debezium.embedded.ConnectorOutputTest
addValueComparatorsBySchemaName, afterEachTestMethod, cleanOffsetStorage, replaceVariables, runConnector, runConnector, runConnector, runConnector, runConnector, runConnector, usingSpec, usingSpec, usingSpec, usingSpec, usingSpec
-
-
-
-
Method Detail
-
readAvailableGtidSet
private static io.debezium.connector.mysql.GtidSet readAvailableGtidSet(Configuration config)
-
waitForGtidSetsToMatch
protected static void waitForGtidSetsToMatch(Configuration master, Configuration replica)
Wait up to 10 seconds until the replica catches up with the master.- Parameters:
master- the configuration with theRelationalDatabaseConnectorConfig.HOSTNAMEandMySqlConnectorConfig.PORTconfiguration properties for the MySQL master; may not be nullreplica- the configuration with theRelationalDatabaseConnectorConfig.HOSTNAMEandMySqlConnectorConfig.PORTconfiguration properties for the MySQL replica; may not be null- See Also:
waitForGtidSetsToMatch(Configuration, Configuration, long, TimeUnit)
-
waitForGtidSetsToMatch
protected static void waitForGtidSetsToMatch(Configuration master, Configuration replica, long timeout, TimeUnit unit)
Wait a maximum amount of time until the replica catches up with the master.- Parameters:
master- the configuration with theRelationalDatabaseConnectorConfig.HOSTNAMEandMySqlConnectorConfig.PORTconfiguration properties for the MySQL master; may not be nullreplica- the configuration with theRelationalDatabaseConnectorConfig.HOSTNAMEandMySqlConnectorConfig.PORTconfiguration properties for the MySQL replica; may not be nulltimeout- the maximum amount of time to waitunit- the time unit for the timeout- See Also:
waitForGtidSetsToMatch(Configuration, Configuration)
-
readSystemVariables
protected Map<String,String> readSystemVariables(Configuration config) throws Exception
Read the system variables and master status using the given connector configuration. This can be used when creatingConnectorOutputTest.TestSpecificationinstanceswith variables.When connected to a replica, the GTID source for the master is added to the variables using the "@{code master_uuid}" variable, which does not correspond to a real MySQL system variable. The GTID source of the server to which the test case connects is given by the "
server_uuid" system variable.- Parameters:
config- the connector configuration; never null- Returns:
- the available system variables
- Throws:
Exception- if there is a problem connecting to the database and reading the system variables
-
globallyIgnorableFieldNames
protected String[] globallyIgnorableFieldNames()
- Overrides:
globallyIgnorableFieldNamesin classConnectorOutputTest
-
addValueComparatorsByFieldPath
protected void addValueComparatorsByFieldPath(BiConsumer<String,VerifyRecord.RecordValueComparator> comparatorsByPath)
- Overrides:
addValueComparatorsByFieldPathin classConnectorOutputTest
-
-