yuanzac commented on a change in pull request #133: SUBMARINE-324. Submarine
cluster status RESTful
URL: https://github.com/apache/submarine/pull/133#discussion_r361627316
##########
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:
I'm not sure if we need to run testGetClusterNodes() again. As
testGetClusterNode calls getClusterNodes and it contains assertion like
"assertEquals(listNodes.size(), 1);"
----------------------------------------------------------------
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]