diff options
Diffstat (limited to 'appc-config/appc-flow-controller/provider/src/test/java/org')
-rw-r--r-- | appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowControlNodeTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowControlNodeTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowControlNodeTest.java index 200a02615..d171f5f8b 100644 --- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowControlNodeTest.java +++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowControlNodeTest.java @@ -27,11 +27,18 @@ package org.onap.appc.flow.controller.node; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.onap.appc.flow.controller.dbervices.FlowControlDBService; import org.onap.appc.flow.controller.interfaceData.Capabilities; +import org.onap.appc.flow.controller.interfaceData.DependencyInfo; +import org.onap.appc.flow.controller.interfaceData.Vnfcs; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; public class FlowControlNodeTest { @@ -70,4 +77,26 @@ public class FlowControlNodeTest { Assert.assertEquals("Capabilities [vnf=[vnf-1, vnf-2], vfModule=[vf-module-1], vm=[], vnfc=[]]", capabilitiesData.toString()); } + @Test + public void should_handle_dependency_config() throws Exception { + + Vnfcs vnfcs = new Vnfcs(); + vnfcs.setVnfcType("some-type"); + vnfcs.setResilience("some-resilence"); + vnfcs.setMandatory("some-mandatory"); + Map<String, List<Vnfcs>> input = new HashMap<>(); + List<Vnfcs> list = new ArrayList<>(); + list.add(vnfcs); + list.add(vnfcs); + input.put("vnfcs", list); + + String jsonPayload = new ObjectMapper().writeValueAsString(input); + + when(dbService.getDependencyInfo(ctx)).thenReturn(jsonPayload); + + FlowControlNode flowControlNode = new FlowControlNode(null, dbService); + DependencyInfo dependencyInfo = flowControlNode.getDependencyInfo(ctx); + + Assert.assertEquals("DependencyInfo [vnfcs=[Vnfcs [vnfcType=some-type, mandatory=some-mandatory, resilience=some-resilence, parents=[]], Vnfcs [vnfcType=some-type, mandatory=some-mandatory, resilience=some-resilence, parents=[]]]]", dependencyInfo.toString()); + } } |