public Cluster buildNewCluster(Clusters clusters,
      ServiceFactory serviceFactory, ServiceComponentFactory componentFactory,
      ServiceComponentHostFactory schFactory, String hostName) throws Exception {
    String clusterName = "cluster-" + System.currentTimeMillis();
    StackId stackId = new StackId("HDP", "2.0.6");

    createStack(stackId);

    clusters.addCluster(clusterName, stackId);
    Cluster cluster = clusters.getCluster(clusterName);
    cluster = initializeClusterWithStack(cluster);

    addHost(clusters, cluster, hostName);

    installHdfsService(cluster, serviceFactory, componentFactory, schFactory, hostName);
    installYarnService(cluster, serviceFactory, componentFactory, schFactory,
        hostName);
    return cluster;
  }
Creates an empty cluster with an ID using the specified cluster name.

@return the cluster ID.
ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java