private Map<String, String> getReplacedServices(UpgradeCheckRequest request) throws AmbariException{
    Map<String, String> result = new LinkedHashMap<>();
    String value = getPropertyValue(request, REPLACED_SERVICES_PROPERTY_NAME);
    String newValue = getPropertyValue(request, NEW_SERVICES_PROPERTY_NAME);
    if(value == null && newValue == null){
      return result; //no need to check removed services as they are not specified in the upgrade xml file.
    } else {
      if (value == null || newValue == null){
        throw new AmbariException(String.format("Both %s and %s list must be specified in the upgrade XML file.", REPLACED_SERVICES_PROPERTY_NAME, NEW_SERVICES_PROPERTY_NAME));
      } else {
        List<String> oldServices = Arrays.asList(value.split(","));
        List<String> newServices = Arrays.asList(newValue.split(","));
        if (oldServices.size() != newServices.size()){
          throw new AmbariException(String.format("%s must have the same number of services as the %s list.", NEW_SERVICES_PROPERTY_NAME, REPLACED_SERVICES_PROPERTY_NAME));
        } else {
          for (int i = 0; i < oldServices.size(); i++){
            String oldService = oldServices.get(i).trim();
            String newService = newServices.get(i).trim();
            if (oldService.isEmpty() || newService.isEmpty()) {
              throw new AmbariException(String.format("Make sure both %s and %s list only contain comma separated list of services.", NEW_SERVICES_PROPERTY_NAME, REPLACED_SERVICES_PROPERTY_NAME));
            } else {
              result.put(oldService, newService);
            }
          }
        }
      }
    }
    return result;
  }
@return service names and new service names map
ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java