private static Map<String, ServiceInfo> getServiceInfo(String xml) throws JAXBException {
    InputStream configStream = new ByteArrayInputStream(xml.getBytes());
    JAXBContext jaxbContext = JAXBContext.newInstance(ServiceMetainfoXml.class);
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
    ServiceMetainfoXml serviceMetainfoXml = (ServiceMetainfoXml) unmarshaller.unmarshal(configStream);

    Map<String, ServiceInfo> serviceInfoMap = new HashMap<>();
    for (ServiceInfo serviceInfo : serviceMetainfoXml.getServices()) {
      serviceInfoMap.put(serviceInfo.getName(), serviceInfo);
    }
    return serviceInfoMap;
  }
Tests the presence and absence of the kerberosEnabledTest block.
ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java