Repository: sqoop Updated Branches: refs/heads/trunk 35556651e -> c814e5834
SQOOP-3375: HiveMiniCluster does not restore hive-site.xml location (Szabolcs Vasas via Boglarka Egyed) Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/c814e583 Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/c814e583 Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/c814e583 Branch: refs/heads/trunk Commit: c814e58348308b05b215db427412cd6c0b21333e Parents: 3555665 Author: Boglarka Egyed <[email protected]> Authored: Mon Sep 3 11:52:44 2018 +0200 Committer: Boglarka Egyed <[email protected]> Committed: Mon Sep 3 11:52:44 2018 +0200 ---------------------------------------------------------------------- .../org/apache/sqoop/hive/minicluster/HiveMiniCluster.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/c814e583/src/test/org/apache/sqoop/hive/minicluster/HiveMiniCluster.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/sqoop/hive/minicluster/HiveMiniCluster.java b/src/test/org/apache/sqoop/hive/minicluster/HiveMiniCluster.java index 19bb760..9dd5448 100644 --- a/src/test/org/apache/sqoop/hive/minicluster/HiveMiniCluster.java +++ b/src/test/org/apache/sqoop/hive/minicluster/HiveMiniCluster.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.io.OutputStream; import java.net.InetAddress; import java.net.Socket; +import java.net.URL; import java.security.PrivilegedAction; import java.util.Map; import java.util.concurrent.TimeoutException; @@ -56,6 +57,8 @@ public class HiveMiniCluster { private HiveConf config; + private URL originalHiveSiteLocation; + public HiveMiniCluster(AuthenticationConfiguration authenticationConfiguration) { this(DEFAULT_HOST, DEFAULT_PORT, authenticationConfiguration); } @@ -102,6 +105,7 @@ public class HiveMiniCluster { config.writeXml(out); } + originalHiveSiteLocation = HiveConf.getHiveSiteLocation(); HiveConf.setHiveSiteLocation(hiveSiteXmlFile.toURI().toURL()); } @@ -118,7 +122,7 @@ public class HiveMiniCluster { public void stop() { hiveServer2.stop(); - HiveConf.setHiveSiteLocation(null); + HiveConf.setHiveSiteLocation(originalHiveSiteLocation); try { FileUtils.deleteDirectory(new File(tempFolderPath)); } catch (IOException e) {
