aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorramu.n <ramu.n@huawei.com>2020-04-30 21:21:15 +0530
committerramu.n <ramu.n@huawei.com>2020-04-30 21:21:43 +0530
commit440c44a4f57858b8bc5146ae730bb08d8d09ddc1 (patch)
treea3db4744306e6415b94540cc326ba2eb77dd3129
parent788ada8a8c280e7599c46281804468d0e468d42b (diff)
Fix BBS integration issue
Issue-ID: SO-2827 Change-Id: I292094db2740632cefc9962ab5bf6028b51bdbb8 Signed-off-by: ramu.n <ramu.n@huawei.com>
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java2
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 f945208854..8cd6ada792 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
@@ -28,6 +28,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;
@@ -120,7 +121,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