@Before
  public void setUp() throws Exception {
    if (driver == null) {
      setUpHiveConf();
      driver = DriverFactory.newDriver(hiveConf);
      client = new HiveMetaStoreClient(hiveConf);
      SessionState.start(new CliSessionState(hiveConf));
    }
  }
Simplify writing HCatalog tests that require a HiveMetaStore.
hcatalog/core/src/test/java/org/apache/hive/hcatalog/mapreduce/HCatBaseTest.java