You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by sm...@apache.org on 2022/09/26 06:58:26 UTC

[knox] branch master updated: KNOX-2807 - Hive's SSL_ENABLED flag is processed on the service level with the correct service configuration name in CM (#636)

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

smolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 7496c39dc KNOX-2807 - Hive's SSL_ENABLED flag is processed on the service level with the correct service configuration name in CM (#636)
7496c39dc is described below

commit 7496c39dc72d7eba4643d7167eab1aafafc9685d
Author: Sandor Molnar <sm...@apache.org>
AuthorDate: Mon Sep 26 08:58:21 2022 +0200

    KNOX-2807 - Hive's SSL_ENABLED flag is processed on the service level with the correct service configuration name in CM (#636)
---
 .../discovery/cm/model/hive/HiveServiceModelGenerator.java        | 4 ++--
 .../discovery/cm/ClouderaManagerServiceDiscoveryTest.java         | 4 ++--
 .../cm/model/hive/HiveOnTezServiceModelGeneratorTest.java         | 8 ++++----
 .../discovery/cm/model/hive/HiveServiceModelGeneratorTest.java    | 8 ++++----
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveServiceModelGenerator.java b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveServiceModelGenerator.java
index 39bec7fe5..cd0e6b0ca 100644
--- a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveServiceModelGenerator.java
+++ b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveServiceModelGenerator.java
@@ -37,7 +37,7 @@ public class HiveServiceModelGenerator extends AbstractServiceModelGenerator {
   static final String TRANSPORT_MODE_ALL  = "all";
 
   static final String SAFETY_VALVE   = "hive_hs2_config_safety_valve";
-  static final String SSL_ENABLED    = "hive.server2.use.SSL";
+  public static final String SSL_ENABLED = "hiveserver2_enable_ssl";
   static final String TRANSPORT_MODE = "hive.server2.transport.mode";
   static final String HTTP_PORT      = "hive.server2.thrift.http.port";
   static final String HTTP_PATH      = "hive.server2.thrift.http.path";
@@ -90,7 +90,7 @@ public class HiveServiceModelGenerator extends AbstractServiceModelGenerator {
 
     ServiceModel model =
         createServiceModel(String.format(Locale.getDefault(), "%s://%s:%s/%s", scheme, hostname, port, httpPath));
-    model.addRoleProperty(getRoleType(), SSL_ENABLED, Boolean.toString(sslEnabled));
+    model.addServiceProperty(SSL_ENABLED, Boolean.toString(sslEnabled));
     model.addRoleProperty(getRoleType(), SAFETY_VALVE, getRoleConfigValue(roleConfig, SAFETY_VALVE));
 
     return model;
diff --git a/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscoveryTest.java b/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscoveryTest.java
index 7eefa6349..3be2e264e 100644
--- a/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscoveryTest.java
+++ b/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscoveryTest.java
@@ -995,7 +995,7 @@ public class ClouderaManagerServiceDiscoveryTest {
     Map<String, String> roleProperties = new HashMap<>();
     roleProperties.put("hive_hs2_config_safety_valve", hs2SafetyValveValue);
 
-    final Map<String, String> serviceProperties = Collections.singletonMap("hive.server2.use.SSL", String.valueOf(enableSSL));
+    final Map<String, String> serviceProperties = Collections.singletonMap(HiveServiceModelGenerator.SSL_ENABLED, String.valueOf(enableSSL));
 
     return doTestDiscovery(hostName,
                            "HIVE-1",
@@ -1023,7 +1023,7 @@ public class ClouderaManagerServiceDiscoveryTest {
     roleProperties.put("hive_server2_transport_mode", "http");
     roleProperties.put("hive_hs2_config_safety_valve", hs2SafetyValveValue);
 
-    final Map<String, String> serviceProperties = Collections.singletonMap("hive.server2.use.SSL", String.valueOf(enableSSL));
+    final Map<String, String> serviceProperties = Collections.singletonMap(HiveServiceModelGenerator.SSL_ENABLED, String.valueOf(enableSSL));
 
     return doTestDiscovery(hostName,
                            "HIVE_ON_TEZ-1",
diff --git a/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveOnTezServiceModelGeneratorTest.java b/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveOnTezServiceModelGeneratorTest.java
index e94340dc1..46d4cfe2d 100644
--- a/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveOnTezServiceModelGeneratorTest.java
+++ b/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveOnTezServiceModelGeneratorTest.java
@@ -55,10 +55,10 @@ public class HiveOnTezServiceModelGeneratorTest extends AbstractServiceModelGene
 
   @Test
   public void testServiceModelMetadata() {
-    final Map<String, String> serviceConfig = Collections.emptyMap();
+    final Map<String, String> serviceConfig = new HashMap<>();
+    serviceConfig.put(HiveServiceModelGenerator.SSL_ENABLED, "false");
 
     final Map<String, String> roleConfig = new HashMap<>();
-    roleConfig.put(HiveOnTezServiceModelGenerator.SSL_ENABLED, "false");
     roleConfig.put(HiveOnTezServiceModelGenerator.HIVEONTEZ_TRANSPORT_MODE,
                    HiveOnTezServiceModelGenerator.TRANSPORT_MODE_HTTP);
     roleConfig.put(HiveOnTezServiceModelGenerator.HIVEONTEZ_HTTP_PORT, "12345");
@@ -69,10 +69,10 @@ public class HiveOnTezServiceModelGeneratorTest extends AbstractServiceModelGene
 
   @Test
   public void testServiceModelMetadataTransportModeAll() {
-    final Map<String, String> serviceConfig = Collections.emptyMap();
+    final Map<String, String> serviceConfig = new HashMap<>();
+    serviceConfig.put(HiveServiceModelGenerator.SSL_ENABLED, "false");
 
     final Map<String, String> roleConfig = new HashMap<>();
-    roleConfig.put(HiveOnTezServiceModelGenerator.SSL_ENABLED, "false");
     roleConfig.put(HiveOnTezServiceModelGenerator.HIVEONTEZ_TRANSPORT_MODE,
                    HiveOnTezServiceModelGenerator.TRANSPORT_MODE_ALL);
     roleConfig.put(HiveOnTezServiceModelGenerator.HIVEONTEZ_HTTP_PORT, "12345");
diff --git a/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveServiceModelGeneratorTest.java b/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveServiceModelGeneratorTest.java
index add66fad3..b979da82a 100644
--- a/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveServiceModelGeneratorTest.java
+++ b/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveServiceModelGeneratorTest.java
@@ -55,10 +55,10 @@ public class HiveServiceModelGeneratorTest extends AbstractServiceModelGenerator
 
   @Test
   public void testServiceModelMetadata() {
-    final Map<String, String> serviceConfig = Collections.emptyMap();
+    final Map<String, String> serviceConfig = new HashMap<>();
+    serviceConfig.put(HiveServiceModelGenerator.SSL_ENABLED, "false");
 
     final Map<String, String> roleConfig = new HashMap<>();
-    roleConfig.put(HiveServiceModelGenerator.SSL_ENABLED, "false");
     roleConfig.put(HiveServiceModelGenerator.SAFETY_VALVE,
                    getSafetyValveConfig(HiveServiceModelGenerator.TRANSPORT_MODE_HTTP));
 
@@ -67,10 +67,10 @@ public class HiveServiceModelGeneratorTest extends AbstractServiceModelGenerator
 
   @Test
   public void testServiceModelMetadataTransportModeAll() {
-    final Map<String, String> serviceConfig = Collections.emptyMap();
+    final Map<String, String> serviceConfig = new HashMap<>();
+    serviceConfig.put(HiveServiceModelGenerator.SSL_ENABLED, "false");
 
     final Map<String, String> roleConfig = new HashMap<>();
-    roleConfig.put(HiveServiceModelGenerator.SSL_ENABLED, "false");
     roleConfig.put(HiveServiceModelGenerator.SAFETY_VALVE,
                    getSafetyValveConfig(HiveServiceModelGenerator.TRANSPORT_MODE_ALL));