Added oparent to sdc main
[sdc.git] / catalog-dao / src / test / java / org / openecomp / sdc / be / dao / jsongraph / GraphVertexTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.be.dao.jsongraph;
22
23 import org.janusgraph.core.JanusGraphVertex;
24 import org.junit.Test;
25 import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
26 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
27 import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
28 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
29 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
30
31 import java.util.HashMap;
32 import java.util.Map;
33
34
35 public class GraphVertexTest {
36
37         private GraphVertex createTestSubject() {
38                 return new GraphVertex();
39         }
40         
41         @Test
42         public void testCtor() throws Exception {
43                 new GraphVertex(VertexTypeEnum.ADDITIONAL_INFORMATION);
44         }
45         
46         @Test
47         public void testGetUniqueId() throws Exception {
48                 GraphVertex testSubject;
49                 String result;
50
51                 // default test
52                 testSubject = createTestSubject();
53                 result = testSubject.getUniqueId();
54         }
55
56         
57         @Test
58         public void testSetUniqueId() throws Exception {
59                 GraphVertex testSubject;
60                 String uniqueId = "";
61
62                 // default test
63                 testSubject = createTestSubject();
64                 testSubject.setUniqueId(uniqueId);
65         }
66
67         
68         @Test
69         public void testGetJson() throws Exception {
70                 GraphVertex testSubject;
71                 Map<String, ? extends ToscaDataDefinition> result;
72
73                 // default test
74                 testSubject = createTestSubject();
75                 result = testSubject.getJson();
76         }
77
78         
79         @Test
80         public void testSetJson() throws Exception {
81                 GraphVertex testSubject;
82                 Map<String, ? extends ToscaDataDefinition> json = null;
83
84                 // default test
85                 testSubject = createTestSubject();
86                 testSubject.setJson(json);
87         }
88
89         
90         @Test
91         public void testGetVertex() throws Exception {
92                 GraphVertex testSubject;
93                 JanusGraphVertex result;
94
95                 // default test
96                 testSubject = createTestSubject();
97                 result = testSubject.getVertex();
98         }
99
100         
101         @Test
102         public void testSetVertex() throws Exception {
103                 GraphVertex testSubject;
104                 JanusGraphVertex vertex = null;
105
106                 // default test
107                 testSubject = createTestSubject();
108                 testSubject.setVertex(vertex);
109         }
110
111         
112         @Test
113         public void testGetLabel() throws Exception {
114                 GraphVertex testSubject;
115                 VertexTypeEnum result;
116
117                 // default test
118                 testSubject = createTestSubject();
119                 result = testSubject.getLabel();
120         }
121
122         
123         @Test
124         public void testSetLabel() throws Exception {
125                 GraphVertex testSubject;
126                 VertexTypeEnum label = null;
127
128                 // default test
129                 testSubject = createTestSubject();
130                 testSubject.setLabel(label);
131         }
132
133         
134         
135         @Test
136         public void testAddMetadataProperty() throws Exception {
137                 GraphVertex testSubject;
138                 GraphPropertyEnum propName = null;
139                 Object propValue = null;
140
141                 // test 1
142                 testSubject = createTestSubject();
143                 propValue = null;
144                 testSubject.addMetadataProperty(propName, propValue);
145         }
146
147         
148         @Test
149         public void testGetMetadataProperty() throws Exception {
150                 GraphVertex testSubject;
151                 GraphPropertyEnum metadataProperty = null;
152                 Object result;
153
154                 // default test
155                 testSubject = createTestSubject();
156                 result = testSubject.getMetadataProperty(metadataProperty);
157         }
158
159         
160         @Test
161         public void testGetMetadataProperties() throws Exception {
162                 GraphVertex testSubject;
163                 Map<GraphPropertyEnum, Object> result;
164
165                 // default test
166                 testSubject = createTestSubject();
167                 result = testSubject.getMetadataProperties();
168         }
169
170         
171         @Test
172         public void testSetMetadataProperties() throws Exception {
173                 GraphVertex testSubject;
174                 Map<GraphPropertyEnum, Object> metadataProperties = null;
175
176                 // default test
177                 testSubject = createTestSubject();
178                 testSubject.setMetadataProperties(metadataProperties);
179         }
180
181         
182         @Test
183         public void testGetMetadataJson() throws Exception {
184                 GraphVertex testSubject;
185                 Map<String, Object> result;
186
187                 // default test
188                 testSubject = createTestSubject();
189                 result = testSubject.getMetadataJson();
190         }
191
192         
193         @Test
194         public void testSetMetadataJson() throws Exception {
195                 GraphVertex testSubject;
196                 Map<String, Object> metadataJson = null;
197
198                 // default test
199                 testSubject = createTestSubject();
200                 testSubject.setMetadataJson(metadataJson);
201         }
202
203         
204
205         
206         @Test
207         public void testGetJsonMetadataField() throws Exception {
208                 GraphVertex testSubject;
209                 Object result;
210
211                 // default test
212                 testSubject = createTestSubject();
213                 result = testSubject.getJsonMetadataField(JsonPresentationFields.API_URL);
214                 testSubject = createTestSubject();
215                 testSubject.setType(ComponentTypeEnum.RESOURCE);
216                 result = testSubject.getJsonMetadataField(JsonPresentationFields.API_URL);
217         }
218
219         
220         @Test
221         public void testUpdateMetadataJsonWithCurrentMetadataProperties() throws Exception {
222                 GraphVertex testSubject;
223
224                 // default test
225                 testSubject = createTestSubject();
226                 testSubject.updateMetadataJsonWithCurrentMetadataProperties();
227                 Map<GraphPropertyEnum, Object> metadataProperties = new HashMap<>();
228                 metadataProperties.put(GraphPropertyEnum.COMPONENT_TYPE, "mock");
229                 testSubject.setMetadataProperties(metadataProperties );
230                 testSubject.updateMetadataJsonWithCurrentMetadataProperties();
231         }
232         
233         @Test
234         public void testGetType() throws Exception {
235                 GraphVertex testSubject;
236
237                 // default test
238                 testSubject = createTestSubject();
239                 testSubject.setType(ComponentTypeEnum.RESOURCE);
240                 testSubject.getType();
241         }
242         
243         @Test
244         public void testCloneData() throws Exception {
245                 GraphVertex testSubject;
246
247                 // default test
248                 testSubject = createTestSubject();
249                 testSubject.cloneData(new GraphVertex());
250         }
251         
252         @Test
253         public void testSetJsonMetadataField() throws Exception {
254                 GraphVertex testSubject;
255
256                 // default test
257                 testSubject = createTestSubject();
258                 testSubject.setJsonMetadataField(JsonPresentationFields.API_URL, "mock");
259         }
260
261 }