huangdx0726 commented on a change in pull request #5590: [Issue 
5474][pulsar-io-debezium] Support CDC Connector for MongoDB
URL: https://github.com/apache/pulsar/pull/5590#discussion_r346625627
 
 

 ##########
 File path: 
tests/integration/src/test/java/org/apache/pulsar/tests/integration/io/SourceTester.java
 ##########
 @@ -51,4 +59,27 @@ public String sourceType() {
 
     public abstract Map<String, String> produceSourceMessages(int numMessages) 
throws Exception;
 
+    public void validateSourceResult(Consumer<KeyValue<byte[], byte[]>> 
consumer, int number) throws Exception {
+        int recordsNumber = 0;
+        Message<KeyValue<byte[], byte[]>> msg = consumer.receive(2, 
TimeUnit.SECONDS);
+        while(msg != null) {
+            recordsNumber ++;
+            final String key = new String(msg.getValue().getKey());
+            final String value = new String(msg.getValue().getValue());
+            log.info("Received message: key = {}, value = {}.", key, value);
+            Assert.assertTrue(key.contains(this.keyContains()));
+            Assert.assertTrue(value.contains(this.valueContains()));
+            consumer.acknowledge(msg);
+            msg = consumer.receive(1, TimeUnit.SECONDS);
+        }
+
+        Assert.assertEquals(recordsNumber, number);
+        log.info("Stop {} server container. topic: {} has {} 
records.",getSourceType(), consumer.getTopic(), recordsNumber);
 
 Review comment:
   I have fixed it

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to