* @throws Exception
*/
@Test
public void testNewConnectionConfiguration() throws Exception {
// Start HiveServer2 with default conf
HiveServer2 hiveServer2 = new HiveServer2();
hiveServer2.init(new HiveConf());
hiveServer2.start();
Thread.sleep(3000);
// Set some conf parameters
String hiveConf = "hive.cli.print.header=true;hive.server2.async.exec.shutdown.timeout=20;" +
"hive.server2.async.exec.threads=30;hive.server2.thrift.http.max.worker.threads=15";
// Set some conf vars
String hiveVar = "stab=salesTable;icol=customerID";
String jdbcUri = "jdbc:hive2://localhost:10000/default" +
"?" + hiveConf +
"#" + hiveVar;
// Open a new connection with these conf & vars
Connection con1 = DriverManager.getConnection(jdbcUri);
// Execute "set" command and retrieve values for the conf & vars specified above
// Assert values retrieved
Statement stmt = con1.createStatement();
// Verify that the property has been properly set while creating the connection above
verifyConfProperty(stmt, "hive.cli.print.header", "true");
verifyConfProperty(stmt, "hive.server2.async.exec.shutdown.timeout", "20");
verifyConfProperty(stmt, "hive.server2.async.exec.threads", "30");
verifyConfProperty(stmt, "hive.server2.thrift.http.max.worker.threads", "15");
verifyConfProperty(stmt, "stab", "salesTable");
verifyConfProperty(stmt, "icol", "customerID");
con1.close();
if(hiveServer2 != null) {
hiveServer2.stop();
}
}