HiveServer2Bootstrap implements BootstrapHadoop { @Override public ComponentMetadata getMetadata() { return new HiveServer2Metadata(); } HiveServer2Bootstrap();  HiveServer2Bootstrap(URL url); @Override ComponentMetadata getMetadata(); @Override String getProperties(); @Override void loadConfig(Map<String, String> configs); @Override Bootstrap start(); @Override Bootstrap stop(); @Override org.apache.hadoop.conf.Configuration getConfiguration();  }
@Test public void hiveServer2ShouldStart() throws InterruptedException, ClassNotFoundException, SQLException { LOGGER.info("HIVE: Loading the Hive JDBC Driver"); Class.forName("org.apache.hive.jdbc.HiveDriver"); Connection con = DriverManager.getConnection("jdbc:hive2: configuration.getString(HiveConfig.HIVE_SERVER2_HOSTNAME_KEY) + ":" + configuration.getInt(HiveConfig.HIVE_SERVER2_PORT_KEY) + "/" + configuration.getString(HiveConfig.HIVE_TEST_DATABASE_NAME_KEY), "user", "pass"); Statement stmt; try { String createDbDdl = "CREATE DATABASE IF NOT EXISTS " + configuration.getString(HiveConfig.HIVE_TEST_DATABASE_NAME_KEY); stmt = con.createStatement(); LOGGER.info("HIVE: Running Create Database Statement: {}", createDbDdl); stmt.execute(createDbDdl); } catch (Exception e) { e.printStackTrace(); } String dropDdl = "DROP TABLE " + configuration.getString(HiveConfig.HIVE_TEST_DATABASE_NAME_KEY) + "." + configuration.getString(HiveConfig.HIVE_TEST_TABLE_NAME_KEY); stmt = con.createStatement(); LOGGER.info("HIVE: Running Drop Table Statement: {}", dropDdl); stmt.execute(dropDdl); String createDdl = "CREATE TABLE IF NOT EXISTS " + configuration.getString(HiveConfig.HIVE_TEST_DATABASE_NAME_KEY) + "." + configuration.getString(HiveConfig.HIVE_TEST_TABLE_NAME_KEY) + " (id INT, msg STRING) " + "PARTITIONED BY (dt STRING) " + "CLUSTERED BY (id) INTO 16 BUCKETS " + "STORED AS ORC tblproperties(\"orc.compress\"=\"NONE\")"; stmt = con.createStatement(); LOGGER.info("HIVE: Running Create Table Statement: {}", createDdl); stmt.execute(createDdl); LOGGER.info("HIVE: Validating Table was Created: "); ResultSet resultSet = stmt.executeQuery("DESCRIBE FORMATTED " + configuration.getString(HiveConfig.HIVE_TEST_TABLE_NAME_KEY)); int count = 0; while (resultSet.next()) { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) { System.out.print(resultSet.getString(i)); } System.out.println(); count++; } assertEquals(33, count); dropDdl = "DROP TABLE " + configuration.getString(HiveConfig.HIVE_TEST_DATABASE_NAME_KEY) + "." + configuration.getString(HiveConfig.HIVE_TEST_TABLE_NAME_KEY); stmt = con.createStatement(); LOGGER.info("HIVE: Running Drop Table Statement: {}", dropDdl); stmt.execute(dropDdl); }