kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject kafka git commit: KAFKA-2586; Enable SSL for inter-broker communication when SSL is enabled in tests
Date Mon, 28 Sep 2015 14:48:02 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk c20e3bf8d -> f540f4a91


KAFKA-2586; Enable SSL for inter-broker communication when SSL is enabled in tests

Author: Ismael Juma <ismael@juma.me.uk>

Reviewers: Jun Rao <junrao@gmail.com>

Closes #252 from ijuma/kafka-2586-enable-inter-broker-ssl-in-tests


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

Branch: refs/heads/trunk
Commit: f540f4a9193fd8437708f3bfe7856bc41d35d727
Parents: c20e3bf
Author: Ismael Juma <ismael@juma.me.uk>
Authored: Mon Sep 28 07:47:56 2015 -0700
Committer: Jun Rao <junrao@gmail.com>
Committed: Mon Sep 28 07:47:56 2015 -0700

----------------------------------------------------------------------
 .../test/scala/unit/kafka/utils/TestUtils.scala  | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/f540f4a9/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 7f482fb..2343ea1 100755
--- a/core/src/test/scala/unit/kafka/utils/TestUtils.scala
+++ b/core/src/test/scala/unit/kafka/utils/TestUtils.scala
@@ -910,19 +910,22 @@ object TestUtils extends Logging {
   }
 
   def addSSLConfigs(mode: SSLFactory.Mode, clientCert: Boolean, trustStoreFile: Option[File],
 certAlias: String): Properties = {
-    var sslConfigs: java.util.Map[String, Object] = new java.util.HashMap[String, Object]()
     if (!trustStoreFile.isDefined) {
       throw new Exception("enableSSL set to true but no trustStoreFile provided")
     }
-    if (mode == SSLFactory.Mode.SERVER)
-      sslConfigs = TestSSLUtils.createSSLConfig(true, true, mode, trustStoreFile.get, certAlias)
-    else
-      sslConfigs = TestSSLUtils.createSSLConfig(clientCert, false, mode, trustStoreFile.get,
certAlias)
+
+    val sslConfigs = {
+      if (mode == SSLFactory.Mode.SERVER) {
+        val sslConfigs = TestSSLUtils.createSSLConfig(true, true, mode, trustStoreFile.get,
certAlias)
+        sslConfigs.put(KafkaConfig.InterBrokerSecurityProtocolProp, SecurityProtocol.SSL.name)
+        sslConfigs
+      }
+      else
+        TestSSLUtils.createSSLConfig(clientCert, false, mode, trustStoreFile.get, certAlias)
+    }
 
     val sslProps = new Properties()
-    sslConfigs.foreach(kv =>
-      sslProps.put(kv._1, kv._2)
-    )
+    sslConfigs.foreach { case (k, v) => sslProps.put(k, v) }
     sslProps
   }
 


Mime
View raw message