1 package org.openecomp.sdc.be.dao.graph;
3 import mockit.Deencapsulation;
5 import org.mockito.Mockito;
6 import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum;
7 import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
8 import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
9 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
11 import java.util.HashMap;
14 public class GraphElementFactoryTest {
17 public void testCreateElement() throws Exception {
18 String label = "mock";
19 Map<String, Object> properties = new HashMap<>();
20 Class<GraphNode> clazz = (Class<GraphNode>) (Mockito.mock(GraphNode.class)).getClass();
23 GraphElementFactory.createElement(label, GraphElementTypeEnum.Node, properties, clazz);
27 public void testCreateElement_1() throws Exception {
28 String label = "mock";
29 GraphElementTypeEnum type = null;
30 Map<String, Object> properties = new HashMap<>();
34 result = GraphElementFactory.createElement(label, GraphElementTypeEnum.Node, properties);
38 public void testCreateRelation() throws Exception {
40 Map<String, Object> properties = new HashMap<>();
41 GraphNode from = Mockito.mock(GraphNode.class);
42 GraphNode to = Mockito.mock(GraphNode.class);
47 result = GraphElementFactory.createRelation(type, properties, from, to);
51 public void testCreateNode() throws Exception {
52 Map<String, Object> properties = new HashMap<>();
55 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.User.getName(),
57 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode",
58 NodeTypeEnum.ResourceCategory.getName(), properties);
59 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.ServiceCategory.getName(),
61 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.Tag.getName(),
63 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.Service.getName(),
65 // result = Deencapsulation.invoke(GraphElementFactory.class, "createNode",
66 // NodeTypeEnum.Resource.getName(), properties);
67 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.Property.getName(),
69 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.HeatParameter.getName(),
71 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode",
72 NodeTypeEnum.HeatParameterValue.getName(), properties);