private Service installService(Cluster cluster, String serviceName,
      RepositoryVersionEntity repositoryVersionEntity) throws AmbariException {
    Service service = null;

    try {
      service = cluster.getService(serviceName);
    } catch (ServiceNotFoundException e) {
      service = serviceFactory.createNew(cluster, serviceName, repositoryVersionEntity);
      cluster.addService(service);
    }

    return service;
  }
Tests the case where a revert happens on a patch upgrade and a new service
has been added which causes the repository to go OUT_OF_SYNC.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java