@Test
  public void testSessionGlobalInitFile() throws Exception {
    File tmpInitFile = new File(initFile.getParent(), "hiverc");
    Assert.assertTrue("Failed to rename " + initFile + " to " + tmpInitFile,
      initFile.renameTo(tmpInitFile));
    initFile = tmpInitFile;
    hiveConf.setVar(HiveConf.ConfVars.HIVE_SERVER2_GLOBAL_INIT_FILE_LOCATION,
        initFile.getAbsolutePath());
    doTestSessionGlobalInitFile();
  }
This class is almost the same as EmbeddedThriftBinaryCLIService,
except its constructor having a HiveConf param for test usage.
service/src/test/org/apache/hive/service/cli/session/TestSessionGlobalInitFile.java