fixed quotes issue in runtime-api 34/103734/4 1.0.1
authorDhrumin Desai <dd303q@att.com>
Mon, 16 Mar 2020 13:37:12 +0000 (09:37 -0400)
committerDeven Panchal <dp023n@att.com>
Tue, 17 Mar 2020 15:41:40 +0000 (15:41 +0000)
Update Runtime

Issue-ID: DCAEGEN2-2120
Change-Id: Ib07060717b43255f17f95d45023e856eed1de674
Signed-off-by: Dhrumin Desai <dd303q@att.com>
Signed-off-by: Deven <dp023n@att.com>
mod/runtimeapi/pom.xml
mod/runtimeapi/runtime-core/pom.xml
mod/runtimeapi/runtime-core/src/main/java/org/onap/dcae/runtime/core/blueprint_creator/BlueprintCreatorOnap.java
mod/runtimeapi/runtime-web/data/imports/onapImports.yaml
mod/runtimeapi/runtime-web/pom.xml

index d935f35..f9919c5 100644 (file)
@@ -32,10 +32,13 @@ limitations under the License.
        </parent>
        <groupId>org.onap.dcaegen2.platform.mod</groupId>
        <artifactId>runtimeapi</artifactId>
-       <version>1.0.0</version>
+       <version>1.0.1</version>
        <name>dcaegen2-platform-mod-runtimeapi</name>
        <description>MOD Runtime API</description>
        <properties>
+               <maven.compiler.source>1.8</maven.compiler.source>
+               <maven.compiler.target>1.8</maven.compiler.target>
+
                <maven.deploy.skip>true</maven.deploy.skip>
                <java.version>1.8</java.version>
                <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
index 53c8536..7add43b 100644 (file)
@@ -23,11 +23,12 @@ limitations under the License.
     <parent>
         <artifactId>runtimeapi</artifactId>
         <groupId>org.onap.dcaegen2.platform.mod</groupId>
-        <version>1.0.0</version>
+        <version>1.0.1</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>runtime-core</artifactId>
+    <version>1.0.1</version>
 
     <dependencies>
         <dependency>
@@ -43,7 +44,7 @@ limitations under the License.
         <dependency>
             <groupId>org.onap.dcaegen2.platform.mod</groupId>
             <artifactId>blueprint-generator</artifactId>
-            <version>1.3.1-SNAPSHOT</version> 
+            <version>1.3.1</version> 
         </dependency>
        <dependency>
                <groupId>org.json</groupId>
index c12b970..7e11b10 100644 (file)
  */
 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() {
index 1e642ff..b164a8d 100644 (file)
@@ -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']
index 413ff9f..ff08ac1 100644 (file)
@@ -22,10 +22,10 @@ limitations under the License.
        <parent>
                <groupId>org.onap.dcaegen2.platform.mod</groupId>
                <artifactId>runtimeapi</artifactId>
-               <version>1.0.0</version>
+               <version>1.0.1</version>
        </parent>
        <artifactId>runtime-web</artifactId>
-       <version>1.0.0</version>
+       <version>1.0.1</version>
        <packaging>jar</packaging>
        <name>runtime-web</name>
        <description>MOD Runtime Web Module</description>
@@ -33,7 +33,7 @@ limitations under the License.
                <dependency>
                        <groupId>org.onap.dcaegen2.platform.mod</groupId>
                        <artifactId>runtime-core</artifactId>
-                       <version>1.0.0</version>
+                       <version>1.0.1</version>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>