ableegoldman commented on a change in pull request #10512: URL: https://github.com/apache/kafka/pull/10512#discussion_r610828209
########## File path: docs/upgrade.html ########## @@ -49,8 +49,9 @@ <h5><a id="upgrade_300_notable" href="#upgrade_300_notable">Notable changes in 3 were removed. These methods were not intended to be public API and there is no replacement.</li> <li>The <code>NoOffsetForPartitionException.partition()</code> method was removed. Please use <code>partitions()</code> instead.</li> - <li>The Scala <code>kafka.common.MessageFormatter</code> was removed. Plese use the Java <code>org.apache.kafka.common.MessageFormatter</code>.</li> + <li>The Scala <code>kafka.common.MessageFormatter</code> was removed. Please use the Java <code>org.apache.kafka.common.MessageFormatter</code>.</li> <li>The <code>MessageFormatter.init(Properties)</code> method was removed. Please use <code>configure(Map)</code> instead.</li> + <li>The <code>PartitionAssignor</code> classes have been removed. Please use <code>ConsumerPartitionAssignor</code> instead.</li> Review comment: ```suggestion <li>The deprecated <code>o.a.k.clients.consumer.internals.PartitionAssignor</code> class has been removed. Please use <code>ConsumerPartitionAssignor</code> instead.</li> ``` ########## File path: clients/src/test/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignorTest.java ########## @@ -0,0 +1,83 @@ +/* + * 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.clients.consumer; + + +import org.apache.kafka.common.KafkaException; +import org.apache.kafka.common.serialization.StringDeserializer; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Properties; + +import static org.apache.kafka.clients.consumer.ConsumerPartitionAssignor.getAssignorInstances; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ConsumerPartitionAssignorTest { + + private List<String> classNames; + private List<Object> classTypes; + + @Test + public void shouldInstantiateNewAssignors() { + classNames = Collections.singletonList(StickyAssignor.class.getName()); + List<ConsumerPartitionAssignor> assignors = getAssignorInstances(classNames, Collections.emptyMap()); + assertTrue(assignors.get(0) instanceof StickyAssignor); + } + + @Test + public void shouldThrowKafkaExceptionOnNonAssignor() { + classNames = Collections.singletonList(String.class.getName()); + assertThrows(KafkaException.class, () -> getAssignorInstances(classNames, Collections.emptyMap())); + } + + @Test + public void shouldThrowKafkaExceptionOnAssignorNotFound() { + classNames = Collections.singletonList("Non-existent assignor"); + assertThrows(KafkaException.class, () -> getAssignorInstances(classNames, Collections.emptyMap())); + } + + @Test + public void shouldInstantiateFromListOfOldAndNewClassTypes() { Review comment: This particular test doesn't make sense any more, since there is no "old" assignor type now that PartitionAssignor is removed ########## File path: clients/src/test/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignorTest.java ########## @@ -0,0 +1,83 @@ +/* + * 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.clients.consumer; + + +import org.apache.kafka.common.KafkaException; +import org.apache.kafka.common.serialization.StringDeserializer; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Properties; + +import static org.apache.kafka.clients.consumer.ConsumerPartitionAssignor.getAssignorInstances; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ConsumerPartitionAssignorTest { + + private List<String> classNames; + private List<Object> classTypes; + + @Test + public void shouldInstantiateNewAssignors() { + classNames = Collections.singletonList(StickyAssignor.class.getName()); + List<ConsumerPartitionAssignor> assignors = getAssignorInstances(classNames, Collections.emptyMap()); + assertTrue(assignors.get(0) instanceof StickyAssignor); Review comment: Can you add one more test like this one, but with more than one assignor in the list to instantiate? ########## File path: clients/src/test/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignorTest.java ########## @@ -0,0 +1,83 @@ +/* + * 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.clients.consumer; + + +import org.apache.kafka.common.KafkaException; +import org.apache.kafka.common.serialization.StringDeserializer; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Properties; + +import static org.apache.kafka.clients.consumer.ConsumerPartitionAssignor.getAssignorInstances; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ConsumerPartitionAssignorTest { + + private List<String> classNames; + private List<Object> classTypes; + + @Test + public void shouldInstantiateNewAssignors() { Review comment: ```suggestion public void shouldInstantiateAssignor() { ``` -- 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