aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config/appc-flow-controller/provider/src/test
diff options
context:
space:
mode:
authorkurczews <krzysztof.kurczewski@nokia.com>2018-03-02 14:44:03 +0100
committerTakamune Cho <tc012c@att.com>2018-03-13 15:19:18 +0000
commit04dee786c77757d8e9b86e9228cba46d717ecd40 (patch)
tree5b258071e5f7ed45a6a113278fceb7af89cc47ab /appc-config/appc-flow-controller/provider/src/test
parentd206edd8b89ddd251b24e635227fae2814b0152e (diff)
Improve coverage FlowControlNode #8
* refactor & test dependency info method * extract get flow sequence method Change-Id: I6c9ab49676b6c325196ec179e863038550b5dad6 Issue-ID: APPC-440 Signed-off-by: kurczews <krzysztof.kurczewski@nokia.com>
Diffstat (limited to 'appc-config/appc-flow-controller/provider/src/test')
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/FlowControlNodeTest.java29
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());
+ }
}