liuxunorg commented on a change in pull request #133: SUBMARINE-324. Submarine 
cluster status RESTful
URL: https://github.com/apache/submarine/pull/133#discussion_r361647349
 
 

 ##########
 File path: 
submarine-server/server-core/src/test/java/org/apache/submarine/server/SubmarineServerClusterTest.java
 ##########
 @@ -104,4 +118,82 @@ public void testGetServerClusterMeta() {
     assertEquals(hashMap.size(), 1);
     LOG.info("SubmarineServerClusterTest::testGetServerClusterMeta <<<");
   }
+
+  @Test
+  public void testGetClusterAddress() throws IOException {
+    GetMethod response = httpGet("/api/" + RestConstants.V1 + "/"
+        + RestConstants.CLUSTER + "/" + RestConstants.ADDRESS);
+    LOG.info(response.toString());
+
+    String requestBody = response.getResponseBodyAsString();
+    LOG.info(requestBody);
+
+    Type type = new TypeToken<JsonResponse<List<String>>>() {}.getType();
+    Gson gson = new Gson();
+    JsonResponse<List<String>> jsonResponse = gson.fromJson(requestBody, type);
+    LOG.info(jsonResponse.getResult().toString());
+    assertEquals(jsonResponse.getCode(), Response.Status.OK.getStatusCode());
+
+    List<String> listAddr = jsonResponse.getResult();
+    LOG.info("listAddr.size = {}", listAddr.size());
+    assertEquals(listAddr.size(), 1);
+  }
+
+  private ArrayList<HashMap<String, Object>> getClusterNodes() throws 
IOException {
+    GetMethod response = httpGet("/api/" + RestConstants.V1 + "/"
+        + RestConstants.CLUSTER + "/" + RestConstants.NODES);
+    LOG.info(response.toString());
+
+    String requestBody = response.getResponseBodyAsString();
+    LOG.info(requestBody);
+
+    Type type = new TypeToken<JsonResponse<ArrayList<HashMap<String, 
Object>>>>() {}.getType();
+    Gson gson = new Gson();
+    JsonResponse<ArrayList<HashMap<String, Object>>> jsonResponse = 
gson.fromJson(requestBody, type);
+    LOG.info(jsonResponse.getResult().toString());
+    assertEquals(jsonResponse.getCode(), Response.Status.OK.getStatusCode());
+
+    ArrayList<HashMap<String, Object>> listNodes = jsonResponse.getResult();
+    LOG.info("listNodes.size = {}", listNodes.size());
+    assertEquals(listNodes.size(), 1);
+
+    return listNodes;
+  }
+
+  @Test
+  public void testGetClusterNodes() throws IOException {
 
 Review comment:
   SubmarineServerClusterTest.java has only one submarine server node, so it 
will always only return 1 through the RESTful interface

----------------------------------------------------------------
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]


With regards,
Apache Git Services

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

Reply via email to