class PreviousUpgradeCompleted extends AbstractCheckDescriptor {

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

    String errorMessage = null;
    UpgradeEntity upgradeInProgress = cluster.getUpgradeInProgress();
    if (null != upgradeInProgress) {
      Direction direction = upgradeInProgress.getDirection();
      String directionText = direction.getText(false);
      String prepositionText = direction.getPreposition();

      errorMessage = MessageFormat.format(ERROR_MESSAGE, directionText, prepositionText,
          upgradeInProgress.getRepositoryVersion().getVersion(), directionText);
    }

    if (null != errorMessage) {
      LinkedHashSet<String> failedOn = new LinkedHashSet<>();
      failedOn.add(cluster.getClusterName());
      prerequisiteCheck.setFailedOn(failedOn);
      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
      prerequisiteCheck.setFailReason(errorMessage);
    }
  }

  public  PreviousUpgradeCompleted();

}