re base code
[sdc.git] / catalog-dao / src / test / java / org / openecomp / sdc / be / dao / graph / GraphElementFactoryTest.java
1 package org.openecomp.sdc.be.dao.graph;
2
3 import mockit.Deencapsulation;
4 import org.junit.Test;
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;
10
11 import java.util.HashMap;
12 import java.util.Map;
13
14 public class GraphElementFactoryTest {
15
16         @Test
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();
21
22                 // default test
23                 GraphElementFactory.createElement(label, GraphElementTypeEnum.Node, properties, clazz);
24         }
25
26         @Test
27         public void testCreateElement_1() throws Exception {
28                 String label = "mock";
29                 GraphElementTypeEnum type = null;
30                 Map<String, Object> properties = new HashMap<>();
31                 GraphNode result;
32
33                 // default test
34                 result = GraphElementFactory.createElement(label, GraphElementTypeEnum.Node, properties);
35         }
36
37         @Test
38         public void testCreateRelation() throws Exception {
39                 String type = "";
40                 Map<String, Object> properties = new HashMap<>();
41                 GraphNode from = Mockito.mock(GraphNode.class);
42                 GraphNode to = Mockito.mock(GraphNode.class);
43                 ;
44                 GraphRelation result;
45
46                 // default test
47                 result = GraphElementFactory.createRelation(type, properties, from, to);
48         }
49
50         @Test
51         public void testCreateNode() throws Exception {
52                 Map<String, Object> properties = new HashMap<>();
53                 GraphNode result;
54
55                 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.User.getName(),
56                                 properties);
57                 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode",
58                                 NodeTypeEnum.ResourceCategory.getName(), properties);
59                 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.ServiceCategory.getName(),
60                                 properties);
61                 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.Tag.getName(),
62                                 properties);
63                 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.Service.getName(),
64                                 properties);
65                 // result = Deencapsulation.invoke(GraphElementFactory.class, "createNode",
66                 // NodeTypeEnum.Resource.getName(), properties);
67                 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.Property.getName(),
68                                 properties);
69                 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode", NodeTypeEnum.HeatParameter.getName(),
70                                 properties);
71                 result = Deencapsulation.invoke(GraphElementFactory.class, "createNode",
72                                 NodeTypeEnum.HeatParameterValue.getName(), properties);
73         }
74 }