@Test
  public void testHostLevelParamsSentWithCommands() throws Exception, AuthorizationException {
    String cluster1 = getUniqueName();
    createCluster(cluster1);
    String serviceName = "PIG";
    createService(cluster1, serviceName, repositoryVersion01, null);
    String componentName1 = "PIG";
    createServiceComponent(cluster1, serviceName, componentName1,
      State.INIT);

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

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

    Map<String, String> mapRequestProps = new HashMap<>();
    mapRequestProps.put("context", "Called from a test");

    // null service should work
    createServiceComponentHost(cluster1, null, componentName1,
      host1, null);
    createServiceComponentHost(cluster1, null, componentName1,
      host2, null);



    ServiceRequest r = new ServiceRequest(cluster1, serviceName, repositoryVersion01.getId(),
        State.INSTALLED.toString());
    Set<ServiceRequest> requests = new HashSet<>();
    requests.add(r);

    RequestStatusResponse trackAction =
      ServiceResourceProviderTest.updateServices(controller, requests, mapRequestProps, true, false);
    Assert.assertEquals(State.INSTALLED,
      clusters.getCluster(cluster1).getService(serviceName)
        .getDesiredState());

    List<Stage> stages = actionDB.getAllStages(trackAction.getRequestId());
    Type type = new TypeToken<Map<String, String>>(){}.getType();

    for (Stage stage : stages){
      Map<String, String> params = StageUtils.getGson().fromJson(stage.getHostParamsStage(), type);
      Assert.assertEquals("0.1", params.get("stack_version"));
      Assert.assertNotNull(params.get("jdk_location"));
      Assert.assertNotNull(params.get("db_name"));
      Assert.assertNotNull(params.get("mysql_jdbc_url"));
      Assert.assertNotNull(params.get("oracle_jdbc_url"));
    }

    ExecutionCommand executionCommand = stages.get(0).getOrderedHostRoleCommands().get(
        0).getExecutionCommandWrapper().getExecutionCommand();

    Map<String, String> paramsCmd = executionCommand.getHostLevelParams();
    Assert.assertNotNull(executionCommand.getRepositoryFile());
    Assert.assertNotNull(paramsCmd.get("clientsToUpdateConfigs"));
  }
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