public void addUserPrincipal(String principal) throws Exception {
    File keytab = new File(workDir, "miniKdc" + keyTabCounter++ + ".keytab");
    miniKdc.createPrincipal(keytab, principal);
    userPrincipals.put(principal, keytab.getPath());
  }
Hadoop security classes read the default realm via static initialization,
 before miniKdc is initialized. Hence we set the realm via a test configuration
 and propagate that to miniKdc.
itests/hive-minikdc/src/test/java/org/apache/hive/minikdc/MiniHiveKdc.java