This is an automated email from the ASF dual-hosted git repository.
pzampino 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 359f220 KNOX-1929 - CM discovery - HIVE URLs not discovered when
HIVE_ON_TEZ is deployed
359f220 is described below
commit 359f220d0ece4b79fadb53bdd378bdd5d3908224
Author: pzampino <[email protected]>
AuthorDate: Thu Jul 25 16:33:04 2019 -0400
KNOX-1929 - CM discovery - HIVE URLs not discovered when HIVE_ON_TEZ is
deployed
---
.../model/hive/HiveOnTezServiceModelGenerator.java | 28 +++++++++++++
...way.topology.discovery.cm.ServiceModelGenerator | 1 +
.../cm/ClouderaManagerServiceDiscoveryTest.java | 48 ++++++++++++++++++++++
3 files changed, 77 insertions(+)
diff --git
a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveOnTezServiceModelGenerator.java
b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveOnTezServiceModelGenerator.java
new file mode 100644
index 0000000..15b4f8e
--- /dev/null
+++
b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/hive/HiveOnTezServiceModelGenerator.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+package org.apache.knox.gateway.topology.discovery.cm.model.hive;
+
+public class HiveOnTezServiceModelGenerator extends HiveServiceModelGenerator {
+
+ private static final String SERVICE_TYPE = "HIVE_ON_TEZ";
+
+ @Override
+ public String getServiceType() {
+ return SERVICE_TYPE;
+ }
+
+}
diff --git
a/gateway-discovery-cm/src/main/resources/META-INF/services/org.apache.knox.gateway.topology.discovery.cm.ServiceModelGenerator
b/gateway-discovery-cm/src/main/resources/META-INF/services/org.apache.knox.gateway.topology.discovery.cm.ServiceModelGenerator
index 64f56ad..4588f46 100644
---
a/gateway-discovery-cm/src/main/resources/META-INF/services/org.apache.knox.gateway.topology.discovery.cm.ServiceModelGenerator
+++
b/gateway-discovery-cm/src/main/resources/META-INF/services/org.apache.knox.gateway.topology.discovery.cm.ServiceModelGenerator
@@ -24,6 +24,7 @@
org.apache.knox.gateway.topology.discovery.cm.model.hdfs.NameNodeServiceModelGen
org.apache.knox.gateway.topology.discovery.cm.model.hdfs.HdfsUIServiceModelGenerator
org.apache.knox.gateway.topology.discovery.cm.model.hdfs.WebHdfsServiceModelGenerator
org.apache.knox.gateway.topology.discovery.cm.model.hive.HiveServiceModelGenerator
+org.apache.knox.gateway.topology.discovery.cm.model.hive.HiveOnTezServiceModelGenerator
org.apache.knox.gateway.topology.discovery.cm.model.hue.HueServiceModelGenerator
org.apache.knox.gateway.topology.discovery.cm.model.hue.HueLBServiceModelGenerator
org.apache.knox.gateway.topology.discovery.cm.model.livy.LivyServiceModelGenerator
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 fa520be..404569c 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
@@ -115,6 +115,30 @@ public class ClouderaManagerServiceDiscoveryTest {
}
@Test
+ public void testHiveOnTezDiscovery() {
+ doTestHiveOnTezServiceDiscovery(false);
+ }
+
+ @Test
+ public void testHiveOnTezDiscoverySSL() {
+ doTestHiveOnTezServiceDiscovery(true);
+ }
+
+ private void doTestHiveOnTezServiceDiscovery(final boolean enableSSL) {
+ final String hostName = "test-host-1";
+ final String thriftPort = "10001";
+ final String thriftPath = "cliService";
+ final String expectedScheme = (enableSSL ? "https" : "http");
+
+ ServiceDiscovery.Cluster cluster =
+ doTestHiveOnTezServiceDiscovery(hostName, thriftPort, thriftPath,
enableSSL);
+ List<String> hiveURLs = cluster.getServiceURLs("HIVE");
+ assertNotNull(hiveURLs);
+ assertEquals(1, hiveURLs.size());
+ assertEquals((expectedScheme + "://" + hostName + ":" +thriftPort + "/" +
thriftPath), hiveURLs.get(0));
+ }
+
+ @Test
public void testWebHDFSServiceDiscovery() {
final String hostName = "test-host-1";
final String nameService = "nameservice1";
@@ -578,6 +602,30 @@ public class ClouderaManagerServiceDiscoveryTest {
}
+ private ServiceDiscovery.Cluster doTestHiveOnTezServiceDiscovery(final
String hostName,
+ final
String thriftPort,
+ final
String thriftPath,
+ final
boolean enableSSL) {
+ final String hs2SafetyValveValue =
+
"<property><name>hive.server2.transport.mode</name><value>http</value></property>\n"
+
+ "<property><name>hive.server2.thrift.http.port</name><value>" +
thriftPort + "</value></property>\n" +
+ "<property><name>hive.server2.thrift.http.path</name><value>" +
thriftPath + "</value></property>";
+
+ // Configure the role
+ Map<String, String> roleProperties = new HashMap<>();
+ roleProperties.put("hive_hs2_config_safety_valve", hs2SafetyValveValue);
+ roleProperties.put("hive.server2.use.SSL", String.valueOf(enableSSL));
+
+ return doTestDiscovery(hostName,
+ "HIVE_ON_TEZ-1",
+ "HIVE_ON_TEZ",
+ "HIVE_ON_TEZ-1-HIVESERVER2-12345",
+ "HIVESERVER2",
+ Collections.emptyMap(),
+ roleProperties);
+ }
+
+
private ServiceDiscovery.Cluster doTestHDFSDiscovery(final String hostName,
final String
nameService,
final String nnPort,