kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nehanarkh...@apache.org
Subject git commit: KAFKA-1233 Integration test for the new producer; reviewed by Jay Kreps and Neha Narkhede
Date Tue, 11 Feb 2014 22:26:02 GMT
Updated Branches:
  refs/heads/trunk 71e21c6ba -> a0939f412


KAFKA-1233 Integration test for the new producer; reviewed by Jay Kreps and Neha Narkhede


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/a0939f41
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/a0939f41
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/a0939f41

Branch: refs/heads/trunk
Commit: a0939f412d7c5c0e294f7d1c2779ae9321338155
Parents: 71e21c6
Author: Guozhang Wang <guwang@linkedin.com>
Authored: Tue Feb 11 14:25:31 2014 -0800
Committer: Neha Narkhede <neha.narkhede@gmail.com>
Committed: Tue Feb 11 14:25:40 2014 -0800

----------------------------------------------------------------------
 build.gradle                                         |  1 +
 core/src/test/scala/unit/kafka/utils/TestUtils.scala | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/a0939f41/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index d9d6e6a..fd519d6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -148,6 +148,7 @@ project(':core') {
     testCompile 'junit:junit:4.1'
     testCompile 'org.easymock:easymock:3.0'
     testCompile 'org.objenesis:objenesis:1.2'
+    testCompile project(':clients')
     if (scalaVersion.startsWith('2.8')) {
       testCompile 'org.scalatest:scalatest:1.2'
     } else if (scalaVersion.startsWith('2.10')) {

http://git-wip-us.apache.org/repos/asf/kafka/blob/a0939f41/core/src/test/scala/unit/kafka/utils/TestUtils.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/utils/TestUtils.scala b/core/src/test/scala/unit/kafka/utils/TestUtils.scala
index 500eeca..1c7a450 100644
--- a/core/src/test/scala/unit/kafka/utils/TestUtils.scala
+++ b/core/src/test/scala/unit/kafka/utils/TestUtils.scala
@@ -39,6 +39,7 @@ import collection.mutable.Map
 import kafka.serializer.{StringEncoder, DefaultEncoder, Encoder}
 import kafka.common.TopicAndPartition
 import junit.framework.Assert
+import kafka.admin.AdminUtils
 
 
 /**
@@ -136,6 +137,20 @@ object TestUtils extends Logging {
   }
 
   /**
+   * Create a topic in zookeeper
+   */
+  def createTopic(zkClient: ZkClient, topic: String, numPartitions: Int = 1, replicationFactor:
Int = 1,
+                  servers: List[KafkaServer]) : scala.collection.immutable.Map[Int, Option[Int]]
= {
+    // create topic
+    AdminUtils.createTopic(zkClient, topic, numPartitions, replicationFactor)
+    // wait until the update metadata request for new topic reaches all servers
+    (0 until numPartitions).map { case i =>
+      TestUtils.waitUntilMetadataIsPropagated(servers, topic, i, 500)
+      i -> TestUtils.waitUntilLeaderIsElectedOrChanged(zkClient, topic, i, 500)
+    }.toMap
+  }
+
+  /**
    * Create a test config for a consumer
    */
   def createConsumerProperties(zkConnect: String, groupId: String, consumerId: String,


Mime
View raw message