private static void checkNoAggregatedFunctionsForJmx(List<MetricDefinition> metricDefinitions) {
    for (MetricDefinition metricDefinition: metricDefinitions) {
      if ("jmx".equals(metricDefinition.getType())) {
        for (String metric: metricDefinition.getMetrics().keySet()) {
          if (metric.endsWith("._sum")) {
            Assert.fail("Aggregated functions aren't supported for JMX metrics. " + metric);
          }
        }
      }
    }
  }
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