private void installComponent(String serviceName, String componentName, String... hostNames) {
    Service service = createMock(serviceName + "_" + componentName, Service.class);
    ServiceComponent component = createMock(componentName, ServiceComponent.class);
    expect(component.getName()).andReturn(componentName).anyTimes();
    Map<String, ServiceComponentHost> hosts = new HashMap<>();
    expect(component.getServiceComponentHosts()).andReturn(hosts).anyTimes();
    for (String hostName : hostNames) {
      ServiceComponentHost host = createMock(hostName, ServiceComponentHost.class);
      expect(host.getHostName()).andReturn(hostName).anyTimes();
      hosts.put(hostName, host);
    }
    installedServices.put(serviceName, service);
    expect(service.getName()).andReturn(serviceName).anyTimes();
    expect(service.getServiceComponents()).andReturn(new HashMap<String, ServiceComponent>() {{
      put(componentName, component);
    }}).anyTimes();
  }
Ensures that when an upgrade is in progress, new requests are not created
to remove identities since it would interfere with the long running
upgrade.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/KerberosIdentityCleanerTest.java