@Test
  public void testProcessConfigurationChanges() throws Exception {
    // Existing property map....
    Map<String, String> serviceSiteProperties = new HashMap<>();
    serviceSiteProperties.put("property1", "property1_value");
    serviceSiteProperties.put("principal_name", "principal_name_value");
    serviceSiteProperties.put("keytab_file_path", "keytab_file_path_value");

    Map<String, Map<String, String>> effectiveProperties = new HashMap<>();
    effectiveProperties.put("service-site", serviceSiteProperties);

    // Updated property map....
    Map<String, String> updatedServiceSiteProperties = new HashMap<>();
    updatedServiceSiteProperties.put("property1", "property1_updated_value");
    updatedServiceSiteProperties.put("property2", "property2_updated_value");
    updatedServiceSiteProperties.put("principal_name", "principal_name_updated_value");
    updatedServiceSiteProperties.put("keytab_file_path", "keytab_file_path_updated_value");

    Map<String, Map<String, String>> kerberosConfigurations = new HashMap<>();
    kerberosConfigurations.put("service-site", updatedServiceSiteProperties);

    KerberosDescriptor kerberosDescriptor = new KerberosDescriptorFactory().createInstance(KERBEROS_DESCRIPTOR_JSON);

    ConfigHelper configHelper = injector.getInstance(ConfigHelper.class);
    expect(configHelper.getEffectiveConfigProperties(eq("c1"), eq(null)))
        .andReturn(effectiveProperties).anyTimes();

    KerberosConfigDataFileWriterFactory factory = injector.getInstance(KerberosConfigDataFileWriterFactory.class);

    ConfigWriterData dataCaptureAll = setupConfigWriter(factory);
    ConfigWriterData dataCaptureIdentitiesOnly = setupConfigWriter(factory);
    ConfigWriterData dataCaptureNewAndIdentities = setupConfigWriter(factory);
    ConfigWriterData dataCaptureNone = setupConfigWriter(factory);

    replayAll();

    injector.getInstance(AmbariMetaInfo.class).init();

    Map<String, String> expectedProperties;

    // Update all configurations
    testKerberosServerAction.processConfigurationChanges("test_directory",
        kerberosConfigurations, Collections.emptyMap(), kerberosDescriptor, UpdateConfigurationPolicy.ALL);

    expectedProperties = new HashMap<>();
    expectedProperties.put("property1", "property1_updated_value");
    expectedProperties.put("property2", "property2_updated_value");
    expectedProperties.put("principal_name", "principal_name_updated_value");
    expectedProperties.put("keytab_file_path", "keytab_file_path_updated_value");

    verifyDataCapture(dataCaptureAll, Collections.singletonMap("service-site", expectedProperties));

    // Update only identity configurations
    testKerberosServerAction.processConfigurationChanges("test_directory",
        kerberosConfigurations, Collections.emptyMap(), kerberosDescriptor, UpdateConfigurationPolicy.IDENTITIES_ONLY);

    expectedProperties = new HashMap<>();
    expectedProperties.put("principal_name", "principal_name_updated_value");
    expectedProperties.put("keytab_file_path", "keytab_file_path_updated_value");

    verifyDataCapture(dataCaptureIdentitiesOnly, Collections.singletonMap("service-site", expectedProperties));

    // Update new and identity configurations
    testKerberosServerAction.processConfigurationChanges("test_directory",
        kerberosConfigurations, Collections.emptyMap(), kerberosDescriptor, UpdateConfigurationPolicy.NEW_AND_IDENTITIES);

    expectedProperties = new HashMap<>();
    expectedProperties.put("property2", "property2_updated_value");
    expectedProperties.put("principal_name", "principal_name_updated_value");
    expectedProperties.put("keytab_file_path", "keytab_file_path_updated_value");

    verifyDataCapture(dataCaptureNewAndIdentities, Collections.singletonMap("service-site", expectedProperties));

    // Update no configurations
    testKerberosServerAction.processConfigurationChanges("test_directory",
        kerberosConfigurations, Collections.emptyMap(), kerberosDescriptor, UpdateConfigurationPolicy.NONE);

    verifyDataCapture(dataCaptureNone, Collections.emptyMap());

    verifyAll();

  }
Test checks that {@code KerberosHelper.applyStackAdvisorUpdates} would be called with
full list of the services and not only list of services with KerberosDescriptior.
In this test HDFS service will have KerberosDescriptor, while Zookeeper not.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerActionTest.java