summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sebastien.determe@intl.att.com>2019-05-24 12:01:05 +0200
committerDeterme, Sebastien (sd378r) <sebastien.determe@intl.att.com>2019-05-24 12:01:05 +0200
commit3b48f829b1325fa6675b8981c119d822a5ea1b13 (patch)
treeb69b7fb9e7db1ea4ec002df2ffcb978faf499a7e /src/main/java/org
parentcbc6af30f0b9b9158d5937ab52b4366f5cb6999e (diff)
Fix op policy payload
The payload should contain a different content value, not the entire yaml Issue-ID: CLAMP-395 Change-Id: I7311caffed554f3c97ef7e07c729266a4fe30940 Signed-off-by: Determe, Sebastien (sd378r) <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
index 906c3cfa8..2ce5afff9 100644
--- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
+++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java
@@ -183,13 +183,20 @@ public class OperationalPolicy implements Serializable, Policy {
return (new Yaml()).dump(jsonMap);
}
+ public String createPolicyPayloadYamlLegacy() {
+ Gson gson = new GsonBuilder().create();
+ Map<?, ?> jsonMap = gson.fromJson(gson.toJson(this.configurationsJson.get("operational_policy")), Map.class);
+ return (new Yaml()).dump(jsonMap);
+ }
+
@Override
public String createPolicyPayload() throws UnsupportedEncodingException {
// Now the Yaml payload must be injected in a json ...
JsonObject payload = new JsonObject();
payload.addProperty("policy-id", this.getName());
- payload.addProperty("content", URLEncoder.encode(createPolicyPayloadYaml(), StandardCharsets.UTF_8.toString()));
+ payload.addProperty("content",
+ URLEncoder.encode(createPolicyPayloadYamlLegacy(), StandardCharsets.UTF_8.toString()));
return new GsonBuilder().setPrettyPrinting().create().toJson(payload);
}