From 60dee30d1987922c4e2e2237b8b9f92d7f04b520 Mon Sep 17 00:00:00 2001 From: Ryan van Huuksloot Date: Thu, 4 Jul 2024 17:39:52 -0400 Subject: [PATCH] Fix bug with multiple transforms --- .../java/io/debezium/operator/api/config/ConfigMapping.java | 3 +-- .../io/debezium/operator/api/config/ConfigMappingTest.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/debezium-operator-api/src/main/java/io/debezium/operator/api/config/ConfigMapping.java b/debezium-operator-api/src/main/java/io/debezium/operator/api/config/ConfigMapping.java index 28d0ab1..613eb18 100644 --- a/debezium-operator-api/src/main/java/io/debezium/operator/api/config/ConfigMapping.java +++ b/debezium-operator-api/src/main/java/io/debezium/operator/api/config/ConfigMapping.java @@ -105,10 +105,9 @@ record NamedItem(String name, ConfigMappable item) { named.stream() .map(NamedItem::name) - .reduce((x, y) -> String.join(",")) + .reduce((x, y) -> x + "," + y) .ifPresent(names -> put(key, names)); - named.forEach(item -> putAll(key + "." + item.name, item.item)); return this; } diff --git a/debezium-operator-api/src/test/java/io/debezium/operator/api/config/ConfigMappingTest.java b/debezium-operator-api/src/test/java/io/debezium/operator/api/config/ConfigMappingTest.java index 9114bd0..8d12159 100644 --- a/debezium-operator-api/src/test/java/io/debezium/operator/api/config/ConfigMappingTest.java +++ b/debezium-operator-api/src/test/java/io/debezium/operator/api/config/ConfigMappingTest.java @@ -83,7 +83,7 @@ void shouldAddList() { config.putList("transforms", transformations, "Reroute"); - assertThat(config.getAsMap()).containsEntry("transforms", ""); + assertThat(config.getAsMap()).containsEntry("transforms", "Reroute0,Reroute1"); assertThat(config.getAsMap()).containsEntry("transforms.Reroute0.type", "io.debezium.transforms.ByLogicalTableRouter"); assertThat(config.getAsMap()).containsEntry("transforms.Reroute0.negate", "false"); assertThat(config.getAsMap()).containsEntry("transforms.Reroute1.type", "io.debezium.transforms.ByLogicalTableRouter"); @@ -93,7 +93,7 @@ void shouldAddList() { "transforms.Reroute0.type=io.debezium.transforms.ByLogicalTableRouter\n" + "transforms.Reroute1.negate=true\n" + "transforms.Reroute1.type=io.debezium.transforms.ByLogicalTableRouter\n" + - "transforms="); + "transforms=Reroute0,Reroute1"); } @Test