This is an automated email from the ASF dual-hosted git repository.

jgus pushed a commit to branch 2.2
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.2 by this push:
     new 76cac52  KAFKA-7884; Docs for message.format.version should display 
valid values (#6209)
76cac52 is described below

commit 76cac5299d01e8155157e6c2024c62cf1977570f
Author: Lee Dongjin <dong...@apache.org>
AuthorDate: Sat Feb 16 09:50:01 2019 +0900

    KAFKA-7884; Docs for message.format.version should display valid values 
(#6209)
    
    The config docs for message.format.version and log.message.format.version 
show invalid (corrupt?) "valid values". The problem is 
that`ApiVersionValidator#toString` is missing. In contrast, all other 
Validators like `ThrottledReplicaListValidator` or `Range`, have its own 
`toString` method. This patch solves this problem by adding 
`ApiVersionValidator#toString`. It also provides a unit test for it.
    
    Reviewers: Jason Gustafson <ja...@confluent.io>
---
 core/src/main/scala/kafka/api/ApiVersion.scala          | 2 ++
 core/src/test/scala/unit/kafka/api/ApiVersionTest.scala | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/core/src/main/scala/kafka/api/ApiVersion.scala 
b/core/src/main/scala/kafka/api/ApiVersion.scala
index a68bcf0..8f78a96 100644
--- a/core/src/main/scala/kafka/api/ApiVersion.scala
+++ b/core/src/main/scala/kafka/api/ApiVersion.scala
@@ -307,4 +307,6 @@ object ApiVersionValidator extends Validator {
       case e: IllegalArgumentException => throw new ConfigException(name, 
value.toString, e.getMessage)
     }
   }
+
+  override def toString: String = "[" + 
ApiVersion.allVersions.map(_.version).distinct.mkString(", ") + "]"
 }
diff --git a/core/src/test/scala/unit/kafka/api/ApiVersionTest.scala 
b/core/src/test/scala/unit/kafka/api/ApiVersionTest.scala
index f3e4294..571a077 100644
--- a/core/src/test/scala/unit/kafka/api/ApiVersionTest.scala
+++ b/core/src/test/scala/unit/kafka/api/ApiVersionTest.scala
@@ -119,4 +119,11 @@ class ApiVersionTest {
     assertEquals("0.11.0", KAFKA_0_11_0_IV0.shortVersion)
   }
 
+  @Test
+  def testApiVersionValidator(): Unit = {
+    val str = ApiVersionValidator.toString
+    val apiVersions = str.slice(1, str.length).split(",")
+    assertEquals(ApiVersion.allVersions.size, apiVersions.length)
+  }
+
 }

Reply via email to