snehashisp commented on code in PR #18325:
URL: https://github.com/apache/kafka/pull/18325#discussion_r2069409569


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/TestPlugins.java:
##########
@@ -477,6 +480,27 @@ private static void compileJavaSources(Path sourceDir, 
Path binDir) throws IOExc
             if (!success) {
                 throw new RuntimeException("Failed to compile test plugin:\n" 
+ writer);
             }
+        } finally {
+            if (!replacements.isEmpty()) {
+                sourceFiles.forEach(File::delete);
+            }
+        }
+    }
+
+    private static File copyAndReplace(File source, Map<String, String> 
replacements) throws RuntimeException {
+        if (replacements.isEmpty()) {
+            return source;
+        }
+        try {
+            String content = Files.readString(source.toPath());
+            for (Map.Entry<String, String> entry : replacements.entrySet()) {
+                content = content.replace(entry.getKey(), entry.getValue());

Review Comment:
   Yeah its powerful. It would be interesting to see in what ways people start 
misusing this capability. If it turns out to be problematic,  I will followup 
and see if the version file approach can be introduced instead. 



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to