From fbd213549e76250132ff6c0b1361c998fda0b4ea Mon Sep 17 00:00:00 2001 From: Dhrumin Desai Date: Mon, 16 Mar 2020 09:37:12 -0400 Subject: fixed quotes issue in runtime-api Update Runtime Issue-ID: DCAEGEN2-2120 Change-Id: Ib07060717b43255f17f95d45023e856eed1de674 Signed-off-by: Dhrumin Desai Signed-off-by: Deven --- mod/runtimeapi/pom.xml | 5 ++++- mod/runtimeapi/runtime-core/pom.xml | 5 +++-- .../core/blueprint_creator/BlueprintCreatorOnap.java | 19 ++++++++++++++++++- .../runtime-web/data/imports/onapImports.yaml | 6 +++++- mod/runtimeapi/runtime-web/pom.xml | 6 +++--- 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/mod/runtimeapi/pom.xml b/mod/runtimeapi/pom.xml index d935f35..f9919c5 100644 --- a/mod/runtimeapi/pom.xml +++ b/mod/runtimeapi/pom.xml @@ -32,10 +32,13 @@ limitations under the License. org.onap.dcaegen2.platform.mod runtimeapi - 1.0.0 + 1.0.1 dcaegen2-platform-mod-runtimeapi MOD Runtime API + 1.8 + 1.8 + true 1.8 yyyyMMdd'T'HHmmss diff --git a/mod/runtimeapi/runtime-core/pom.xml b/mod/runtimeapi/runtime-core/pom.xml index 53c8536..7add43b 100644 --- a/mod/runtimeapi/runtime-core/pom.xml +++ b/mod/runtimeapi/runtime-core/pom.xml @@ -23,11 +23,12 @@ limitations under the License. runtimeapi org.onap.dcaegen2.platform.mod - 1.0.0 + 1.0.1 4.0.0 runtime-core + 1.0.1 @@ -43,7 +44,7 @@ limitations under the License. org.onap.dcaegen2.platform.mod blueprint-generator - 1.3.1-SNAPSHOT + 1.3.1 org.json 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 obj = yaml.load(blueprintContent); Map inputsObj = (Map) obj.get("inputs"); for(Map.Entry entry: inputsObj.entrySet()){ + LinkedHashMap modified = retainQuotesForDefault(entry.getValue()); + entry.setValue(modified); if(entry.getKey().matches(locationPort+".*url")) { Map inputValue = (Map) 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 retainQuotesForDefault(Object valueOfInputObject) { + LinkedHashMap temp = (LinkedHashMap) 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() { diff --git a/mod/runtimeapi/runtime-web/data/imports/onapImports.yaml b/mod/runtimeapi/runtime-web/data/imports/onapImports.yaml index 1e642ff..b164a8d 100644 --- a/mod/runtimeapi/runtime-web/data/imports/onapImports.yaml +++ b/mod/runtimeapi/runtime-web/data/imports/onapImports.yaml @@ -1 +1,5 @@ -imports: ['https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml','https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml','https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml','https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/pgaas/1.1.0/pgaas_types.yaml','https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml','https://nexus.onap.org/content/repositories/raw/org.onap.ccsdk.platform.plugins/type_files/dmaap/dmaap.yaml'] \ No newline at end of file +imports: ['https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml', 'https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml', + 'https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml', + 'https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/pgaas/1.1.0/pgaas_types.yaml', + 'https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml', + 'https://nexus.onap.org/content/repositories/raw/org.onap.ccsdk.platform.plugins/type_files/dmaap/dmaap.yaml'] diff --git a/mod/runtimeapi/runtime-web/pom.xml b/mod/runtimeapi/runtime-web/pom.xml index 413ff9f..ff08ac1 100644 --- a/mod/runtimeapi/runtime-web/pom.xml +++ b/mod/runtimeapi/runtime-web/pom.xml @@ -22,10 +22,10 @@ limitations under the License. org.onap.dcaegen2.platform.mod runtimeapi - 1.0.0 + 1.0.1 runtime-web - 1.0.0 + 1.0.1 jar runtime-web MOD Runtime Web Module @@ -33,7 +33,7 @@ limitations under the License. org.onap.dcaegen2.platform.mod runtime-core - 1.0.0 + 1.0.1 org.springframework.boot -- cgit 1.2.3-korg