ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adorosz...@apache.org
Subject ambari git commit: AMBARI-20994. Integrate RootServiceService with Swagger (adoroszlai)
Date Tue, 16 May 2017 08:59:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/ambari-rest-api-explorer 580067f99 -> 228b92897


AMBARI-20994. Integrate RootServiceService with Swagger (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/228b9289
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/228b9289
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/228b9289

Branch: refs/heads/ambari-rest-api-explorer
Commit: 228b9289755c33342586d8cbe209b5341d7380d0
Parents: 580067f
Author: Attila Doroszlai <adoroszlai@hortonworks.com>
Authored: Tue May 16 11:02:06 2017 +0200
Committer: Attila Doroszlai <adoroszlai@hortonworks.com>
Committed: Tue May 16 11:02:06 2017 +0200

----------------------------------------------------------------------
 .../ambari/server/api/services/BaseService.java |   2 +
 .../server/api/services/RootServiceService.java | 363 ++++++++++++++-----
 .../AmbariManagementControllerImpl.java         |   5 -
 .../RootServiceComponentResponse.java           |  56 ++-
 .../RootServiceHostComponentResponse.java       |  72 ++--
 .../server/controller/RootServiceResponse.java  |  24 +-
 .../controller/RootServiceResponseFactory.java  |  30 +-
 .../internal/HostResourceProvider.java          |   8 +-
 .../RootServiceComponentResourceProvider.java   |  63 ++--
 ...ootServiceHostComponentResourceProvider.java |  70 ++--
 .../internal/RootServiceResourceProvider.java   |  20 +-
 .../api/services/RootServiceServiceTest.java    |  11 +-
 .../RootServiceResponseFactoryTest.java         |   9 +-
 ...ootServiceComponentResourceProviderTest.java |  21 +-
 14 files changed, 456 insertions(+), 298 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
index 2808911..5f6474c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
@@ -86,6 +86,8 @@ public abstract class BaseService {
   static final String PARAM_TYPE_BODY = "body";
 
 
+  static final String FIELDS_SEPARATOR = ", ";
+
   /**
    * Logger instance.
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
index ce9240c..5afb7dc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -20,6 +20,7 @@ package org.apache.ambari.server.api.services;
 
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.ws.rs.GET;
@@ -28,137 +29,325 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.controller.ApiModel;
+import org.apache.ambari.server.controller.HostResponse;
+import org.apache.ambari.server.controller.RootServiceComponentResponse;
+import org.apache.ambari.server.controller.RootServiceHostComponentResponse;
+import org.apache.ambari.server.controller.RootServiceResponse;
+import org.apache.ambari.server.controller.internal.HostResourceProvider;
+import org.apache.ambari.server.controller.internal.RootServiceComponentResourceProvider;
+import org.apache.ambari.server.controller.internal.RootServiceHostComponentResourceProvider;
+import org.apache.ambari.server.controller.internal.RootServiceResourceProvider;
 import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.http.HttpStatus;
 
-@Path("/services/")
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+@Path("/services")
+@Api(value = "/services", description = "Endpoint for querying root-level services, ie. Ambari Server and Ambari Agents")
 public class RootServiceService extends BaseService {
-  
-  @GET
-  @Produces("text/plain")
-  public Response getServices(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
 
-    return handleRequest(headers, body, ui, Request.Type.GET,
-      createServiceResource(null));
+  private static final String KEY_COMPONENTS = "components";
+  private static final String KEY_HOST_COMPONENTS = "hostComponents";
+
+  private static final String DEFAULT_FIELDS_ROOT_SERVICES =
+    RootServiceResourceProvider.SERVICE_NAME_PROPERTY_ID;
+
+  private static final String DEFAULT_FIELDS_ROOT_SERVICE =
+    RootServiceResourceProvider.SERVICE_NAME_PROPERTY_ID + FIELDS_SEPARATOR +
+      KEY_COMPONENTS + PropertyHelper.EXTERNAL_PATH_SEP + RootServiceComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID + FIELDS_SEPARATOR +
+      KEY_COMPONENTS + PropertyHelper.EXTERNAL_PATH_SEP + RootServiceComponentResourceProvider.SERVICE_NAME_PROPERTY_ID;
+
+  private static final String DEFAULT_FIELDS_ROOT_SERVICE_COMPONENTS =
+    RootServiceComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID + FIELDS_SEPARATOR +
+    RootServiceComponentResourceProvider.SERVICE_NAME_PROPERTY_ID;
+
+  private static final String DEFAULT_FIELDS_ROOT_SERVICE_COMPONENT =
+    RootServiceComponentResourceProvider.ALL_PROPERTIES + FIELDS_SEPARATOR +
+    KEY_HOST_COMPONENTS + PropertyHelper.EXTERNAL_PATH_SEP + RootServiceHostComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID + FIELDS_SEPARATOR +
+    KEY_HOST_COMPONENTS + PropertyHelper.EXTERNAL_PATH_SEP + RootServiceHostComponentResourceProvider.HOST_NAME_PROPERTY_ID + FIELDS_SEPARATOR +
+    KEY_HOST_COMPONENTS + PropertyHelper.EXTERNAL_PATH_SEP + RootServiceHostComponentResourceProvider.SERVICE_NAME_PROPERTY_ID;
+
+  private static final String DEFAULT_FIELDS_ROOT_SERVICE_HOST_COMPONENT =
+    RootServiceHostComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID + FIELDS_SEPARATOR +
+    RootServiceHostComponentResourceProvider.HOST_NAME_PROPERTY_ID + FIELDS_SEPARATOR +
+    RootServiceHostComponentResourceProvider.SERVICE_NAME_PROPERTY_ID;
+
+  private static final String DEFAULT_FIELDS_HOSTS =
+    HostResourceProvider.HOST_HOST_NAME_PROPERTY_ID;
+
+  private static final String DEFAULT_FIELDS_HOST =
+    HostResourceProvider.ALL_PROPERTIES;
+
+  @GET
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns the list of root-level services",
+    response = RootServiceResponseWrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY,
+      defaultValue = DEFAULT_FIELDS_ROOT_SERVICES),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRootServices(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
+    ResourceInstance resource = createServiceResource(null);
+    return handleRequest(headers, body, ui, Request.Type.GET, resource);
   }
   
   @GET
   @Path("{serviceName}")
-  @Produces("text/plain")
-  public Response getService(String body, @Context HttpHeaders headers, @Context UriInfo ui,
-      @PathParam("serviceName") String serviceName) {
-
-    return handleRequest(headers, body, ui, Request.Type.GET,
-      createServiceResource(serviceName));
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns information about the given root-level service, including a list of its components",
+    response = RootServiceResponseWithComponentList.class)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY,
+      defaultValue = DEFAULT_FIELDS_ROOT_SERVICE),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRootService(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @ApiParam(value = "service name", required = true) @PathParam("serviceName") String serviceName
+  ) {
+    ResourceInstance resource = createServiceResource(serviceName);
+    return handleRequest(headers, body, ui, Request.Type.GET, resource);
   }
 
   @GET
-  @Path("{serviceName}/components/{componentName}/hostComponents")
-  @Produces("text/plain")
-  public Response getRootHostComponents(String body, @Context HttpHeaders headers, @Context UriInfo ui,
-      @PathParam("serviceName") String serviceName,
-      @PathParam("componentName") String componentName) {
-
-    return handleRequest(headers, body, ui, Request.Type.GET,
-      createHostComponentResource(serviceName, null, componentName));
-  }
-  
-  
-  @GET
-  @Path("{serviceName}/hosts/")
-  @Produces("text/plain")
+  @Path("{serviceName}/hosts")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns the list of hosts for the given root-level service",
+    response = HostResponse.Wrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY,
+      defaultValue = DEFAULT_FIELDS_HOSTS),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
   public Response getRootHosts(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
-
-    return handleRequest(headers, body, ui, Request.Type.GET,
-      createHostResource(null));
+    ResourceInstance resource = createHostResource(null);
+    return handleRequest(headers, body, ui, Request.Type.GET, resource);
   }
   
   @GET
   @Path("{serviceName}/hosts/{hostName}")
-  @Produces("text/plain")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns information about the given host", response = HostResponse.Wrapper.class)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY,
+      defaultValue = DEFAULT_FIELDS_HOST),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
   public Response getRootHost(String body, @Context HttpHeaders headers, @Context UriInfo ui,
-      @PathParam("hostName") String hostName) {
-
-    return handleRequest(headers, body, ui, Request.Type.GET,
-      createHostResource(hostName));
+    @ApiParam(value = "host name", required = true) @PathParam("hostName") String hostName
+  ) {
+    ResourceInstance resource = createHostResource(hostName);
+    return handleRequest(headers, body, ui, Request.Type.GET, resource);
   }
   
+  @GET
+  @Path("{serviceName}/hosts/{hostName}/hostComponents")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns the list of components for the given root-level service on the given host",
+    response = RootServiceHostComponentResponseWrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY,
+      defaultValue = DEFAULT_FIELDS_ROOT_SERVICE_HOST_COMPONENT),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRootServiceHostComponents(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @ApiParam(value = "service name", required = true) @PathParam("serviceName") String serviceName,
+    @ApiParam(value = "host name", required = true) @PathParam("hostName") String hostName
+  ) {
+    ResourceInstance resource = createHostComponentResource(serviceName, hostName, null);
+    return handleRequest(headers, body, ui, Request.Type.GET, resource);
+  }
   
-  protected ResourceInstance createHostResource(String hostName) {
-    return createResource(Resource.Type.Host, Collections.singletonMap(Resource.Type.Host, hostName));
+  @GET
+  @Path("{serviceName}/hosts/{hostName}/hostComponents/{hostComponent}")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns information about the given component for the given root-level service on the given host",
+    response = RootServiceHostComponentResponseWrapper.class)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY,
+      defaultValue = DEFAULT_FIELDS_ROOT_SERVICE_HOST_COMPONENT),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRootServiceHostComponent(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @ApiParam(value = "service name", required = true) @PathParam("serviceName") String serviceName,
+    @ApiParam(value = "host name", required = true) @PathParam("hostName") String hostName,
+    @ApiParam(value = "component name", required = true) @PathParam("hostComponent") String hostComponent
+  ) {
+    ResourceInstance resource = createHostComponentResource(serviceName, hostName, hostComponent);
+    return handleRequest(headers, body, ui, Request.Type.GET, resource);
   }
-
   
   @GET
-  @Path("{serviceName}/hosts/{hostName}/hostComponents/")
-  @Produces("text/plain")
-  public Response getRootHostComponent(String body, @Context HttpHeaders headers, @Context UriInfo ui,
-      @PathParam("serviceName") String serviceName,
-      @PathParam("hostName") String hostName) {
-
-    return handleRequest(headers, body, ui, Request.Type.GET,
-      createHostComponentResource(serviceName, hostName, null));
+  @Path("{serviceName}/components")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns the list of components for the given root-level service",
+    response = RootServiceComponentResponseWrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY,
+      defaultValue = DEFAULT_FIELDS_ROOT_SERVICE_COMPONENTS),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRootServiceComponents(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @ApiParam(value = "service name", required = true) @PathParam("serviceName") String serviceName
+  ) {
+    ResourceInstance resource = createServiceComponentResource(serviceName, null);
+    return handleRequest(headers, body, ui, Request.Type.GET, resource);
   }
   
   @GET
-  @Path("{serviceName}/hosts/{hostName}/hostComponents/{hostComponent}")
-  @Produces("text/plain")
-  public Response getRootHostComponent(String body, @Context HttpHeaders headers, @Context UriInfo ui,
-      @PathParam("serviceName") String serviceName,
-      @PathParam("hostName") String hostName,
-      @PathParam("hostComponent") String hostComponent) {
+  @Path("{serviceName}/components/{componentName}")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns information about the given component for the given root-level service",
+    response = RootServiceComponentWithHostComponentList.class)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY,
+      defaultValue = DEFAULT_FIELDS_ROOT_SERVICE_COMPONENT),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRootServiceComponent(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @ApiParam(value = "service name", required = true) @PathParam("serviceName") String serviceName,
+    @ApiParam(value = "component name", required = true) @PathParam("componentName") String componentName
+  ) {
+    ResourceInstance resource = createServiceComponentResource(serviceName, componentName);
+    return handleRequest(headers, body, ui, Request.Type.GET, resource);
+  }
+
+  @GET
+  @Path("{serviceName}/components/{componentName}/hostComponents")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns the list of hosts for the given root-level service component",
+    response = RootServiceHostComponentResponseWrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY,
+      defaultValue = DEFAULT_FIELDS_ROOT_SERVICE_HOST_COMPONENT),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRootServiceComponentHosts(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @ApiParam(value = "service name", required = true) @PathParam("serviceName") String serviceName,
+    @ApiParam(value = "component name", required = true) @PathParam("componentName") String componentName
+  ) {
+    ResourceInstance resource = createHostComponentResource(serviceName, null, componentName);
+    return handleRequest(headers, body, ui, Request.Type.GET, resource);
+  }
 
-    return handleRequest(headers, body, ui, Request.Type.GET,
-      createHostComponentResource(serviceName, hostName, hostComponent));
+  protected ResourceInstance createServiceResource(String serviceName) {
+    Map<Resource.Type, String> mapIds = Collections.singletonMap(Resource.Type.RootService, serviceName);
+    return createResource(Resource.Type.RootService, mapIds);
   }
   
-  
+  protected ResourceInstance createServiceComponentResource(String serviceName, String componentName) {
+    Map<Resource.Type, String> mapIds = new HashMap<>();
+    mapIds.put(Resource.Type.RootService, serviceName);
+    mapIds.put(Resource.Type.RootServiceComponent, componentName);
+    return createResource(Resource.Type.RootServiceComponent, mapIds);
+  }
+
+  protected ResourceInstance createHostResource(String hostName) {
+    return createResource(Resource.Type.Host, Collections.singletonMap(Resource.Type.Host, hostName));
+  }
+
   protected ResourceInstance createHostComponentResource(String serviceName, String hostName, String componentName) {
-    
-    Map<Resource.Type,String> mapIds = new HashMap<>();
+    Map<Resource.Type, String> mapIds = new HashMap<>();
     mapIds.put(Resource.Type.RootService, serviceName);
     mapIds.put(Resource.Type.Host, hostName);
     mapIds.put(Resource.Type.RootServiceComponent, componentName);
-
     return createResource(Resource.Type.RootServiceHostComponent, mapIds);
   }
 
-  @GET
-  @Path("{serviceName}/components/")
-  @Produces("text/plain")
-  public Response getServiceComponents(String body, @Context HttpHeaders headers, @Context UriInfo ui,
-      @PathParam("serviceName") String serviceName) {
+  private interface RootServiceResponseWrapper extends ApiModel {
+    @ApiModelProperty(name = RootServiceResourceProvider.RESPONSE_KEY)
+    @SuppressWarnings("unused")
+    RootServiceResponse getRootServiceResponse();
+  }
 
-    return handleRequest(headers, body, ui, Request.Type.GET,
-      createServiceComponentResource(serviceName, null));
+  private interface RootServiceResponseWithComponentList extends RootServiceResponseWrapper {
+    @ApiModelProperty(name = KEY_COMPONENTS)
+    @SuppressWarnings("unused")
+    List<RootServiceComponentResponseWrapper> getComponents();
   }
-  
-  @GET
-  @Path("{serviceName}/components/{componentName}")
-  @Produces("text/plain")
-  public Response getServiceComponent(String body, @Context HttpHeaders headers, @Context UriInfo ui,
-      @PathParam("serviceName") String serviceName,
-      @PathParam("componentName") String componentName) {
 
-    return handleRequest(headers, body, ui, Request.Type.GET,
-        createServiceComponentResource(serviceName, componentName));
+  private interface RootServiceComponentResponseWrapper extends ApiModel {
+    @ApiModelProperty(name = RootServiceComponentResourceProvider.RESPONSE_KEY)
+    @SuppressWarnings("unused")
+    RootServiceComponentResponse getRootServiceComponentResponse();
   }
-  
-  protected ResourceInstance createServiceResource(String serviceName) {
-    return createResource(Resource.Type.RootService,
-        Collections.singletonMap(Resource.Type.RootService, serviceName));
+
+  private interface RootServiceComponentWithHostComponentList extends RootServiceComponentResponseWrapper {
+    @ApiModelProperty(name = KEY_HOST_COMPONENTS)
+    @SuppressWarnings("unused")
+    List<RootServiceHostComponentResponseWrapper> getHostComponents();
   }
-  
-  protected ResourceInstance createServiceComponentResource(String serviceName,
-      String componentName) {
-    
-    Map<Resource.Type,String> mapIds = new HashMap<>();
-    mapIds.put(Resource.Type.RootService, serviceName);
-    mapIds.put(Resource.Type.RootServiceComponent, componentName);
 
-    return createResource(Resource.Type.RootServiceComponent, mapIds);
+  private interface RootServiceHostComponentResponseWrapper extends ApiModel {
+    @ApiModelProperty(name = RootServiceHostComponentResourceProvider.RESPONSE_KEY)
+    @SuppressWarnings("unused")
+    RootServiceHostComponentResponse getRootServiceHostComponentResponse();
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 751ce08..4c8154e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -4839,11 +4839,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       String serviceName  = request.getServiceName();
       try {
         Set<RootServiceComponentResponse> rootServiceComponents = getRootServiceComponents(request);
-
-        for (RootServiceComponentResponse serviceComponentResponse : rootServiceComponents) {
-          serviceComponentResponse.setServiceName(serviceName);
-        }
-
         response.addAll(rootServiceComponents);
       } catch (AmbariException e) {
         if (requests.size() == 1) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceComponentResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceComponentResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceComponentResponse.java
index 4845c78..11fc0fd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceComponentResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceComponentResponse.java
@@ -15,71 +15,69 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.ambari.server.controller;
 
 import java.util.Map;
+import java.util.Objects;
+
+import org.apache.ambari.server.controller.internal.RootServiceComponentResourceProvider;
+
+import io.swagger.annotations.ApiModelProperty;
 
 public class RootServiceComponentResponse {
 
-  private String serviceName;
-  private String componentName;
-  private Map<String, String> properties;
-  private String componentVersion;
+  private final String serviceName;
+  private final String componentName;
+  private final Map<String, String> properties;
+  private final String componentVersion;
+  private final long serverClock = System.currentTimeMillis() / 1000L;
 
-  public RootServiceComponentResponse(String componentName, String componentVersion, Map<String, String> properties) {
+  public RootServiceComponentResponse(String serviceName, String componentName, String componentVersion, Map<String, String> properties) {
+    this.serviceName = serviceName;
     this.componentName = componentName;
-    this.setComponentVersion(componentVersion); 
-    this.setProperties(properties);
-    
+    this.componentVersion = componentVersion;
+    this.properties = properties;
   }
 
+  @ApiModelProperty(name = RootServiceComponentResourceProvider.SERVICE_NAME)
   public String getServiceName() {
     return serviceName;
   }
 
-  public void setServiceName(String serviceName) {
-    this.serviceName = serviceName;
-  }
-
+  @ApiModelProperty(name = RootServiceComponentResourceProvider.COMPONENT_NAME)
   public String getComponentName() {
     return componentName;
   }
 
+  @ApiModelProperty(name = RootServiceComponentResourceProvider.PROPERTIES)
   public Map<String, String> getProperties() {
     return properties;
   }
 
-  public void setProperties(Map<String, String> properties) {
-    this.properties = properties;
-  }
-  
+  @ApiModelProperty(name = RootServiceComponentResourceProvider.COMPONENT_VERSION)
   public String getComponentVersion() {
     return componentVersion;
   }
 
-  public void setComponentVersion(String componentVersion) {
-    this.componentVersion = componentVersion;
-  }
+  @ApiModelProperty(name = RootServiceComponentResourceProvider.SERVER_CLOCK)
+  public long getServerClock() { return serverClock; }
   
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
 
-    RootServiceComponentResponse that = (RootServiceComponentResponse) o;
-
-    return !(componentName != null ? !componentName.equals(that.componentName) : that.componentName != null) &&
-        !(componentVersion != null ? !componentVersion.equals(that.componentVersion) : that.componentVersion != null) &&
-        !(properties != null ? !properties.equals(that.properties) : that.properties != null);
+    RootServiceComponentResponse other = (RootServiceComponentResponse) o;
 
+    return Objects.equals(serviceName, other.serviceName) &&
+      Objects.equals(componentName, other.componentName) &&
+      Objects.equals(componentVersion, other.componentVersion) &&
+      Objects.equals(properties, other.properties);
   }
 
   @Override
   public int hashCode() {
-    int result = 31 + (componentName != null ? componentName.hashCode() : 0);
-    result += (componentVersion != null ? componentVersion.hashCode() : 0);
-    return result;
+    return Objects.hash(serviceName, componentName, componentVersion);
   }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceHostComponentResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceHostComponentResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceHostComponentResponse.java
index 6cbc30c..6f35610 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceHostComponentResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceHostComponentResponse.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -19,20 +19,25 @@
 package org.apache.ambari.server.controller;
 
 import java.util.Map;
+import java.util.Objects;
 
-public class RootServiceHostComponentResponse {
+import org.apache.ambari.server.controller.internal.RootServiceHostComponentResourceProvider;
+
+import io.swagger.annotations.ApiModelProperty;
 
-  private String serviceName;
-  private String hostName;
-  private String componentName;
-  private String componentState;
-  private String componentVersion;
-  private Map<String, String> properties;
+public class RootServiceHostComponentResponse {
 
+  private final String serviceName;
+  private final String hostName;
+  private final String componentName;
+  private final String componentState;
+  private final String componentVersion;
+  private final Map<String, String> properties;
 
-  public RootServiceHostComponentResponse(String hostName, String componentName, String componentState,
+  public RootServiceHostComponentResponse(String serviceName, String hostName, String componentName, String componentState,
       String componentVersion,
       Map<String, String> properties) {
+    this.serviceName = serviceName;
     this.hostName = hostName;
     this.componentName = componentName;
     this.componentState = componentState;
@@ -40,63 +45,54 @@ public class RootServiceHostComponentResponse {
     this.properties = properties;
   }
 
+  @ApiModelProperty(name = RootServiceHostComponentResourceProvider.SERVICE_NAME)
   public String getServiceName() {
     return serviceName;
   }
 
-  public void setServiceName(String serviceName) {
-    this.serviceName = serviceName;
-  }
-
+  @ApiModelProperty(name = RootServiceHostComponentResourceProvider.HOST_NAME)
   public String getHostName() {
     return hostName;
   }
 
+  @ApiModelProperty(name = RootServiceHostComponentResourceProvider.COMPONENT_NAME)
   public String getComponentName() {
     return componentName;
   }
 
-  public void setComponentName(String componentName) {
-    this.componentName = componentName;
+  @ApiModelProperty(name = RootServiceHostComponentResourceProvider.COMPONENT_STATE)
+  public String getComponentState() {
+    return componentState;
+  }
+
+  @ApiModelProperty(name = RootServiceHostComponentResourceProvider.COMPONENT_VERSION)
+  public String getComponentVersion() {
+    return componentVersion;
   }
 
+  @ApiModelProperty(name = RootServiceHostComponentResourceProvider.PROPERTIES)
   public Map<String, String> getProperties() {
     return properties;
   }
 
-  public void setProperties(Map<String, String> properties) {
-    this.properties = properties;
-  }
-  
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
 
-    RootServiceHostComponentResponse that = (RootServiceHostComponentResponse) o;
-
-    return !(hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) &&
-        !(componentName != null ? !componentName.equals(that.componentName) : that.componentName != null) &&
-        !(componentState != null ? !componentState.equals(that.componentState) : that.componentState != null) &&
-        !(componentVersion != null ? !componentVersion.equals(that.componentVersion) : that.componentVersion != null) &&
-        !(properties != null ? !properties.equals(that.properties) : that.properties != null);
+    RootServiceHostComponentResponse other = (RootServiceHostComponentResponse) o;
 
+    return Objects.equals(serviceName, other.serviceName) &&
+      Objects.equals(hostName, other.hostName) &&
+      Objects.equals(componentName, other.componentName) &&
+      Objects.equals(componentState, other.componentState) &&
+      Objects.equals(componentVersion, other.componentVersion) &&
+      Objects.equals(properties, other.properties);
   }
 
   @Override
   public int hashCode() {
-    int result = 31 + (hostName != null ? hostName.hashCode() : 0);
-    result = result + (componentName != null ? componentName.hashCode() : 0);
-    result = result + (componentState != null ? componentState.hashCode() : 0);
-    result = result + (componentVersion != null ? componentVersion.hashCode() : 0);
-    return result;
-  }
-
-  public String getComponentState() {
-    return componentState;
+    return Objects.hash(serviceName, hostName, componentName, componentVersion, componentState);
   }
 
-  public String getComponentVersion() {
-    return componentVersion;
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponse.java
index 736ffff..43b8950 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponse.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -18,14 +18,21 @@
 
 package org.apache.ambari.server.controller;
 
+import java.util.Objects;
+
+import org.apache.ambari.server.controller.internal.RootServiceResourceProvider;
+
+import io.swagger.annotations.ApiModelProperty;
+
 public class RootServiceResponse {
 
-  private String serviceName;
+  private final String serviceName;
 
   public RootServiceResponse(String serviceName) {
     this.serviceName = serviceName;
   }
 
+  @ApiModelProperty(name = RootServiceResourceProvider.SERVICE_NAME)
   public String getServiceName() {
     return serviceName;
   }
@@ -35,21 +42,14 @@ public class RootServiceResponse {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
 
-    RootServiceResponse that = (RootServiceResponse) o;
+    RootServiceResponse other = (RootServiceResponse) o;
 
-    if (serviceName != null ?
-        !serviceName.equals(that.serviceName) : that.serviceName != null) {
-      return false;
-    }
-    
-    return true;
+    return Objects.equals(serviceName, other.serviceName);
   }
 
   @Override
   public int hashCode() {
-    int result = 1;
-    result = 31 + (serviceName != null ? serviceName.hashCode() : 0);
-    return result;
+    return Objects.hash(serviceName);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java
index 2ceb769..714fbed 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java
@@ -84,7 +84,7 @@ public class RootServiceResponseFactory extends
   public Set<RootServiceComponentResponse> getRootServiceComponents(
       RootServiceComponentRequest request) throws ObjectNotFoundException {
     Set<RootServiceComponentResponse> response = new HashSet<>();
-    
+
     String serviceName = request.getServiceName();
     String componentName = request.getComponentName();
     Services service;
@@ -109,13 +109,13 @@ public class RootServiceResponseFactory extends
       catch (IllegalArgumentException ex) {
         throw new ObjectNotFoundException("Component name: " + componentName);
       }
-      response = Collections.singleton(new RootServiceComponentResponse(component.toString(),
+      response = Collections.singleton(new RootServiceComponentResponse(serviceName, component.toString(),
                                        getComponentVersion(componentName, null),
                                        getComponentProperties(componentName)));
     } else {
     
       for (Components component: service.getComponents())    
-        response.add(new RootServiceComponentResponse(component.toString(),
+        response.add(new RootServiceComponentResponse(serviceName, component.toString(),
                      getComponentVersion(component.name(), null),
                      getComponentProperties(component.name())));
       }
@@ -198,8 +198,10 @@ public class RootServiceResponseFactory extends
   public Set<RootServiceHostComponentResponse> getRootServiceHostComponent(RootServiceHostComponentRequest request, Set<HostResponse> hosts) throws AmbariException {
     Set<RootServiceHostComponentResponse> response = new HashSet<>();
 
-    Set<RootServiceComponentResponse> rootServiceComponents = 
-        getRootServiceComponents(new RootServiceComponentRequest(request.getServiceName(), request.getComponentName()));
+    String serviceName = request.getServiceName();
+    String componentName = request.getComponentName();
+    Set<RootServiceComponentResponse> rootServiceComponents =
+        getRootServiceComponents(new RootServiceComponentRequest(serviceName, componentName));
 
     //Cartesian product with hosts and components
     for (RootServiceComponentResponse component : rootServiceComponents) {
@@ -207,7 +209,7 @@ public class RootServiceResponseFactory extends
       Set<HostResponse> filteredHosts = new HashSet<>(hosts);
       
       //Make some filtering of hosts if need
-      if (component.getComponentName().equals(Components.AMBARI_SERVER.name()))
+      if (component.getComponentName().equals(Components.AMBARI_SERVER.name())) {
         CollectionUtils.filter(filteredHosts, new Predicate() {
           @Override
           public boolean evaluate(Object arg0) {
@@ -215,15 +217,17 @@ public class RootServiceResponseFactory extends
             return hostResponse.getHostname().equals(StageUtils.getHostName());
           }
         });
+      }
       
       for (HostResponse host : filteredHosts) {
-        
-        if (component.getComponentName().equals(Components.AMBARI_SERVER.name()))
-          response.add(new RootServiceHostComponentResponse(host.getHostname(), component.getComponentName(),
-            RUNNING_STATE, getComponentVersion(component.getComponentName(), host), component.getProperties()));
-        else
-          response.add(new RootServiceHostComponentResponse(host.getHostname(), component.getComponentName(),
-            host.getHostState().toString(), getComponentVersion(component.getComponentName(), host), component.getProperties()));
+        String state;
+        if (component.getComponentName().equals(Components.AMBARI_SERVER.name())) {
+          state = RUNNING_STATE;
+        } else {
+          state = host.getHostState().toString();
+        }
+        String componentVersion = getComponentVersion(componentName, host);
+        response.add(new RootServiceHostComponentResponse(serviceName, host.getHostname(), componentName, state, componentVersion, component.getProperties()));
       }
     }
     

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
index 8a78911..747aac3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
@@ -73,6 +73,7 @@ import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.ImmutableSet;
 import com.google.inject.Inject;
 import com.google.inject.assistedinject.Assisted;
 import com.google.inject.assistedinject.AssistedInject;
@@ -88,6 +89,7 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
 
   // Hosts
   public static final String RESPONSE_KEY = "Hosts";
+  public static final String ALL_PROPERTIES = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "*";
 
   public static final String CLUSTER_NAME_PROPERTY_ID = "cluster_name";
   public static final String CPU_COUNT_PROPERTY_ID = "cpu_count";
@@ -145,9 +147,7 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
   protected static final String FORCE_DELETE_COMPONENTS = "force_delete_components";
 
 
-  private static Set<String> pkPropertyIds =
-    new HashSet<>(Arrays.asList(new String[]{
-      HOST_HOST_NAME_PROPERTY_ID}));
+  private static final Set<String> PK_PROPERTY_IDS = ImmutableSet.of(HOST_HOST_NAME_PROPERTY_ID);
 
   @Inject
   private OsFamily osFamily;
@@ -358,7 +358,7 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return PK_PROPERTY_IDS;
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProvider.java
index fe95210..1397182 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProvider.java
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
@@ -39,26 +38,26 @@ import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 
-public class RootServiceComponentResourceProvider extends
-    ReadOnlyResourceProvider {
-  
-  public static final String SERVICE_NAME_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootServiceComponents", "service_name");
-  
-  public static final String COMPONENT_NAME_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootServiceComponents", "component_name");
-  
-  public static final String COMPONENT_VERSION_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootServiceComponents", "component_version");
-  
-  public static final String PROPERTIES_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootServiceComponents", "properties");
-  
-  public static final String PROPERTIES_SERVER_CLOCK = PropertyHelper
-      .getPropertyId("RootServiceComponents", "server_clock");
-  
-  private Set<String> pkPropertyIds = new HashSet<>(
-    Arrays.asList(new String[]{SERVICE_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID}));
+import com.google.common.collect.ImmutableSet;
+
+public class RootServiceComponentResourceProvider extends ReadOnlyResourceProvider {
+
+  public static final String RESPONSE_KEY = "RootServiceComponents";
+  public static final String ALL_PROPERTIES = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "*";
+
+  public static final String SERVICE_NAME = "service_name";
+  public static final String COMPONENT_NAME = "component_name";
+  public static final String COMPONENT_VERSION = "component_version";
+  public static final String PROPERTIES = "properties";
+  public static final String SERVER_CLOCK = "server_clock";
+
+  public static final String SERVICE_NAME_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + SERVICE_NAME;
+  public static final String COMPONENT_NAME_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + COMPONENT_NAME;
+  public static final String COMPONENT_VERSION_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + COMPONENT_VERSION;
+  public static final String PROPERTIES_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + PROPERTIES;
+  public static final String SERVER_CLOCK_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + SERVER_CLOCK;
+
+  private static final Set<String> PK_PROPERTY_IDS = ImmutableSet.of(SERVICE_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID);
 
   protected RootServiceComponentResourceProvider(Set<String> propertyIds,
       Map<Type, String> keyPropertyIds,
@@ -95,21 +94,13 @@ public class RootServiceComponentResourceProvider extends
     for (RootServiceComponentResponse response : responses) {
       Resource resource = new ResourceImpl(Resource.Type.RootServiceComponent);
 
-      setResourceProperty(resource, SERVICE_NAME_PROPERTY_ID,
-          response.getServiceName(), requestedIds);
-      
-      setResourceProperty(resource, COMPONENT_NAME_PROPERTY_ID,
-          response.getComponentName(), requestedIds);
-      
-      setResourceProperty(resource, PROPERTIES_PROPERTY_ID,
-          response.getProperties(), requestedIds);
-      
-      setResourceProperty(resource, COMPONENT_VERSION_PROPERTY_ID,
-          response.getComponentVersion(), requestedIds);
+      setResourceProperty(resource, SERVICE_NAME_PROPERTY_ID, response.getServiceName(), requestedIds);
+      setResourceProperty(resource, COMPONENT_NAME_PROPERTY_ID, response.getComponentName(), requestedIds);
+      setResourceProperty(resource, PROPERTIES_PROPERTY_ID, response.getProperties(), requestedIds);
+      setResourceProperty(resource, COMPONENT_VERSION_PROPERTY_ID, response.getComponentVersion(), requestedIds);
       
-      if(response.getComponentName().equals(Components.AMBARI_SERVER.name())){
-        setResourceProperty(resource, PROPERTIES_SERVER_CLOCK,
-            System.currentTimeMillis() / 1000L, requestedIds);
+      if (Components.AMBARI_SERVER.name().equals(response.getComponentName())) {
+        setResourceProperty(resource, SERVER_CLOCK_PROPERTY_ID, response.getServerClock(), requestedIds);
       }      
 
       resources.add(resource);
@@ -125,7 +116,7 @@ public class RootServiceComponentResourceProvider extends
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return PK_PROPERTY_IDS;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceHostComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceHostComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceHostComponentResourceProvider.java
index d5c33c1..591f984 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceHostComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceHostComponentResourceProvider.java
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
@@ -40,26 +39,27 @@ import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 
-public class RootServiceHostComponentResourceProvider extends
-    ReadOnlyResourceProvider {
-  
-  public static final String SERVICE_NAME_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootServiceHostComponents", "service_name");
-  public static final String HOST_NAME_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootServiceHostComponents", "host_name");
-  public static final String COMPONENT_NAME_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootServiceHostComponents", "component_name");
-  public static final String COMPONENT_VERSION_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootServiceHostComponents", "component_version");
-  public static final String COMPONENT_STATE_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootServiceHostComponents", "component_state");
-  public static final String PROPERTIES_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootServiceHostComponents", "properties");
-  
-  
-  private Set<String> pkPropertyIds = new HashSet<>(
-    Arrays.asList(new String[]{SERVICE_NAME_PROPERTY_ID, HOST_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID}));
+import com.google.common.collect.ImmutableSet;
+
+public class RootServiceHostComponentResourceProvider extends ReadOnlyResourceProvider {
+
+  public static final String RESPONSE_KEY = "RootServiceHostComponents";
 
+  public static final String SERVICE_NAME = "service_name";
+  public static final String HOST_NAME = "host_name";
+  public static final String COMPONENT_NAME = "component_name";
+  public static final String COMPONENT_VERSION = "component_version";
+  public static final String COMPONENT_STATE = "component_state";
+  public static final String PROPERTIES = "properties";
+
+  public static final String SERVICE_NAME_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + SERVICE_NAME;
+  public static final String HOST_NAME_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + HOST_NAME;
+  public static final String COMPONENT_NAME_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + COMPONENT_NAME;
+  public static final String COMPONENT_VERSION_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + COMPONENT_VERSION;
+  public static final String COMPONENT_STATE_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + COMPONENT_STATE;
+  public static final String PROPERTIES_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + PROPERTIES;
+
+  private static final Set<String> PK_PROPERTY_IDS = ImmutableSet.of(SERVICE_NAME_PROPERTY_ID, HOST_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID);
 
   public RootServiceHostComponentResourceProvider(Set<String> propertyIds,
       Map<Type, String> keyPropertyIds,
@@ -97,23 +97,12 @@ public class RootServiceHostComponentResourceProvider extends
     for (RootServiceHostComponentResponse response : responses) {
       Resource resource = new ResourceImpl(Resource.Type.RootServiceHostComponent);
 
-      setResourceProperty(resource, SERVICE_NAME_PROPERTY_ID,
-          response.getServiceName(), requestedIds);
-      
-      setResourceProperty(resource, HOST_NAME_PROPERTY_ID,
-          response.getHostName(), requestedIds);
-      
-      setResourceProperty(resource, COMPONENT_NAME_PROPERTY_ID,
-          response.getComponentName(), requestedIds);
-      
-      setResourceProperty(resource, COMPONENT_STATE_PROPERTY_ID,
-          response.getComponentState(), requestedIds);
-      
-      setResourceProperty(resource, COMPONENT_VERSION_PROPERTY_ID,
-          response.getComponentVersion(), requestedIds);
-      
-      setResourceProperty(resource, PROPERTIES_PROPERTY_ID,
-          response.getProperties(), requestedIds);
+      setResourceProperty(resource, SERVICE_NAME_PROPERTY_ID, response.getServiceName(), requestedIds);
+      setResourceProperty(resource, HOST_NAME_PROPERTY_ID, response.getHostName(), requestedIds);
+      setResourceProperty(resource, COMPONENT_NAME_PROPERTY_ID, response.getComponentName(), requestedIds);
+      setResourceProperty(resource, COMPONENT_STATE_PROPERTY_ID, response.getComponentState(), requestedIds);
+      setResourceProperty(resource, COMPONENT_VERSION_PROPERTY_ID, response.getComponentVersion(), requestedIds);
+      setResourceProperty(resource, PROPERTIES_PROPERTY_ID, response.getProperties(), requestedIds);
 
       resources.add(resource);
     }
@@ -129,7 +118,7 @@ public class RootServiceHostComponentResourceProvider extends
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
+    return PK_PROPERTY_IDS;
   }
 
   // Get the root service host components for the given set of requests
@@ -137,13 +126,8 @@ public class RootServiceHostComponentResourceProvider extends
       Set<RootServiceHostComponentRequest> requests) throws AmbariException {
     Set<RootServiceHostComponentResponse> response = new HashSet<>();
     for (RootServiceHostComponentRequest request : requests) {
-      String serviceName = request.getServiceName();
       try {
         Set<RootServiceHostComponentResponse> rootServiceHostComponents = getRootServiceHostComponents(request);
-        for (RootServiceHostComponentResponse rootServiceHostComponentResponse : rootServiceHostComponents ) {
-          rootServiceHostComponentResponse.setServiceName(serviceName);
-        }
-
         response.addAll(rootServiceHostComponents);
       } catch (AmbariException e) {
         if (requests.size() == 1) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceResourceProvider.java
index 80f720c..f967443 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceResourceProvider.java
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.controller.internal;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Map;
@@ -38,13 +37,15 @@ import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 
+import com.google.common.collect.ImmutableSet;
+
 public class RootServiceResourceProvider extends ReadOnlyResourceProvider {
-  
-  public static final String SERVICE_NAME_PROPERTY_ID = PropertyHelper
-      .getPropertyId("RootService", "service_name");
 
-  private Set<String> pkPropertyIds = new HashSet<>(
-    Arrays.asList(new String[]{SERVICE_NAME_PROPERTY_ID}));
+  public static final String RESPONSE_KEY = "RootService";
+  public static final String SERVICE_NAME = "service_name";
+  public static final String SERVICE_NAME_PROPERTY_ID = RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + SERVICE_NAME;
+
+  private static final Set<String> PK_PROPERTY_IDS = ImmutableSet.of(SERVICE_NAME_PROPERTY_ID);
 
   protected RootServiceResourceProvider(Set<String> propertyIds,
       Map<Type, String> keyPropertyIds,
@@ -80,10 +81,7 @@ public class RootServiceResourceProvider extends ReadOnlyResourceProvider {
 
     for (RootServiceResponse response : responses) {
       Resource resource = new ResourceImpl(Resource.Type.RootService);
-
-      setResourceProperty(resource, SERVICE_NAME_PROPERTY_ID,
-          response.getServiceName(), requestedIds);
-
+      setResourceProperty(resource, SERVICE_NAME_PROPERTY_ID, response.getServiceName(), requestedIds);
       resources.add(resource);
     }
 
@@ -96,7 +94,7 @@ public class RootServiceResourceProvider extends ReadOnlyResourceProvider {
 
   @Override
   protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds ;
+    return PK_PROPERTY_IDS;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java
index 64898c8..90725f7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java
@@ -42,31 +42,31 @@ public class RootServiceServiceTest extends BaseServiceTest {
     
     //getServices
     RootServiceService service = new TestRootServiceService(null, null, null);
-    Method m = service.getClass().getMethod("getServices", String.class, HttpHeaders.class, UriInfo.class);
+    Method m = service.getClass().getMethod("getRootServices", String.class, HttpHeaders.class, UriInfo.class);
     Object[] args = new Object[] {null, getHttpHeaders(), getUriInfo()};
     listInvocations.add(new ServiceTestInvocation(Request.Type.GET, service, m, args, null));
     
     //getService
     service = new TestRootServiceService("AMBARI", null, null);
-    m = service.getClass().getMethod("getService", String.class, HttpHeaders.class, UriInfo.class, String.class);
+    m = service.getClass().getMethod("getRootService", String.class, HttpHeaders.class, UriInfo.class, String.class);
     args = new Object[] {null, getHttpHeaders(), getUriInfo(), "AMBARI"};
     listInvocations.add(new ServiceTestInvocation(Request.Type.GET, service, m, args, null));
     
     //getServiceComponents
     service = new TestRootServiceService("AMBARI", null, null);
-    m = service.getClass().getMethod("getServiceComponents", String.class, HttpHeaders.class, UriInfo.class, String.class);
+    m = service.getClass().getMethod("getRootServiceComponents", String.class, HttpHeaders.class, UriInfo.class, String.class);
     args = new Object[] {null, getHttpHeaders(), getUriInfo(), "AMBARI"};
     listInvocations.add(new ServiceTestInvocation(Request.Type.GET, service, m, args, null));
     
     //getServiceComponent
     service = new TestRootServiceService("AMBARI", "AMBARI_SERVER", null);
-    m = service.getClass().getMethod("getServiceComponent", String.class, HttpHeaders.class, UriInfo.class, String.class, String.class);
+    m = service.getClass().getMethod("getRootServiceComponent", String.class, HttpHeaders.class, UriInfo.class, String.class, String.class);
     args = new Object[] {null, getHttpHeaders(), getUriInfo(), "AMBARI", "AMBARI_SERVER"};
     listInvocations.add(new ServiceTestInvocation(Request.Type.GET, service, m, args, null));
     
     //getRootHostComponents
     service = new TestRootServiceService("AMBARI", "AMBARI_SERVER", null);
-    m = service.getClass().getMethod("getRootHostComponents", String.class, HttpHeaders.class, UriInfo.class, String.class, String.class);
+    m = service.getClass().getMethod("getRootServiceComponentHosts", String.class, HttpHeaders.class, UriInfo.class, String.class, String.class);
     args = new Object[] {null, getHttpHeaders(), getUriInfo(), "AMBARI", "AMBARI_SERVER"};
     listInvocations.add(new ServiceTestInvocation(Request.Type.GET, service, m, args, null));
     
@@ -125,7 +125,6 @@ public class RootServiceServiceTest extends BaseServiceTest {
       return getTestResource();
     }
     
-    
     @Override
     RequestFactory getRequestFactory() {
       return getTestRequestFactory();

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/test/java/org/apache/ambari/server/controller/RootServiceResponseFactoryTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/RootServiceResponseFactoryTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/RootServiceResponseFactoryTest.java
index e9b4aa7..e36077f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/RootServiceResponseFactoryTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/RootServiceResponseFactoryTest.java
@@ -109,8 +109,7 @@ public class RootServiceResponseFactoryTest {
     RootServiceResponseFactory.Components ambariServerComponent = RootServiceResponseFactory.Components.AMBARI_SERVER;
 
     // Request null service name, not-null component name
-    request = new RootServiceComponentRequest(null,
-        ambariServerComponent.name());
+    request = new RootServiceComponentRequest(null, ambariServerComponent.name());
 
     try {
       rootServiceComponents = responseFactory.getRootServiceComponents(request);
@@ -119,8 +118,8 @@ public class RootServiceResponseFactoryTest {
     }
 
     // Request existent service name, null component name
-    request = new RootServiceComponentRequest(
-        RootServiceResponseFactory.Services.AMBARI.name(), null);
+    String serviceName = RootServiceResponseFactory.Services.AMBARI.name();
+    request = new RootServiceComponentRequest(serviceName, null);
 
     rootServiceComponents = responseFactory.getRootServiceComponents(request);
     assertEquals(
@@ -142,7 +141,7 @@ public class RootServiceResponseFactoryTest {
         }
       } else {
         assertTrue(rootServiceComponents.contains(new RootServiceComponentResponse(
-            component.name(), RootServiceResponseFactory.NOT_APPLICABLE,
+            serviceName, component.name(), RootServiceResponseFactory.NOT_APPLICABLE,
             Collections.<String, String> emptyMap())));
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/228b9289/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProviderTest.java
index eb6f08e..f60f982 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProviderTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -25,6 +25,7 @@ import static org.easymock.EasyMock.verify;
 
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.ambari.server.controller.AmbariManagementController;
@@ -50,13 +51,15 @@ public class RootServiceComponentResourceProviderTest {
     AmbariManagementController managementController = createMock(AmbariManagementController.class);
 
     Set<RootServiceComponentResponse> allResponse = new HashSet<>();
-    allResponse.add(new RootServiceComponentResponse("component1", "1.1.1", Collections.<String,String>emptyMap()));
-    allResponse.add(new RootServiceComponentResponse("component2", "1.1.1", Collections.<String,String>emptyMap()));
-    allResponse.add(new RootServiceComponentResponse("component3", "1.1.1", Collections.<String,String>emptyMap()));
-    allResponse.add(new RootServiceComponentResponse(RootServiceResponseFactory.Components.AMBARI_SERVER.name(), "1.1.1", Collections.<String,String>emptyMap()));
+    String serviceName = RootServiceResponseFactory.Services.AMBARI.name();
+    Map<String, String> emptyMap = Collections.emptyMap();
+    allResponse.add(new RootServiceComponentResponse(serviceName, "component1", "1.1.1", emptyMap));
+    allResponse.add(new RootServiceComponentResponse(serviceName, "component2", "1.1.1", emptyMap));
+    allResponse.add(new RootServiceComponentResponse(serviceName, "component3", "1.1.1", emptyMap));
+    allResponse.add(new RootServiceComponentResponse(serviceName, RootServiceResponseFactory.Components.AMBARI_SERVER.name(), "1.1.1", emptyMap));
 
     Set<RootServiceComponentResponse> nameResponse = new HashSet<>();
-    nameResponse.add(new RootServiceComponentResponse("component4", "1.1.1", Collections.<String,String>emptyMap()));
+    nameResponse.add(new RootServiceComponentResponse(serviceName, "component4", "1.1.1", emptyMap));
 
 
     // set expectations
@@ -77,7 +80,7 @@ public class RootServiceComponentResourceProviderTest {
     propertyIds.add(RootServiceComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID);
     propertyIds.add(RootServiceComponentResourceProvider.PROPERTIES_PROPERTY_ID);
     propertyIds.add(RootServiceComponentResourceProvider.COMPONENT_VERSION_PROPERTY_ID);
-    propertyIds.add(RootServiceComponentResourceProvider.PROPERTIES_SERVER_CLOCK);
+    propertyIds.add(RootServiceComponentResourceProvider.SERVER_CLOCK_PROPERTY_ID);
 
     // create the request
     Request request = PropertyHelper.getReadRequest(propertyIds);
@@ -89,14 +92,14 @@ public class RootServiceComponentResourceProviderTest {
     for (Resource resource : resources) {
       String componentName = (String) resource.getPropertyValue(RootServiceComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID);
       String componentVersion = (String) resource.getPropertyValue(RootServiceComponentResourceProvider.COMPONENT_VERSION_PROPERTY_ID);
-      Long server_clock = (Long) resource.getPropertyValue(RootServiceComponentResourceProvider.PROPERTIES_SERVER_CLOCK);
+      Long server_clock = (Long) resource.getPropertyValue(RootServiceComponentResourceProvider.SERVER_CLOCK_PROPERTY_ID);
       if (componentName.equals(RootServiceResponseFactory.Components.AMBARI_SERVER.name())){
         Assert.assertNotNull(server_clock);
       } else {
         Assert.assertNull(server_clock);
       }
       
-      Assert.assertTrue(allResponse.contains(new RootServiceComponentResponse(componentName, componentVersion, Collections.<String,String>emptyMap())));
+      Assert.assertTrue(allResponse.contains(new RootServiceComponentResponse(serviceName, componentName, componentVersion, emptyMap)));
     }
 
     // get service named service4


Mime
View raw message