use of org.apache.hive.jdbc.miniHS2.MiniHS2.MiniClusterType in project hive by apache.
the class StartMiniHS2Cluster method testRunCluster.
/**
* Not a unit test - this simply runs a MiniHS2 cluster, which can be used for manual testing.
*/
@Test
public void testRunCluster() throws Exception {
if (!Boolean.parseBoolean(System.getProperty("miniHS2.run", "false"))) {
return;
}
MiniClusterType clusterType = MiniClusterType.valueOf(System.getProperty("miniHS2.clusterType", "MR").toUpperCase());
String confFilesProperty = System.getProperty("miniHS2.conf", "../../data/conf/hive-site.xml");
boolean usePortsFromConf = Boolean.parseBoolean(System.getProperty("miniHS2.usePortsFromConf", "false"));
// Load conf files
String[] confFiles = confFilesProperty.split(",");
int idx;
for (idx = 0; idx < confFiles.length; ++idx) {
String confFile = confFiles[idx];
if (confFile.isEmpty()) {
continue;
}
HiveConf.setHiveSiteLocation(new URL("file://" + new File(confFile).toURI().getPath()));
break;
}
HiveConf conf = new HiveConf();
conf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
conf.setBoolVar(HiveConf.ConfVars.HIVE_RPC_QUERY_PLAN, true);
for (; idx < confFiles.length; ++idx) {
String confFile = confFiles[idx];
if (confFile.isEmpty()) {
continue;
}
conf.addResource(new URL("file://" + new File(confFile).toURI().getPath()));
}
miniHS2 = new MiniHS2(conf, clusterType, usePortsFromConf);
Map<String, String> confOverlay = new HashMap<String, String>();
miniHS2.start(confOverlay);
miniHS2.getDFS().getFileSystem().mkdirs(new Path("/apps_staging_dir/anonymous"));
System.out.println("JDBC URL avaailable at " + miniHS2.getJdbcURL());
// MiniHS2 cluster is up .. let it run until someone kills the test
while (true) {
Thread.sleep(1000);
}
}