Class AbstractSnapshotTest<T extends org.apache.kafka.connect.source.SourceConnector>
java.lang.Object
io.debezium.embedded.AbstractConnectorTest
io.debezium.embedded.async.AbstractAsyncEngineConnectorTest
io.debezium.pipeline.source.snapshot.incremental.AbstractSnapshotTest<T>
- All Implemented Interfaces:
Testing
- Direct Known Subclasses:
AbstractBlockingSnapshotTest,AbstractIncrementalSnapshotTest
public abstract class AbstractSnapshotTest<T extends org.apache.kafka.connect.source.SourceConnector>
extends AbstractAsyncEngineConnectorTest
-
Nested Class Summary
Nested classes/interfaces inherited from class io.debezium.embedded.AbstractConnectorTest
AbstractConnectorTest.SourceRecordsNested classes/interfaces inherited from interface io.debezium.util.Testing
Testing.Debug, Testing.Files, Testing.InterruptableFunction, Testing.Network, Testing.Print, Testing.Timer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprotected static final intprotected static final intprotected static final Pathprotected static final Stringprotected final PathFields inherited from class io.debezium.embedded.AbstractConnectorTest
consumedLines, engine, isEngineRunning, logger, logTestName, OFFSET_STORE_PATH, pollTimeoutInMs, skipTestRule -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringalterTableAddColumnStatement(String tableName) protected StringalterTableDropColumnStatement(String tableName) private static StringbuildAdditionalConditions(Map<String, String> additionalConditions) protected abstract Configuration.Builderconfig()protected abstract StringconsumeMixedWithIncrementalSnapshot(int recordCount) consumeMixedWithIncrementalSnapshot(int recordCount, String topicName) consumeMixedWithIncrementalSnapshot(int recordCount, Function<org.apache.kafka.connect.source.SourceRecord, V> valueConverter, Predicate<Map.Entry<Integer, V>> dataCompleted, Consumer<List<org.apache.kafka.connect.source.SourceRecord>> recordConsumer, String topicName) consumeMixedWithIncrementalSnapshot(int recordCount, Predicate<Map.Entry<Integer, Integer>> dataCompleted, Consumer<List<org.apache.kafka.connect.source.SourceRecord>> recordConsumer) consumeMixedWithIncrementalSnapshot(int recordCount, Predicate<Map.Entry<Integer, V>> dataCompleted, Function<org.apache.kafka.connect.data.Struct, Integer> idCalculator, Function<org.apache.kafka.connect.source.SourceRecord, V> valueConverter, String topicName, Consumer<List<org.apache.kafka.connect.source.SourceRecord>> recordConsumer) consumeMixedWithIncrementalSnapshot(int recordCount, Predicate<Map.Entry<Integer, V>> dataCompleted, Function<org.apache.kafka.connect.data.Struct, Integer> idCalculator, Function<org.apache.kafka.connect.source.SourceRecord, V> valueConverter, String topicName, Consumer<List<org.apache.kafka.connect.source.SourceRecord>> recordConsumer, boolean assertRecords) consumeRecordsMixedWithIncrementalSnapshot(int recordCount) consumeRecordsMixedWithIncrementalSnapshot(int recordCount, Predicate<Map.Entry<Integer, org.apache.kafka.connect.source.SourceRecord>> dataCompleted, Consumer<List<org.apache.kafka.connect.source.SourceRecord>> recordConsumer) protected Stringdatabase()protected abstract JdbcConnectionprotected intGet the maximum number of messages that can be obtained from the connector and held in-memory before they are consumed by test methods usingAbstractConnectorTest.consumeRecord(),AbstractConnectorTest.consumeRecords(int), orAbstractConnectorTest.consumeRecords(int, Consumer).protected abstract Configuration.BuildermutableConfig(boolean signalTableOnly, boolean storeOnlyCapturedDdl) protected Stringprotected voidpopulate4PkTable(JdbcConnection connection, String tableName) protected voidprotected voidpopulateTable(JdbcConnection connection) protected voidpopulateTable(JdbcConnection connection, String tableName) protected voidpopulateTable(String table) protected voidprotected voidpopulateTables(JdbcConnection connection) protected voidpopulateTableWithSpecificValue(int startRow, int count, int value) private voidpopulateTableWithSpecificValue(JdbcConnection connection, String tableName, int startRow, int count, int value) protected voidsendAdHocSnapshotSignal(String... dataCollectionIds) protected voidsendAdHocSnapshotSignalWithAdditionalConditionsWithSurrogateKey(Map<String, String> additionalConditions, String surrogateKey, io.debezium.pipeline.signal.actions.AbstractSnapshotSignal.SnapshotType snapshotType, String... dataCollectionIds) protected voidsendAdHocSnapshotSignalWithAdditionalConditionsWithSurrogateKey(Map<String, String> additionalConditions, String surrogateKey, String... dataCollectionIds) protected voidsendAdHocSnapshotSignalWithAdditionalConditionWithSurrogateKey(String additionalCondition, String surrogateKey, io.debezium.pipeline.signal.actions.AbstractSnapshotSignal.SnapshotType snapshotType, String... dataCollectionIds) protected voidsendAdHocSnapshotSignalWithAdditionalConditionWithSurrogateKey(String additionalCondition, String surrogateKey, String... dataCollectionIds) protected voidsendExecuteSnapshotFileSignal(String fullTableNames) protected voidsendExecuteSnapshotFileSignal(String fullTableNames, String type, Path signalFile) protected abstract Stringserver()protected abstract Stringprotected Stringprotected voidprotected voidstartConnector(io.debezium.engine.DebeziumEngine.CompletionCallback callback) protected voidstartConnector(Function<Configuration.Builder, Configuration.Builder> custConfig) protected voidstartConnector(Function<Configuration.Builder, Configuration.Builder> custConfig, io.debezium.engine.DebeziumEngine.CompletionCallback callback, boolean expectNoRecords) protected voidprotected Stringprotected abstract Stringprotected Stringtask()protected abstract Stringprotected Stringprotected voidwaitForCdcTransactionPropagation(int expectedTransactions) protected voidMethods inherited from class io.debezium.embedded.async.AbstractAsyncEngineConnectorTest
createEngine, createEngineBuilderMethods inherited from class io.debezium.embedded.AbstractConnectorTest
assertBeginTransaction, assertConfigurationErrors, assertConfigurationErrors, assertConfigurationErrors, assertConnectorIsRunning, assertConnectorNotRunning, assertDelete, assertEndTransaction, assertEngineIsRunning, assertHasNoSourceQuery, assertInsert, assertKey, assertNoConfigurationErrors, assertNoRecordsToConsume, assertOffset, assertOffset, assertOnlyTransactionRecordsToConsume, assertRecordTransactionMetadata, assertSchemaMatchesStruct, assertSchemaMatchesStruct, assertSourceQuery, assertTombstone, assertTombstone, assertUpdate, assertValueField, configValue, consumeAvailableRecords, consumeAvailableRecordsByTopic, consumeDmlRecordsByTopic, consumeDmlRecordsByTopic, consumeDmlRecordsByTopic, consumeRecord, consumeRecords, consumeRecords, consumeRecords, consumeRecordsButSkipUntil, consumeRecordsByTopic, consumeRecordsByTopic, consumeRecordsByTopic, consumeRecordsByTopicUntil, consumeRecordsUntil, debug, getConsumer, getSnapshotMetricsObjectName, getSnapshotMetricsObjectName, getSnapshotMetricsObjectName, getStreamingMetricsObjectName, getStreamingMetricsObjectName, getStreamingMetricsObjectName, getStreamingMetricsObjectName, getStreamingNamespace, initializeConnectorTestFramework, isStreamingRunning, isStreamingRunning, isStreamingRunning, isStreamingRunning, isTransactionRecord, loggingCompletion, print, readLastCommittedOffset, readLastCommittedOffsets, setConsumeTimeout, skipAvroValidation, start, start, start, start, start, start, start, startAndConsumeTillEnd, startAndConsumeTillEnd, stopConnector, stopConnector, storeOffsets, validate, waitForAvailableRecords, waitForConnectorShutdown, waitForEngineShutdown, waitForSnapshotToBeCompleted, waitForSnapshotToBeCompleted, waitForSnapshotWithCustomMetricsToBeCompleted, waitForStreamingRunning, waitForStreamingRunning, waitForStreamingRunning, waitForStreamingWithCustomMetricsToStart, waitTimeForEngine, waitTimeForRecords, waitTimeForRecordsAfterNulls
-
Field Details
-
ROW_COUNT
protected static final int ROW_COUNT- See Also:
-
SCHEMA_HISTORY_PATH
-
PARTITION_NO
protected static final int PARTITION_NO- See Also:
-
SERVER_NAME
- See Also:
-
MAXIMUM_NO_RECORDS_CONSUMES
private static final int MAXIMUM_NO_RECORDS_CONSUMES- See Also:
-
signalsFile
-
-
Constructor Details
-
AbstractSnapshotTest
public AbstractSnapshotTest()
-
-
Method Details
-
connectorClass
-
databaseConnection
-
topicName
-
tableName
-
topicNames
-
tableNames
-
signalTableName
-
signalTableNameSanitized
-
config
-
mutableConfig
protected abstract Configuration.Builder mutableConfig(boolean signalTableOnly, boolean storeOnlyCapturedDdl) -
connector
-
server
-
task
-
database
-
waitForCdcTransactionPropagation
- Throws:
Exception
-
alterTableAddColumnStatement
-
alterTableDropColumnStatement
-
tableDataCollectionId
-
tableDataCollectionIds
-
populateTable
- Throws:
SQLException
-
populateTable
- Throws:
SQLException
-
populateTables
- Throws:
SQLException
-
populateTable
- Throws:
SQLException
-
populateTable
- Throws:
SQLException
-
populateTableWithSpecificValue
protected void populateTableWithSpecificValue(int startRow, int count, int value) throws SQLException - Throws:
SQLException
-
populateTableWithSpecificValue
private void populateTableWithSpecificValue(JdbcConnection connection, String tableName, int startRow, int count, int value) throws SQLException - Throws:
SQLException
-
populateTables
- Throws:
SQLException
-
populate4PkTable
- Throws:
SQLException
-
consumeMixedWithIncrementalSnapshot
protected Map<Integer,Integer> consumeMixedWithIncrementalSnapshot(int recordCount) throws InterruptedException - Throws:
InterruptedException
-
consumeMixedWithIncrementalSnapshot
protected Map<Integer,Integer> consumeMixedWithIncrementalSnapshot(int recordCount, String topicName) throws InterruptedException - Throws:
InterruptedException
-
consumeMixedWithIncrementalSnapshot
protected <V> Map<Integer,V> consumeMixedWithIncrementalSnapshot(int recordCount, Function<org.apache.kafka.connect.source.SourceRecord, V> valueConverter, Predicate<Map.Entry<Integer, throws InterruptedExceptionV>> dataCompleted, Consumer<List<org.apache.kafka.connect.source.SourceRecord>> recordConsumer, String topicName) - Throws:
InterruptedException
-
consumeMixedWithIncrementalSnapshot
protected <V> Map<Integer,V> consumeMixedWithIncrementalSnapshot(int recordCount, Predicate<Map.Entry<Integer, V>> dataCompleted, Function<org.apache.kafka.connect.data.Struct, throws InterruptedExceptionInteger> idCalculator, Function<org.apache.kafka.connect.source.SourceRecord, V> valueConverter, String topicName, Consumer<List<org.apache.kafka.connect.source.SourceRecord>> recordConsumer) - Throws:
InterruptedException
-
consumeMixedWithIncrementalSnapshot
protected <V> Map<Integer,V> consumeMixedWithIncrementalSnapshot(int recordCount, Predicate<Map.Entry<Integer, V>> dataCompleted, Function<org.apache.kafka.connect.data.Struct, throws InterruptedExceptionInteger> idCalculator, Function<org.apache.kafka.connect.source.SourceRecord, V> valueConverter, String topicName, Consumer<List<org.apache.kafka.connect.source.SourceRecord>> recordConsumer, boolean assertRecords) - Throws:
InterruptedException
-
consumeRecordsMixedWithIncrementalSnapshot
protected Map<Integer,org.apache.kafka.connect.source.SourceRecord> consumeRecordsMixedWithIncrementalSnapshot(int recordCount) throws InterruptedException - Throws:
InterruptedException
-
consumeMixedWithIncrementalSnapshot
protected Map<Integer,Integer> consumeMixedWithIncrementalSnapshot(int recordCount, Predicate<Map.Entry<Integer, Integer>> dataCompleted, Consumer<List<org.apache.kafka.connect.source.SourceRecord>> recordConsumer) throws InterruptedException- Throws:
InterruptedException
-
consumeRecordsMixedWithIncrementalSnapshot
protected Map<Integer,org.apache.kafka.connect.source.SourceRecord> consumeRecordsMixedWithIncrementalSnapshot(int recordCount, Predicate<Map.Entry<Integer, org.apache.kafka.connect.source.SourceRecord>> dataCompleted, Consumer<List<org.apache.kafka.connect.source.SourceRecord>> recordConsumer) throws InterruptedException- Throws:
InterruptedException
-
valueFieldName
-
pkFieldName
-
startConnector
protected void startConnector(io.debezium.engine.DebeziumEngine.CompletionCallback callback) -
startConnector
-
startConnector
protected void startConnector(Function<Configuration.Builder, Configuration.Builder> custConfig, io.debezium.engine.DebeziumEngine.CompletionCallback callback, boolean expectNoRecords) -
startConnectorWithSnapshot
protected void startConnectorWithSnapshot(Function<Configuration.Builder, Configuration.Builder> custConfig) -
startConnector
protected void startConnector() -
waitForConnectorToStart
protected void waitForConnectorToStart() -
getRecordValue
-
getMaximumEnqueuedRecordCount
protected int getMaximumEnqueuedRecordCount()Description copied from class:AbstractConnectorTestGet the maximum number of messages that can be obtained from the connector and held in-memory before they are consumed by test methods usingAbstractConnectorTest.consumeRecord(),AbstractConnectorTest.consumeRecords(int), orAbstractConnectorTest.consumeRecords(int, Consumer).By default this method return
100.- Overrides:
getMaximumEnqueuedRecordCountin classAbstractConnectorTest- Returns:
- the maximum number of records that can be enqueued
-
sendExecuteSnapshotFileSignal
- Throws:
IOException
-
sendExecuteSnapshotFileSignal
protected void sendExecuteSnapshotFileSignal(String fullTableNames, String type, Path signalFile) throws IOException - Throws:
IOException
-
sendAdHocSnapshotSignal
- Throws:
SQLException
-
sendAdHocSnapshotSignalWithAdditionalConditionWithSurrogateKey
-
sendAdHocSnapshotSignalWithAdditionalConditionsWithSurrogateKey
-
sendAdHocSnapshotSignalWithAdditionalConditionWithSurrogateKey
-
sendAdHocSnapshotSignalWithAdditionalConditionsWithSurrogateKey
-
buildAdditionalConditions
-