@Before
    public void setUp() throws Exception {
        hiveConf = new HiveConfForTest(getClass());
        HiveConf.setBoolVar(hiveConf, HiveConf.ConfVars.CREATE_TABLES_AS_ACID, true);
        HiveConf.setBoolVar(hiveConf, HiveConf.ConfVars.HIVE_CREATE_TABLES_AS_INSERT_ONLY, true);
        HiveConf.setBoolVar(hiveConf, HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, true);
        hiveConf.set(HiveConf.ConfVars.HIVE_DEFAULT_MANAGED_FILEFORMAT.varname, "ORC");
        hiveConf.setVar(HiveConf.ConfVars.HIVE_TXN_MANAGER, DbTxnManager.class.getName());
        hiveConf.set(HiveConf.ConfVars.METASTORE_CLIENT_CAPABILITIES.varname, "HIVEFULLACIDREAD,HIVEFULLACIDWRITE,HIVECACHEINVALIDATE,HIVEMANAGESTATS,HIVEMANAGEDINSERTWRITE,HIVEMANAGEDINSERTREAD");
        TestTxnDbUtil.setConfValues(hiveConf);
        TestTxnDbUtil.prepDb(hiveConf);

        SessionState.start(new SessionState(hiveConf));
        d = DriverFactory.newDriver(hiveConf);

        wh = new File(System.getProperty("java.io.tmpdir") + File.separator +
                "hive" + File.separator + "warehouse" + File.separator + "hive" + File.separator);
        wh.mkdirs();

        ext_wh = new File(System.getProperty("java.io.tmpdir") + File.separator +
                "hive" + File.separator + "warehouse" + File.separator + "hive-external" + File.separator);
        ext_wh.mkdirs();

        MetastoreConf.setVar(hiveConf, ConfVars.METASTORE_METADATA_TRANSFORMER_CLASS,
                "org.apache.hadoop.hive.metastore.MetastoreDefaultTransformer");
        MetastoreConf.setBoolVar(hiveConf, ConfVars.HIVE_IN_TEST, false);
        MetastoreConf.setVar(hiveConf, ConfVars.WAREHOUSE, wh.getCanonicalPath());
        MetastoreConf.setVar(hiveConf, ConfVars.WAREHOUSE_EXTERNAL, ext_wh.getCanonicalPath());
        MetastoreConf.setBoolVar(hiveConf, MetastoreConf.ConfVars.CREATE_TABLES_AS_ACID, true);
        client = new HiveMetaStoreClient(hiveConf);

        dropTables();
        runStatementOnDriver("create database " + database_with_default_table_type +" with DBPROPERTIES('defaultTableType'='EXTERNAL')");
        runStatementOnDriver("create database " + default_db);
    }
This class resides in itests to facilitate running query using Tez engine, since the jars are
fully loaded here, which is not the case if it stays in ql.
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestDatabaseTableDefault.java