private static TestAmbariMetaInfo createAmbariMetaInfo(File stackRoot,
    File versionFile, File resourcesRoot) throws Exception {

    Properties properties = new Properties();
    properties.setProperty(Configuration.METADATA_DIR_PATH.getKey(), stackRoot.getPath());
    properties.setProperty(Configuration.SERVER_VERSION_FILE.getKey(), versionFile.getPath());

    properties.setProperty(Configuration.RESOURCES_DIR.getKey(), resourcesRoot.getPath());
    properties.setProperty(Configuration.MPACKS_V2_STAGING_DIR_PATH.getKey(),"src/test/resources/mpacks-v2");

    Configuration configuration = new Configuration(properties);

    TestAmbariMetaInfo metaInfo = new TestAmbariMetaInfo(configuration);

    metaInfo.replayAllMocks();

    try {
      metaInfo.init();
    } catch(Exception e) {
      LOG.info("Error in initializing ", e);
      throw e;
    }
    waitForAllReposToBeResolved(metaInfo);

    return metaInfo;
  }
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