re base code
[sdc.git] / catalog-model / src / test / java / org / openecomp / sdc / be / model / operations / impl / PropertyOperationTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 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.model.operations.impl;
22
23 import com.thinkaurelius.titan.core.TitanVertex;
24 import fj.data.Either;
25 import org.apache.commons.lang3.tuple.ImmutablePair;
26 import org.junit.Assert;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.mockito.Mockito;
30 import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
31 import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
32 import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
33 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
34 import org.openecomp.sdc.be.datatypes.elements.PropertyRule;
35 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
36 import org.openecomp.sdc.be.model.*;
37 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
38 import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
39 import org.openecomp.sdc.be.model.tosca.ToscaType;
40 import org.openecomp.sdc.be.model.tosca.constraints.GreaterThanConstraint;
41 import org.openecomp.sdc.be.model.tosca.constraints.InRangeConstraint;
42 import org.openecomp.sdc.be.model.tosca.constraints.LessOrEqualConstraint;
43 import org.openecomp.sdc.be.resources.data.DataTypeData;
44 import org.openecomp.sdc.be.resources.data.PropertyData;
45 import org.openecomp.sdc.be.resources.data.PropertyValueData;
46
47 import java.util.*;
48
49 import static org.junit.Assert.*;
50
51 public class PropertyOperationTest extends ModelTestBase {
52
53     TitanGenericDao titanGenericDao = Mockito.mock(TitanGenericDao.class);
54
55     PropertyOperation propertyOperation = new PropertyOperation(titanGenericDao, null);
56
57     @Before
58     public void setup() {
59         propertyOperation.setTitanGenericDao(titanGenericDao);
60
61     }
62
63     /*
64      * @Test public void addPropertyToResourceTest() {
65      *
66      * String propName = "myProp"; PropertyDefinition property = buildPropertyDefinition(); List<PropertyConstraint> constraints = buildConstraints(); property.setConstraints(constraints);
67      *
68      * PropertyData propertyData = new PropertyData(property, propertyOperation.convertConstraintsToString(constraints));
69      *
70      * Either<PropertyData, TitanOperationStatus> either = Either.left(propertyData); //when(propertyDao.create((GraphNeighbourTable)anyObject(), eq(PropertyData.class), eq(NodeTypeEnum.Property))).thenReturn(either); GraphRelation graphRelation =
71      * new GraphRelation(); Either<GraphRelation, TitanOperationStatus> relationResult = Either.left(graphRelation);
72      *
73      * when(titanGenericDao.createNode((PropertyData)anyObject(), eq(PropertyData.class))).thenReturn(either); when(titanGenericDao.createRelation((GraphNode)anyObject(), (GraphNode)anyObject(), eq(GraphEdgeLabels.PROPERTY),
74      * anyMap())).thenReturn(relationResult);
75      *
76      * Either<PropertyDefinition, StorageOperationStatus> result = propertyOperation.addPropertyToResource(propName, property, NodeTypeEnum.Resource, "my-resource.1.0");
77      *
78      * assertTrue(result.isLeft()); System.out.println(result.left().value()); PropertyDefinition propertyDefinition = result.left().value();
79      *
80      * List<PropertyConstraint> originalConstraints = property.getConstraints(); List<PropertyConstraint> propertyConstraintsResult = propertyDefinition.getConstraints(); assertEquals(propertyConstraintsResult.size(), originalConstraints.size());
81      *
82      * }
83      */
84     private PropertyDefinition buildPropertyDefinition() {
85         PropertyDefinition property = new PropertyDefinition();
86         property.setDefaultValue("10");
87         property.setDescription("Size of the local disk, in Gigabytes (GB), available to applications running on the Compute node.");
88         property.setType(ToscaType.INTEGER.name().toLowerCase());
89         return property;
90     }
91
92     @Test
93     public void addPropertiesToGraphTableTest() {
94
95         // Map<String, PropertyDefinition> properties = new HashMap<String,
96         // PropertyDefinition>();
97         // String propName = "myProp";
98         // PropertyDefinition property = buildPropertyDefinition();
99         //
100         // List<PropertyConstraint> constraints = buildConstraints();
101         // property.setConstraints(constraints);
102         //
103         // properties.put(propName, property);
104         //
105         // GraphNeighbourTable graphNeighbourTable = new GraphNeighbourTable();
106         // ResourceData resourceData = new ResourceData();
107         // String resourceName = "my-resource";
108         // String resourceVersion = "1.0";
109         // String resourceId = resourceName + "." + resourceVersion;
110         // resourceData.setUniqueId(resourceId);
111         // int resourceIndex = graphNeighbourTable.addNode(resourceData);
112         //
113         // heatParametersOperation.addPropertiesToGraphTable(properties,
114         // graphNeighbourTable, resourceIndex, resourceId);
115         //
116         // assertEquals(2, graphNeighbourTable.getNodes().size());
117         // assertEquals(1, graphNeighbourTable.getDirectedEdges().size());
118         // List<GraphNode> nodes = graphNeighbourTable.getNodes();
119         // boolean nodeFound = false;
120         // for (GraphNode neo4jNode : nodes) {
121         // if (neo4jNode instanceof PropertyData) {
122         // PropertyData propertyData = (PropertyData)neo4jNode;
123         // assertEquals("check property unique id", resourceId + "." + propName,
124         // propertyData.getUniqueId());
125         // assertEquals(property.getDescription(),
126         // propertyData.getPropertyDataDefinition().getDescription());
127         // nodeFound = true;
128         // }
129         // }
130         // assertEquals("looking for PropertyData object in table", true,
131         // nodeFound);
132         //
133         // NodeRelation nodeRelation =
134         // graphNeighbourTable.getDirectedEdges().get(0);
135         // assertEquals("check from index to index edge", 0,
136         // nodeRelation.getFromIndex());
137         // assertEquals("check from index to index edge", 1,
138         // nodeRelation.getToIndex());
139         // assertEquals("check edge type",
140         // GraphEdgePropertiesDictionary.PROPERTY,
141         // nodeRelation.getEdge().getEdgeType());
142         // assertEquals("check propert name on edge", true,
143         // nodeRelation.getEdge().getProperties().values().contains(propName));
144     }
145
146     @Test
147     public void convertConstraintsTest() {
148
149         List<PropertyConstraint> constraints = buildConstraints();
150         List<String> convertedStringConstraints = propertyOperation.convertConstraintsToString(constraints);
151         assertEquals("constraints size", constraints.size(), convertedStringConstraints.size());
152
153         List<PropertyConstraint> convertedConstraints = propertyOperation.convertConstraints(convertedStringConstraints);
154         assertEquals("check size of constraints", constraints.size(), convertedConstraints.size());
155
156         Set<String> constraintsClasses = new HashSet<>();
157         for (PropertyConstraint propertyConstraint : constraints) {
158             constraintsClasses.add(propertyConstraint.getClass().getName());
159         }
160
161         for (PropertyConstraint propertyConstraint : convertedConstraints) {
162             assertTrue("check all classes generated", constraintsClasses.contains(propertyConstraint.getClass().getName()));
163         }
164     }
165
166     @Test
167     public void testIsPropertyDefaultValueValid_NoDefault() {
168         PropertyDefinition property = new PropertyDefinition();
169         property.setName("myProperty");
170         property.setType(ToscaPropertyType.BOOLEAN.getType());
171         assertTrue(propertyOperation.isPropertyDefaultValueValid(property, null));
172     }
173
174     @Test
175     public void testIsPropertyDefaultValueValid_ValidDefault() {
176         PropertyDefinition property = new PropertyDefinition();
177         property.setName("myProperty");
178         property.setType(ToscaPropertyType.INTEGER.getType());
179         property.setDefaultValue("50");
180         assertTrue(propertyOperation.isPropertyDefaultValueValid(property, null));
181     }
182
183     @Test
184     public void testIsPropertyDefaultValueValid_InvalidDefault() {
185         PropertyDefinition property = new PropertyDefinition();
186         property.setName("myProperty");
187         property.setType(ToscaPropertyType.BOOLEAN.getType());
188         property.setDefaultValue("50");
189         assertFalse(propertyOperation.isPropertyDefaultValueValid(property, null));
190     }
191
192     private List<PropertyConstraint> buildConstraints() {
193         List<PropertyConstraint> constraints = new ArrayList<>();
194         GreaterThanConstraint propertyConstraint1 = new GreaterThanConstraint("0");
195         LessOrEqualConstraint propertyConstraint2 = new LessOrEqualConstraint("10");
196         List<String> range = new ArrayList<>();
197         range.add("0");
198         range.add("100");
199         InRangeConstraint propertyConstraint3 = new InRangeConstraint(range);
200         constraints.add(propertyConstraint1);
201         constraints.add(propertyConstraint2);
202         constraints.add(propertyConstraint3);
203         return constraints;
204     }
205
206     @Test
207     public void findPropertyValueBestMatch1() {
208
209         String propertyUniqueId = "x1";
210         ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
211         instanceProperty.setValue("v1");
212         instanceProperty.setDefaultValue("vv1");
213         List<String> path = new ArrayList<>();
214         path.add("node1");
215         path.add("node2");
216         path.add("node3");
217         instanceProperty.setPath(path);
218
219         Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
220         ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
221         instanceProperty1.setValue("v1node1");
222         instanceIdToValue.put("node1", instanceProperty1);
223
224         ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
225         instanceProperty2.setValue("v1node2");
226         instanceIdToValue.put("node2", instanceProperty2);
227
228         ComponentInstanceProperty instanceProperty3 = new ComponentInstanceProperty();
229         instanceProperty3.setValue("v1node3");
230         instanceIdToValue.put("node3", instanceProperty3);
231
232         propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);
233
234         assertEquals("check value", "v1node1", instanceProperty.getValue());
235         assertEquals("check default value", "v1node2", instanceProperty.getDefaultValue());
236
237     }
238
239     @Test
240     public void findPropertyValueBestMatch2() {
241
242         String propertyUniqueId = "x1";
243         ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
244         instanceProperty.setValue("v1");
245         instanceProperty.setDefaultValue("vv1");
246         List<String> path = new ArrayList<>();
247         path.add("node1");
248         path.add("node2");
249         path.add("node3");
250         instanceProperty.setPath(path);
251
252         Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
253
254         ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
255         instanceProperty2.setValue("v1node2");
256         instanceProperty2.setValueUniqueUid("aaaa");
257         instanceIdToValue.put("node2", instanceProperty2);
258
259         propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);
260
261         assertEquals("check value", "v1node2", instanceProperty.getValue());
262         assertEquals("check default value", "vv1", instanceProperty.getDefaultValue());
263         assertNull("check value unique id is null", instanceProperty.getValueUniqueUid());
264
265     }
266
267     @Test
268     public void findPropertyValueBestMatch3() {
269
270         String propertyUniqueId = "x1";
271         ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
272         instanceProperty.setValue("v1");
273         instanceProperty.setDefaultValue("vv1");
274         List<String> path = new ArrayList<>();
275         path.add("node1");
276         path.add("node2");
277         path.add("node3");
278         instanceProperty.setPath(path);
279
280         Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
281         ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
282         instanceProperty1.setValue("v1node1");
283         instanceProperty1.setValueUniqueUid("aaaa");
284         instanceIdToValue.put("node1", instanceProperty1);
285
286         ComponentInstanceProperty instanceProperty3 = new ComponentInstanceProperty();
287         instanceProperty3.setValue("v1node3");
288         instanceIdToValue.put("node3", instanceProperty3);
289
290         propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);
291
292         assertEquals("check value", "v1node1", instanceProperty.getValue());
293         assertEquals("check default value", "v1node3", instanceProperty.getDefaultValue());
294         assertEquals("check valid unique id", instanceProperty1.getValueUniqueUid(), instanceProperty.getValueUniqueUid());
295
296     }
297
298     @Test
299     public void findPropertyValueBestMatch1Rules() {
300
301         String propertyUniqueId = "x1";
302         ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
303         instanceProperty.setValue("v1");
304         instanceProperty.setDefaultValue("vv1");
305         List<String> path = new ArrayList<>();
306         path.add("node1");
307         path.add("node2");
308         path.add("node3");
309         instanceProperty.setPath(path);
310
311         Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
312         ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
313         instanceProperty1.setValue("v1node1");
314
315         List<PropertyRule> rules = new ArrayList<>();
316         PropertyRule propertyRule = new PropertyRule();
317         String[] ruleArr = { "node1", ".+", "node3" };
318         List<String> rule1 = new ArrayList<>(Arrays.asList(ruleArr));
319         propertyRule.setRule(rule1);
320         propertyRule.setValue("88");
321         rules.add(propertyRule);
322         instanceProperty1.setRules(rules);
323
324         instanceIdToValue.put("node1", instanceProperty1);
325
326         ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
327         instanceProperty2.setValue("v1node2");
328         instanceIdToValue.put("node2", instanceProperty2);
329
330         ComponentInstanceProperty instanceProperty3 = new ComponentInstanceProperty();
331         instanceProperty3.setValue("v1node3");
332         instanceIdToValue.put("node3", instanceProperty3);
333
334         propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);
335
336         assertEquals("check value", propertyRule.getValue(), instanceProperty.getValue());
337         assertEquals("check default value", "v1node2", instanceProperty.getDefaultValue());
338
339     }
340
341     @Test
342     public void findPropertyValueBestMatch2Rules() {
343
344         String propertyUniqueId = "x1";
345         ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
346         instanceProperty.setValue("v1");
347         instanceProperty.setDefaultValue("vv1");
348         List<String> path = new ArrayList<>();
349         path.add("node1");
350         path.add("node2");
351         path.add("node3");
352         instanceProperty.setPath(path);
353
354         Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
355         ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
356         instanceProperty1.setValue("v1node1");
357
358         List<PropertyRule> rules = new ArrayList<>();
359         PropertyRule propertyRule1 = new PropertyRule();
360         String[] ruleArr1 = { "node1", "node2", ".+" };
361         List<String> rule1 = new ArrayList<>(Arrays.asList(ruleArr1));
362         propertyRule1.setRule(rule1);
363         propertyRule1.setValue("88");
364
365         PropertyRule propertyRule2 = new PropertyRule();
366         String[] ruleArr2 = { "node1", "node2", "node3" };
367         List<String> rule2 = new ArrayList<>(Arrays.asList(ruleArr2));
368         propertyRule2.setRule(rule2);
369         propertyRule2.setValue("99");
370
371         rules.add(propertyRule2);
372         rules.add(propertyRule1);
373
374         instanceProperty1.setRules(rules);
375
376         instanceIdToValue.put("node1", instanceProperty1);
377
378         ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
379         instanceProperty2.setValue("v1node2");
380         instanceIdToValue.put("node2", instanceProperty2);
381
382         ComponentInstanceProperty instanceProperty3 = new ComponentInstanceProperty();
383         instanceProperty3.setValue("v1node3");
384         instanceIdToValue.put("node3", instanceProperty3);
385
386         propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);
387
388         assertEquals("check value", propertyRule2.getValue(), instanceProperty.getValue());
389         assertEquals("check default value", "v1node2", instanceProperty.getDefaultValue());
390
391     }
392
393     @Test
394     public void findPropertyValueBestMatch1RuleLowLevel() {
395
396         String propertyUniqueId = "x1";
397         ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
398         instanceProperty.setValue("v1");
399         instanceProperty.setDefaultValue("vv1");
400         List<String> path = new ArrayList<>();
401         path.add("node1");
402         path.add("node2");
403         path.add("node3");
404         instanceProperty.setPath(path);
405
406         Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
407         ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
408         instanceProperty1.setValue("v1node1");
409
410         List<PropertyRule> rules = new ArrayList<>();
411         PropertyRule propertyRule1 = new PropertyRule();
412         String[] ruleArr1 = { "node1", "node2", ".+" };
413         List<String> rule1 = new ArrayList<>(Arrays.asList(ruleArr1));
414         propertyRule1.setRule(rule1);
415         propertyRule1.setValue("88");
416
417         PropertyRule propertyRule2 = new PropertyRule();
418         String[] ruleArr2 = { "node1", "node2", "node3" };
419         List<String> rule2 = new ArrayList<>(Arrays.asList(ruleArr2));
420         propertyRule2.setRule(rule2);
421         propertyRule2.setValue("99");
422
423         rules.add(propertyRule2);
424         rules.add(propertyRule1);
425
426         instanceProperty1.setRules(rules);
427
428         instanceIdToValue.put("node1", instanceProperty1);
429
430         ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
431         instanceProperty2.setValue("v1node2");
432
433         List<PropertyRule> rules3 = new ArrayList<>();
434         PropertyRule propertyRule3 = new PropertyRule();
435         String[] ruleArr3 = { "node2", "node3" };
436         List<String> rule3 = new ArrayList<>(Arrays.asList(ruleArr3));
437         propertyRule3.setRule(rule3);
438         propertyRule3.setValue("77");
439         rules3.add(propertyRule3);
440
441         instanceProperty2.setRules(rules3);
442         instanceIdToValue.put("node2", instanceProperty2);
443
444         ComponentInstanceProperty instanceProperty3 = new ComponentInstanceProperty();
445         instanceProperty3.setValue("v1node3");
446         instanceIdToValue.put("node3", instanceProperty3);
447
448         propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);
449
450         assertEquals("check value", propertyRule2.getValue(), instanceProperty.getValue());
451         assertEquals("check default value", propertyRule3.getValue(), instanceProperty.getDefaultValue());
452
453     }
454
455     @Test
456     public void findPropertyValueBestMatchDefaultValueNotChanged() {
457
458         String propertyUniqueId = "x1";
459         ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
460         instanceProperty.setValue("v1");
461         instanceProperty.setDefaultValue("vv1");
462         List<String> path = new ArrayList<>();
463         path.add("node1");
464         path.add("node2");
465         path.add("node3");
466         instanceProperty.setPath(path);
467
468         Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
469         ComponentInstanceProperty instanceProperty1 = new ComponentInstanceProperty();
470         instanceProperty1.setValue("v1node1");
471
472         List<PropertyRule> rules = new ArrayList<>();
473         PropertyRule propertyRule1 = new PropertyRule();
474         String[] ruleArr1 = { "node1", "node2", ".+" };
475         List<String> rule1 = new ArrayList<>(Arrays.asList(ruleArr1));
476         propertyRule1.setRule(rule1);
477         propertyRule1.setValue("88");
478
479         PropertyRule propertyRule2 = new PropertyRule();
480         String[] ruleArr2 = { "node1", "node2", "node3" };
481         List<String> rule2 = new ArrayList<>(Arrays.asList(ruleArr2));
482         propertyRule2.setRule(rule2);
483         propertyRule2.setValue("99");
484
485         rules.add(propertyRule2);
486         rules.add(propertyRule1);
487
488         instanceProperty1.setRules(rules);
489
490         instanceIdToValue.put("node1", instanceProperty1);
491
492         ComponentInstanceProperty instanceProperty2 = new ComponentInstanceProperty();
493         instanceProperty2.setValue("v1node2");
494
495         List<PropertyRule> rules3 = new ArrayList<>();
496         PropertyRule propertyRule3 = new PropertyRule();
497         String[] ruleArr3 = { "node2", "node333" };
498         List<String> rule3 = new ArrayList<>(Arrays.asList(ruleArr3));
499         propertyRule3.setRule(rule3);
500         propertyRule3.setValue("77");
501         rules3.add(propertyRule3);
502
503         instanceProperty2.setRules(rules3);
504         instanceIdToValue.put("node2", instanceProperty2);
505
506         propertyOperation.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);
507
508         assertEquals("check value", propertyRule2.getValue(), instanceProperty.getValue());
509         assertEquals("check default value", "vv1", instanceProperty.getDefaultValue());
510
511         }
512
513         private PropertyOperation createTestSubject() {
514                 return new PropertyOperation(new TitanGenericDao(new TitanGraphClient()), null);
515         }
516
517         
518         @Test
519         public void testMain() throws Exception {
520                 String[] args = new String[] { "" };
521
522                 // default test
523                 PropertyOperation.main(args);
524         }
525
526         
527         @Test
528         public void testConvertPropertyDataToPropertyDefinition() throws Exception {
529                 PropertyOperation testSubject;
530                 PropertyData propertyDataResult = new PropertyData();
531                 String propertyName = "";
532                 String resourceId = "";
533                 PropertyDefinition result;
534
535                 // default test
536                 testSubject = createTestSubject();
537                 result = testSubject.convertPropertyDataToPropertyDefinition(propertyDataResult, propertyName, resourceId);
538         }
539         
540         @Test
541         public void testAddProperty() throws Exception {
542                 PropertyOperation testSubject;
543                 String propertyName = "";
544                 PropertyDefinition propertyDefinition = new PropertyDefinition();
545                 String resourceId = "";
546                 Either<PropertyData, StorageOperationStatus> result;
547
548                 // default test
549                 testSubject = createTestSubject();
550                 result = testSubject.addProperty(propertyName, propertyDefinition, resourceId);
551         }
552
553         
554         @Test
555         public void testValidateAndUpdateProperty() throws Exception {
556                 PropertyOperation testSubject;
557                 IComplexDefaultValue propertyDefinition = new PropertyDefinition();
558                 Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
559                 dataTypes.put("", new DataTypeDefinition());
560                 StorageOperationStatus result;
561
562                 // default test
563                 testSubject = createTestSubject();
564                 result = testSubject.validateAndUpdateProperty(propertyDefinition, dataTypes);
565         }
566
567         
568         @Test
569         public void testAddPropertyToGraph() throws Exception {
570                 PropertyOperation testSubject;
571                 String propertyName = "";
572                 PropertyDefinition propertyDefinition = new PropertyDefinition();
573                 String resourceId = "";
574                 Either<PropertyData, TitanOperationStatus> result;
575
576                 // default test
577                 testSubject = createTestSubject();
578                 result = testSubject.addPropertyToGraph(propertyName, propertyDefinition, resourceId);
579         }
580
581         
582         @Test
583         public void testAddPropertyToGraphByVertex() throws Exception {
584                 PropertyOperation testSubject;
585                 TitanVertex metadataVertex = null;
586                 String propertyName = "";
587                 PropertyDefinition propertyDefinition = new PropertyDefinition();
588                 String resourceId = "";
589                 TitanOperationStatus result;
590
591                 // default test
592                 testSubject = createTestSubject();
593                 result = testSubject.addPropertyToGraphByVertex(metadataVertex, propertyName, propertyDefinition, resourceId);
594         }
595
596         
597         @Test
598         public void testGetTitanGenericDao() throws Exception {
599                 PropertyOperation testSubject;
600                 TitanGenericDao result;
601
602                 // default test
603                 testSubject = createTestSubject();
604                 result = testSubject.getTitanGenericDao();
605         }
606
607         @Test
608         public void testDeletePropertyFromGraph() throws Exception {
609                 PropertyOperation testSubject;
610                 String propertyId = "";
611                 Either<PropertyData, TitanOperationStatus> result;
612
613                 // default test
614                 testSubject = createTestSubject();
615                 result = testSubject.deletePropertyFromGraph(propertyId);
616         }
617
618         
619         @Test
620         public void testUpdateProperty() throws Exception {
621                 PropertyOperation testSubject;
622                 String propertyId = "";
623                 PropertyDefinition newPropertyDefinition = new PropertyDefinition();
624                 Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
625                 Either<PropertyData, StorageOperationStatus> result;
626
627                 // default test
628                 testSubject = createTestSubject();
629                 result = testSubject.updateProperty(propertyId, newPropertyDefinition, dataTypes);
630         }
631
632         
633         @Test
634         public void testUpdatePropertyFromGraph() throws Exception {
635                 PropertyOperation testSubject;
636                 String propertyId = "";
637                 PropertyDefinition propertyDefinition = null;
638                 Either<PropertyData, TitanOperationStatus> result;
639
640                 // default test
641                 testSubject = createTestSubject();
642                 result = testSubject.updatePropertyFromGraph(propertyId, propertyDefinition);
643         }
644
645         
646         @Test
647         public void testSetTitanGenericDao() throws Exception {
648                 PropertyOperation testSubject;
649                 TitanGenericDao titanGenericDao = null;
650
651                 // default test
652                 testSubject = createTestSubject();
653                 testSubject.setTitanGenericDao(titanGenericDao);
654         }
655
656         
657         @Test
658         public void testAddPropertyToNodeType() throws Exception {
659                 PropertyOperation testSubject;
660                 String propertyName = "";
661                 PropertyDefinition propertyDefinition = new PropertyDefinition();
662                 NodeTypeEnum nodeType = NodeTypeEnum.Attribute;
663                 String uniqueId = "";
664                 Either<PropertyData, TitanOperationStatus> result;
665
666                 // default test
667                 testSubject = createTestSubject();
668                 result = testSubject.addPropertyToNodeType(propertyName, propertyDefinition, nodeType, uniqueId);
669         }
670
671         
672         @Test
673         public void testFindPropertiesOfNode() throws Exception {
674                 PropertyOperation testSubject;
675                 NodeTypeEnum nodeType = null;
676                 String uniqueId = "";
677                 Either<Map<String, PropertyDefinition>, TitanOperationStatus> result;
678
679                 // default test
680                 testSubject = createTestSubject();
681                 result = testSubject.findPropertiesOfNode(nodeType, uniqueId);
682         }
683
684         
685         @Test
686         public void testDeletePropertiesAssociatedToNode() throws Exception {
687                 PropertyOperation testSubject;
688                 NodeTypeEnum nodeType = null;
689                 String uniqueId = "";
690                 Either<Map<String, PropertyDefinition>, StorageOperationStatus> result;
691
692                 // default test
693                 testSubject = createTestSubject();
694                 result = testSubject.deletePropertiesAssociatedToNode(nodeType, uniqueId);
695         }
696
697         
698         @Test
699         public void testDeleteAllPropertiesAssociatedToNode() throws Exception {
700                 PropertyOperation testSubject;
701                 NodeTypeEnum nodeType = null;
702                 String uniqueId = "";
703                 Either<Map<String, PropertyDefinition>, StorageOperationStatus> result;
704
705                 // default test
706                 testSubject = createTestSubject();
707                 result = testSubject.deleteAllPropertiesAssociatedToNode(nodeType, uniqueId);
708         }
709
710         
711         @Test
712         public void testIsPropertyExist() throws Exception {
713                 PropertyOperation testSubject;
714                 List<PropertyDefinition> properties = null;
715                 String resourceUid = "";
716                 String propertyName = "";
717                 String propertyType = "";
718                 boolean result;
719
720                 // default test
721                 testSubject = createTestSubject();
722                 result = testSubject.isPropertyExist(properties, resourceUid, propertyName, propertyType);
723         }
724
725         
726         @Test
727         public void testValidateAndUpdateRules() throws Exception {
728                 PropertyOperation testSubject;
729                 String propertyType = "";
730                 List<PropertyRule> rules = null;
731                 String innerType = "";
732                 Map<String, DataTypeDefinition> dataTypes = null;
733                 boolean isValidate = false;
734                 ImmutablePair<String, Boolean> result;
735
736                 // test 1
737                 testSubject = createTestSubject();
738                 rules = null;
739                 result = testSubject.validateAndUpdateRules(propertyType, rules, innerType, dataTypes, isValidate);
740         }
741
742         
743         @Test
744         public void testAddRulesToNewPropertyValue() throws Exception {
745                 PropertyOperation testSubject;
746                 PropertyValueData propertyValueData = new PropertyValueData();
747                 ComponentInstanceProperty resourceInstanceProperty = new ComponentInstanceProperty();
748                 String resourceInstanceId = "";
749
750                 // default test
751                 testSubject = createTestSubject();
752                 testSubject.addRulesToNewPropertyValue(propertyValueData, resourceInstanceProperty, resourceInstanceId);
753         }
754
755         
756         @Test
757         public void testFindPropertyValue() throws Exception {
758                 PropertyOperation testSubject;
759                 String resourceInstanceId = "";
760                 String propertyId = "";
761                 ImmutablePair<TitanOperationStatus, String> result;
762
763                 // default test
764                 testSubject = createTestSubject();
765                 result = testSubject.findPropertyValue(resourceInstanceId, propertyId);
766         }
767
768         
769         @Test
770         public void testUpdateRulesInPropertyValue() throws Exception {
771                 PropertyOperation testSubject;
772                 PropertyValueData propertyValueData = new PropertyValueData();
773                 ComponentInstanceProperty resourceInstanceProperty = new ComponentInstanceProperty();
774                 String resourceInstanceId = "";
775
776                 // default test
777                 testSubject = createTestSubject();
778                 testSubject.updateRulesInPropertyValue(propertyValueData, resourceInstanceProperty, resourceInstanceId);
779         }
780
781         
782         @Test
783         public void testGetAllPropertiesOfResourceInstanceOnlyPropertyDefId() throws Exception {
784                 PropertyOperation testSubject;
785                 String resourceInstanceUid = "";
786                 Either<List<ComponentInstanceProperty>, TitanOperationStatus> result;
787
788                 // default test
789                 testSubject = createTestSubject();
790                 result = testSubject.getAllPropertiesOfResourceInstanceOnlyPropertyDefId(resourceInstanceUid);
791         }
792
793         
794         @Test
795         public void testRemovePropertyOfResourceInstance() throws Exception {
796                 PropertyOperation testSubject;
797                 String propertyValueUid = "";
798                 String resourceInstanceId = "";
799                 Either<PropertyValueData, TitanOperationStatus> result;
800
801                 // default test
802                 testSubject = createTestSubject();
803                 result = testSubject.removePropertyOfResourceInstance(propertyValueUid, resourceInstanceId);
804         }
805
806         
807         @Test
808         public void testRemovePropertyValueFromResourceInstance() throws Exception {
809                 PropertyOperation testSubject;
810                 String propertyValueUid = "";
811                 String resourceInstanceId = "";
812                 boolean inTransaction = false;
813                 Either<ComponentInstanceProperty, StorageOperationStatus> result;
814
815                 // default test
816                 testSubject = createTestSubject();
817                 result = testSubject.removePropertyValueFromResourceInstance(propertyValueUid, resourceInstanceId,
818                                 inTransaction);
819         }
820
821         
822         @Test
823         public void testBuildResourceInstanceProperty() throws Exception {
824                 PropertyOperation testSubject;
825                 PropertyValueData propertyValueData = new PropertyValueData();
826                 ComponentInstanceProperty resourceInstanceProperty = new ComponentInstanceProperty();
827                 ComponentInstanceProperty result;
828
829                 // default test
830                 testSubject = createTestSubject();
831                 result = testSubject.buildResourceInstanceProperty(propertyValueData, resourceInstanceProperty);
832         }
833
834         
835         @Test
836         public void testIsPropertyDefaultValueValid() throws Exception {
837                 PropertyOperation testSubject;
838                 IComplexDefaultValue propertyDefinition = null;
839                 Map<String, DataTypeDefinition> dataTypes = null;
840                 boolean result;
841
842                 // test 1
843                 testSubject = createTestSubject();
844                 propertyDefinition = null;
845                 result = testSubject.isPropertyDefaultValueValid(propertyDefinition, dataTypes);
846                 Assert.assertEquals(false, result);
847         }
848
849         
850         @Test
851         public void testIsPropertyTypeValid() throws Exception {
852                 PropertyOperation testSubject;
853                 IComplexDefaultValue property = null;
854                 boolean result;
855
856                 // test 1
857                 testSubject = createTestSubject();
858                 property = null;
859                 result = testSubject.isPropertyTypeValid(property);
860                 Assert.assertEquals(false, result);
861         }
862
863         
864         @Test
865         public void testIsPropertyInnerTypeValid() throws Exception {
866                 PropertyOperation testSubject;
867                 IComplexDefaultValue property = null;
868                 Map<String, DataTypeDefinition> dataTypes = null;
869                 ImmutablePair<String, Boolean> result;
870
871                 // test 1
872                 testSubject = createTestSubject();
873                 property = null;
874                 result = testSubject.isPropertyInnerTypeValid(property, dataTypes);
875         }
876
877         
878         @Test
879         public void testGetAllPropertiesOfResourceInstanceOnlyPropertyDefId_1() throws Exception {
880                 PropertyOperation testSubject;
881                 String resourceInstanceUid = "";
882                 NodeTypeEnum instanceNodeType = null;
883                 Either<List<ComponentInstanceProperty>, TitanOperationStatus> result;
884
885                 // default test
886                 testSubject = createTestSubject();
887                 result = testSubject.getAllPropertiesOfResourceInstanceOnlyPropertyDefId(resourceInstanceUid, instanceNodeType);
888         }
889
890         
891         @Test
892         public void testFindDefaultValueFromSecondPosition() throws Exception {
893                 PropertyOperation testSubject;
894                 List<String> pathOfComponentInstances = null;
895                 String propertyUniqueId = "";
896                 String defaultValue = "";
897                 Either<String, TitanOperationStatus> result;
898
899                 // test 1
900                 testSubject = createTestSubject();
901                 pathOfComponentInstances = null;
902                 result = testSubject.findDefaultValueFromSecondPosition(pathOfComponentInstances, propertyUniqueId,
903                                 defaultValue);
904         }
905
906         
907         @Test
908         public void testUpdatePropertyByBestMatch() throws Exception {
909                 PropertyOperation testSubject;
910                 String propertyUniqueId = "";
911                 ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
912                 List<String> path = new ArrayList<>();
913                 path.add("path");
914                 instanceProperty.setPath(path);
915                 Map<String, ComponentInstanceProperty> instanceIdToValue = new HashMap<>();
916                 instanceIdToValue.put("123", instanceProperty);
917
918                 // default test
919                 testSubject = createTestSubject();
920                 testSubject.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);
921         }
922
923         
924         @Test
925         public void testGetDataTypeByUid() throws Exception {
926                 PropertyOperation testSubject;
927                 String uniqueId = "";
928                 Either<DataTypeDefinition, TitanOperationStatus> result;
929
930                 // default test
931                 testSubject = createTestSubject();
932                 result = testSubject.getDataTypeByUid(uniqueId);
933         }
934
935         
936         @Test
937         public void testAddDataType() throws Exception {
938                 PropertyOperation testSubject;
939                 DataTypeDefinition dataTypeDefinition = new DataTypeDefinition();
940                 Either<DataTypeDefinition, StorageOperationStatus> result;
941
942                 // default test
943                 testSubject = createTestSubject();
944                 result = testSubject.addDataType(dataTypeDefinition);
945         }
946
947         
948         @Test
949         public void testGetDataTypeByName() throws Exception {
950                 PropertyOperation testSubject;
951                 String name = "";
952                 boolean inTransaction = false;
953                 Either<DataTypeDefinition, StorageOperationStatus> result;
954
955                 // default test
956                 testSubject = createTestSubject();
957                 result = testSubject.getDataTypeByName(name, inTransaction);
958         }
959
960         
961         @Test
962         public void testGetDataTypeByName_1() throws Exception {
963                 PropertyOperation testSubject;
964                 String name = "";
965                 Either<DataTypeDefinition, StorageOperationStatus> result;
966
967                 // default test
968                 testSubject = createTestSubject();
969                 result = testSubject.getDataTypeByName(name);
970         }
971
972         
973         @Test
974         public void testGetDataTypeByNameWithoutDerived() throws Exception {
975                 PropertyOperation testSubject;
976                 String name = "";
977                 Either<DataTypeDefinition, StorageOperationStatus> result;
978
979                 // default test
980                 testSubject = createTestSubject();
981                 result = testSubject.getDataTypeByNameWithoutDerived(name);
982         }
983
984         
985         @Test
986         public void testGetDataTypeByUidWithoutDerivedDataTypes() throws Exception {
987                 PropertyOperation testSubject;
988                 String uniqueId = "";
989                 Either<DataTypeDefinition, TitanOperationStatus> result;
990
991                 // default test
992                 testSubject = createTestSubject();
993                 result = testSubject.getDataTypeByUidWithoutDerivedDataTypes(uniqueId);
994         }
995
996         
997         @Test
998         public void testIsDefinedInDataTypes() throws Exception {
999                 PropertyOperation testSubject;
1000                 String propertyType = "";
1001                 Either<Boolean, TitanOperationStatus> result;
1002
1003                 // default test
1004                 testSubject = createTestSubject();
1005                 result = testSubject.isDefinedInDataTypes(propertyType);
1006         }
1007
1008         
1009         @Test
1010         public void testGetAllDataTypes() throws Exception {
1011                 PropertyOperation testSubject;
1012                 Either<Map<String, DataTypeDefinition>, TitanOperationStatus> result;
1013
1014                 // default test
1015                 testSubject = createTestSubject();
1016                 result = testSubject.getAllDataTypes();
1017         }
1018
1019         
1020         @Test
1021         public void testCheckInnerType() throws Exception {
1022                 PropertyOperation testSubject;
1023                 PropertyDataDefinition propDataDef = new PropertyDataDefinition();
1024                 Either<String, TitanOperationStatus> result;
1025
1026                 // default test
1027                 testSubject = createTestSubject();
1028                 result = testSubject.checkInnerType(propDataDef);
1029         }
1030
1031         
1032         @Test
1033         public void testGetAllDataTypeNodes() throws Exception {
1034                 PropertyOperation testSubject;
1035                 Either<List<DataTypeData>, TitanOperationStatus> result;
1036
1037                 // default test
1038                 testSubject = createTestSubject();
1039                 result = testSubject.getAllDataTypeNodes();
1040         }
1041
1042         
1043         @Test
1044         public void testValidateAndUpdatePropertyValue() throws Exception {
1045                 PropertyOperation testSubject;
1046                 String propertyType = "";
1047                 String value = "";
1048                 boolean isValidate = false;
1049                 String innerType = "";
1050                 Map<String, DataTypeDefinition> dataTypes = null;
1051                 Either<Object, Boolean> result;
1052
1053                 // default test
1054                 testSubject = createTestSubject();
1055                 result = testSubject.validateAndUpdatePropertyValue(propertyType, value, isValidate, innerType, dataTypes);
1056         }
1057
1058         
1059         @Test
1060         public void testValidateAndUpdatePropertyValue_1() throws Exception {
1061                 PropertyOperation testSubject;
1062                 String propertyType = "";
1063                 String value = "";
1064                 String innerType = "";
1065                 Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
1066                 dataTypes.put("", new DataTypeDefinition());
1067                 Either<Object, Boolean> result;
1068
1069                 // default test
1070                 testSubject = createTestSubject();
1071                 result = testSubject.validateAndUpdatePropertyValue(propertyType, value, innerType, dataTypes);
1072         }
1073
1074         
1075
1076
1077         
1078         @Test
1079         public void testAddPropertiesToElementType() throws Exception {
1080                 PropertyOperation testSubject;
1081                 String uniqueId = "";
1082                 NodeTypeEnum elementType = null;
1083                 List<PropertyDefinition> properties = null;
1084                 Either<Map<String, PropertyData>, TitanOperationStatus> result;
1085
1086                 // test 1
1087                 testSubject = createTestSubject();
1088                 properties = null;
1089                 result = testSubject.addPropertiesToElementType(uniqueId, elementType, properties);
1090         }
1091
1092         
1093         @Test
1094         public void testUpdateDataType() throws Exception {
1095                 PropertyOperation testSubject;
1096                 DataTypeDefinition newDataTypeDefinition = new DataTypeDefinition();
1097                 DataTypeDefinition oldDataTypeDefinition = new DataTypeDefinition();
1098                 Either<DataTypeDefinition, StorageOperationStatus> result;
1099
1100                 // default test
1101                 testSubject = createTestSubject();
1102                 result = testSubject.updateDataType(newDataTypeDefinition, oldDataTypeDefinition);
1103         }
1104 }