Update the format of resourceInput

Save format when resource is list type
e.g.
{key2:[vf_prop_list,INDEX,key]|default}

Issue-ID: SO-1393

Change-Id: Ibb5e7bb31114fa3bbd7a3e1af5f2152a98941a4b
Signed-off-by: zm330 <zhangminyj@chinamobile.com>
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
index 0bf82fd..dc73fe9 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcs.java
@@ -35,7 +35,8 @@
                     + "\t\t\t\"modelUuid\"              : <MODEL_UUID>,\n"
                     + "\t\t\t\"modelInvariantUuid\"     : <MODEL_INVARIANT_ID>,\n"
                     + "\t\t\t\"modelVersion\"           : <MODEL_VERSION>,\n"
-                    + "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>\n" + "\t\t}" + "\t}";
+                    + "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>\n" + "\t\t},\n"
+                    + "\t\t\"resourceInput\"            : <RESOURCE_INPUT>\n" + "\t}";
 
     public QueryVnfcs() {
         super();
@@ -104,6 +105,7 @@
             put(valueMap, "MODEL_INVARIANT_ID", o.getModelInvariantUUID());
             put(valueMap, "MODEL_VERSION", o.getModelVersion());
             put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
+            put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
 
             sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
             sep = ",\n";
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java
index 1fd4f19..abc5935 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVnfcsTest.java
@@ -50,6 +50,7 @@
         c1.setModelInvariantUUID("inv1");
         c1.setModelVersion("v1");
         c1.setModelCustomizationUUID("cust1");
+        c1.setResourceInput("resourceInput1");
 
         VnfcCustomization c2 = new VnfcCustomization();
         c2.setModelName("model2");
@@ -57,6 +58,7 @@
         c2.setModelInvariantUUID("inv2");
         c2.setModelVersion("v2");
         c2.setModelCustomizationUUID("cust2");
+        c2.setResourceInput("resourceInput2");
 
         customizations.add(c1);
         customizations.add(c2);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index 179fa44..388302f 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -575,15 +575,11 @@
                 Input input = inputOptional.get();
                 defaultValue = input.getDefault() != null ? input.getDefault().toString() : "";
             }
-            String valueStr = value.toString();
-            String regex = "(?<=\\[).*?(?=\\])";
+            // Gets a value between [ and ]
+            String regex = "\\[.*?\\]";
             Pattern pattern = Pattern.compile(regex);
-            Matcher matcher = pattern.matcher(valueStr);
-            if (matcher.find()) {
-                valueStr = matcher.group();
-            } else {
-                valueStr = inputName;
-            }
+            Matcher matcher = pattern.matcher(value.toString());
+            String valueStr = matcher.find() ? matcher.group() : inputName;
             outInput = valueStr + "|" + defaultValue;
         } else {
             outInput = value != null ? value.toString() : "";
@@ -1891,11 +1887,16 @@
             resouceRequest.put(key, resourceValue);
         }
 
+        String resourceCustomizationUuid =
+                vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+
         String jsonStr = null;
         try {
             ObjectMapper objectMapper = new ObjectMapper();
             jsonStr = objectMapper.writeValueAsString(resouceRequest);
             jsonStr = jsonStr.replace("\"", "\\\"");
+            logger.debug("vfcResource request for resource customization id (" + resourceCustomizationUuid + ") : "
+                    + jsonStr);
         } catch (JsonProcessingException e) {
             e.printStackTrace();
         }
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
index f6a369e..846eaf4 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
@@ -62,16 +62,20 @@
         ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller();
         LinkedHashMap<String, Property> hashMap = new LinkedHashMap<>();
         hashMap.put("key1", property);
+        Map<String, Object> map = new HashMap<>();
+        map.put("customizationUUID", "69df3303-d2b3-47a1-9d04-41604d3a95fd");
+        Metadata metadata = new Metadata(map);
         when(nodeTemplate.getProperties()).thenReturn(hashMap);
         when(property.getValue()).thenReturn(getInput);
         when(getInput.getInputName()).thenReturn("nameKey");
         when(input.getName()).thenReturn("nameKey");
         when(input.getDefault()).thenReturn("defaultValue");
         when(getInput.toString()).thenReturn("getinput:[sites,INDEX,role]");
+        when(nodeTemplate.getMetaData()).thenReturn(metadata);
         List<Input> inputs = new ArrayList<>();
         inputs.add(input);
         String resourceInput = toscaResourceInstaller.getVnfcResourceInput(nodeTemplate, inputs);
-        assertEquals("{\\\"key1\\\":\\\"sites,INDEX,role|defaultValue\\\"}", resourceInput);
+        assertEquals("{\\\"key1\\\":\\\"[sites,INDEX,role]|defaultValue\\\"}", resourceInput);
     }
 
     @Test
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
index da8d5a1..9688a57 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
@@ -55,7 +55,7 @@
     @JsonProperty("groups")
     private List<GroupResource> groups;
 
-    @JsonProperty("group-order")
+    @JsonProperty("vnfcInstGroupOrder")
     private String groupOrder;
 
     private String vnfHostname;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java
index c363fcc..50bd3e2 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java
@@ -27,7 +27,7 @@
 public class VnfcResource extends Resource {
     private static final long serialVersionUID = 1L;
 
-    @JsonProperty("resource-input")
+    @JsonProperty("resourceInput")
     private String resourceInput;
 
     public VnfcResource() {