Class AbstractMongoConnectorIT

    • Field Detail

      • context

        protected io.debezium.connector.mongodb.MongoDbTaskContext context
    • Constructor Detail

      • AbstractMongoConnectorIT

        public AbstractMongoConnectorIT()
    • Method Detail

      • beforEach

        public void beforEach()
      • afterEach

        public void afterEach()
      • 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
      • primary

        protected io.debezium.connector.mongodb.ConnectionContext.MongoPrimary primary()
      • 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)