Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in 1.0.0 and 0.11.0.2 as valid versions #454

Merged
merged 4 commits into from
Mar 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/controllers/Logkafka.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ class Logkafka (val messagesApi: MessagesApi, val kafkaManagerContext: KafkaMana
LogkafkaNewConfigs.configMaps(Kafka_0_10_2_1).map{case(k,v) => LKConfig(k,Some(v))}.toList)
val kafka_0_11_0_0_Default = CreateLogkafka("","",
LogkafkaNewConfigs.configMaps(Kafka_0_11_0_0).map{case(k,v) => LKConfig(k,Some(v))}.toList)
val kafka_0_11_0_2_Default = CreateLogkafka("","",
LogkafkaNewConfigs.configMaps(Kafka_0_11_0_2).map{case(k,v) => LKConfig(k,Some(v))}.toList)
val kafka_1_0_0_Default = CreateLogkafka("","",
LogkafkaNewConfigs.configMaps(Kafka_1_0_0).map{case(k,v) => LKConfig(k,Some(v))}.toList)

val defaultCreateForm = Form(
mapping(
Expand Down Expand Up @@ -131,6 +135,8 @@ class Logkafka (val messagesApi: MessagesApi, val kafkaManagerContext: KafkaMana
case Kafka_0_10_2_0 => (defaultCreateForm.fill(kafka_0_10_2_0_Default), clusterContext)
case Kafka_0_10_2_1 => (defaultCreateForm.fill(kafka_0_10_2_1_Default), clusterContext)
case Kafka_0_11_0_0 => (defaultCreateForm.fill(kafka_0_11_0_0_Default), clusterContext)
case Kafka_0_11_0_2 => (defaultCreateForm.fill(kafka_0_11_0_2_Default), clusterContext)
case Kafka_1_0_0 => (defaultCreateForm.fill(kafka_1_0_0_Default), clusterContext)
}
}
}
Expand Down Expand Up @@ -226,6 +232,8 @@ class Logkafka (val messagesApi: MessagesApi, val kafkaManagerContext: KafkaMana
case Kafka_0_10_2_0 => LogkafkaNewConfigs.configNames(Kafka_0_10_2_0).map(n => (n,LKConfig(n,None))).toMap
case Kafka_0_10_2_1 => LogkafkaNewConfigs.configNames(Kafka_0_10_2_1).map(n => (n,LKConfig(n,None))).toMap
case Kafka_0_11_0_0 => LogkafkaNewConfigs.configNames(Kafka_0_11_0_0).map(n => (n,LKConfig(n,None))).toMap
case Kafka_0_11_0_2 => LogkafkaNewConfigs.configNames(Kafka_0_11_0_2).map(n => (n,LKConfig(n,None))).toMap
case Kafka_1_0_0 => LogkafkaNewConfigs.configNames(Kafka_1_0_0).map(n => (n,LKConfig(n,None))).toMap
}
val identityOption = li.identityMap.get(log_path)
if (identityOption.isDefined) {
Expand Down
7 changes: 6 additions & 1 deletion app/controllers/Topic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class Topic (val messagesApi: MessagesApi, val kafkaManagerContext: KafkaManager
val kafka_0_10_2_0_Default = CreateTopic("",1,1,TopicConfigs.configNames(Kafka_0_10_2_0).map(n => TConfig(n,None)).toList)
val kafka_0_10_2_1_Default = CreateTopic("",1,1,TopicConfigs.configNames(Kafka_0_10_2_1).map(n => TConfig(n,None)).toList)
val kafka_0_11_0_0_Default = CreateTopic("",1,1,TopicConfigs.configNames(Kafka_0_11_0_0).map(n => TConfig(n,None)).toList)
val kafka_0_11_0_2_Default = CreateTopic("",1,1,TopicConfigs.configNames(Kafka_0_11_0_2).map(n => TConfig(n,None)).toList)
val kafka_1_0_0_Default = CreateTopic("",1,1,TopicConfigs.configNames(Kafka_1_0_0).map(n => TConfig(n,None)).toList)

val defaultCreateForm = Form(
mapping(
Expand Down Expand Up @@ -150,7 +152,8 @@ class Topic (val messagesApi: MessagesApi, val kafkaManagerContext: KafkaManager
case Kafka_0_10_2_0 => (defaultCreateForm.fill(kafka_0_10_2_0_Default), clusterContext)
case Kafka_0_10_2_1 => (defaultCreateForm.fill(kafka_0_10_2_1_Default), clusterContext)
case Kafka_0_11_0_0 => (defaultCreateForm.fill(kafka_0_11_0_0_Default), clusterContext)

case Kafka_0_11_0_2 => (defaultCreateForm.fill(kafka_0_11_0_2_Default), clusterContext)
case Kafka_1_0_0 => (defaultCreateForm.fill(kafka_1_0_0_Default), clusterContext)
}
}
}
Expand Down Expand Up @@ -392,6 +395,8 @@ class Topic (val messagesApi: MessagesApi, val kafkaManagerContext: KafkaManager
case Kafka_0_10_2_0 => TopicConfigs.configNames(Kafka_0_10_2_0).map(n => (n,TConfig(n,None))).toMap
case Kafka_0_10_2_1 => TopicConfigs.configNames(Kafka_0_10_2_1).map(n => (n,TConfig(n,None))).toMap
case Kafka_0_11_0_0 => TopicConfigs.configNames(Kafka_0_11_0_0).map(n => (n,TConfig(n,None))).toMap
case Kafka_0_11_0_2 => TopicConfigs.configNames(Kafka_0_11_0_2).map(n => (n,TConfig(n,None))).toMap
case Kafka_1_0_0 => TopicConfigs.configNames(Kafka_1_0_0).map(n => (n,TConfig(n,None))).toMap
}
val combinedMap = defaultConfigMap ++ ti.config.toMap.map(tpl => tpl._1 -> TConfig(tpl._1,Option(tpl._2)))
(defaultUpdateConfigForm.fill(UpdateTopicConfig(ti.topic,combinedMap.toList.map(_._2),ti.configReadVersion)),
Expand Down
2 changes: 1 addition & 1 deletion app/kafka/manager/actor/cluster/KafkaStateActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class KafkaAdminClient(context: => ActorContext, adminClientActorPath: ActorPath


object KafkaManagedOffsetCache {
val supportedVersions: Set[KafkaVersion] = Set(Kafka_0_8_2_0, Kafka_0_8_2_1, Kafka_0_8_2_2, Kafka_0_9_0_0, Kafka_0_9_0_1, Kafka_0_10_0_0, Kafka_0_10_0_1, Kafka_0_10_1_0, Kafka_0_10_1_1, Kafka_0_10_2_0, Kafka_0_10_2_1, Kafka_0_11_0_0)
val supportedVersions: Set[KafkaVersion] = Set(Kafka_0_8_2_0, Kafka_0_8_2_1, Kafka_0_8_2_2, Kafka_0_9_0_0, Kafka_0_9_0_1, Kafka_0_10_0_0, Kafka_0_10_0_1, Kafka_0_10_1_0, Kafka_0_10_1_1, Kafka_0_10_2_0, Kafka_0_10_2_1, Kafka_0_11_0_0, Kafka_0_11_0_2, Kafka_1_0_0)
val ConsumerOffsetTopic = "__consumer_offsets"

def isSupported(version: KafkaVersion) : Boolean = {
Expand Down
12 changes: 11 additions & 1 deletion app/kafka/manager/model/model.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ case object Kafka_0_11_0_0 extends KafkaVersion {
override def toString = "0.11.0.0"
}

case object Kafka_0_11_0_2 extends KafkaVersion {
override def toString = "0.11.0.2"
}

case object Kafka_1_0_0 extends KafkaVersion {
override def toString = "1.0.0"
}

object KafkaVersion {
val supportedVersions: Map[String,KafkaVersion] = Map(
"0.8.1.1" -> Kafka_0_8_1_1,
Expand All @@ -79,7 +87,9 @@ object KafkaVersion {
"0.10.1.1" -> Kafka_0_10_1_1,
"0.10.2.0" -> Kafka_0_10_2_0,
"0.10.2.1" -> Kafka_0_10_2_1,
"0.11.0.0" -> Kafka_0_11_0_0
"0.11.0.0" -> Kafka_0_11_0_0,
"0.11.0.2" -> Kafka_0_11_0_2,
"1.0.0" -> Kafka_1_0_0
)

val formSelectList : IndexedSeq[(String,String)] = supportedVersions.toIndexedSeq.filterNot(_._1.contains("beta")).map(t => (t._1,t._2.toString)).sortWith((a, b) => sortVersion(a._1, b._1))
Expand Down
4 changes: 3 additions & 1 deletion app/kafka/manager/utils/LogkafkaNewConfigs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ object LogkafkaNewConfigs {
Kafka_0_10_1_1 -> logkafka82.LogConfig,
Kafka_0_10_2_0 -> logkafka82.LogConfig,
Kafka_0_10_2_1 -> logkafka82.LogConfig,
Kafka_0_11_0_0 -> logkafka82.LogConfig
Kafka_0_11_0_0 -> logkafka82.LogConfig,
Kafka_0_11_0_2 -> logkafka82.LogConfig,
Kafka_1_0_0 -> logkafka82.LogConfig
)

def configNames(version: KafkaVersion) : Set[String] = {
Expand Down
4 changes: 3 additions & 1 deletion app/kafka/manager/utils/TopicConfigs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ object TopicConfigs {
Kafka_0_10_1_1 -> zero90.LogConfig,
Kafka_0_10_2_0 -> zero90.LogConfig,
Kafka_0_10_2_1 -> zero90.LogConfig,
Kafka_0_11_0_0 -> zero90.LogConfig
Kafka_0_11_0_0 -> zero90.LogConfig,
Kafka_0_11_0_2 -> zero90.LogConfig,
Kafka_1_0_0 -> zero90.LogConfig
)

def configNames(version: KafkaVersion) : Set[String] = {
Expand Down
8 changes: 6 additions & 2 deletions test/kafka/manager/model/KafkaVersionTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class KafkaVersionTest extends FunSuite {
"0.10.1.1" -> Kafka_0_10_1_1,
"0.10.2.0" -> Kafka_0_10_2_0,
"0.10.2.1" -> Kafka_0_10_2_1,
"0.11.0.0" -> Kafka_0_11_0_0
"0.11.0.0" -> Kafka_0_11_0_0,
"0.11.0.2" -> Kafka_0_11_0_2,
"1.0.0" -> Kafka_1_0_0
)

test("apply method: supported version.") {
Expand Down Expand Up @@ -57,7 +59,9 @@ class KafkaVersionTest extends FunSuite {
("0.10.1.1","0.10.1.1"),
("0.10.2.0","0.10.2.0"),
("0.10.2.1","0.10.2.1"),
("0.11.0.0","0.11.0.0")
("0.11.0.0","0.11.0.0"),
("0.11.0.2","0.11.0.2"),
("1.0.0","1.0.0")
)
assertResult(expected)(KafkaVersion.formSelectList)
}
Expand Down
16 changes: 16 additions & 0 deletions test/kafka/manager/utils/TestClusterConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,20 @@ class TestClusterConfig extends FunSuite with Matchers {
assert(deserialize.isSuccess === true)
assert(cc == deserialize.get)
}

test("serialize and deserialize 0.11.0.2") {
val cc = ClusterConfig("qa", "0.11.0.2", "localhost:2181", jmxEnabled = false, pollConsumers = true, filterConsumers = true, activeOffsetCacheEnabled = true, jmxUser = None, jmxPass = None, jmxSsl = false, tuning = None, securityProtocol = "PLAINTEXT")
val serialize: String = ClusterConfig.serialize(cc)
val deserialize = ClusterConfig.deserialize(serialize)
assert(deserialize.isSuccess === true)
assert(cc == deserialize.get)
}

test("serialize and deserialize 1.0.0") {
val cc = ClusterConfig("qa", "1.0.0", "localhost:2181", jmxEnabled = false, pollConsumers = true, filterConsumers = true, activeOffsetCacheEnabled = true, jmxUser = None, jmxPass = None, jmxSsl = false, tuning = None, securityProtocol = "PLAINTEXT")
val serialize: String = ClusterConfig.serialize(cc)
val deserialize = ClusterConfig.deserialize(serialize)
assert(deserialize.isSuccess === true)
assert(cc == deserialize.get)
}
}