Package io.debezium.connector.mongodb
Class AbstractMongoConnectorIT
java.lang.Object
io.debezium.embedded.AbstractConnectorTest
io.debezium.connector.mongodb.AbstractMongoConnectorIT
- All Implemented Interfaces:
Testing
- Direct Known Subclasses:
AbstractExtractNewDocumentStateTestIT,BlockingSnapshotIT,CloudEventsConverterIT,FieldBlacklistIT,FieldExcludeListIT,FieldRenamesIT,IncrementalSnapshotIT,MongoDbConnectorIT,MongoDbConnectorWithConnectionStringIT,MongoEventRouterTestIT,MongoMetricsIT,NotificationsIT,TransactionMetadataIT
A common abstract base class for the Mongodb connector integration testing.
- Author:
- Chris Cranford
-
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 TypeFieldDescriptionprotected Configurationprotected io.debezium.connector.mongodb.MongoDbTaskContextprotected LogInterceptorprotected static MongoDbDeploymentprivate static final intFields inherited from class io.debezium.embedded.AbstractConnectorTest
consumedLines, engine, isEngineRunning, logger, logTestName, OFFSET_STORE_PATH, pollTimeoutInMs, skipTestRule -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidafterAll()voidstatic voidvoidprivate static booleancollectionExists(com.mongodb.client.MongoDatabase database, String collectionName) protected com.mongodb.client.MongoClientconnect()protected voiddeleteDocuments(String dbName, String collectionName, org.bson.Document filter) Deletes a document in a collection based on a specified filter.protected voiddropAndInsertDocuments(String dbName, String collectionName, org.bson.Document... documents) Drops the specified collection if it exists and inserts all documents into the empty collection.private static ObjectNamegetMetricsObjectNameWithTags(String connector, Map<String, String> tags) static ObjectNamegetSnapshotMetricsObjectName(String connector, String server) static ObjectNamegetSnapshotMetricsObjectName(String connector, String server, int taskId) static ObjectNamegetStreamingMetricsObjectName(String connector, String server) static ObjectNamegetStreamingMetricsObjectName(String connector, String server, int taskId) protected voidinsertDocuments(String dbName, String collectionName, org.bson.Document... documents) Inserts all documents in the specified collection.protected voidinsertDocumentsInTx(String dbName, String collectionName, org.bson.Document... documents) Inserts all documents in the specified collection within a transaction.protected List<org.bson.Document>loadTestDocuments(String pathOnClasspath) Load test documents from the classpath.protected voidstoreDocuments(com.mongodb.client.MongoCollection<org.bson.Document> collection, String pathOnClasspath) protected voidstoreDocuments(String dbName, String collectionName, String pathOnClasspath) protected voidupdateDocument(String dbName, String collectionName, org.bson.Document filter, org.bson.Document document) Updates a document in a collection based on a specified filter.protected voidupdateDocumentsInTx(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.static voidwaitForSnapshotToBeCompleted(String connector, String server) static voidwaitForSnapshotToBeCompleted(String connector, String server, int taskId) private static voidwaitForSnapshotToBeCompleted(ObjectName objectName) static voidwaitForStreamingRunning(String connector, String server) static voidwaitForStreamingRunning(String connector, String server, int taskId) private static voidwaitForStreamingRunning(ObjectName objectName) 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, consumeAvailableRecordsByTopic, consumeDmlRecordsByTopic, consumeDmlRecordsByTopic, consumeDmlRecordsByTopic, consumeRecord, consumeRecords, consumeRecords, consumeRecords, consumeRecordsButSkipUntil, consumeRecordsByTopic, consumeRecordsByTopic, consumeRecordsByTopic, consumeRecordsByTopicUntil, consumeRecordsUntil, debug, getConsumer, getMaximumEnqueuedRecordCount, getSnapshotMetricsObjectName, getSnapshotMetricsObjectName, 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, validate, waitForAvailableRecords, waitForConnectorShutdown, waitForSnapshotToBeCompleted, waitForSnapshotWithCustomMetricsToBeCompleted, waitForStreamingRunning, waitForStreamingRunning, waitForStreamingWithCustomMetricsToStart, waitTimeForRecords, waitTimeForRecordsAfterNulls
-
Field Details
-
TASK_ID
private static final int TASK_ID- See Also:
-
mongo
-
config
-
context
protected io.debezium.connector.mongodb.MongoDbTaskContext context -
logInterceptor
-
-
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
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 namecollectionName- the collection namedocuments- 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 namecollectionName- the collection namedocuments- 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 namecollectionName- the collection namedocuments- 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 namecollectionName- the collection namefilter- the document filterdocument- 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 namecollectionName- the collection namefilter- the document filterdocument- the document fields to be updated
-
deleteDocuments
Deletes a document in a collection based on a specified filter.- Parameters:
dbName- the database namecollectionName- the collection namefilter- the document filter
-
connect
protected com.mongodb.client.MongoClient connect() -
collectionExists
private static boolean collectionExists(com.mongodb.client.MongoDatabase database, String collectionName) -
storeDocuments
-
storeDocuments
protected void storeDocuments(com.mongodb.client.MongoCollection<org.bson.Document> collection, String pathOnClasspath) -
getSnapshotMetricsObjectName
-
getSnapshotMetricsObjectName
-
waitForSnapshotToBeCompleted
-
waitForSnapshotToBeCompleted
-
getStreamingMetricsObjectName
-
getStreamingMetricsObjectName
-
waitForStreamingRunning
-
waitForStreamingRunning
-
waitForSnapshotToBeCompleted
-
waitForStreamingRunning
-
getMetricsObjectNameWithTags
-