@Test
  public void testRollbackDoesNotDeleteOriginTableWhenCTLTFails() throws CommandProcessorException {
    HiveConf conf = new HiveConf(baseConf);
    conf.setVar(HiveConf.ConfVars.HIVE_TXN_MANAGER, "org.apache.hadoop.hive.ql.lockmgr.DbTxnManager");
    conf.setBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, true);
    conf.setBoolVar(HiveConf.ConfVars.HIVE_STRICT_MANAGED_TABLES, true);
    conf.setBoolVar(HiveConf.ConfVars.CREATE_TABLES_AS_ACID, true);
    conf.setBoolVar(HiveConf.ConfVars.HIVE_CREATE_TABLES_AS_INSERT_ONLY, true);
    conf.setVar(HiveConf.ConfVars.HIVE_DEFAULT_MANAGED_FILEFORMAT, "ORC");

    driver = DriverFactory.newDriver(conf);

    driver.run("CREATE EXTERNAL TABLE `old_hbase_hive_table`(\n" +
        "   `key` int COMMENT '',\n" +
        "   `value` string COMMENT '')\n" +
        " ROW FORMAT SERDE\n" +
        "   'org.apache.hadoop.hive.hbase.HBaseSerDe'\n" +
        " STORED BY\n" +
        "   'org.apache.hadoop.hive.hbase.HBaseStorageHandler'\n" +
        " WITH SERDEPROPERTIES (\n" +
        "   'hbase.columns.mapping'=':key,cf:cf')\n" +
        " TBLPROPERTIES ('hbase.table.name'='hbase_hive_table')");
    try {
      driver.run("create table new_hbase_hive_table like old_hbase_hive_table");
    } catch (Exception e) {
      // expected - above command will try to create a transactional table but will fail
    }
    // original table is still present, rollback() has not deleted it
    driver.run("select * from old_hbase_hive_table");

    driver.run("drop table old_hbase_hive_table");
  }
Test class for running queries using HBase tables. Creates a mini ZK and an HBase test cluster.
Each test method must instantiate a driver object first, using either the baseConf or a modified version of that.
Once finished, each test method must take care of cleaning up any database objects they've created (tables,
databases, etc.), otherwise those will be visible for subsequent test methods too.
hbase-handler/src/test/org/apache/hadoop/hive/hbase/TestHBaseQueries.java