@Test
  public void setRestartRequiredAfterChangeService() throws Exception {
    String cluster1 = getUniqueName();
    createCluster(cluster1);
    Cluster cluster = clusters.getCluster(cluster1);
    StackId stackId = new StackId("HDP-2.0.7");
    cluster.setDesiredStackVersion(stackId);
    cluster.setCurrentStackVersion(stackId);

    String hdfsService = "HDFS";
    String zookeeperService = "ZOOKEEPER";
    createService(cluster1, hdfsService, repositoryVersion207, null);
    createService(cluster1, zookeeperService, repositoryVersion207, null);

    String namenode = "NAMENODE";
    String datanode = "DATANODE";
    String hdfsClient = "HDFS_CLIENT";
    String zookeeperServer = "ZOOKEEPER_SERVER";
    String zookeeperClient = "ZOOKEEPER_CLIENT";

    createServiceComponent(cluster1, hdfsService, namenode,
      State.INIT);
    createServiceComponent(cluster1, hdfsService, datanode,
      State.INIT);
    createServiceComponent(cluster1, zookeeperService, zookeeperServer,
      State.INIT);
    createServiceComponent(cluster1, zookeeperService, zookeeperClient,
      State.INIT);

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

    addHostToCluster(host1, cluster1);
    createServiceComponentHost(cluster1, hdfsService, namenode, host1, null);
    createServiceComponentHost(cluster1, hdfsService, datanode, host1, null);
    createServiceComponentHost(cluster1, zookeeperService, zookeeperServer, host1,
      null);
    createServiceComponentHost(cluster1, zookeeperService, zookeeperClient, host1,
      null);

    ServiceComponentHost zookeeperSch = null;
    for (ServiceComponentHost sch : cluster.getServiceComponentHosts(host1)) {
      if (sch.getServiceComponentName().equals(zookeeperServer)) {
        zookeeperSch = sch;
      }
    }
    assertFalse(zookeeperSch.isRestartRequired());

    addHostToCluster(host2, cluster1);
    createServiceComponentHost(cluster1, zookeeperService, zookeeperClient, host2, null);

    assertFalse(zookeeperSch.isRestartRequired());  //No restart required if adding host

    createServiceComponentHost(cluster1, zookeeperService, zookeeperServer, host2, null);

    assertTrue(zookeeperSch.isRestartRequired());  //Add zk server required restart

    deleteServiceComponentHost(cluster1, zookeeperService, zookeeperServer, host2, null);
    deleteServiceComponentHost(cluster1, zookeeperService, zookeeperClient, host2, null);
    deleteHost(host2);

    assertTrue(zookeeperSch.isRestartRequired());   //Restart if removing host!
  }
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