@Test
  public void testGetKerberosDescriptorWithPreconfigure() throws AmbariException {
    KerberosDescriptor descriptor = metaInfo.getKerberosDescriptor(STACK_NAME_HDP, "2.0.8", true);

    Assert.assertNotNull(descriptor);
    Assert.assertNotNull(descriptor.getProperties());
    Assert.assertEquals(3, descriptor.getProperties().size());

    Assert.assertNotNull(descriptor.getIdentities());
    Assert.assertEquals(1, descriptor.getIdentities().size());
    Assert.assertEquals("spnego", descriptor.getIdentities().get(0).getName());

    Assert.assertNotNull(descriptor.getConfigurations());
    Assert.assertEquals(1, descriptor.getConfigurations().size());
    Assert.assertNotNull(descriptor.getConfigurations().get("core-site"));
    Assert.assertNotNull(descriptor.getConfiguration("core-site"));

    Assert.assertNotNull(descriptor.getServices());
    Assert.assertEquals(2, descriptor.getServices().size());
    Assert.assertNotNull(descriptor.getServices().get("HDFS"));
    Assert.assertNotNull(descriptor.getService("HDFS"));
    Assert.assertTrue(descriptor.getService("HDFS").shouldPreconfigure());
    Assert.assertNotNull(descriptor.getServices().get("HDFS"));
    Assert.assertNotNull(descriptor.getService("HDFS"));
    Assert.assertTrue(descriptor.getService("HDFS").shouldPreconfigure());
    Assert.assertNotNull(descriptor.getServices().get("NEW_SERVICE"));
    Assert.assertNotNull(descriptor.getService("NEW_SERVICE"));
    Assert.assertTrue(descriptor.getService("NEW_SERVICE").shouldPreconfigure());
  }
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