@Test
  @Ignore
  public void testLive() throws Throwable {
    ADKerberosOperationHandler handler = new ADKerberosOperationHandler();
    String principal = System.getProperty("principal");
    String password = System.getProperty("password");
    String realm = System.getProperty("realm");
    String ldapUrl = System.getProperty("ldap_url");
    String containerDN = System.getProperty("container_dn");

    if (principal == null) {
      principal = DEFAULT_ADMIN_PRINCIPAL;
    }

    if (password == null) {
      password = DEFAULT_ADMIN_PASSWORD;
    }

    if (realm == null) {
      realm = DEFAULT_REALM;
    }

    if (ldapUrl == null) {
      ldapUrl = DEFAULT_LDAP_URL;
    }

    if (containerDN == null) {
      containerDN = DEFAULT_PRINCIPAL_CONTAINER_DN;
    }

    PrincipalKeyCredential credentials = new PrincipalKeyCredential(principal, password);
    Map<String, String> kerberosEnvMap = new HashMap<>();

    kerberosEnvMap.put(ADKerberosOperationHandler.KERBEROS_ENV_LDAP_URL, ldapUrl);
    kerberosEnvMap.put(ADKerberosOperationHandler.KERBEROS_ENV_PRINCIPAL_CONTAINER_DN, containerDN);

    handler.open(credentials, realm, kerberosEnvMap);

    System.out.println("Test Admin Credentials: " + handler.testAdministratorCredentials());
    // does the principal already exist?
    System.out.println("Principal exists: " + handler.principalExists("nn/c1508.ambari.apache.org", true));

    handler.close();

    handler.open(credentials, realm, kerberosEnvMap);

    String evaluatedPrincipal;

    evaluatedPrincipal = "nn/c6501.ambari.apache.org@" + DEFAULT_REALM;
    if (handler.principalExists(evaluatedPrincipal, true)) {
      handler.setPrincipalPassword(evaluatedPrincipal, "some password", true);
    } else {
      handler.createPrincipal(evaluatedPrincipal, "some password", true);
    }

    evaluatedPrincipal = "hdfs@" + DEFAULT_REALM;
    if (handler.principalExists(evaluatedPrincipal, false)) {
      handler.setPrincipalPassword(evaluatedPrincipal, "some password", false);
    } else {
      handler.createPrincipal(evaluatedPrincipal, "some password", true);
    }

    kerberosEnvMap.put(ADKerberosOperationHandler.KERBEROS_ENV_AD_CREATE_ATTRIBUTES_TEMPLATE,
        "#set( $user = \"${principal_primary}-${principal_digest}\" )" +
            "{" +
            "  \"objectClass\": [" +
            "    \"top\"," +
            "    \"person\"," +
            "    \"organizationalPerson\"," +
            "    \"user\"" +
            "  ]," +
            "  \"cn\": \"$user\"," +
            "  \"sAMAccountName\": \"$user.substring(0,20)\"," +
            "  #if( $is_service )" +
            "  \"servicePrincipalName\": \"$principal_name\"," +
            "  #end" +
            "  \"userPrincipalName\": \"$normalized_principal\"," +
            "  \"unicodePwd\": \"$password\"," +
            "  \"accountExpires\": \"0\"," +
            "  \"userAccountControl\": \"66048\"" +
            "}"
    );

    handler.close();

    handler.open(credentials, realm, kerberosEnvMap);

    // remove the principal
    handler.removePrincipal("abcdefg", false);
    handler.removePrincipal("abcdefg/c1509.ambari.apache.org@" + DEFAULT_REALM, true);

    handler.createPrincipal("abcdefg/c1509.ambari.apache.org@" + DEFAULT_REALM, "some password", true);
    handler.createPrincipal("abcdefg@" + DEFAULT_REALM, "some password", false);

    //update the password
    handler.setPrincipalPassword("abcdefg/c1509.ambari.apache.org@" + DEFAULT_REALM, "some password", true);

    handler.close();
  }
Implementation to illustrate the use of operations on this class

@throws Throwable
ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandlerTest.java