diff options
author | 2020-03-17 17:55:16 +0000 | |
---|---|---|
committer | 2020-03-17 17:55:16 +0000 | |
commit | 7b6c75e956c686f5a57cbb0f1e662b0634765ba9 (patch) | |
tree | 550161b30638bd67d4a6ea3a314220d9f925c90b /mod/runtimeapi/runtime-core/src/main/java/org | |
parent | 9a80a980210f958551bf083b7a853ddcfca16563 (diff) | |
parent | fbd213549e76250132ff6c0b1361c998fda0b4ea (diff) |
Merge "fixed quotes issue in runtime-api Update Runtime"
Diffstat (limited to 'mod/runtimeapi/runtime-core/src/main/java/org')
-rw-r--r-- | mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java b/mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java index c12b970..7e11b10 100644 --- a/mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java +++ b/mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java @@ -17,12 +17,14 @@ */ package org.onap.dcae.runtime.core.blueprint_creator; +import org.onap.blueprintgenerator.core.Fixes; import org.onap.dcae.runtime.core.Node; import org.onap.blueprintgenerator.models.blueprint.Blueprint; import org.onap.blueprintgenerator.models.componentspec.ComponentSpec; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; +import java.util.LinkedHashMap; import java.util.Map; public class BlueprintCreatorOnap implements BlueprintCreator{ @@ -57,12 +59,27 @@ public class BlueprintCreatorOnap implements BlueprintCreator{ Map<String,Object> obj = yaml.load(blueprintContent); Map<String,Object> inputsObj = (Map<String, Object>) obj.get("inputs"); for(Map.Entry<String,Object> entry: inputsObj.entrySet()){ + LinkedHashMap<String, Object> modified = retainQuotesForDefault(entry.getValue()); + entry.setValue(modified); if(entry.getKey().matches(locationPort+".*url")) { Map<String,String> inputValue = (Map<String, String>) entry.getValue(); inputValue.put("default",topicUrl + "/" + dmaapEntityName); } } - node.getBlueprintData().setBlueprint_content(yaml.dump(obj)); + node.getBlueprintData().setBlueprint_content(Fixes.applyFixes(yaml.dump(obj))); + } + + private LinkedHashMap<String, Object> retainQuotesForDefault(Object valueOfInputObject) { + LinkedHashMap<String, Object> temp = (LinkedHashMap<String, Object>) valueOfInputObject; + if(temp.containsKey("type") && temp.get("type").equals("string")) { + String def = (String) temp.get("default"); + if(def != null){ + def = def.replaceAll("\"$", "").replaceAll("^\"", ""); + } + def = '"' + def + '"'; + temp.replace("default", def); + } + return temp; } private Yaml getYamlInstance() { |