smolnar82 commented on a change in pull request #296: KNOX-2240 - KnoxShell 
Custom Command for WEBHDFS Use
URL: https://github.com/apache/knox/pull/296#discussion_r396274308
 
 

 ##########
 File path: 
gateway-util-common/src/test/java/org/apache/knox/gateway/util/JsonUtilsTest.java
 ##########
 @@ -54,4 +55,46 @@ public void testGetMapFromString() {
     assertEquals("Bearer", map.get("token_type"));
     assertEquals("1364487943100", map.get("expires_in"));
   }
+
+  @Test
+  public void testFileStatusesAsMap() {
+    String json = "{\n" +
+      "   \"FileStatuses\":{\n" +
+      "      \"FileStatus\":[\n" +
+      "         {\n" +
+      "            \"accessTime\":0,\n" +
+      "            \"blockSize\":0,\n" +
+      "            \"childrenNum\":3,\n" +
+      "            \"fileId\":16389,\n" +
+      "            \"group\":\"supergroup\",\n" +
+      "            \"length\":0,\n" +
+      "            \"modificationTime\":1581578495905,\n" +
+      "            \"owner\":\"hdfs\",\n" +
+      "            \"pathSuffix\":\"tmp\",\n" +
+      "            \"permission\":\"1777\",\n" +
+      "            \"replication\":0,\n" +
+      "            \"storagePolicy\":0,\n" +
+      "            \"type\":\"DIRECTORY\"\n" +
+      "         },\n" +
+      "         {\n" +
+      "            \"accessTime\":0,\n" +
+      "            \"blockSize\":0,\n" +
+      "            \"childrenNum\":658,\n" +
+      "            \"fileId\":16386,\n" +
+      "            \"group\":\"supergroup\",\n" +
+      "            \"length\":0,\n" +
+      "            \"modificationTime\":1581578527580,\n" +
+      "            \"owner\":\"hdfs\",\n" +
+      "            \"pathSuffix\":\"user\",\n" +
+      "            \"permission\":\"755\",\n" +
+      "            \"replication\":0,\n" +
+      "            \"storagePolicy\":0,\n" +
+      "            \"type\":\"DIRECTORY\"\n" +
+      "          } \n" +
+      "       ]\n" +
+      "   }\n" +
+      "}";
+    Map<String,HashMap<String, ArrayList<HashMap<String, String>>>> map = 
JsonUtils.getFileStatusesAsMap(json);
+    assertNotNull(map);
+  }
 
 Review comment:
   nit: some more asserts to place here to see if the generated map has the 
proper content?

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

Reply via email to