@Test public void testJsonToMap() { String jsonStr = "{\"username\":\"admin\",\"password\":\"admin\",\"fs.default.name\":\"defaultnamevalue\",\"hadoop.security.authorization\":\"authvalue\",\"hadoop.security.authentication\":\"authenticationvalue\",\"hadoop.security.auth_to_local\":\"localvalue\",\"dfs.datanode.kerberos.principal\":\"principalvalue\",\"dfs.namenode.kerberos.principal\":\"namenodeprincipalvalue\",\"dfs.secondary.namenode.kerberos.principal\":\"secprincipalvalue\",\"commonNameForCertificate\":\"certificatevalue\"}"; Map<String, String> dbMap = jsonUtil.jsonToMap(jsonStr); Assert.assertNotNull(dbMap); }
public Map<String, String> jsonToMap(String jsonStr) { try { return JsonUtilsV2.jsonToMap(jsonStr); } catch (Exception e) { throw restErrorUtil.createRESTException( "Invalid input data: " + e.getMessage(), MessageEnums.INVALID_INPUT_DATA); } }
JSONUtil { public Map<String, String> jsonToMap(String jsonStr) { try { return JsonUtilsV2.jsonToMap(jsonStr); } catch (Exception e) { throw restErrorUtil.createRESTException( "Invalid input data: " + e.getMessage(), MessageEnums.INVALID_INPUT_DATA); } } }
JSONUtil { public Map<String, String> jsonToMap(String jsonStr) { try { return JsonUtilsV2.jsonToMap(jsonStr); } catch (Exception e) { throw restErrorUtil.createRESTException( "Invalid input data: " + e.getMessage(), MessageEnums.INVALID_INPUT_DATA); } }  }
JSONUtil { public Map<String, String> jsonToMap(String jsonStr) { try { return JsonUtilsV2.jsonToMap(jsonStr); } catch (Exception e) { throw restErrorUtil.createRESTException( "Invalid input data: " + e.getMessage(), MessageEnums.INVALID_INPUT_DATA); } }  File writeJsonToFile(ViewBaseBean viewBean, String fileName); Map<String, String> jsonToMap(String jsonStr); String readMapToString(Map<?, ?> map); String readListToString(List<?> list); String writeObjectAsString(Serializable obj); T writeJsonToJavaObject(String json, Class<T> tClass); }
JSONUtil { public Map<String, String> jsonToMap(String jsonStr) { try { return JsonUtilsV2.jsonToMap(jsonStr); } catch (Exception e) { throw restErrorUtil.createRESTException( "Invalid input data: " + e.getMessage(), MessageEnums.INVALID_INPUT_DATA); } }  File writeJsonToFile(ViewBaseBean viewBean, String fileName); Map<String, String> jsonToMap(String jsonStr); String readMapToString(Map<?, ?> map); String readListToString(List<?> list); String writeObjectAsString(Serializable obj); T writeJsonToJavaObject(String json, Class<T> tClass);  }