You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kg...@apache.org on 2018/07/12 07:09:04 UTC

[3/3] hive git commit: HIVE-20088: Beeline config location path is assembled incorrectly (Denes Bodo via Zoltan Haindrich)

HIVE-20088: Beeline config location path is assembled incorrectly (Denes Bodo via Zoltan Haindrich)

Signed-off-by: Zoltan Haindrich <ki...@rxd.hu>


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

Branch: refs/heads/master
Commit: 5ade74060c9615a658d66fb0dac397671d2368ba
Parents: d118506
Author: Denes Bodo <bo...@gmail.com>
Authored: Thu Jul 12 09:01:17 2018 +0200
Committer: Zoltan Haindrich <ki...@rxd.hu>
Committed: Thu Jul 12 09:01:17 2018 +0200

----------------------------------------------------------------------
 .../hs2connection/BeelineSiteParser.java        |  2 +-
 .../UserHS2ConnectionFileParser.java            |  2 +-
 .../hs2connection/TestBeelineSiteParser.java    | 41 ++++++++++++++++++++
 .../TestUserHS2ConnectionFileParser.java        | 16 ++++++++
 4 files changed, 59 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/5ade7406/beeline/src/java/org/apache/hive/beeline/hs2connection/BeelineSiteParser.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/hs2connection/BeelineSiteParser.java b/beeline/src/java/org/apache/hive/beeline/hs2connection/BeelineSiteParser.java
index 600d84e..4c55104 100644
--- a/beeline/src/java/org/apache/hive/beeline/hs2connection/BeelineSiteParser.java
+++ b/beeline/src/java/org/apache/hive/beeline/hs2connection/BeelineSiteParser.java
@@ -63,7 +63,7 @@ public class BeelineSiteParser implements HS2ConnectionFileParser {
       locations
           .add(System.getenv("HIVE_CONF_DIR") + File.separator + DEFAULT_BEELINE_SITE_FILE_NAME);
     }
-    locations.add(ETC_HIVE_CONF_LOCATION + DEFAULT_BEELINE_SITE_FILE_NAME);
+    locations.add(ETC_HIVE_CONF_LOCATION + File.separator + DEFAULT_BEELINE_SITE_FILE_NAME);
   }
 
   @VisibleForTesting

http://git-wip-us.apache.org/repos/asf/hive/blob/5ade7406/beeline/src/java/org/apache/hive/beeline/hs2connection/UserHS2ConnectionFileParser.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/hs2connection/UserHS2ConnectionFileParser.java b/beeline/src/java/org/apache/hive/beeline/hs2connection/UserHS2ConnectionFileParser.java
index 9d45daf..47dee4c 100644
--- a/beeline/src/java/org/apache/hive/beeline/hs2connection/UserHS2ConnectionFileParser.java
+++ b/beeline/src/java/org/apache/hive/beeline/hs2connection/UserHS2ConnectionFileParser.java
@@ -56,7 +56,7 @@ public class UserHS2ConnectionFileParser implements HS2ConnectionFileParser {
       locations.add(
           System.getenv("HIVE_CONF_DIR") + File.separator + DEFAULT_CONNECTION_CONFIG_FILE_NAME);
     }
-    locations.add(ETC_HIVE_CONF_LOCATION + DEFAULT_CONNECTION_CONFIG_FILE_NAME);
+    locations.add(ETC_HIVE_CONF_LOCATION + File.separator + DEFAULT_CONNECTION_CONFIG_FILE_NAME);
   }
 
   @VisibleForTesting

http://git-wip-us.apache.org/repos/asf/hive/blob/5ade7406/beeline/src/test/org/apache/hive/beeline/hs2connection/TestBeelineSiteParser.java
----------------------------------------------------------------------
diff --git a/beeline/src/test/org/apache/hive/beeline/hs2connection/TestBeelineSiteParser.java b/beeline/src/test/org/apache/hive/beeline/hs2connection/TestBeelineSiteParser.java
new file mode 100644
index 0000000..fc2b44d
--- /dev/null
+++ b/beeline/src/test/org/apache/hive/beeline/hs2connection/TestBeelineSiteParser.java
@@ -0,0 +1,41 @@
+/*
+ * 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.hive.beeline.hs2connection;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.util.Collection;
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestBeelineSiteParser {
+    @Test
+    public void testConfigLocationPathInEtc() throws Exception {
+        BeelineSiteParser testHS2ConfigManager =
+                new BeelineSiteParser();
+        Field locations = testHS2ConfigManager.getClass().getDeclaredField("locations");
+        locations.setAccessible(true);
+        Collection<String> locs = (List<String>)locations.get(testHS2ConfigManager);
+        Assert.assertTrue(locs.contains(
+                BeelineSiteParser.ETC_HIVE_CONF_LOCATION +
+                        File.separator +
+                        BeelineSiteParser.DEFAULT_BEELINE_SITE_FILE_NAME));
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/hive/blob/5ade7406/beeline/src/test/org/apache/hive/beeline/hs2connection/TestUserHS2ConnectionFileParser.java
----------------------------------------------------------------------
diff --git a/beeline/src/test/org/apache/hive/beeline/hs2connection/TestUserHS2ConnectionFileParser.java b/beeline/src/test/org/apache/hive/beeline/hs2connection/TestUserHS2ConnectionFileParser.java
index f5923d1..78c3a77 100644
--- a/beeline/src/test/org/apache/hive/beeline/hs2connection/TestUserHS2ConnectionFileParser.java
+++ b/beeline/src/test/org/apache/hive/beeline/hs2connection/TestUserHS2ConnectionFileParser.java
@@ -18,7 +18,9 @@
 package org.apache.hive.beeline.hs2connection;
 
 import java.io.File;
+import java.lang.reflect.Field;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import org.apache.hive.beeline.hs2connection.BeelineHS2ConnectionFileParseException;
@@ -171,6 +173,20 @@ public class TestUserHS2ConnectionFileParser {
         LOCATION_2.equals(testHS2ConfigManager.getFileLocation()));
   }
 
+  @Test
+  public void testConfigLocationPathInEtc() throws Exception {
+    UserHS2ConnectionFileParser testHS2ConfigManager =
+            new UserHS2ConnectionFileParser();
+    Field locations = testHS2ConfigManager.getClass().getDeclaredField("locations");
+    locations.setAccessible(true);
+    Collection<String> locs = (List<String>)locations.get(testHS2ConfigManager);
+    Assert.assertTrue(locs.contains(
+            UserHS2ConnectionFileParser.ETC_HIVE_CONF_LOCATION +
+            File.separator +
+            UserHS2ConnectionFileParser.DEFAULT_CONNECTION_CONFIG_FILE_NAME));
+
+  }
+
   private String getParsedUrlFromConfigFile(String filename)
       throws BeelineHS2ConnectionFileParseException {
     String path = HiveTestUtils.getFileFromClasspath(filename);