diff options
author | ramu.n <ramu.n@huawei.com> | 2020-04-30 21:21:15 +0530 |
---|---|---|
committer | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2020-05-22 14:55:14 +0000 |
commit | 58eec96f412a7977ca09c973d2a81f046148c8dd (patch) | |
tree | 89d5f3ddb2c21ae6bd5580bd8ed9a7104e09c0eb | |
parent | 58b560cd2e90485b47f60e17330cac227a5d7111 (diff) |
Fix BBS integration issue
Issue-ID: SO-2827
Change-Id: I292094db2740632cefc9962ab5bf6028b51bdbb8
Signed-off-by: ramu.n <ramu.n@huawei.com>
(cherry picked from commit 440c44a4f57858b8bc5146ae730bb08d8d09ddc1)
3 files changed, 11 insertions, 8 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java index a98778bf5d..e8e3f34f28 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,13 +21,14 @@ package org.onap.so.adapters.catalogdb.catalogrest; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.lang3.StringEscapeUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.databind.ObjectMapper; public abstract class CatalogQuery { protected static Logger logger = LoggerFactory.getLogger(CatalogQuery.class); @@ -103,9 +104,10 @@ public abstract class CatalogQuery { return false; } ObjectMapper mapper = new ObjectMapper(); - mapper.readValue(jsonInString, String.class); + mapper.readTree(jsonInString); return true; } catch (IOException e) { + logger.error("Invalid json: {}", jsonInString); return false; } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java index d6e7415a77..be8a522b82 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java @@ -29,6 +29,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; +import org.apache.commons.lang3.StringEscapeUtils; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.slf4j.Logger; @@ -122,7 +123,7 @@ public class QueryServiceVnfs extends CatalogQuery { put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode()); put(valueMap, "VNFC_INSTANCE_GROUP_ORDER", o.getVnfcInstanceGroupOrder()); put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign()); - if (isJSONValid(o.getResourceInput())) { + if (isJSONValid(StringEscapeUtils.unescapeJava(o.getResourceInput()))) { put(valueMap, "RESOURCE_INPUT", o.getResourceInput()); } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java index 094a1f0bf3..8e1814f225 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java @@ -156,7 +156,7 @@ public class VnfResourceCustomization implements Serializable { .append("vfModuleCustomizations", vfModuleCustomizations) .append("vnfcInstanceGroupOrder", vnfcInstanceGroupOrder) .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations) - .append("controllerActor", controllerActor).toString(); + .append("controllerActor", controllerActor).append("resourceInput", resourceInput).toString(); } @PrePersist |