diff options
author | Kanagaraj Manickam <kanagaraj.manickam@huawei.com> | 2020-03-05 06:35:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-05 06:35:52 +0000 |
commit | 7fd4e74500eaf8d684f615495f7debddc146b888 (patch) | |
tree | 188e48cdf8dae87a820fd5688a74e6123d501fbc /framework/src | |
parent | ee6c134312bff3506f4f7eca695dad7d0dfec2d9 (diff) | |
parent | cf1ab5db1033e403dfc839d5fbbe0580be1d497b (diff) |
Merge "Resolved JsonElement issue for grpc server and other classes"
Diffstat (limited to 'framework/src')
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java | 6 | ||||
-rw-r--r-- | framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java | 4 |
2 files changed, 3 insertions, 7 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java index c4be02e3..8d707906 100644 --- a/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java +++ b/framework/src/main/java/org/onap/cli/fw/output/print/OnapCommandPrint.java @@ -31,8 +31,7 @@ import org.apache.commons.csv.CSVPrinter; import org.onap.cli.fw.error.OnapCommandOutputPrintingFailed; import org.onap.cli.fw.output.OnapCommandPrintDirection; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import com.google.gson.JsonParser; import net.minidev.json.JSONArray; import net.minidev.json.JSONObject; @@ -43,7 +42,6 @@ import net.minidev.json.JSONValue; */ public class OnapCommandPrint { - private static Gson gson = new GsonBuilder().serializeNulls().create(); public static final int MAX_COLUMN_LENGTH = 50; @@ -273,7 +271,7 @@ public class OnapCommandPrint { array.add(rowO); } try { - return gson.toJson(array.toJSONString()).toString(); + return new JsonParser().parse(array.toJSONString()).toString(); } catch (Exception e) { // NOSONAR // TODO Auto-generated catch block return array.toJSONString(); diff --git a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java index 97fc9e01..d5d04888 100644 --- a/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java +++ b/framework/src/test/java/org/onap/cli/fw/output/OnapCommandResultTest.java @@ -32,7 +32,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; public class OnapCommandResultTest { - private static Gson gson = new GsonBuilder().serializeNulls().create(); @Test @Ignore @@ -230,10 +229,9 @@ public class OnapCommandResultTest { res.setRecords(list); res.setScope(OnapCommandResultAttributeScope.LONG); res.setType(OnapCommandResultType.JSON); - String result = res.print(); String expRes="[{\"param\":{\"id\":\"0001\",\"value\":\"result\"}}]"; - assertEquals(gson.toJson(expRes),result); + assertEquals(expRes,result); } } |