pkuwm commented on a change in pull request #1416:
URL: https://github.com/apache/helix/pull/1416#discussion_r500718509



##########
File path: 
helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java
##########
@@ -125,6 +126,93 @@ public void testGetClusterTopology() {
   }
 
   @Test(dependsOnMethods = "testGetClusterTopology")
+  public void testGetClusterTopologyAndFaultZoneMap() throws IOException {

Review comment:
       It'd be more complete if the bad response is also tested. We don't 
always have good response. Eg. the cluster is not setup -> Error 400 bad 
request.

##########
File path: 
helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ClusterAccessor.java
##########
@@ -442,6 +442,42 @@ public Response getClusterTopology(@PathParam("clusterId") 
String clusterId) thr
     return OK(objectMapper.writeValueAsString(clusterTopology));
   }
 
+  @ResponseMetered(name = HttpConstants.READ_REQUEST)
+  @Timed(name = HttpConstants.READ_REQUEST)
+  @GET
+  @Path("{clusterId}/topologymap")
+  public Response getClusterTopologyMap(@PathParam("clusterId") String 
clusterId) {
+    HelixAdmin admin = getHelixAdmin();
+    Map<String, List<String>> topologyMap;
+    try {
+      topologyMap = admin.getClusterTopology(clusterId).getTopologyMap();
+    } catch (HelixException ex) {
+      return badRequest(ex.getMessage());
+    } catch (Exception ex) {
+      LOG.error("Failed to get cluster topology map from cluster {}.", 
clusterId, ex);
+      return serverError(ex);

Review comment:
       This `serverError` actually is not needed, because jersey framework will 
handle it. If there is any exception that is not handled, it'll return server 
error 500. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to