@Test
  public void testCreateClusterWithHostMapping() throws Exception, AuthorizationException {
    String cluster1 = getUniqueName();

    String host1 = getUniqueName();
    String host2 = getUniqueName();

    Set<String> hostNames = new HashSet<>();
    hostNames.add(host1);
    hostNames.add(host2);
    ClusterRequest r = new ClusterRequest(null, cluster1, "HDP-0.1", hostNames);

    try {
      controller.createCluster(r);
      fail("Expected create cluster to fail for invalid hosts");
    } catch (Exception e) {
      // Expected
    }

    try {
      clusters.getCluster(cluster1);
      fail("Expected to fail for non created cluster");
    } catch (ClusterNotFoundException e) {
      // Expected
    }

    clusters.addHost(host1);
    clusters.addHost(host2);
    setOsFamily(clusters.getHost(host1), "redhat", "6.3");
    setOsFamily(clusters.getHost(host2), "redhat", "6.3");

    controller.createCluster(r);
    Assert.assertNotNull(clusters.getCluster(cluster1));
  }
Allows to set maintenanceStateHelper. For use when there is anything to test
with maintenance mode.
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java