summaryrefslogtreecommitdiffstats
path: root/auth/cli-editor/src/main/java
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2020-01-29 09:50:33 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2020-01-30 12:15:09 +0000
commit393e00b78140a27232d961fcdae70b99af2cdbbe (patch)
tree9ece796dd23034536a3ae9e64ed5e03c71d73f1c /auth/cli-editor/src/main/java
parent18e4f9625363459dac24be15b74210e2886097b9 (diff)
Remove content section from ToscaPolicy properties in APEX
Currently APEX specific information is placed under properties|content in ToscaPolicy. Avoid keeping under "content" and keep the information directly under properties. Change-Id: Ic437271c9a2d71104013b5568af5525df4a4bb56 Issue-ID: POLICY-2332 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'auth/cli-editor/src/main/java')
-rw-r--r--auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/utils/CliUtils.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/utils/CliUtils.java b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/utils/CliUtils.java
index c4e9956ea..ccf799047 100644
--- a/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/utils/CliUtils.java
+++ b/auth/cli-editor/src/main/java/org/onap/policy/apex/auth/clieditor/utils/CliUtils.java
@@ -21,7 +21,6 @@
package org.onap.policy.apex.auth.clieditor.utils;
import com.google.gson.JsonObject;
-
import java.beans.PropertyDescriptor;
import java.io.File;
import java.io.IOException;
@@ -30,7 +29,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Properties;
-
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.lang3.StringUtils;
@@ -78,14 +76,17 @@ public class CliUtils {
String toscaTemplate = TextFileUtils.getTextFileAsString(parameters.getInputToscaTemplateFileName());
JsonObject toscaTemplateJson = standardCoder.decode(toscaTemplate, JsonObject.class);
- JsonObject engineServiceParameters = apexConfigJson.get("engineServiceParameters").getAsJsonObject();
- engineServiceParameters.add("policy_type_impl", policyModelJson);
JsonObject toscaPolicyProperties = toscaTemplateJson.get("topology_template").getAsJsonObject();
JsonObject toscaPolicy = toscaPolicyProperties.get("policies").getAsJsonArray().get(0).getAsJsonObject();
JsonObject toscaProperties = toscaPolicy.get(toscaPolicy.keySet().toArray()[0].toString()).getAsJsonObject()
.get("properties").getAsJsonObject();
- toscaProperties.add("content", apexConfigJson);
+ apexConfigJson.entrySet().forEach(entry -> {
+ if ("engineServiceParameters".equals(entry.getKey())) {
+ entry.getValue().getAsJsonObject().add("policy_type_impl", policyModelJson);
+ }
+ toscaProperties.add(entry.getKey(), entry.getValue());
+ });
final String toscaPolicyString = standardCoder.encode(toscaTemplateJson);
final String toscaPolicyFileName = parameters.getOutputToscaPolicyFileName();
if (StringUtils.isNotBlank(toscaPolicyFileName)) {