summaryrefslogtreecommitdiffstats
path: root/asdc-controller/src
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller/src')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java17
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java6
2 files changed, 14 insertions, 9 deletions
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 179fa44547..388302f46e 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 @@ public class ToscaResourceInstaller {
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 @@ public class ToscaResourceInstaller {
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 f6a369e405..846eaf47e2 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 @@ public class ToscaResourceInputTest {
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