Class MongoDbConnectorIT

All Implemented Interfaces:
Testing

public class MongoDbConnectorIT extends AbstractMongoConnectorIT
Author:
Randall Hauch
  • Constructor Details

    • MongoDbConnectorIT

      public MongoDbConnectorIT()
  • Method Details

    • shouldNotStartWithInvalidConfiguration

      public void shouldNotStartWithInvalidConfiguration()
      Verifies that the connector doesn't run with an invalid configuration. This does not actually connect to the Mongo 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()
    • shouldProvideWallTime

      public void shouldProvideWallTime() throws InterruptedException
      Throws:
      InterruptedException
    • shouldNotProvideWallTimeForOlderVersions

      public void shouldNotProvideWallTimeForOlderVersions() throws InterruptedException
      Throws:
      InterruptedException
    • shouldConsumePreImage

      public void shouldConsumePreImage() throws InterruptedException
      Throws:
      InterruptedException
    • shouldConsumeAllEventsFromDatabase

      public void shouldConsumeAllEventsFromDatabase() throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • shouldSkipOversizedEvents

      public void shouldSkipOversizedEvents() throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • shouldConsumeAllEventsFromDatabaseWithSkippedOperations

      @FixFor("DBZ-1831") public void shouldConsumeAllEventsFromDatabaseWithSkippedOperations() throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • shouldConsumeAllEventsFromDatabaseWithCustomAuthSource

      @FixFor("DBZ-1168") public void shouldConsumeAllEventsFromDatabaseWithCustomAuthSource() throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • shouldConsumeEventsOnlyFromIncludedDatabasesWithRegexFilter

      @FixFor("DBZ-4575") public void shouldConsumeEventsOnlyFromIncludedDatabasesWithRegexFilter() throws IOException, InterruptedException
      Throws:
      IOException
      InterruptedException
    • shouldConsumeEventsOnlyFromIncludedDatabasesWithLiteralFilter

      @FixFor("DBZ-4575") public void shouldConsumeEventsOnlyFromIncludedDatabasesWithLiteralFilter() throws IOException, InterruptedException
      Throws:
      IOException
      InterruptedException
    • shouldConsumeEventsOnlyFromIncludedDatabases

      public void shouldConsumeEventsOnlyFromIncludedDatabases(io.debezium.connector.mongodb.MongoDbConnectorConfig.FiltersMatchMode filtersMatchMode) throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • shouldConsumeEventsOnlyFromNonExcludedCollectionsWithRegexFilter

      public void shouldConsumeEventsOnlyFromNonExcludedCollectionsWithRegexFilter() throws IOException, InterruptedException
      Throws:
      IOException
      InterruptedException
    • shouldConsumeEventsOnlyFromNonExcludedCollectionsWithLiteralFilter

      public void shouldConsumeEventsOnlyFromNonExcludedCollectionsWithLiteralFilter() throws IOException, InterruptedException
      Throws:
      IOException
      InterruptedException
    • shouldConsumeEventsOnlyFromNonExcludedCollections

      public void shouldConsumeEventsOnlyFromNonExcludedCollections(io.debezium.connector.mongodb.MongoDbConnectorConfig.FiltersMatchMode matchMode) throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • shouldSupportDbRef

      @FixFor("DBZ-1767") public void shouldSupportDbRef() throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • shouldConsumeEventsFromCollectionWithReplacedTopicName

      @FixFor("DBZ-865 and DBZ-1242") public void shouldConsumeEventsFromCollectionWithReplacedTopicName() throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • 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:
      InterruptedException
      IOException
    • shouldResumeTransactionInMiddle

      @FixFor("DBZ-1215") public void shouldResumeTransactionInMiddle() throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • 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)
    • 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)
    • storeDocuments

      protected void storeDocuments(String dbName, String collectionName, String pathOnClasspath)
      Overrides:
      storeDocuments in class AbstractMongoConnectorIT
    • storeDocuments

      protected void storeDocuments(com.mongodb.client.MongoCollection<org.bson.Document> collection, String pathOnClasspath)
      Overrides:
      storeDocuments in class AbstractMongoConnectorIT
    • 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)
    • loadTestDocuments

      protected List<org.bson.Document> loadTestDocuments(String pathOnClasspath)
      Description copied from class: AbstractMongoConnectorIT
      Load test documents from the classpath.
      Overrides:
      loadTestDocuments in class AbstractMongoConnectorIT
      Parameters:
      pathOnClasspath - the path on the classpath to the file containing the documents to load
      Returns:
      list of loaded documents; never null but may contain no entries.
    • shouldEmitHeartbeatMessages

      @FixFor("DBZ-1198") public void shouldEmitHeartbeatMessages() throws InterruptedException, IOException
      Throws:
      InterruptedException
      IOException
    • 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
    • shouldSkipNonPipelineRecords

      public void shouldSkipNonPipelineRecords() throws Exception
      Throws:
      Exception
    • assertSourceRecordKeyFieldIsEqualTo

      private static void assertSourceRecordKeyFieldIsEqualTo(org.apache.kafka.connect.source.SourceRecord record, String fieldName, String expected)
    • shouldSupportDbRef2

      public void shouldSupportDbRef2() throws Exception
      Throws:
      Exception
    • shouldReplicateContent

      public void shouldReplicateContent() throws Exception
      Throws:
      Exception
    • 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)
    • deleteDocument

      private void deleteDocument(String dbName, String collectionName, org.bson.types.ObjectId objectId)
    • toObjectId

      private org.bson.types.ObjectId toObjectId(String oid)