Github user praveend commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10294#discussion_r48714076
  
    --- Diff: 
external/kafka-v09/src/test/java/org/apache/spark/streaming/kafka/v09/JavaKafkaRDDSuite.java
 ---
    @@ -0,0 +1,156 @@
    +/*
    + * 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.spark.streaming.kafka.v09;
    +
    +import java.io.Serializable;
    +import java.util.HashMap;
    +
    +import org.apache.kafka.clients.consumer.ConsumerConfig;
    +import org.apache.kafka.clients.consumer.ConsumerRecord;
    +import org.apache.spark.streaming.kafka.v09.Broker;
    +import org.apache.spark.streaming.kafka.v09.KafkaTestUtils;
    +import org.apache.spark.streaming.kafka.v09.KafkaUtils;
    +import org.apache.spark.streaming.kafka.v09.OffsetRange;
    +import scala.Tuple2;
    +
    +import kafka.common.TopicAndPartition;
    +import kafka.message.MessageAndMetadata;
    +import kafka.serializer.StringDecoder;
    +import org.junit.After;
    +import org.junit.Assert;
    +import org.junit.Before;
    +import org.junit.Test;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.api.java.function.Function;
    +
    +public class JavaKafkaRDDSuite implements Serializable {
    +  private transient JavaSparkContext sc = null;
    +  private transient KafkaTestUtils kafkaTestUtils = null;
    +
    +  @Before
    +  public void setUp() {
    +    kafkaTestUtils = new KafkaTestUtils();
    +    kafkaTestUtils.setup();
    +    SparkConf sparkConf = new SparkConf()
    +        .setMaster("local[4]").setAppName(this.getClass().getSimpleName());
    +    sc = new JavaSparkContext(sparkConf);
    +  }
    +
    +  @After
    +  public void tearDown() {
    +    if (sc != null) {
    +      sc.stop();
    +      sc = null;
    +    }
    +
    +    if (kafkaTestUtils != null) {
    +      kafkaTestUtils.teardown();
    +      kafkaTestUtils = null;
    +    }
    +  }
    +
    +  @Test
    +  public void testKafkaRDD() throws InterruptedException {
    +    String topic1 = "new_topic1_testKafkaRDD";
    +    String topic2 = "new_topic2_testKafkaRDD";
    +
    +    String[] topic1data = createTopicAndSendData(topic1);
    +    String[] topic2data = createTopicAndSendData(topic2);
    +
    +    HashMap<String, String> kafkaParams = new HashMap<String, String>();
    +    kafkaParams.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, 
kafkaTestUtils.brokerAddress());
    +    kafkaParams.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, 
"org.apache.kafka.common.serialization.StringDeserializer");
    +    kafkaParams.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, 
"org.apache.kafka.common.serialization.StringDeserializer");
    +    kafkaParams.put("spark.kafka.poll.time", "1000");
    +
    +    OffsetRange[] offsetRanges = {
    +        OffsetRange.create(topic1, 0, 0, 1),
    +        OffsetRange.create(topic2, 0, 0, 1)
    +    };
    +
    +    HashMap<TopicAndPartition, Broker> emptyLeaders = new 
HashMap<TopicAndPartition, Broker>();
    --- End diff --
    
    We could probably remove this section of defining broker and leaders as we 
no longer expose the concept of brokers and leaders to end users


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to