cadonna commented on a change in pull request #9848:
URL: https://github.com/apache/kafka/pull/9848#discussion_r558440845



##########
File path: 
streams/src/test/java/org/apache/kafka/streams/processor/internals/RepartitionTopicsTest.java
##########
@@ -0,0 +1,434 @@
+/*
+ * 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.streams.processor.internals;
+
+import org.apache.kafka.common.Cluster;
+import org.apache.kafka.common.Node;
+import org.apache.kafka.common.PartitionInfo;
+import org.apache.kafka.common.TopicPartition;
+import org.apache.kafka.streams.errors.MissingSourceTopicException;
+import org.apache.kafka.streams.errors.TaskAssignmentException;
+import 
org.apache.kafka.streams.processor.internals.InternalTopologyBuilder.TopicsInfo;
+import 
org.apache.kafka.streams.processor.internals.assignment.CopartitionedTopicsEnforcer;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.apache.kafka.common.utils.Utils.mkEntry;
+import static org.apache.kafka.common.utils.Utils.mkMap;
+import static org.apache.kafka.common.utils.Utils.mkSet;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.mock;
+import static org.easymock.EasyMock.niceMock;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertThrows;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({Cluster.class})
+public class RepartitionTopicsTest {
+
+    private static final String SOURCE_TOPIC_NAME1 = "source1";
+    private static final String SOURCE_TOPIC_NAME2 = "source2";
+    private static final String SOURCE_TOPIC_NAME3 = "source3";
+    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_NAME3 = "repartition3";
+    private static final String REPARTITION_TOPIC_NAME4 = "repartition4";
+    private static final String REPARTITION_WITHOUT_PARTITION_COUNT = 
"repartitionWithoutPartitionCount";
+    private static final String SOME_OTHER_TOPIC = "someOtherTopic";
+    private static final Map<String, String> TOPIC_CONFIG1 = 
Collections.singletonMap("config1", "val1");
+    private static final Map<String, String> TOPIC_CONFIG2 = 
Collections.singletonMap("config2", "val2");
+    private static final Map<String, String> TOPIC_CONFIG5 = 
Collections.singletonMap("config5", "val5");
+    private static final RepartitionTopicConfig REPARTITION_TOPIC_CONFIG1 =
+        new RepartitionTopicConfig(REPARTITION_TOPIC_NAME1, TOPIC_CONFIG1, 4, 
true);
+    private static final RepartitionTopicConfig REPARTITION_TOPIC_CONFIG2 =
+        new RepartitionTopicConfig(REPARTITION_TOPIC_NAME2, TOPIC_CONFIG2, 2, 
true);
+    private static final TopicsInfo TOPICS_INFO1 = new TopicsInfo(
+        mkSet(REPARTITION_TOPIC_NAME1),
+        mkSet(SOURCE_TOPIC_NAME1, SOURCE_TOPIC_NAME2),
+        mkMap(
+            mkEntry(REPARTITION_TOPIC_NAME1, REPARTITION_TOPIC_CONFIG1),
+            mkEntry(REPARTITION_TOPIC_NAME2, REPARTITION_TOPIC_CONFIG2)
+        ),
+        Collections.emptyMap()
+    );
+    private static final TopicsInfo TOPICS_INFO2 = new TopicsInfo(
+        mkSet(SINK_TOPIC_NAME1),
+        mkSet(REPARTITION_TOPIC_NAME1),
+        mkMap(mkEntry(REPARTITION_TOPIC_NAME1, REPARTITION_TOPIC_CONFIG1)),
+        Collections.emptyMap()
+    );
+
+    final InternalTopologyBuilder internalTopologyBuilder = 
mock(InternalTopologyBuilder.class);
+    final InternalTopicManager internalTopicManager = 
mock(InternalTopicManager.class);
+    final CopartitionedTopicsEnforcer copartitionedTopicsEnforcer = 
mock(CopartitionedTopicsEnforcer.class);
+    final Cluster clusterMetadata = niceMock(Cluster.class);
+
+    @Before
+    public void setUp() {

Review comment:
       No, I will remove 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:
us...@infra.apache.org


Reply via email to