lhotari commented on code in PR #24654:
URL: https://github.com/apache/pulsar/pull/24654#discussion_r2325145601
##########
pulsar-io/kafka-connect-adaptor/src/test/java/org/apache/pulsar/io/kafka/connect/KafkaConnectSourceTest.java:
##########
@@ -96,6 +103,182 @@ public void testOpenAndReadConnectorConfig() throws
Exception {
testOpenAndReadTask(config);
}
+
+ @Test(timeOut = 30000)
+ public void testFlushWhenAllMessagesFilteredWithoutBlocking() throws
Exception {
+
+ Map<String, Object> config = getConfig();
+ config.put(TaskConfig.TASK_CLASS_CONFIG,
"org.apache.kafka.connect.file.FileStreamSourceTask");
+
+ config.put("transforms", "Filter");
+ config.put("transforms.Filter.type",
"org.apache.kafka.connect.transforms.Filter");
+ config.put("transforms.Filter.predicate", "DropMeTopic");
+
+ config.put("predicates", "DropMeTopic");
+ config.put("predicates.DropMeTopic.type",
"org.apache.kafka.connect.transforms.predicates.TopicNameMatches");
+ config.put("predicates.DropMeTopic.pattern",
".*my-property/my-ns/kafka-connect-source.*");
+
+ kafkaConnectSource = new KafkaConnectSource();
+ kafkaConnectSource.open(config, context);
+
+ OffsetStorageWriter original = kafkaConnectSource.getOffsetWriter();
+ OffsetStorageWriter spyWriter = org.mockito.Mockito.spy(original);
+ java.lang.reflect.Field f =
AbstractKafkaConnectSource.class.getDeclaredField("offsetWriter");
+ f.setAccessible(true);
+ f.set(kafkaConnectSource, spyWriter);
Review Comment:
There's also a valid point about the repetition. It could be addressed by
extracting a method `wrapOffsetWriterWithSpy` etc.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]