private void createTopologyRequest(Cluster cluster, String hostName) {
    final String groupName = "MyHostGroup";

    // add topology request
    Blueprint bp = createNiceMock(Blueprint.class);
    expect(bp.getName()).andReturn("TestBluePrint").anyTimes();

    Configuration clusterConfig = new Configuration(
      Maps.newHashMap(),
      Maps.newHashMap()
    );

    Map<String, HostGroupInfo> hostGroups = new HashMap<>();
    HostGroupInfo hostGroupInfo = new HostGroupInfo(groupName);
    hostGroupInfo.setConfiguration(clusterConfig);
    hostGroupInfo.addHost(hostName);
    hostGroupInfo.addHost(hostName + "2");
    hostGroupInfo.addHost(hostName + "3");
    hostGroups.put(groupName, hostGroupInfo);

    ProvisionClusterRequest topologyRequest = createNiceMock(ProvisionClusterRequest.class);
    expect(topologyRequest.getType()).andReturn(TopologyRequest.Type.PROVISION).anyTimes();
    expect(topologyRequest.getBlueprint()).andReturn(bp).anyTimes();
    expect(topologyRequest.getClusterId()).andReturn(cluster.getClusterId()).anyTimes();
    expect(topologyRequest.getConfiguration()).andReturn(clusterConfig).anyTimes();
    expect(topologyRequest.getDescription()).andReturn("Test description").anyTimes();
    expect(topologyRequest.getHostGroupInfo()).andReturn(hostGroups).anyTimes();

    replay(bp, topologyRequest);

    persistedState.persistTopologyRequest(topologyRequest);

    createTopologyLogicalRequest(cluster, hostName);
  }
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