aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2021-09-29 18:29:04 +0000
committerGerrit Code Review <gerrit@onap.org>2021-09-29 18:29:04 +0000
commit116f692ed073a0785785222c6ecb67d3543ffca2 (patch)
tree2ef988d2487da240f0533bc5ae511eebeff5b09e
parent790f8caea5a9d862005951a86ef45ebd47d2b1f3 (diff)
parent9239e962d4c4502e2e77e7dea66ddfafb6fda43d (diff)
Merge "Add Instant Serializer/deserializer"
-rw-r--r--runtime/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java10
-rw-r--r--runtime/src/test/resources/http-cache/example/policy/pap/v1/pdps/.file40
2 files changed, 43 insertions, 7 deletions
diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java b/runtime/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java
index 909b240fb..7093952be 100644
--- a/runtime/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java
+++ b/runtime/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2018-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,12 +40,16 @@ public class JsonUtils {
protected static final Logger logger = LoggerFactory.getLogger(JsonUtils.class);
- public static final Gson GSON = new GsonBuilder().setPrettyPrinting()
+ public static final Gson GSON = new GsonBuilder()
+ .registerTypeAdapter(Instant.class, new InstantSerializer())
+ .registerTypeAdapter(Instant.class, new InstantDeserializer())
+ .setPrettyPrinting()
.registerTypeAdapter(SecureServicePermission.class, new SecureServicePermissionDeserializer()).create();
- public static final Gson GSON_JPA_MODEL = new GsonBuilder().setPrettyPrinting()
+ public static final Gson GSON_JPA_MODEL = new GsonBuilder()
.registerTypeAdapter(Instant.class, new InstantSerializer())
.registerTypeAdapter(Instant.class, new InstantDeserializer()).setPrettyPrinting()
+ .setPrettyPrinting()
.excludeFieldsWithoutExposeAnnotation().create();
private JsonUtils() {
diff --git a/runtime/src/test/resources/http-cache/example/policy/pap/v1/pdps/.file b/runtime/src/test/resources/http-cache/example/policy/pap/v1/pdps/.file
index 467409f47..8b75fc216 100644
--- a/runtime/src/test/resources/http-cache/example/policy/pap/v1/pdps/.file
+++ b/runtime/src/test/resources/http-cache/example/policy/pap/v1/pdps/.file
@@ -8,7 +8,15 @@
{
"currentInstanceCount": 0,
"desiredInstanceCount": 1,
- "pdpInstances": [],
+ "pdpInstances": [
+ {
+ "instanceId": "controlloop-f8287777-5f3e-4f0f-b21b-d8829c93f57b",
+ "pdpState": "ACTIVE",
+ "healthy": "HEALTHY",
+ "message": "Pdp Heartbeat",
+ "lastUpdate": "2021-09-29T02:51:21Z"
+ }
+ ],
"pdpType": "apex",
"policies": [
{
@@ -31,7 +39,15 @@
{
"currentInstanceCount": 0,
"desiredInstanceCount": 1,
- "pdpInstances": [],
+ "pdpInstances": [
+ {
+ "instanceId": "drools-f8287777-5f3e-4f0f-b21b-d8829c93f57b",
+ "pdpState": "ACTIVE",
+ "healthy": "HEALTHY",
+ "message": "Pdp Heartbeat",
+ "lastUpdate": "2021-09-29T02:51:21Z"
+ }
+ ],
"pdpType": "drools",
"policies": [
{
@@ -54,7 +70,15 @@
{
"currentInstanceCount": 0,
"desiredInstanceCount": 1,
- "pdpInstances": [],
+ "pdpInstances": [
+ {
+ "instanceId": "xacml-f8287777-5f3e-4f0f-b21b-d8829c93f57b",
+ "pdpState": "ACTIVE",
+ "healthy": "HEALTHY",
+ "message": "Pdp Heartbeat",
+ "lastUpdate": "2021-09-29T02:51:21Z"
+ }
+ ],
"pdpType": "xacml",
"policies": [],
"properties": {},
@@ -76,7 +100,15 @@
{
"currentInstanceCount": 0,
"desiredInstanceCount": 1,
- "pdpInstances": [],
+ "pdpInstances": [
+ {
+ "instanceId": "monitoring-f8287777-5f3e-4f0f-b21b-d8829c93f57b",
+ "pdpState": "ACTIVE",
+ "healthy": "HEALTHY",
+ "message": "Pdp Heartbeat",
+ "lastUpdate": "2021-09-29T02:51:21Z"
+ }
+ ],
"pdpType": "xacml",
"policies": [
{