@Test
  public void testGetClustersWithFilters() throws Exception, AuthorizationException {
    String cluster1 = getUniqueName();
    String cluster2 = getUniqueName();
    String cluster3 = getUniqueName();
    String cluster4 = getUniqueName();

    clusters.addCluster(cluster1, new StackId("HDP-0.1"));
    clusters.addCluster(cluster2, new StackId("HDP-0.1"));
    clusters.addCluster(cluster3, new StackId("HDP-1.2.0"));
    clusters.addCluster(cluster4, new StackId("HDP-0.1"));

    ClusterRequest r = new ClusterRequest(null, null, null, null);
    Set<ClusterResponse> resp = controller.getClusters(Collections.singleton(r));
    Assert.assertTrue(resp.size() >= 4);

    r = new ClusterRequest(null, cluster1, null, null);
    resp = controller.getClusters(Collections.singleton(r));
    Assert.assertEquals(1, resp.size());
    Cluster c1 = clusters.getCluster(cluster1);
    Assert.assertEquals(c1.getClusterId(), resp.iterator().next().getClusterId());

    r = new ClusterRequest(null, null, "HDP-0.1", null);
    resp = controller.getClusters(Collections.singleton(r));
    Assert.assertTrue(resp.size() >= 3);

    r = new ClusterRequest(null, null, null, null);
    resp = controller.getClusters(Collections.singleton(r));
    Assert.assertTrue("Stack ID request is invalid and expect them all", resp.size() > 3);
  }
Create a cluster with a service, and verify that the request tasks have the correct output log and error log paths.
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java