Skip to content

Commit

Permalink
Review fixes:
Browse files Browse the repository at this point in the history
 * Added comment for getKrb5LoginModuleName.
 * Used === operator in tests instead of equals.
  • Loading branch information
gaborgsomogyi committed Oct 10, 2018
1 parent a2c4397 commit fffd139
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ private[kafka010] object KafkaSecurityHelper extends Logging {
}
}

/**
* Krb5LoginModule package vary in different JVMs.
* Please see Hadoop UserGroupInformation for further details.
*/
private def getKrb5LoginModuleName(): String = {
if (System.getProperty("java.vendor").contains("IBM")) {
"com.ibm.security.auth.module.Krb5LoginModule"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class TokenUtilSuite extends SparkFunSuite with BeforeAndAfterEach {
val adminClientProperties = TokenUtil.createAdminClientProperties(sparkConf)

assert(adminClientProperties.get(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG)
.equals(bootStrapServers))
=== bootStrapServers)
assert(adminClientProperties.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)
.equals(plainSecurityProtocol))
=== plainSecurityProtocol)
assert(!adminClientProperties.containsKey("ssl.truststore.location"))
assert(!adminClientProperties.containsKey("ssl.truststore.password"))
}
Expand All @@ -74,11 +74,11 @@ class TokenUtilSuite extends SparkFunSuite with BeforeAndAfterEach {
val adminClientProperties = TokenUtil.createAdminClientProperties(sparkConf)

assert(adminClientProperties.get(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG)
.equals(bootStrapServers))
=== bootStrapServers)
assert(adminClientProperties.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)
.equals(sslSecurityProtocol))
assert(adminClientProperties.get("ssl.truststore.location").equals(trustStoreLocation))
assert(adminClientProperties.get("ssl.truststore.password").equals(trustStorePassword))
=== sslSecurityProtocol)
assert(adminClientProperties.get("ssl.truststore.location") === trustStoreLocation)
assert(adminClientProperties.get("ssl.truststore.password") === trustStorePassword)
}

test("createAdminClientProperties without keytab should not set dynamic jaas config") {
Expand All @@ -88,9 +88,9 @@ class TokenUtilSuite extends SparkFunSuite with BeforeAndAfterEach {
val adminClientProperties = TokenUtil.createAdminClientProperties(sparkConf)

assert(adminClientProperties.get(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG)
.equals(bootStrapServers))
=== bootStrapServers)
assert(adminClientProperties.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)
.equals(sslSecurityProtocol))
=== sslSecurityProtocol)
assert(!adminClientProperties.containsKey(SaslConfigs.SASL_MECHANISM))
assert(!adminClientProperties.containsKey(SaslConfigs.SASL_JAAS_CONFIG))
}
Expand All @@ -105,9 +105,9 @@ class TokenUtilSuite extends SparkFunSuite with BeforeAndAfterEach {
val adminClientProperties = TokenUtil.createAdminClientProperties(sparkConf)

assert(adminClientProperties.get(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG)
.equals(bootStrapServers))
=== bootStrapServers)
assert(adminClientProperties.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)
.equals(sslSecurityProtocol))
=== sslSecurityProtocol)
assert(adminClientProperties.containsKey(SaslConfigs.SASL_MECHANISM))
assert(adminClientProperties.containsKey(SaslConfigs.SASL_JAAS_CONFIG))
}
Expand Down

0 comments on commit fffd139

Please sign in to comment.