Package io.debezium.connector.mongodb
Class MongoDbConnectorIT
- java.lang.Object
-
- io.debezium.embedded.AbstractConnectorTest
-
- io.debezium.connector.mongodb.MongoDbConnectorIT
-
- All Implemented Interfaces:
Testing
public class MongoDbConnectorIT extends AbstractConnectorTest
- Author:
- Randall Hauch
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.debezium.embedded.AbstractConnectorTest
AbstractConnectorTest.SourceRecords
-
Nested classes/interfaces inherited from interface io.debezium.util.Testing
Testing.Debug, Testing.Files, Testing.InterruptableFunction, Testing.Network, Testing.Print, Testing.Timer
-
-
Field Summary
Fields Modifier and Type Field Description private Configurationconfigprivate io.debezium.connector.mongodb.MongoDbTaskContextcontext-
Fields inherited from class io.debezium.embedded.AbstractConnectorTest
engine, logger, logTestName, OFFSET_STORE_PATH, pollTimeoutInMs, skipTestRule
-
-
Constructor Summary
Constructors Constructor Description MongoDbConnectorIT()
-
Method Summary
-
Methods 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, consumeDmlRecordsByTopic, consumeDmlRecordsByTopic, consumeDmlRecordsByTopic, consumeRecord, consumeRecords, consumeRecords, consumeRecords, consumeRecordsByTopic, consumeRecordsByTopic, consumeRecordsByTopic, debug, getMaximumEnqueuedRecordCount, getSnapshotMetricsObjectName, getStreamingMetricsObjectName, getStreamingMetricsObjectName, getStreamingNamespace, initializeConnectorTestFramework, isStreamingRunning, isStreamingRunning, isTransactionRecord, loggingCompletion, print, readLastCommittedOffset, readLastCommittedOffsets, setConsumeTimeout, skipAvroValidation, start, start, start, start, start, startAndConsumeTillEnd, stopConnector, stopConnector, validate, waitForAvailableRecords, waitForConnectorShutdown, waitForSnapshotToBeCompleted, waitForStreamingRunning, waitForStreamingRunning, waitTimeForRecords, waitTimeForRecordsAfterNulls
-
-
-
-
Field Detail
-
config
private Configuration config
-
context
private io.debezium.connector.mongodb.MongoDbTaskContext context
-
-
Method Detail
-
beforeEach
public void beforeEach()
-
afterEach
public void afterEach()
-
shouldNotStartWithInvalidConfiguration
public void shouldNotStartWithInvalidConfiguration()
Verifies that the connector doesn't run with an invalid configuration. This does not actually connect to the MySQL server.
-
shouldFailToValidateInvalidConfiguration
public void shouldFailToValidateInvalidConfiguration()
-
shouldThrowExceptionWhenFieldExcludeListDatabasePartIsOnlyProvided
public void shouldThrowExceptionWhenFieldExcludeListDatabasePartIsOnlyProvided()
-
shouldThrowExceptionWhenFieldExcludeListDatabaseAndCollectionPartIsOnlyProvided
public void shouldThrowExceptionWhenFieldExcludeListDatabaseAndCollectionPartIsOnlyProvided()
-
shouldThrowExceptionWhenFieldExcludeListDatabaseAndCollectionPartsAreMissing
public void shouldThrowExceptionWhenFieldExcludeListDatabaseAndCollectionPartsAreMissing()
-
shouldThrowExceptionWhenFieldExcludeListFieldPartIsMissing
public void shouldThrowExceptionWhenFieldExcludeListFieldPartIsMissing()
-
shouldNotThrowExceptionWhenFieldExcludeListHasLeadingWhiteSpaces
public void shouldNotThrowExceptionWhenFieldExcludeListHasLeadingWhiteSpaces()
-
shouldNotThrowExceptionWhenFieldExcludeListHasWhiteSpaces
public void shouldNotThrowExceptionWhenFieldExcludeListHasWhiteSpaces()
-
shouldNotThrowExceptionWhenFieldExcludeListIsValid
public void shouldNotThrowExceptionWhenFieldExcludeListIsValid()
-
shouldThrowExceptionWhenFieldRenamesDatabaseAndCollectionPartsAreMissing
public void shouldThrowExceptionWhenFieldRenamesDatabaseAndCollectionPartsAreMissing()
-
shouldThrowExceptionWhenFieldRenamesReplacementPartIsMissing
public void shouldThrowExceptionWhenFieldRenamesReplacementPartIsMissing()
-
shouldThrowExceptionWhenFieldRenamesReplacementPartSeparatorIsMissing
public void shouldThrowExceptionWhenFieldRenamesReplacementPartSeparatorIsMissing()
-
shouldThrowExceptionWhenFieldRenamesRenameMappingKeyIsMissing
public void shouldThrowExceptionWhenFieldRenamesRenameMappingKeyIsMissing()
-
shouldThrowExceptionWhenFieldRenamesRenameMappingValueIsMissing
public void shouldThrowExceptionWhenFieldRenamesRenameMappingValueIsMissing()
-
shouldNotThrowExceptionWhenFieldRenamesHasLeadingWhiteSpaces
public void shouldNotThrowExceptionWhenFieldRenamesHasLeadingWhiteSpaces()
-
shouldNotThrowExceptionWhenFieldRenamesHasWhiteSpaces
public void shouldNotThrowExceptionWhenFieldRenamesHasWhiteSpaces()
-
shouldNotThrowExceptionWhenFieldRenamesIsValid
public void shouldNotThrowExceptionWhenFieldRenamesIsValid()
-
shouldValidateFilterFieldConfiguration
public void shouldValidateFilterFieldConfiguration(Field field, String value, int errorCount)
-
shouldValidateAcceptableConfiguration
public void shouldValidateAcceptableConfiguration()
-
shouldConsumeAllEventsFromDatabase
public void shouldConsumeAllEventsFromDatabase() throws InterruptedException, IOException- Throws:
InterruptedExceptionIOException
-
shouldConsumeAllEventsFromDatabaseWithSkippedOperations
@FixFor("DBZ-1831") public void shouldConsumeAllEventsFromDatabaseWithSkippedOperations() throws InterruptedException, IOException
- Throws:
InterruptedExceptionIOException
-
shouldConsumeAllEventsFromDatabaseWithCustomAuthSource
@FixFor("DBZ-1168") public void shouldConsumeAllEventsFromDatabaseWithCustomAuthSource() throws InterruptedException, IOException
- Throws:
InterruptedExceptionIOException
-
shouldSupportDbRef
@FixFor("DBZ-1767") public void shouldSupportDbRef() throws InterruptedException, IOException
- Throws:
InterruptedExceptionIOException
-
shouldConsumeEventsFromCollectionWithReplacedTopicName
@FixFor("DBZ-865 and DBZ-1242") public void shouldConsumeEventsFromCollectionWithReplacedTopicName() throws InterruptedException, IOException
- Throws:
InterruptedExceptionIOException
-
testEmptySchemaWarningAfterApplyingCollectionFilters
@FixFor("DBZ-1242") public void testEmptySchemaWarningAfterApplyingCollectionFilters() throws Exception
- Throws:
Exception
-
verifyFromInitialSync
protected void verifyFromInitialSync(org.apache.kafka.connect.source.SourceRecord record, AtomicBoolean foundLast)
-
shouldConsumeTransaction
@FixFor("DBZ-1215") public void shouldConsumeTransaction() throws InterruptedException, IOException
- Throws:
InterruptedExceptionIOException
-
shouldResumeTransactionInMiddle
@FixFor("DBZ-1215") public void shouldResumeTransactionInMiddle() throws InterruptedException, IOException
- Throws:
InterruptedExceptionIOException
-
shouldSnapshotDocumentContainingFieldNamedOp
@FixFor("DBZ-2116") public void shouldSnapshotDocumentContainingFieldNamedOp() throws Exception
- Throws:
Exception
-
shouldFilterItemsInCollectionWhileTakingSnapshot
@FixFor("DBZ-2496") public void shouldFilterItemsInCollectionWhileTakingSnapshot() throws Exception
- Throws:
Exception
-
shouldSelectivelySnapshot
@FixFor("DBZ-2456") public void shouldSelectivelySnapshot() throws InterruptedException
- Throws:
InterruptedException
-
verifyNotFromInitialSync
protected void verifyNotFromInitialSync(org.apache.kafka.connect.source.SourceRecord record)
-
verifyFromTransaction
protected void verifyFromTransaction(org.apache.kafka.connect.source.SourceRecord record, long order)
-
verifyNotFromTransaction
protected void verifyNotFromTransaction(org.apache.kafka.connect.source.SourceRecord record)
-
verifyCreateOperation
protected void verifyCreateOperation(org.apache.kafka.connect.source.SourceRecord record)
-
verifyReadOperation
protected void verifyReadOperation(org.apache.kafka.connect.source.SourceRecord record)
-
verifyUpdateOperation
protected void verifyUpdateOperation(org.apache.kafka.connect.source.SourceRecord record)
-
verifyDeleteOperation
protected void verifyDeleteOperation(org.apache.kafka.connect.source.SourceRecord record)
-
verifyOperation
protected void verifyOperation(org.apache.kafka.connect.source.SourceRecord record, Envelope.Operation expected)
-
primary
protected io.debezium.connector.mongodb.ConnectionContext.MongoPrimary primary()
-
storeDocuments
protected void storeDocuments(String dbName, String collectionName, String pathOnClasspath)
-
storeDocuments
protected void storeDocuments(com.mongodb.client.MongoCollection<org.bson.Document> collection, String pathOnClasspath)
-
storeDocumentsInTx
protected void storeDocumentsInTx(String dbName, String collectionName, String pathOnClasspath)
-
storeDocuments
protected void storeDocuments(com.mongodb.client.ClientSession session, com.mongodb.client.MongoCollection<org.bson.Document> collection, String pathOnClasspath)
-
connectionErrorHandler
protected BiConsumer<String,Throwable> connectionErrorHandler(int numErrorsBeforeFailing)
-
shouldUseSSL
public void shouldUseSSL() throws InterruptedException, IOException- Throws:
InterruptedExceptionIOException
-
shouldEmitHeartbeatMessages
@FixFor("DBZ-1198") public void shouldEmitHeartbeatMessages() throws InterruptedException, IOException
- Throws:
InterruptedExceptionIOException
-
shouldOutputRecordsInCloudEventsFormat
@FixFor("DBZ-1292") public void shouldOutputRecordsInCloudEventsFormat() throws Exception
- Throws:
Exception
-
shouldGenerateRecordForInsertEvent
public void shouldGenerateRecordForInsertEvent() throws Exception- Throws:
Exception
-
shouldGenerateRecordForUpdateEvent
public void shouldGenerateRecordForUpdateEvent() throws Exception- Throws:
Exception
-
shouldGeneratorRecordForDeleteEvent
public void shouldGeneratorRecordForDeleteEvent() throws Exception- Throws:
Exception
-
shouldGenerateRecordForDeleteEventWithoutTombstone
@FixFor("DBZ-582") public void shouldGenerateRecordForDeleteEventWithoutTombstone() throws Exception
- Throws:
Exception
-
shouldGenerateRecordsWithCorrectlySerializedId
public void shouldGenerateRecordsWithCorrectlySerializedId() throws Exception- Throws:
Exception
-
assertSourceRecordKeyFieldIsEqualTo
private static void assertSourceRecordKeyFieldIsEqualTo(org.apache.kafka.connect.source.SourceRecord record, String fieldName, String expected)
-
shouldNotReplicateSnapshot
public void shouldNotReplicateSnapshot() throws Exception- Throws:
Exception
-
shouldGenerateRecordForUpdateEventUsingLegacyV1SourceInfo
@FixFor("DBZ-1880") public void shouldGenerateRecordForUpdateEventUsingLegacyV1SourceInfo() throws Exception
- Throws:
Exception
-
formatObjectId
private String formatObjectId(org.bson.types.ObjectId objId)
-
insertDocuments
private void insertDocuments(String dbName, String collectionName, org.bson.Document... documents)
-
updateDocuments
private void updateDocuments(String dbName, String collectionName, org.bson.Document filter, org.bson.Document document)
-
deleteDocument
private void deleteDocument(String dbName, String collectionName, org.bson.types.ObjectId objectId)
-
toObjectId
private org.bson.types.ObjectId toObjectId(String oid)
-
-