Class AbstractMongoConnectorIT

java.lang.Object
io.debezium.embedded.AbstractConnectorTest
io.debezium.connector.mongodb.AbstractMongoConnectorIT
All Implemented Interfaces:
Testing
Direct Known Subclasses:
AbstractExtractNewDocumentStateTestIT, CloudEventsConverterIT, FieldBlacklistIT, FieldExcludeListIT, FieldRenamesIT, IncrementalSnapshotIT, MongoDbConnectorIT, MongoDbConnectorWithConnectionStringIT, MongoEventRouterTestIT, MongoMetricsIT, TransactionMetadataIT

public abstract class AbstractMongoConnectorIT extends AbstractConnectorTest
A common abstract base class for the Mongodb connector integration testing.
Author:
Chris Cranford
  • Field Details

  • Constructor Details

    • AbstractMongoConnectorIT

      public AbstractMongoConnectorIT()
  • Method Details

    • beforeEach

      public void beforeEach()
    • afterEach

      public void afterEach()
    • beforeAll

      public static void beforeAll()
    • afterAll

      public static void afterAll()
    • loadTestDocuments

      protected List<org.bson.Document> loadTestDocuments(String pathOnClasspath)
      Load test documents from the classpath.
      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.
    • dropAndInsertDocuments

      protected void dropAndInsertDocuments(String dbName, String collectionName, org.bson.Document... documents)
      Drops the specified collection if it exists and inserts all documents into the empty collection. NOTE: This method will only drop the collection if the documents list is provided.
      Parameters:
      dbName - the database name
      collectionName - the collection name
      documents - the documents to be inserted, can be empty
    • insertDocuments

      protected void insertDocuments(String dbName, String collectionName, org.bson.Document... documents)
      Inserts all documents in the specified collection.
      Parameters:
      dbName - the database name
      collectionName - the collection name
      documents - the documents to be inserted, can be empty
    • insertDocumentsInTx

      protected void insertDocumentsInTx(String dbName, String collectionName, org.bson.Document... documents)
      Inserts all documents in the specified collection within a transaction.
      Parameters:
      dbName - the database name
      collectionName - the collection name
      documents - the documents to be inserted, can be empty
    • updateDocument

      protected void updateDocument(String dbName, String collectionName, org.bson.Document filter, org.bson.Document document)
      Updates a document in a collection based on a specified filter.
      Parameters:
      dbName - the database name
      collectionName - the collection name
      filter - the document filter
      document - the document fields to be updated
    • updateDocumentsInTx

      protected void updateDocumentsInTx(String dbName, String collectionName, org.bson.Document filter, org.bson.Document document)
      Updates documents in a collection based on a specified filter within a transaction.
      Parameters:
      dbName - the database name
      collectionName - the collection name
      filter - the document filter
      document - the document fields to be updated
    • deleteDocuments

      protected void deleteDocuments(String dbName, String collectionName, org.bson.Document filter)
      Deletes a document in a collection based on a specified filter.
      Parameters:
      dbName - the database name
      collectionName - the collection name
      filter - the document filter
    • connect

      protected com.mongodb.client.MongoClient connect()
    • collectionExists

      private static boolean collectionExists(com.mongodb.client.MongoDatabase database, String collectionName)
    • storeDocuments

      protected void storeDocuments(String dbName, String collectionName, String pathOnClasspath)
    • storeDocuments

      protected void storeDocuments(com.mongodb.client.MongoCollection<org.bson.Document> collection, String pathOnClasspath)
    • getSnapshotMetricsObjectName

      public static ObjectName getSnapshotMetricsObjectName(String connector, String server)
    • getSnapshotMetricsObjectName

      public static ObjectName getSnapshotMetricsObjectName(String connector, String server, int taskId)
    • waitForSnapshotToBeCompleted

      public static void waitForSnapshotToBeCompleted(String connector, String server)
    • waitForSnapshotToBeCompleted

      public static void waitForSnapshotToBeCompleted(String connector, String server, int taskId)
    • getStreamingMetricsObjectName

      public static ObjectName getStreamingMetricsObjectName(String connector, String server)
    • getStreamingMetricsObjectName

      public static ObjectName getStreamingMetricsObjectName(String connector, String server, int taskId)
    • waitForStreamingRunning

      public static void waitForStreamingRunning(String connector, String server)
    • waitForStreamingRunning

      public static void waitForStreamingRunning(String connector, String server, int taskId)
    • waitForSnapshotToBeCompleted

      private static void waitForSnapshotToBeCompleted(ObjectName objectName)
    • waitForStreamingRunning

      private static void waitForStreamingRunning(ObjectName objectName)
    • getMetricsObjectNameWithTags

      private static ObjectName getMetricsObjectNameWithTags(String connector, Map<String,String> tags)