kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject [1/3] kafka git commit: KAFKA-2687: Add support for ListGroups and DescribeGroup APIs
Date Tue, 03 Nov 2015 22:40:25 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk f413143ed -> 596c203af


http://git-wip-us.apache.org/repos/asf/kafka/blob/596c203a/core/src/test/scala/unit/kafka/coordinator/MemberMetadataTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/coordinator/MemberMetadataTest.scala b/core/src/test/scala/unit/kafka/coordinator/MemberMetadataTest.scala
index 0a5bb3c..88eb9ae 100644
--- a/core/src/test/scala/unit/kafka/coordinator/MemberMetadataTest.scala
+++ b/core/src/test/scala/unit/kafka/coordinator/MemberMetadataTest.scala
@@ -23,15 +23,18 @@ import org.junit.Test
 import org.scalatest.junit.JUnitSuite
 
 class MemberMetadataTest extends JUnitSuite {
+  val groupId = "groupId"
+  val clientId = "clientId"
+  val clientHost = "clientHost"
+  val memberId = "memberId"
+  val sessionTimeoutMs = 10000
+
 
   @Test
   def testMatchesSupportedProtocols {
-    val groupId = "groupId"
-    val memberId = "memberId"
-    val sessionTimeoutMs = 10000
     val protocols = List(("range", Array.empty[Byte]))
 
-    val member = new MemberMetadata(memberId, groupId, sessionTimeoutMs, protocols)
+    val member = new MemberMetadata(memberId, groupId, clientId, clientHost, sessionTimeoutMs,
protocols)
     assertTrue(member.matches(protocols))
     assertFalse(member.matches(List(("range", Array[Byte](0)))))
     assertFalse(member.matches(List(("roundrobin", Array.empty[Byte]))))
@@ -40,48 +43,36 @@ class MemberMetadataTest extends JUnitSuite {
 
   @Test
   def testVoteForPreferredProtocol {
-    val groupId = "groupId"
-    val memberId = "memberId"
-    val sessionTimeoutMs = 10000
     val protocols = List(("range", Array.empty[Byte]), ("roundrobin", Array.empty[Byte]))
 
-    val member = new MemberMetadata(memberId, groupId, sessionTimeoutMs, protocols)
+    val member = new MemberMetadata(memberId, groupId, clientId, clientHost, sessionTimeoutMs,
protocols)
     assertEquals("range", member.vote(Set("range", "roundrobin")))
     assertEquals("roundrobin", member.vote(Set("blah", "roundrobin")))
   }
 
   @Test
   def testMetadata {
-    val groupId = "groupId"
-    val memberId = "memberId"
-    val sessionTimeoutMs = 10000
     val protocols = List(("range", Array[Byte](0)), ("roundrobin", Array[Byte](1)))
 
-    val member = new MemberMetadata(memberId, groupId, sessionTimeoutMs, protocols)
+    val member = new MemberMetadata(memberId, groupId, clientId, clientHost, sessionTimeoutMs,
protocols)
     assertTrue(util.Arrays.equals(Array[Byte](0), member.metadata("range")))
     assertTrue(util.Arrays.equals(Array[Byte](1), member.metadata("roundrobin")))
   }
 
   @Test(expected = classOf[IllegalArgumentException])
   def testMetadataRaisesOnUnsupportedProtocol {
-    val groupId = "groupId"
-    val memberId = "memberId"
-    val sessionTimeoutMs = 10000
     val protocols = List(("range", Array.empty[Byte]), ("roundrobin", Array.empty[Byte]))
 
-    val member = new MemberMetadata(memberId, groupId, sessionTimeoutMs, protocols)
+    val member = new MemberMetadata(memberId, groupId, clientId, clientHost, sessionTimeoutMs,
protocols)
     member.metadata("blah")
     fail()
   }
 
   @Test(expected = classOf[IllegalArgumentException])
   def testVoteRaisesOnNoSupportedProtocols {
-    val groupId = "groupId"
-    val memberId = "memberId"
-    val sessionTimeoutMs = 10000
     val protocols = List(("range", Array.empty[Byte]), ("roundrobin", Array.empty[Byte]))
 
-    val member = new MemberMetadata(memberId, groupId, sessionTimeoutMs, protocols)
+    val member = new MemberMetadata(memberId, groupId, clientId, clientHost, sessionTimeoutMs,
protocols)
     member.vote(Set("blah"))
     fail()
   }

http://git-wip-us.apache.org/repos/asf/kafka/blob/596c203a/core/src/test/scala/unit/kafka/server/OffsetCommitTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/server/OffsetCommitTest.scala b/core/src/test/scala/unit/kafka/server/OffsetCommitTest.scala
index 4e5e776..31f743b 100755
--- a/core/src/test/scala/unit/kafka/server/OffsetCommitTest.scala
+++ b/core/src/test/scala/unit/kafka/server/OffsetCommitTest.scala
@@ -17,7 +17,7 @@
 
 package kafka.server
 
-import kafka.api.{GroupMetadataRequest, OffsetCommitRequest, OffsetFetchRequest}
+import kafka.api.{GroupCoordinatorRequest, OffsetCommitRequest, OffsetFetchRequest}
 import kafka.consumer.SimpleConsumer
 import kafka.common.{OffsetMetadata, OffsetMetadataAndError, OffsetAndMetadata, ErrorMapping,
TopicAndPartition}
 import kafka.utils._
@@ -56,7 +56,7 @@ class OffsetCommitTest extends ZooKeeperTestHarness {
     time = new MockTime()
     server = TestUtils.createServer(KafkaConfig.fromProps(config), time)
     simpleConsumer = new SimpleConsumer("localhost", server.boundPort(), 1000000, 64*1024,
"test-client")
-    val consumerMetadataRequest = GroupMetadataRequest(group)
+    val consumerMetadataRequest = GroupCoordinatorRequest(group)
     Stream.continually {
       val consumerMetadataResponse = simpleConsumer.send(consumerMetadataRequest)
       consumerMetadataResponse.coordinatorOpt.isDefined


Mime
View raw message