lucasbru commented on code in PR #18395:
URL: https://github.com/apache/kafka/pull/18395#discussion_r1907830474


##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/streams/topics/RepartitionTopicsTest.java:
##########
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.streams.topics;
+
+import org.apache.kafka.common.requests.StreamsGroupHeartbeatResponse.Status;
+import org.apache.kafka.common.utils.LogContext;
+import 
org.apache.kafka.coordinator.group.generated.StreamsGroupTopologyValue.Subtopology;
+import 
org.apache.kafka.coordinator.group.generated.StreamsGroupTopologyValue.TopicConfig;
+import 
org.apache.kafka.coordinator.group.generated.StreamsGroupTopologyValue.TopicInfo;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.OptionalInt;
+import java.util.Set;
+import java.util.function.Function;
+
+import static org.apache.kafka.common.utils.Utils.mkEntry;
+import static org.apache.kafka.common.utils.Utils.mkMap;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class RepartitionTopicsTest {
+
+    private static final LogContext LOG_CONTEXT = new LogContext();
+    private static final String SOURCE_TOPIC_NAME1 = "source1";
+    private static final String SOURCE_TOPIC_NAME2 = "source2";
+    private static final String SINK_TOPIC_NAME1 = "sink1";
+    private static final String SINK_TOPIC_NAME2 = "sink2";
+    private static final String REPARTITION_TOPIC_NAME1 = "repartition1";
+    private static final String REPARTITION_TOPIC_NAME2 = "repartition2";
+    private static final String REPARTITION_TOPIC_WITHOUT_PARTITION_COUNT = 
"repartitionWithoutPartitionCount";
+    private static final TopicConfig TOPIC_CONFIG1 = new 
TopicConfig().setKey("config1").setValue("val1");
+    private static final TopicConfig TOPIC_CONFIG2 = new 
TopicConfig().setKey("config2").setValue("val2");
+    private static final TopicConfig TOPIC_CONFIG5 = new 
TopicConfig().setKey("config5").setValue("val5");
+    private static final TopicInfo REPARTITION_TOPIC_INFO1 = new TopicInfo()
+        .setName(REPARTITION_TOPIC_NAME1)
+        .setPartitions(4)
+        .setTopicConfigs(List.of(TOPIC_CONFIG1));
+    private static final Subtopology SUBTOPOLOGY2 = new Subtopology()
+        .setSubtopologyId("SUBTOPOLOGY2")
+        .setSourceTopics(Collections.singletonList(REPARTITION_TOPIC_NAME1))
+        .setRepartitionSinkTopics(Collections.singletonList(SINK_TOPIC_NAME1))
+        .setRepartitionSourceTopics(List.of(REPARTITION_TOPIC_INFO1))
+        .setStateChangelogTopics(Collections.emptyList());
+    private static final TopicInfo REPARTITION_TOPIC_INFO2 = new TopicInfo()
+        .setName(REPARTITION_TOPIC_NAME2)
+        .setPartitions(2)
+        .setTopicConfigs(List.of(TOPIC_CONFIG2));
+    private static final Subtopology SUBTOPOLOGY1 = new Subtopology()
+        .setSubtopologyId("SUBTOPOLOGY1")
+        .setSourceTopics(List.of(SOURCE_TOPIC_NAME1, SOURCE_TOPIC_NAME2))
+        
.setRepartitionSinkTopics(Collections.singletonList(REPARTITION_TOPIC_NAME1))
+        .setRepartitionSourceTopics(List.of(
+            REPARTITION_TOPIC_INFO1,
+            REPARTITION_TOPIC_INFO2
+        ))

Review Comment:
   Good comment! Actually, it's the other way around. In our RPCs we do not 
include the repartition source topics in the source topics. I made a mistake 
during the refactoring here.



-- 
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]

Reply via email to