@Test
  public void testReinstallClientSchSkippedInMaintenance() throws Exception {
    String cluster1 = getUniqueName();
    final String host1 = getUniqueName();
    final String host2 = getUniqueName();
    final String host3 = getUniqueName();

    Cluster c1 = setupClusterWithHosts(cluster1, "HDP-1.2.0",
      new ArrayList<String>() {{
        add(host1);
        add(host2);
        add(host3);
      }},
      "centos5");

    RepositoryVersionEntity repositoryVersion = repositoryVersion120;

    Service hdfs = c1.addService("HDFS", repositoryVersion);
    createServiceComponent(cluster1, "HDFS", "NAMENODE", State.INIT);
    createServiceComponent(cluster1, "HDFS", "DATANODE", State.INIT);
    createServiceComponent(cluster1, "HDFS", "HDFS_CLIENT", State.INIT);

    createServiceComponentHost(cluster1, "HDFS", "NAMENODE", host1, State.INIT);
    createServiceComponentHost(cluster1, "HDFS", "DATANODE", host1, State.INIT);
    createServiceComponentHost(cluster1, "HDFS", "HDFS_CLIENT", host1, State.INIT);
    createServiceComponentHost(cluster1, "HDFS", "HDFS_CLIENT", host2, State.INIT);
    createServiceComponentHost(cluster1, "HDFS", "HDFS_CLIENT", host3, State.INIT);

    installService(cluster1, "HDFS", false, false);

    clusters.getHost(host3).setMaintenanceState(c1.getClusterId(), MaintenanceState.ON);

    Long id = startService(cluster1, "HDFS", false ,true);

    Assert.assertNotNull(id);
    List<Stage> stages = actionDB.getAllStages(id);
    Assert.assertNotNull(stages);
    HostRoleCommand hrc1 = null;
    HostRoleCommand hrc2 = null;
    HostRoleCommand hrc3 = null;
    for (Stage s : stages) {
      for (HostRoleCommand hrc : s.getOrderedHostRoleCommands()) {
        if (hrc.getRole().equals(Role.HDFS_CLIENT) && hrc.getHostName().equals(host1)) {
          hrc1 = hrc;
        } else if (hrc.getRole().equals(Role.HDFS_CLIENT) && hrc.getHostName().equals(host2)) {
          hrc2 = hrc;
        } else if (hrc.getRole().equals(Role.HDFS_CLIENT) && hrc.getHostName().equals(host3)) {
          hrc3 = hrc;
        }
      }
    }

    Assert.assertNotNull(hrc1);
    Assert.assertNotNull(hrc2);
    Assert.assertNull(hrc3);
  }
Ensure that ServiceNotFoundException is handled where there are multiple requests as would be the
case when an OR predicate is provided in the query.
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java