From 5a49cac6ffc172bc9fdb3b9d13311915c9952204 Mon Sep 17 00:00:00 2001 From: "George, Lina (lg941u)" Date: Wed, 3 Jan 2018 00:35:33 -0500 Subject: Updates to config data services bundle Issue-ID: APPC-350 Change-Id: Id5738986a40f8c094c0ce2fc0033d378796733cf Signed-off-by: George, Lina (lg941u) --- .../data/services/db/TestConfigResourceNode.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'appc-config/appc-data-services/provider/src/test/java/org') 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") @@ -158,6 +166,25 @@ public class TestConfigResourceNode { node.saveConfigBlock(inParams, ctx); } + @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(); -- cgit 1.2.3-korg