private void addHostToCluster(String hostName, String clusterName) throws AmbariException {
    clusters.addHost(hostName);

    Host host = clusters.getHost(hostName);
    setOsFamily(clusters.getHost(hostName), "centos", "5.9");

    Set<String> hostnames = new HashSet<>();
    hostnames.add(hostName);
    clusters.mapAndPublishHostsToCluster(hostnames, clusterName);
  }
Tests that {@link HostRegisteredEvent} properly updates the
{@link Clusters} in-memory mapping of hostIds to hosts.

@throws AmbariException
ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java