@Before
  public void setup() throws Exception {
    injector = Guice.createInjector(Modules.override(
        new InMemoryDefaultTestModule()).with(new MockModule()));

    injector.getInstance(GuiceJpaInitializer.class);
    injector.injectMembers(this);

    helper.createStack(stackId);

    clusters.addCluster("c1", stackId);
    cluster = clusters.getCluster("c1");
    helper.getOrCreateRepositoryVersion(stackId, stackId.getStackVersion());

    Config config1 = configFactory.createNew(cluster, "test-type1", "version1", new HashMap<>(), new HashMap<>());
    Config config2 = configFactory.createNew(cluster, "test-type2", "version1", new HashMap<>(), new HashMap<>());

    cluster.addDesiredConfig("test user", new HashSet<>(Arrays.asList(config1, config2)));

    // 100 hosts
    for (int i = 0; i < NUMBER_OF_HOSTS; i++) {
      String hostName = "c64-" + i;
      hostNames.add(hostName);

      clusters.addHost(hostName);
      setOsFamily(clusters.getHost(hostName), "redhat", "6.4");
      clusters.mapHostToCluster(hostName, "c1");
    }

    Service service = installService("HDFS");
    addServiceComponent(service, "NAMENODE");
    addServiceComponent(service, "DATANODE");
  }
Creates 100 hosts and adds them to the cluster.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java