class RequiredServicesInRepositoryCheck extends AbstractCheckDescriptor {

  @Override
  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
    String clusterName = request.getClusterName();
    Cluster cluster = clustersProvider.get().getCluster(clusterName);

    VersionDefinitionXml xml = getVersionDefinitionXml(request);
    Set<String> missingDependencies = xml.getMissingDependencies(cluster);

    if (!missingDependencies.isEmpty()) {
      String failReasonTemplate = getFailReason(prerequisiteCheck, request);

      String message = String.format(
          "The following services are also required to be included in this upgrade: %s",
          StringUtils.join(missingDependencies, ", "));

      prerequisiteCheck.setFailedOn(new LinkedHashSet<>(missingDependencies));
      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
      prerequisiteCheck.setFailReason(String.format(failReasonTemplate, message));

      Set<ServiceDetail> missingServiceDetails = missingDependencies.stream().map(
          missingService -> new ServiceDetail(missingService)).collect(
              Collectors.toCollection(TreeSet::new));

      prerequisiteCheck.getFailedDetail().addAll(missingServiceDetails);
      return;
    }

    prerequisiteCheck.setStatus(PrereqCheckStatus.PASS);
  }

  public  RequiredServicesInRepositoryCheck();

}