summaryrefslogtreecommitdiffstats
path: root/appc-config/appc-data-services/provider/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'appc-config/appc-data-services/provider/src/test')
-rw-r--r--appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/db/TestConfigResourceNode.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/db/TestConfigResourceNode.java b/appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/db/TestConfigResourceNode.java
index fb44e8799..76ddbdcdf 100644
--- a/appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/db/TestConfigResourceNode.java
+++ b/appc-config/appc-data-services/provider/src/test/java/org/onap/appc/data/services/db/TestConfigResourceNode.java
@@ -24,6 +24,7 @@
package org.onap.appc.data.services.db;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.assertFalse;
@@ -34,6 +35,13 @@ import org.onap.appc.data.services.node.ConfigResourceNode;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
public class TestConfigResourceNode {
@Ignore("Test is taking 60 seconds")
@@ -159,6 +167,25 @@ public class TestConfigResourceNode {
}
@Test
+ public void testProcessCapabilitiesForVMLevel () throws Exception {
+ //{"capabilities":{"vnfc":[],"vm":[{"ConfigureTest":["SSC","MMSC"]}],"vf-module":[],"vnf":["ConfigModify","HealthCheck"]}}
+ SvcLogicContext ctx = new SvcLogicContext();
+ ConfigResourceNode node = new ConfigResourceNode();
+ String findCapability="Restart";
+ JsonNode subCapabilities = JsonNodeFactory.instance.objectNode();
+ String subCaps= "[{\"Restart\":[\"SSC\",\"MMC\"]},{\"Rebuild\":[\"SSC\"]},{\"Migrate\":[\"SSC\"]},{\"Snapshot\":[\"SSC\"]},{\"Start\":[\"SSC\"]},{\"Stop\":[\"SSC\"]}]";
+ ObjectMapper m = new ObjectMapper();
+ subCapabilities = m.readTree(subCaps);
+ String vServerId="testServer";
+ ctx.setAttribute("tmp.vnfInfo.vm.vnfc.vnfc-function-code", "MMC");
+ ctx.setAttribute("tmp.vnfInfo.vm.vnfc.vnfc-name","testVnfc") ;
+ node.processCapabilitiesForVMLevel( vServerId, ctx,
+ findCapability, subCapabilities);
+ String result=ctx.getAttribute("capabilities");
+ assertEquals(result,"Supported");
+ }
+
+ @Test
public void testcheckIfCapabilityCheckNeeded () throws Exception {
ConfigResourceNode node = new ConfigResourceNode();
String findCapability="Start";