@Before
  public void setUp() throws Exception {
    kerberosIdentityCleaner = new KerberosIdentityCleaner(new AmbariEventPublisher(), kerberosHelper, clusters);
    kerberosDescriptor = kerberosDescriptorFactory.createInstance("{" +
      "  'services': [" +
      "    {" +
      "      'name': 'OOZIE'," +
      "      'components': [" +
      "        {" +
      "          'name': 'OOZIE_SERVER'," +
      "          'identities': [" +
      "            {" +
      "              'name': '/HDFS/NAMENODE/hdfs'" +
      "            }," +
      "            {" +
      "              'name': 'oozie_server1'," +
      "              'principal': { 'value': 'oozie1/_HOST@EXAMPLE.COM' }" +
      "            }," +"" +
      "            {" +
      "              'name': 'oozie_server2'," +
      "              'principal': { 'value': 'oozie/_HOST@EXAMPLE.COM' }" +
      "            }" +
      "          ]" +
      "        }" +
      "      ]" +
      "    }," +
      "    {" +
      "      'name': 'OOZIE2'," +
      "      'components': [" +
      "        {" +
      "          'name': 'OOZIE_SERVER2'," +
      "          'identities': [" +
      "            {" +
      "              'name': 'oozie_server3'," +
      "              'principal': { 'value': 'oozie/_HOST@EXAMPLE.COM' }" +
      "            }" +"" +
      "          ]" +
      "        }" +
      "      ]" +
      "    }," +
      "    {" +
      "      'name': 'YARN'," +
      "      'components': [" +
      "        {" +
      "          'name': 'RESOURCE_MANAGER'," +
      "          'identities': [" +
      "            {" +
      "              'name': 'rm_unique'" +
      "            }," +
      "            {" +
      "              'name': 'rm1-shared'," +
      "              'keytab' : { 'file' : 'shared' }" +
      "            }" +
      "          ]" +
      "        }" +
      "      ]" +
      "    }," +
      "    {" +
      "      'name': 'YARN2'," +
      "      'components': [" +
      "        {" +
      "          'name': 'RESOURCE_MANAGER2'," +
      "          'identities': [" +
      "            {" +
      "              'name': 'rm2-shared'," +
      "              'keytab' : { 'file' : 'shared' }" +
      "            }" +
      "          ]" +
      "        }" +
      "      ]" +
      "    }," +
      "    {" +
      "      'name': 'HDFS'," +
      "      'identities': [" +
      "            {" +
      "              'name': 'hdfs-service'" +
      "            }," +
      "            {" +
      "              'name': 'shared'," +
      "              'principal': { 'value': 'oozie/_HOST@EXAMPLE.COM' }" +
      "            }," +
      "            {" +
      "              'name': '/YARN/RESOURCE_MANAGER/rm'" +
      "            }," +
      "          ]," +
      "      'components': [" +
      "        {" +
      "          'name': 'NAMENODE'," +
      "          'identities': [" +
      "            {" +
      "              'name': 'namenode'" +
      "            }" +
      "          ]" +
      "        }," +
      "        {" +
      "          'name': 'DATANODE'," +
      "          'identities': [" +
      "            {" +
      "              'name': 'datanode'" +
      "            }" +
      "          ]" +
      "        }" +
      "      ]" +
      "    }" +
      "  ]" +
      "}");
    expect(clusters.getCluster(CLUSTER_ID)).andReturn(cluster).anyTimes();
    expect(cluster.getSecurityType()).andReturn(SecurityType.KERBEROS).anyTimes();
    expect(kerberosHelper.getKerberosDescriptor(cluster, false)).andReturn(kerberosDescriptor).anyTimes();
    expect(cluster.getServices()).andReturn(installedServices).anyTimes();
    expect(cluster.getUpgradeInProgress()).andReturn(null).once();
  }
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