// Path: hadoop-mini-clusters-common/src/main/java/com/github/sakserv/minicluster/util/FileUtils.java
// public final class FileUtils {
// 
//     // Logger
//     private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(FileUtils.class);
// 
//     public static void deleteFolder(String directory, boolean quietly) {
//         try {
//             Path directoryPath = Paths.get(directory).toAbsolutePath();
//             if (!quietly) {
//                 LOG.info("FILEUTILS: Deleting contents of directory: {}",
//                         directoryPath.toAbsolutePath().toString());
//             }
//             Files.walkFileTree(directoryPath, new SimpleFileVisitor<Path>() {
//                 @Override
//                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
//                         throws IOException {
//                     Files.delete(file);
//                     if (!quietly) {
//                         LOG.info("Removing file: {}", file.toAbsolutePath().toString());
//                     }
//                     return FileVisitResult.CONTINUE;
//                 }
// 
//                 @Override
//                 public FileVisitResult postVisitDirectory(Path dir, IOException exc)
//                         throws IOException {
//                     Files.delete(dir);
//                     if (!quietly) {
//                         LOG.info("Removing directory: {}", dir.toAbsolutePath().toString());
//                     }
//                     return FileVisitResult.CONTINUE;
//                 }
//             });
//         } catch (IOException e) {
//             LOG.error("FILEUTILS: Unable to remove {}", directory);
//         }
//     }
// 
//     public static void deleteFolder(String directory) {
//         deleteFolder(directory, false);
//     }
// 
//     @Override
//     public String toString() {
//         return "FileUtils";
//     }
// }
// 
// Path: hadoop-mini-clusters-common/src/main/java/com/github/sakserv/minicluster/util/WindowsLibsUtils.java
// public class WindowsLibsUtils {
// 
//     // Logger
//     private static final Logger LOG = LoggerFactory.getLogger(WindowsLibsUtils.class);
// 
//     public static void setHadoopHome() {
// 
//         // Set hadoop.home.dir to point to the windows lib dir
//         if (System.getProperty("os.name").startsWith("Windows")) {
// 
//             String windowsLibDir = getHadoopHome();
// 
//             LOG.info("WINDOWS: Setting hadoop.home.dir: {}", windowsLibDir);
//             System.setProperty("hadoop.home.dir", windowsLibDir);
//             System.load(new File(windowsLibDir + Path.SEPARATOR + "lib" + Path.SEPARATOR + "hadoop.dll").getAbsolutePath());
//             System.load(new File(windowsLibDir + Path.SEPARATOR + "lib" + Path.SEPARATOR + "hdfs.dll").getAbsolutePath());
// 
//         }
//     }
// 
//     public static String getHadoopHome() {
// 
//         if(System.getProperty("HADOOP_HOME") != null) {
//             LOG.info("HADOOP_HOME: " + System.getProperty("HADOOP_HOME"));
//             return System.getProperty("HADOOP_HOME");
//         } else if (System.getenv("HADOOP_HOME") != null) { //takes the hadoop home from system environment variable
//             LOG.info("HADOOP_HOME: " + System.getenv("HADOOP_HOME"));
//             return System.getenv("HADOOP_HOME");
//         } else {
// 
//             File windowsLibDir = new File("." + Path.SEPARATOR + "windows_libs" +
//                     Path.SEPARATOR + System.getProperty("hdp.release.version"));
// 
//             if (!windowsLibDir.exists()) {
//                 windowsLibDir = new File(".." + Path.SEPARATOR + windowsLibDir);
//                 if (!windowsLibDir.exists()) {
//                     LOG.error("WINDOWS: ERROR: Could not find windows native libs");
//                 }
//             }
//             return windowsLibDir.getAbsolutePath();
//         }
// 
//     }
// 
// }


import java.io.File;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hive.service.server.HiveServer2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.sakserv.minicluster.MiniCluster;
import com.github.sakserv.minicluster.util.FileUtils;
import com.github.sakserv.minicluster.util.WindowsLibsUtils;
/*
 *  Licensed 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 com.github.sakserv.minicluster.impl;




public class HiveLocalServer2 implements MiniCluster {

    // Logger
    private static final Logger LOG = LoggerFactory.getLogger(HiveLocalServer2.class);
    
    private HiveServer2 hiveServer2;
    
    private String hiveServer2Hostname;
    private Integer hiveServer2Port;
// Path: hadoop-mini-clusters-common/src/main/java/com/github/sakserv/minicluster/util/FileUtils.java
// public final class FileUtils {
// 
//     // Logger
//     private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(FileUtils.class);
// 
//     public static void deleteFolder(String directory, boolean quietly) {
//         try {
//             Path directoryPath = Paths.get(directory).toAbsolutePath();
//             if (!quietly) {
//                 LOG.info("FILEUTILS: Deleting contents of directory: {}",
//                         directoryPath.toAbsolutePath().toString());
//             }
//             Files.walkFileTree(directoryPath, new SimpleFileVisitor<Path>() {
//                 @Override
//                 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
//                         throws IOException {
//                     Files.delete(file);
//                     if (!quietly) {
//                         LOG.info("Removing file: {}", file.toAbsolutePath().toString());
//                     }
//                     return FileVisitResult.CONTINUE;
//                 }
// 
//                 @Override
//                 public FileVisitResult postVisitDirectory(Path dir, IOException exc)
//                         throws IOException {
//                     Files.delete(dir);
//                     if (!quietly) {
//                         LOG.info("Removing directory: {}", dir.toAbsolutePath().toString());
//                     }
//                     return FileVisitResult.CONTINUE;
//                 }
//             });
//         } catch (IOException e) {
//             LOG.error("FILEUTILS: Unable to remove {}", directory);
//         }
//     }
// 
//     public static void deleteFolder(String directory) {
//         deleteFolder(directory, false);
//     }
// 
//     @Override
//     public String toString() {
//         return "FileUtils";
//     }
// }
// 
// Path: hadoop-mini-clusters-common/src/main/java/com/github/sakserv/minicluster/util/WindowsLibsUtils.java
// public class WindowsLibsUtils {
// 
//     // Logger
//     private static final Logger LOG = LoggerFactory.getLogger(WindowsLibsUtils.class);
// 
//     public static void setHadoopHome() {
// 
//         // Set hadoop.home.dir to point to the windows lib dir
//         if (System.getProperty("os.name").startsWith("Windows")) {
// 
//             String windowsLibDir = getHadoopHome();
// 
//             LOG.info("WINDOWS: Setting hadoop.home.dir: {}", windowsLibDir);
//             System.setProperty("hadoop.home.dir", windowsLibDir);
//             System.load(new File(windowsLibDir + Path.SEPARATOR + "lib" + Path.SEPARATOR + "hadoop.dll").getAbsolutePath());
//             System.load(new File(windowsLibDir + Path.SEPARATOR + "lib" + Path.SEPARATOR + "hdfs.dll").getAbsolutePath());
// 
//         }
//     }
// 
//     public static String getHadoopHome() {
// 
//         if(System.getProperty("HADOOP_HOME") != null) {
//             LOG.info("HADOOP_HOME: " + System.getProperty("HADOOP_HOME"));
//             return System.getProperty("HADOOP_HOME");
//         } else if (System.getenv("HADOOP_HOME") != null) { //takes the hadoop home from system environment variable
//             LOG.info("HADOOP_HOME: " + System.getenv("HADOOP_HOME"));
//             return System.getenv("HADOOP_HOME");
//         } else {
// 
//             File windowsLibDir = new File("." + Path.SEPARATOR + "windows_libs" +
//                     Path.SEPARATOR + System.getProperty("hdp.release.version"));
// 
//             if (!windowsLibDir.exists()) {
//                 windowsLibDir = new File(".." + Path.SEPARATOR + windowsLibDir);
//                 if (!windowsLibDir.exists()) {
//                     LOG.error("WINDOWS: ERROR: Could not find windows native libs");
//                 }
//             }
//             return windowsLibDir.getAbsolutePath();
//         }
// 
//     }
// 
// }


// Path: hadoop-mini-clusters-hiveserver2/src/main/java/com/github/sakserv/minicluster/impl/HiveLocalServer2.java
import java.io.File;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hive.service.server.HiveServer2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.sakserv.minicluster.MiniCluster;
import com.github.sakserv.minicluster.util.FileUtils;
import com.github.sakserv.minicluster.util.WindowsLibsUtils;

/*
 *  Licensed 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 com.github.sakserv.minicluster.impl;




public class HiveLocalServer2 implements MiniCluster {

    // Logger
    private static final Logger LOG = LoggerFactory.getLogger(HiveLocalServer2.class);
    
    private HiveServer2 hiveServer2;
    
    private String hiveServer2Hostname;
    private Integer hiveServer2Port;
    private String hiveMetastoreHostname;