@Test
  public void testKerberosDescriptor() throws Exception {
    ServiceInfo service;

    // Test that kerberos descriptor file is not available when not supplied in service definition
    service = metaInfo.getService(STACK_NAME_HDP, "2.1.1", "PIG");
    Assert.assertNotNull(service);
    Assert.assertNull(service.getKerberosDescriptorFile());

    // Test that kerberos descriptor file is available when supplied in service definition
    service = metaInfo.getService(STACK_NAME_HDP, "2.0.8", "HDFS");
    Assert.assertNotNull(service);
    Assert.assertNotNull(service.getKerberosDescriptorFile());

    // Test that kerberos descriptor file is available from inherited stack version
    service = metaInfo.getService(STACK_NAME_HDP, "2.1.1", "HDFS");
    Assert.assertNotNull(service);
    Assert.assertNotNull(service.getKerberosDescriptorFile());

    // Test that kerberos.json file can be parsed into mapped data
    Map<?,?> kerberosDescriptorData = new Gson()
        .fromJson(new FileReader(service.getKerberosDescriptorFile()), Map.class);

    Assert.assertNotNull(kerberosDescriptorData);
    Assert.assertEquals(1, kerberosDescriptorData.size());
  }
Test scenario when service were removed and not mapped alerts need to be disabled

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java