Refactoring Consolidation Service
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / components / impl / GroupBusinessLogicTest.java
1 package org.openecomp.sdc.be.components.impl;
2
3 import java.util.Collection;
4 import java.util.List;
5 import java.util.Map;
6
7 import org.apache.commons.lang3.tuple.ImmutablePair;
8 import org.junit.Test;
9 import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
10 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
11 import org.openecomp.sdc.be.info.ArtifactTemplateInfo;
12 import org.openecomp.sdc.be.info.GroupDefinitionInfo;
13 import org.openecomp.sdc.be.model.Component;
14 import org.openecomp.sdc.be.model.ComponentInstance;
15 import org.openecomp.sdc.be.model.DataTypeDefinition;
16 import org.openecomp.sdc.be.model.GroupDefinition;
17 import org.openecomp.sdc.be.model.GroupInstance;
18 import org.openecomp.sdc.be.model.GroupInstanceProperty;
19 import org.openecomp.sdc.be.model.GroupProperty;
20 import org.openecomp.sdc.be.model.PropertyDefinition;
21 import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames;
22 import org.openecomp.sdc.be.model.User;
23 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
24 import org.openecomp.sdc.exception.ResponseFormat;
25
26 import com.google.common.base.Function;
27
28 import fj.data.Either;
29
30
31 public class GroupBusinessLogicTest {
32
33         private GroupBusinessLogic createTestSubject() {
34                 return new GroupBusinessLogic();
35         }
36
37         
38         @Test
39         public void testGetComponentTypeForResponse() throws Exception {
40                 GroupBusinessLogic testSubject;
41                 Component component = null;
42                 String result;
43
44                 // default test
45                 testSubject = createTestSubject();
46                 
47         }
48
49         
50         @Test
51         public void testVerifyArtifactsBelongsToComponent() throws Exception {
52         GroupBusinessLogic testSubject;Component component = null;
53         List<String> artifacts = null;
54         String context = "";
55         Either<Boolean,ResponseFormat> result;
56         
57         // test 1
58         testSubject=createTestSubject();artifacts = null;
59         
60         
61         }
62
63         
64         @Test
65         public void testVerifyComponentInstancesAreValidMembers() throws Exception {
66         GroupBusinessLogic testSubject;Component component = null;
67         ComponentTypeEnum componentType = null;
68         String groupName = "";
69         String groupType = "";
70         Map<String,String> groupMembers = null;
71         List<String> memberToscaTypes = null;
72         Either<Boolean,ResponseFormat> result;
73         
74         // test 1
75         testSubject=createTestSubject();groupMembers = null;
76         
77         
78         
79         // test 2
80         testSubject=createTestSubject();memberToscaTypes = null;
81         
82         
83         }
84
85         
86         @Test
87         public void testValidateAndUpdateGroupMetadata() throws Exception {
88                 GroupBusinessLogic testSubject;
89                 String componentId = "";
90                 User user = null;
91                 ComponentTypeEnum componentType = null;
92                 GroupDefinition updatedGroup = null;
93                 boolean inTransaction = false;
94                 boolean shouldLock = false;
95                 Either<GroupDefinition, ResponseFormat> result;
96
97                 // default test
98                 testSubject = createTestSubject();
99                 
100         }
101
102         
103         @Test
104         public void testUpdateGroupMetadata() throws Exception {
105                 GroupBusinessLogic testSubject;
106                 Component component = null;
107                 GroupDefinition currentGroup = null;
108                 GroupDefinition updatedGroup = null;
109                 Either<GroupDefinition, ResponseFormat> result;
110
111                 // default test
112                 testSubject = createTestSubject();
113                 
114         }
115
116         
117         @Test
118         public void testUpdateGroup() throws Exception {
119                 GroupBusinessLogic testSubject;
120                 Component component = null;
121                 GroupDefinition updatedGroup = null;
122                 String currentGroupName = "";
123                 Either<GroupDefinition, ResponseFormat> result;
124
125                 // default test
126                 testSubject = createTestSubject();
127                 
128         }
129
130         
131         @Test
132         public void testValidateAndUpdateGroupProperties() throws Exception {
133                 GroupBusinessLogic testSubject;
134                 String componentId = "";
135                 String groupUniqueId = "";
136                 User user = null;
137                 ComponentTypeEnum componentType = null;
138                 List<GroupProperty> groupPropertiesToUpdate = null;
139                 boolean inTransaction = false;
140                 Either<List<GroupProperty>, ResponseFormat> result;
141
142                 // default test
143                 testSubject = createTestSubject();
144                 
145         }
146
147         
148         @Test
149         public void testResetEmptyValueWithDefaults() throws Exception {
150         GroupBusinessLogic testSubject;List<GroupProperty> groupPropertiesToUpdate = null;
151         GroupDefinition originalGroup = null;
152         
153         
154         // default test
155         }
156
157         
158         @Test
159         public void testValidateGroupPropertyAndResetEmptyValue() throws Exception {
160         GroupBusinessLogic testSubject;GroupDefinition originalGroup = null;
161         List<GroupProperty> groupPropertiesToUpdate = null;
162         Either<List<GroupProperty>,ResponseFormat> result;
163         
164         // default test
165         testSubject=createTestSubject();
166         }
167
168         
169         @Test
170         public void testValidatePropertyBusinessLogic() throws Exception {
171         GroupBusinessLogic testSubject;List<GroupProperty> groupPropertiesToUpdate = null;
172         GroupDefinition originalGroup = null;
173         Either<List<GroupProperty>,ResponseFormat> result;
174         
175         // default test
176         testSubject=createTestSubject();
177         }
178
179         
180         @Test
181         public void testPrepareMapWithOriginalProperties() throws Exception {
182                 GroupBusinessLogic testSubject;
183                 GroupDefinition originalGroup = null;
184                 Map<PropertyNames, String> result;
185
186                 // default test
187                 testSubject = createTestSubject();
188                 
189         }
190
191         
192         @Test
193         public void testValidateOnlyValueChanged() throws Exception {
194         GroupBusinessLogic testSubject;List<GroupProperty> groupPropertiesToUpdate = null;
195         GroupDefinition originalGroup = null;
196         Either<List<GroupProperty>,ResponseFormat> result;
197         
198         // default test
199         testSubject=createTestSubject();
200         }
201
202         
203         @Test
204         public void testIsOnlyGroupPropertyValueChanged() throws Exception {
205                 GroupBusinessLogic testSubject;
206                 GroupProperty groupProperty = null;
207                 GroupProperty groupProperty2 = null;
208                 boolean result;
209
210                 // default test
211                 testSubject = createTestSubject();
212                 
213         }
214
215         
216         @Test
217         public void testValidateAndUpdateGroupMetadata_1() throws Exception {
218                 GroupBusinessLogic testSubject;
219                 GroupDefinition currentGroup = null;
220                 GroupDefinition groupUpdate = null;
221                 Either<GroupDefinition, ResponseFormat> result;
222
223                 // default test
224                 testSubject = createTestSubject();
225                 
226         }
227
228         
229         @Test
230         public void testValidateAndUpdateGroupName() throws Exception {
231                 GroupBusinessLogic testSubject;
232                 GroupDefinition currentGroup = null;
233                 GroupDefinition groupUpdate = null;
234                 Either<Boolean, ResponseFormat> result;
235
236                 // default test
237                 testSubject = createTestSubject();
238                 
239         }
240
241         
242         @Test
243         public void testValidateGroupName() throws Exception {
244                 GroupBusinessLogic testSubject;
245                 String currentGroupName = "";
246                 String groupUpdateName = "";
247                 boolean isforceNameModification = false;
248                 Either<Boolean, ResponseFormat> result;
249
250                 // default test
251                 testSubject = createTestSubject();
252                 
253         }
254
255         
256         @Test
257         public void testGetGroupWithArtifactsById() throws Exception {
258                 GroupBusinessLogic testSubject;
259                 ComponentTypeEnum componentType = null;
260                 String componentId = "";
261                 String groupId = "";
262                 String userId = "";
263                 boolean inTransaction = false;
264                 Either<GroupDefinitionInfo, ResponseFormat> result;
265
266                 // default test
267                 testSubject = createTestSubject();
268                 
269         }
270
271         
272         @Test
273         public void testFindGroupOnComponent() throws Exception {
274                 GroupBusinessLogic testSubject;
275                 Component component = null;
276                 String groupId = "";
277                 Either<GroupDefinition, StorageOperationStatus> result;
278
279                 // default test
280                 testSubject = createTestSubject();
281                 
282         }
283
284         
285         @Test
286         public void testValidateGroupsBeforeUpdate() throws Exception {
287         GroupBusinessLogic testSubject;String componentId = "";
288         String userId = "";
289         ComponentTypeEnum componentType = null;
290         List<GroupDefinition> groups = null;
291         boolean inTransaction = false;
292         Either<org.openecomp.sdc.be.model.Component,ResponseFormat> result;
293         
294         // default test
295         testSubject=createTestSubject();
296         }
297
298         
299         @Test
300         public void testValidateGroupsInComponentByFunc() throws Exception {
301         GroupBusinessLogic testSubject;List<GroupDefinition> groups = null;
302         Component component = null;
303         Function<GroupDefinition,String> getByParam = null;
304         ResponseFormat result;
305         
306         // default test
307         testSubject=createTestSubject();
308         }
309
310         
311         @Test
312         public void testGetAsString() throws Exception {
313                 GroupBusinessLogic testSubject;
314                 List<String> list = null;
315                 String result;
316
317                 // test 1
318                 testSubject = createTestSubject();
319                 list = null;
320                 
321                 
322         }
323
324         
325         @Test
326         public void testUpdateGroupPropertiesValue() throws Exception {
327         GroupBusinessLogic testSubject;String componentId = "";
328         GroupDefinition currentGroup = null;
329         List<GroupProperty> groupPropertyToUpdate = null;
330         boolean inTransaction = false;
331         Either<List<GroupProperty>,ResponseFormat> result;
332         
333         // default test
334         testSubject=createTestSubject();
335         }
336
337         
338         @Test
339         public void testValidateGenerateVfModuleGroupNames() throws Exception {
340                 GroupBusinessLogic testSubject;
341                 List<ArtifactTemplateInfo> allGroups = null;
342                 String resourceSystemName = "";
343                 int startGroupCounter = 0;
344                 Either<Boolean, ResponseFormat> result;
345
346                 // default test
347                 testSubject = createTestSubject();
348                 
349         }
350
351         
352         @Test
353         public void testValidateGenerateVfModuleGroupName() throws Exception {
354                 GroupBusinessLogic testSubject;
355                 String resourceSystemName = "";
356                 String description = "";
357                 int groupCounter = 0;
358                 Either<String, ResponseFormat> result;
359
360                 // test 1
361                 testSubject = createTestSubject();
362                 resourceSystemName = null;
363                 description = null;
364                 
365                 
366
367                 // test 2
368                 testSubject = createTestSubject();
369                 resourceSystemName = "";
370                 description = null;
371                 
372                 
373
374                 // test 3
375                 testSubject = createTestSubject();
376                 description = null;
377                 resourceSystemName = null;
378                 
379                 
380
381                 // test 4
382                 testSubject = createTestSubject();
383                 description = "";
384                 resourceSystemName = null;
385                 
386                 
387         }
388
389         
390         @Test
391         public void testValidateUpdateVfGroupNames() throws Exception {
392                 GroupBusinessLogic testSubject;
393                 Map<String, GroupDefinition> groups = null;
394                 String resourceSystemName = "";
395                 Either<Map<String, GroupDefinition>, ResponseFormat> result;
396
397                 // default test
398                 testSubject = createTestSubject();
399                 
400         }
401
402         
403         @Test
404         public void testGetNextVfModuleNameCounter() throws Exception {
405                 GroupBusinessLogic testSubject;
406                 Map<String, GroupDefinition> groups = null;
407                 int result;
408
409                 // test 1
410                 testSubject = createTestSubject();
411                 groups = null;
412                 
413                 
414         }
415
416         
417         @Test
418         public void testGetNextVfModuleNameCounter_1() throws Exception {
419                 GroupBusinessLogic testSubject;
420                 Collection<GroupDefinition> groups = null;
421                 int result;
422
423                 // test 1
424                 testSubject = createTestSubject();
425                 groups = null;
426                 
427                 
428         }
429
430         
431         @Test
432         public void testValidateUpdateVfGroupNamesOnGraph() throws Exception {
433                 GroupBusinessLogic testSubject;
434                 List<GroupDefinition> groups = null;
435                 Component component = null;
436                 boolean inTransaction = false;
437                 Either<List<GroupDefinition>, ResponseFormat> result;
438
439                 // default test
440                 testSubject = createTestSubject();
441                 
442         }
443
444         
445         @Test
446         public void testGetGroupInstWithArtifactsById() throws Exception {
447                 GroupBusinessLogic testSubject;
448                 ComponentTypeEnum componentType = null;
449                 String componentId = "";
450                 String componentInstanceId = "";
451                 String groupInstId = "";
452                 String userId = "";
453                 boolean inTransaction = false;
454                 Either<GroupDefinitionInfo, ResponseFormat> result;
455
456                 // default test
457                 testSubject = createTestSubject();
458                 
459         }
460
461         
462         @Test
463         public void testFindComponentInstanceAndGroupInstanceOnComponent() throws Exception {
464                 GroupBusinessLogic testSubject;
465                 Component component = null;
466                 String componentInstanceId = "";
467                 String groupInstId = "";
468                 Either<ImmutablePair<ComponentInstance, GroupInstance>, StorageOperationStatus> result;
469
470                 // default test
471                 testSubject = createTestSubject();
472                 
473         }
474
475         
476         @Test
477         public void testGetLatestIntProperty() throws Exception {
478         GroupBusinessLogic testSubject;Map<PropertyNames,String> newValues = null;
479         Map<PropertyNames,String> parentValues = null;
480         PropertyNames propertyKey = null;
481         int result;
482         
483         // default test
484         testSubject=createTestSubject();
485         }
486
487         
488         @Test
489         public void testIsPropertyChanged() throws Exception {
490         GroupBusinessLogic testSubject;Map<PropertyNames,String> newValues = null;
491         Map<PropertyNames,String> parentValues = null;
492         PropertyNames minInstances = null;
493         boolean result;
494         
495         // default test
496         testSubject=createTestSubject();
497         }
498
499         
500         @Test
501         public void testValidateMinMaxAndInitialCountPropertyLogicVF() throws Exception {
502         GroupBusinessLogic testSubject;Map<PropertyNames,String> newValues = null;
503         Map<PropertyNames,String> parentValues = null;
504         Either<Boolean,ResponseFormat> result;
505         
506         // default test
507         testSubject=createTestSubject();
508         }
509
510         
511         @Test
512         public void testValidateMinMaxAndInitialCountPropertyLogic() throws Exception {
513         GroupBusinessLogic testSubject;Map<PropertyNames,String> newValues = null;
514         Map<PropertyNames,String> currValues = null;
515         Map<PropertyNames,String> parentValues = null;
516         Either<Boolean,ResponseFormat> result;
517         
518         // default test
519         testSubject=createTestSubject();
520         }
521
522         
523         @Test
524         public void testValidateValueInRange() throws Exception {
525         GroupBusinessLogic testSubject;ImmutablePair<PropertyNames,String> newValue = null;
526         ImmutablePair<PropertyNames,String> min = null;
527         ImmutablePair<PropertyNames,String> max = null;
528         Either<Boolean,ResponseFormat> result;
529         
530         // default test
531         testSubject=createTestSubject();
532         }
533
534         
535         @Test
536         public void testParseIntValue() throws Exception {
537                 GroupBusinessLogic testSubject;
538                 String value = "";
539                 PropertyNames propertyName = null;
540                 int result;
541
542                 // default test
543                 testSubject = createTestSubject();
544                 
545         }
546
547         
548         @Test
549         public void testValidateAndUpdateGroupInstancePropertyValues() throws Exception {
550                 GroupBusinessLogic testSubject;
551                 String componentId = "";
552                 String instanceId = "";
553                 GroupInstance oldGroupInstance = null;
554                 List<GroupInstanceProperty> newProperties = null;
555                 boolean inTransaction = false;
556                 Either<GroupInstance, ResponseFormat> result;
557
558                 // default test
559                 testSubject = createTestSubject();
560                 
561         }
562
563         
564         @Test
565         public void testValidateReduceGroupInstancePropertiesBeforeUpdate() throws Exception {
566         GroupBusinessLogic testSubject;GroupInstance oldGroupInstance = null;
567         List<GroupInstanceProperty> newProperties = null;
568         Either<List<GroupInstanceProperty>,ResponseFormat> result;
569         
570         // default test
571         testSubject=createTestSubject();
572         }
573
574         
575         @Test
576         public void testFillValuesAndParentValuesFromExistingProperties() throws Exception {
577         GroupBusinessLogic testSubject;Map<String,GroupInstanceProperty> existingProperties = null;
578         Map<PropertyNames,String> propertyValues = null;
579         Map<PropertyNames,String> parentPropertyValues = null;
580         
581         
582         // default test
583         }
584
585         
586         @Test
587         public void testHandleAndAddProperty() throws Exception {
588         GroupBusinessLogic testSubject;List<GroupInstanceProperty> reducedProperties = null;
589         Map<PropertyNames,String> newPropertyValues = null;
590         GroupInstanceProperty currNewProperty = null;
591         GroupInstanceProperty currExistingProperty = null;
592         Either<Boolean,ResponseFormat> result;
593         
594         // default test
595         testSubject=createTestSubject();
596         }
597
598         
599         @Test
600         public void testIsUpdatable() throws Exception {
601                 GroupBusinessLogic testSubject;
602                 PropertyNames updatablePropertyName = null;
603                 boolean result;
604
605                 // default test
606                 testSubject = createTestSubject();
607                 
608         }
609
610         
611         @Test
612         public void testAddPropertyUpdatedValues() throws Exception {
613         GroupBusinessLogic testSubject;List<GroupInstanceProperty> reducedProperties = null;
614         PropertyNames propertyName = null;
615         Map<PropertyNames,String> newPropertyValues = null;
616         GroupInstanceProperty newProperty = null;
617         GroupInstanceProperty existingProperty = null;
618         
619         
620         // default test
621         }
622
623         
624         @Test
625         public void testIsEmptyMinInitialCountValue() throws Exception {
626                 GroupBusinessLogic testSubject;
627                 PropertyNames propertyName = null;
628                 String newValue = "";
629                 boolean result;
630
631                 // default test
632                 testSubject = createTestSubject();
633                 
634         }
635
636         
637         @Test
638         public void testConvertIfUnboundMax() throws Exception {
639                 GroupBusinessLogic testSubject;
640                 String value = "";
641                 int result;
642
643                 // default test
644                 testSubject = createTestSubject();
645                 
646         }
647
648         
649         @Test
650         public void testValidateAndUpdatePropertyValue() throws Exception {
651                 GroupBusinessLogic testSubject;
652                 GroupInstanceProperty newProperty = null;
653                 GroupInstanceProperty existingProperty = null;
654                 Either<Boolean, ResponseFormat> result;
655
656                 // default test
657                 testSubject = createTestSubject();
658                 
659         }
660
661         
662         @Test
663         public void testValidateImmutableProperty() throws Exception {
664                 GroupBusinessLogic testSubject;
665                 GroupProperty oldProperty = null;
666                 GroupProperty newProperty = null;
667
668                 // default test
669                 testSubject = createTestSubject();
670         }
671
672         
673         @Test
674         public void testCreateGroups() throws Exception {
675                 GroupBusinessLogic testSubject;
676                 Component component = null;
677                 User user = null;
678                 ComponentTypeEnum componentType = null;
679                 List<GroupDefinition> groupDefinitions = null;
680                 Either<List<GroupDefinition>, ResponseFormat> result;
681
682                 // test 1
683                 testSubject = createTestSubject();
684                 groupDefinitions = null;
685                 
686                 
687         }
688
689         
690         @Test
691         public void testAddGroups() throws Exception {
692                 GroupBusinessLogic testSubject;
693                 Component component = null;
694                 User user = null;
695                 ComponentTypeEnum componentType = null;
696                 List<GroupDefinition> groupDefinitions = null;
697                 Either<List<GroupDefinition>, ResponseFormat> result;
698
699                 // test 1
700                 testSubject = createTestSubject();
701                 groupDefinitions = null;
702                 
703                 
704         }
705
706         
707         @Test
708         public void testDeleteGroups() throws Exception {
709                 GroupBusinessLogic testSubject;
710                 Component component = null;
711                 User user = null;
712                 ComponentTypeEnum componentType = null;
713                 List<GroupDefinition> groupDefinitions = null;
714                 Either<List<GroupDefinition>, ResponseFormat> result;
715
716                 // default test
717                 testSubject = createTestSubject();
718                 
719         }
720
721         
722         @Test
723         public void testUpdateGroups() throws Exception {
724                 GroupBusinessLogic testSubject;
725                 Component component = null;
726                 ComponentTypeEnum componentType = null;
727                 List<GroupDefinition> groupDefinitions = null;
728                 Either<List<GroupDefinition>, ResponseFormat> result;
729
730                 // default test
731                 testSubject = createTestSubject();
732                 
733         }
734
735         
736         @Test
737         public void testHandleGroup() throws Exception {
738                 GroupBusinessLogic testSubject;
739                 Component component = null;
740                 User user = null;
741                 ComponentTypeEnum componentType = null;
742                 GroupDefinition groupDefinition = null;
743                 Map<String, DataTypeDefinition> allDAtaTypes = null;
744                 Either<GroupDefinition, ResponseFormat> result;
745
746                 // default test
747                 testSubject = createTestSubject();
748                 
749         }
750
751         
752         @Test
753         public void testHandleProperty() throws Exception {
754                 GroupBusinessLogic testSubject;
755                 GroupProperty groupProperty = null;
756                 PropertyDefinition prop = null;
757                 Integer index = 0;
758                 Map<String, DataTypeDefinition> allDataTypes = null;
759                 Either<GroupProperty, TitanOperationStatus> result;
760
761                 // test 1
762                 testSubject = createTestSubject();
763                 prop = null;
764                 
765                 
766         }
767 }