aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/test
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2019-05-03 06:38:08 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-03 06:38:08 +0000
commit38cefe5dd2658490d00a0575f38179092668f118 (patch)
tree02877bd1fa3c92266dd82b6e4934660bb184ddaa /asdc-controller/src/test
parentc0e52204abd4e04cba5edbf81ac2e07dbbb6f8c5 (diff)
parent4be9e10f23a3d64607c9d986ce98146c828b94f8 (diff)
Merge "add resource input Save format when resource is list type e.g. {key2:vf_prop_list,INDEX,key|default}"
Diffstat (limited to 'asdc-controller/src/test')
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java22
1 files changed, 18 insertions, 4 deletions
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 844adeede2..f6a369e405 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
@@ -33,10 +33,7 @@ import org.onap.sdc.toscaparser.api.parameters.Input;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.installer.ToscaResourceStructure;
import org.onap.so.db.catalog.beans.Service;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
+import java.util.*;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
@@ -61,6 +58,23 @@ public class ToscaResourceInputTest {
Input input;
@Test
+ public void getListResourceInput() {
+ ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller();
+ LinkedHashMap<String, Property> hashMap = new LinkedHashMap<>();
+ hashMap.put("key1", property);
+ 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]");
+ List<Input> inputs = new ArrayList<>();
+ inputs.add(input);
+ String resourceInput = toscaResourceInstaller.getVnfcResourceInput(nodeTemplate, inputs);
+ assertEquals("{\\\"key1\\\":\\\"sites,INDEX,role|defaultValue\\\"}", resourceInput);
+ }
+
+ @Test
public void processResourceSequenceTest() {
ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller();
ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure();