private static MiniHS2 getMiniHS2WithKerbWithRemoteHMSWithKerb(MiniHiveKdc miniHiveKdc,
      HiveConf hiveConf, String authenticationType) throws Exception {
    String hivePrincipal =
        miniHiveKdc.getFullyQualifiedServicePrincipal(MiniHiveKdc.HIVE_SERVICE_PRINCIPAL);
    String hiveKeytab = miniHiveKdc.getKeyTabFile(
        miniHiveKdc.getServicePrincipalForUser(MiniHiveKdc.HIVE_SERVICE_PRINCIPAL));

    String hiveMetastorePrincipal =
        miniHiveKdc.getFullyQualifiedServicePrincipal(MiniHiveKdc.HIVE_METASTORE_SERVICE_PRINCIPAL);
    String hiveMetastoreKeytab = miniHiveKdc.getKeyTabFile(
        miniHiveKdc.getServicePrincipalForUser(MiniHiveKdc.HIVE_METASTORE_SERVICE_PRINCIPAL));

    MiniHS2.Builder b = new MiniHS2.Builder().withTransactionalTables(false).withConf(hiveConf)
        .withSecureRemoteMetastore(hiveMetastorePrincipal, hiveMetastoreKeytab).
            withMiniKdc(hivePrincipal, hiveKeytab).withAuthenticationType(authenticationType);
    if(HiveServer2.isHttpTransportMode(hiveConf)){
      b.withHTTPTransport();
    }
    return b.build();
  }
Create a MiniHS2 with the hive service principal and keytab in MiniHiveKdc. It uses remote HMS
and can support a different Sasl authType. It creates a metastore service principal and keytab
which can be used for secure HMS
@param miniHiveKdc
@param hiveConf
@param authenticationType
@return new MiniHS2 instance
@throws Exception
itests/hive-minikdc/src/test/java/org/apache/hive/minikdc/MiniHiveKdc.java