@Test
  public void testReconfigureClientWithServiceStarted() throws Exception {
    String cluster1 = getUniqueName();
    createCluster(cluster1);
    Cluster cluster = clusters.getCluster(cluster1);
    cluster.setDesiredStackVersion(new StackId("HDP-0.1"));
    String serviceName = "HDFS";
    createService(cluster1, serviceName, null);
    String componentName1 = "NAMENODE";
    String componentName2 = "DATANODE";
    String componentName3 = "HDFS_CLIENT";

    createServiceComponent(cluster1, serviceName, componentName1,
      State.INIT);
    createServiceComponent(cluster1, serviceName, componentName2,
      State.INIT);
    createServiceComponent(cluster1, serviceName, componentName3,
      State.INIT);

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

    addHostToCluster(host1, cluster1);
    addHostToCluster(host2, cluster1);

    createServiceComponentHost(cluster1, serviceName, componentName1,
      host1, null);
    createServiceComponentHost(cluster1, serviceName, componentName2,
      host1, null);
    createServiceComponentHost(cluster1, serviceName, componentName3,
      host1, null);
    createServiceComponentHost(cluster1, serviceName, componentName3,
      host2, null);

    // Create and attach config
    Map<String, String> configs = new HashMap<>();
    configs.put("a", "b");
    Map<String, String> configs2 = new HashMap<>();
    configs2.put("c", "d");

    ConfigurationRequest cr1,cr2,cr3;
    cr1 = new ConfigurationRequest(cluster1, "core-site","version1",
      configs, null);
    cr2 = new ConfigurationRequest(cluster1, "hdfs-site","version1",
      configs, null);

    ClusterRequest crReq = new ClusterRequest(cluster.getClusterId(), cluster1, null, null);
    crReq.setDesiredConfig(Collections.singletonList(cr1));
    controller.updateClusters(Collections.singleton(crReq), null);
    crReq = new ClusterRequest(cluster.getClusterId(), cluster1, null, null);
    crReq.setDesiredConfig(Collections.singletonList(cr2));
    controller.updateClusters(Collections.singleton(crReq), null);

    installService(cluster1, serviceName, false, false);
    startService(cluster1, serviceName, false, false);

    Cluster c = clusters.getCluster(cluster1);
    Service s = c.getService(serviceName);
    // Stop Sch only
    stopServiceComponentHosts(cluster1, serviceName);
    Assert.assertEquals(State.STARTED, s.getDesiredState());
    for (ServiceComponent sc : s.getServiceComponents().values()) {
      for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
        Assert.assertEquals(State.INSTALLED, sch.getDesiredState());
      }
    }

    // Reconfigure
    cr3 = new ConfigurationRequest(cluster1, "core-site","version122",
      configs2, null);
    crReq = new ClusterRequest(cluster.getClusterId(), cluster1, null, null);
    crReq.setDesiredConfig(Collections.singletonList(cr3));
    controller.updateClusters(Collections.singleton(crReq), null);

    long id = startService(cluster1, serviceName, false, true);
    List<Stage> stages = actionDB.getAllStages(id);
    HostRoleCommand clientHrc = null;
    for (Stage stage : stages) {
      for (HostRoleCommand hrc : stage.getOrderedHostRoleCommands()) {
        if (hrc.getHostName().equals(host2) && hrc.getRole().toString()
          .equals("HDFS_CLIENT")) {
          clientHrc = hrc;
        }
      }
    }
    Assert.assertNotNull(clientHrc);
  }
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