aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
blob: 9195df09559332d490a0c60ce5f3045fc8cb580b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
/*-
 * ============LICENSE_START=======================================================
 * ONAP - SO
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.onap.so.bpmn.servicedecomposition.tasks;

import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfcCustomization;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class BBInputSetupMapperLayerTest {

    BBInputSetupMapperLayer bbInputSetupMapperLayer = new BBInputSetupMapperLayer();

    ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/";


    @Test
    public void testMapOrchestrationStatusFromAAI() {
        OrchestrationStatus expected = OrchestrationStatus.INVENTORIED;
        String orchStatusInput = "Inventoried";
        OrchestrationStatus actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
        assertThat(actual, sameBeanAs(expected));

        expected = OrchestrationStatus.ASSIGNED;
        orchStatusInput = "Assigned";
        actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
        assertThat(actual, sameBeanAs(expected));

        expected = OrchestrationStatus.ACTIVE;
        orchStatusInput = "Active";
        actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
        assertThat(actual, sameBeanAs(expected));

        expected = OrchestrationStatus.CREATED;
        orchStatusInput = "Created";
        actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
        assertThat(actual, sameBeanAs(expected));

        expected = OrchestrationStatus.PRECREATED;
        orchStatusInput = "PreCreated";
        actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
        assertThat(actual, sameBeanAs(expected));

        expected = OrchestrationStatus.PENDING_CREATE;
        orchStatusInput = "PendingCreate";
        actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
        assertThat(actual, sameBeanAs(expected));

        expected = OrchestrationStatus.PENDING_DELETE;
        orchStatusInput = "PendingDelete";
        actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
        assertThat(actual, sameBeanAs(expected));

        expected = OrchestrationStatus.PENDING;
        orchStatusInput = "Pending";
        actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
        assertThat(actual, sameBeanAs(expected));

        expected = OrchestrationStatus.PENDING_ACTIVATION;
        orchStatusInput = "PendingActivation";
        actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapOrchestrationFuzzyCases() {
        List<String> values = Arrays.asList("pending-create", "pending_Create", "pendinggcreate", "PendingCreate");
        values.forEach(value -> {
            assertThat(bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(value),
                    equalTo(OrchestrationStatus.PENDING_CREATE));
        });
    }

    @Test
    public void testMapAAICustomer() throws IOException {
        Customer expected = mapper.readValue(new File(RESOURCE_PATH + "Customer.json"), Customer.class);

        org.onap.aai.domain.yang.Customer customerAAI = mapper.readValue(new File(RESOURCE_PATH + "Customer_AAI.json"),
                org.onap.aai.domain.yang.Customer.class);

        Customer actual = bbInputSetupMapperLayer.mapAAICustomer(customerAAI);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAIServiceSubscription() throws IOException {
        ServiceSubscription expected = mapper.readValue(new File(RESOURCE_PATH + "ServiceSubscriptionExpected.json"),
                ServiceSubscription.class);

        org.onap.aai.domain.yang.ServiceSubscription svcSubscriptionAAI =
                mapper.readValue(new File(RESOURCE_PATH + "ServiceSubscription_AAI.json"),
                        org.onap.aai.domain.yang.ServiceSubscription.class);

        ServiceSubscription actual = bbInputSetupMapperLayer.mapAAIServiceSubscription(svcSubscriptionAAI);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAIProject() throws IOException {
        Project expected = mapper.readValue(new File(RESOURCE_PATH + "Project.json"), Project.class);

        org.onap.aai.domain.yang.Project projectAAI = new org.onap.aai.domain.yang.Project();
        projectAAI.setProjectName("projectName");

        Project actual = bbInputSetupMapperLayer.mapAAIProject(projectAAI);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapRequestProject() throws IOException {
        Project expected = mapper.readValue(new File(RESOURCE_PATH + "Project.json"), Project.class);

        org.onap.so.serviceinstancebeans.Project requestProject = new org.onap.so.serviceinstancebeans.Project();
        requestProject.setProjectName("projectName");

        Project actual = bbInputSetupMapperLayer.mapRequestProject(requestProject);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAIOwningEntity() throws IOException {
        OwningEntity expected = mapper.readValue(new File(RESOURCE_PATH + "OwningEntity.json"), OwningEntity.class);

        org.onap.aai.domain.yang.OwningEntity entityAAI = new org.onap.aai.domain.yang.OwningEntity();
        entityAAI.setOwningEntityId("owningEntityId");
        entityAAI.setOwningEntityName("owningEntityName");

        OwningEntity actual = bbInputSetupMapperLayer.mapAAIOwningEntity(entityAAI);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapRequestOwningEntity() throws IOException {
        OwningEntity expected = mapper.readValue(new File(RESOURCE_PATH + "OwningEntity.json"), OwningEntity.class);

        org.onap.so.serviceinstancebeans.OwningEntity requestOwningEntity =
                new org.onap.so.serviceinstancebeans.OwningEntity();
        requestOwningEntity.setOwningEntityId("owningEntityId");
        requestOwningEntity.setOwningEntityName("owningEntityName");

        OwningEntity actual = bbInputSetupMapperLayer.mapRequestOwningEntity(requestOwningEntity);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAIPlatform() throws IOException {
        Platform expected = mapper.readValue(new File(RESOURCE_PATH + "Platform.json"), Platform.class);

        org.onap.aai.domain.yang.Platform platformAAI = new org.onap.aai.domain.yang.Platform();
        platformAAI.setPlatformName("platformName");

        Platform actual = bbInputSetupMapperLayer.mapAAIPlatform(platformAAI);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAILineOfBusiness() throws IOException {
        LineOfBusiness expected =
                mapper.readValue(new File(RESOURCE_PATH + "LineOfBusiness.json"), LineOfBusiness.class);

        org.onap.aai.domain.yang.LineOfBusiness lobAAI = new org.onap.aai.domain.yang.LineOfBusiness();
        lobAAI.setLineOfBusinessName("lineOfBusinessName");

        LineOfBusiness actual = bbInputSetupMapperLayer.mapAAILineOfBusiness(lobAAI);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAINetworkPolicy() throws JsonParseException, JsonMappingException, IOException {
        NetworkPolicy expectedNetworkPolicy =
                mapper.readValue(new File(RESOURCE_PATH + "NetworkPolicy.json"), NetworkPolicy.class);

        org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy = new org.onap.aai.domain.yang.NetworkPolicy();
        aaiNetworkPolicy.setNetworkPolicyId("networkPolicyId");
        aaiNetworkPolicy.setNetworkPolicyFqdn("networkPolicyFqdn");
        aaiNetworkPolicy.setHeatStackId("heatStackId");
        aaiNetworkPolicy.setResourceVersion("resourceVersion");

        NetworkPolicy actualNetworkPolicy = bbInputSetupMapperLayer.mapAAINetworkPolicy(aaiNetworkPolicy);

        assertThat(actualNetworkPolicy, sameBeanAs(expectedNetworkPolicy));
    }

    @Test
    public void testMapAAIVolumeGroup() throws JsonParseException, JsonMappingException, IOException {
        VolumeGroup expectedVolumeGroup =
                mapper.readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class);

        org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = mapper.readValue(
                new File(RESOURCE_PATH + "VolumeGroup_AAI.json"), org.onap.aai.domain.yang.VolumeGroup.class);

        VolumeGroup actualVolumeGroup = bbInputSetupMapperLayer.mapAAIVolumeGroup(aaiVolumeGroup);

        assertThat(actualVolumeGroup, sameBeanAs(expectedVolumeGroup));
    }

    @Test
    public void testMapCatalogServiceIntoServiceInstance() throws IOException {
        ModelInfoServiceInstance expected = mapper.readValue(new File(RESOURCE_PATH + "ModelInfoServiceInstance.json"),
                ModelInfoServiceInstance.class);

        Service catalogService = mapper.readValue(new File(RESOURCE_PATH + "CatalogServiceInput.json"), Service.class);

        ModelInfoServiceInstance actual = bbInputSetupMapperLayer.mapCatalogServiceIntoServiceInstance(catalogService);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapCatalogInstanceGroupToInstanceGroup() throws IOException {
        ModelInfoInstanceGroup expected =
                mapper.readValue(new File(RESOURCE_PATH + "ModelInfoInstanceGroup.json"), ModelInfoInstanceGroup.class);

        InstanceGroup instanceGroup =
                mapper.readValue(new File(RESOURCE_PATH + "InstanceGroup.json"), InstanceGroup.class);
        instanceGroup.setCollectionInstanceGroupCustomizations(new ArrayList<>());
        CollectionResourceInstanceGroupCustomization collectionInstanceGroupCust =
                new CollectionResourceInstanceGroupCustomization();
        collectionInstanceGroupCust.setModelCustomizationUUID("modelCustomizationUUID");
        collectionInstanceGroupCust.setFunction("function");
        collectionInstanceGroupCust.setDescription("description");
        instanceGroup.getCollectionInstanceGroupCustomizations().add(collectionInstanceGroupCust);
        CollectionResourceCustomization collectionResourceCust = new CollectionResourceCustomization();
        collectionResourceCust.setModelCustomizationUUID("modelCustomizationUUID");
        ModelInfoInstanceGroup actual =
                bbInputSetupMapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionResourceCust, instanceGroup);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapCollectionNetworkResourceCustToNetworkResourceCust() {
        String modelCustomizationUUID = "modelCustomizationUUID";
        String modelInstanceName = "modelInstanceName";
        String networkRole = "networkRole";
        String networkScope = "networkScope";
        String networkTechnology = "networkTechnology";
        String networkType = "networkType";

        NetworkResourceCustomization expected = new NetworkResourceCustomization();
        expected.setModelCustomizationUUID(modelCustomizationUUID);
        expected.setModelInstanceName(modelInstanceName);
        expected.setNetworkRole(networkRole);
        expected.setNetworkScope(networkScope);
        expected.setNetworkTechnology(networkTechnology);
        expected.setNetworkType(networkType);
        CollectionNetworkResourceCustomization collectionNetworkResourceCust =
                new CollectionNetworkResourceCustomization();
        collectionNetworkResourceCust.setModelCustomizationUUID(modelCustomizationUUID);
        collectionNetworkResourceCust.setModelInstanceName(modelInstanceName);
        collectionNetworkResourceCust.setNetworkRole(networkRole);
        collectionNetworkResourceCust.setNetworkScope(networkScope);
        collectionNetworkResourceCust.setNetworkTechnology(networkTechnology);
        collectionNetworkResourceCust.setNetworkType(networkType);
        NetworkResourceCustomization actual = bbInputSetupMapperLayer
                .mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapCatalogCollectionToCollection() throws IOException {
        ModelInfoCollection expected =
                mapper.readValue(new File(RESOURCE_PATH + "ModelInfoCollection.json"), ModelInfoCollection.class);

        CollectionResourceCustomization collectionCust =
                mapper.readValue(new File(RESOURCE_PATH + "CollectionResourceCustomization.json"),
                        CollectionResourceCustomization.class);

        CollectionResource collectionResource =
                mapper.readValue(new File(RESOURCE_PATH + "CollectionResource.json"), CollectionResource.class);

        ModelInfoCollection actual =
                bbInputSetupMapperLayer.mapCatalogCollectionToCollection(collectionCust, collectionResource);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAIServiceInstanceIntoServiceInstance() throws IOException {
        ServiceInstance expected = mapper.readValue(
                new File(RESOURCE_PATH + "ServiceInstance_aaiServiceInstanceToSI.json"), ServiceInstance.class);

        org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI =
                mapper.readValue(new File(RESOURCE_PATH + "ServiceInstanceAAIInput.json"),
                        org.onap.aai.domain.yang.ServiceInstance.class);

        ServiceInstance actual = bbInputSetupMapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testSetPlatformAndLOB() throws IOException {
        ServiceInstance expected = mapper.readValue(
                new File(RESOURCE_PATH + "ServiceInstance_aaiPlatformAndLOBToSI.json"), ServiceInstance.class);

        Map<ResourceKey, String> resourcesToBeOrchestrated = new HashMap<>();
        resourcesToBeOrchestrated.put(ResourceKey.GENERIC_VNF_ID, "vnfId");
        Platform platformMSO = new Platform();
        platformMSO.setPlatformName("platformName");
        LineOfBusiness lineOfBusinessMSO = new LineOfBusiness();
        lineOfBusinessMSO.setLineOfBusinessName("lineOfBusinessName");

        ServiceInstance actual = mapper.readValue(
                new File(RESOURCE_PATH + "ServiceInstanceAAIPlatformAndLOBInput.json"), ServiceInstance.class);

        bbInputSetupMapperLayer.setPlatformAndLOBIntoServiceInstance(platformMSO, lineOfBusinessMSO, actual,
                resourcesToBeOrchestrated);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAIL3NetworkIntoL3Network() throws IOException {
        L3Network expected =
                mapper.readValue(new File(RESOURCE_PATH + "l3NetworkExpectedWithSubnet.json"), L3Network.class);

        org.onap.aai.domain.yang.L3Network aaiL3Network =
                mapper.readValue(new File(RESOURCE_PATH + "aaiL3NetworkInputWithSubnets.json"),
                        org.onap.aai.domain.yang.L3Network.class);

        L3Network actual = bbInputSetupMapperLayer.mapAAIL3Network(aaiL3Network);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAIGenericVnfIntoGenericVnf() throws IOException {
        GenericVnf expected = mapper.readValue(new File(RESOURCE_PATH + "GenericVnfExpected.json"), GenericVnf.class);
        org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = mapper.readValue(
                new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), org.onap.aai.domain.yang.GenericVnf.class);

        GenericVnf actual = bbInputSetupMapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAIPnfIntoPnf() throws IOException {
        Pnf expected = mapper.readValue(new File(RESOURCE_PATH + "PnfExpected.json"), Pnf.class);
        org.onap.aai.domain.yang.Pnf aaiPnf =
                mapper.readValue(new File(RESOURCE_PATH + "aaiPnfInput.json"), org.onap.aai.domain.yang.Pnf.class);

        Pnf actual = bbInputSetupMapperLayer.mapAAIPnfIntoPnf(aaiPnf);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapAAICollectionIntoCollection() throws JsonParseException, JsonMappingException, IOException {
        org.onap.aai.domain.yang.Collection aaiCollection = mapper
                .readValue(new File(RESOURCE_PATH + "CollectionInput.json"), org.onap.aai.domain.yang.Collection.class);

        Collection expectedCollection =
                mapper.readValue(new File(RESOURCE_PATH + "CollectionExpected.json"), Collection.class);

        Collection actualCollection = bbInputSetupMapperLayer.mapAAICollectionIntoCollection(aaiCollection);

        assertThat(actualCollection, sameBeanAs(expectedCollection));
    }

    @Test
    public void testMapAAIInstanceGroupIntoInstanceGroup()
            throws JsonParseException, JsonMappingException, IOException {
        org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = mapper.readValue(
                new File(RESOURCE_PATH + "InstanceGroupInput.json"), org.onap.aai.domain.yang.InstanceGroup.class);

        org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup expectedInstanceGroup =
                mapper.readValue(new File(RESOURCE_PATH + "InstanceGroupExpected.json"),
                        org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class);

        org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup actualInstanceGroup =
                bbInputSetupMapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup);

        assertThat(actualInstanceGroup, sameBeanAs(expectedInstanceGroup));
    }

    @Test
    public void testMapAAIRouteTableReferenceIntoRouteTableReference()
            throws JsonParseException, JsonMappingException, IOException {
        org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference =
                mapper.readValue(new File(RESOURCE_PATH + "RouteTableReferenceInput.json"),
                        org.onap.aai.domain.yang.RouteTableReference.class);

        RouteTableReference expectedRouteTableReference = mapper
                .readValue(new File(RESOURCE_PATH + "RouteTableReferenceExpected.json"), RouteTableReference.class);

        RouteTableReference actualRouteTableReference =
                bbInputSetupMapperLayer.mapAAIRouteTableReferenceIntoRouteTableReference(aaiRouteTableReference);

        assertThat(actualRouteTableReference, sameBeanAs(expectedRouteTableReference));
    }

    @Test
    public void testMapCatalogNetworkToNetwork() throws JsonParseException, JsonMappingException, IOException {
        NetworkResourceCustomization networkResourceCustomization = mapper.readValue(
                new File(RESOURCE_PATH + "NetworkResourceCustomizationInput.json"), NetworkResourceCustomization.class);

        ModelInfoNetwork expectedModelInfoNetwork =
                mapper.readValue(new File(RESOURCE_PATH + "ModelInfoNetworkExpected.json"), ModelInfoNetwork.class);

        ModelInfoNetwork actualModelInfoNetwork =
                bbInputSetupMapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization);

        assertThat(actualModelInfoNetwork, sameBeanAs(expectedModelInfoNetwork));
    }

    @Test
    public void testMapCatalogVnfToVnf() throws IOException {
        VnfResourceCustomization vnfResourceCustomization = mapper.readValue(
                new File(RESOURCE_PATH + "VnfResourceCustomizationInput.json"), VnfResourceCustomization.class);

        ModelInfoGenericVnf expectedModelInfoGenericVnf = mapper
                .readValue(new File(RESOURCE_PATH + "ModelInfoGenericVnfExpected.json"), ModelInfoGenericVnf.class);

        ModelInfoGenericVnf actualModelInfoGenericVnf =
                bbInputSetupMapperLayer.mapCatalogVnfToVnf(vnfResourceCustomization);

        assertThat(actualModelInfoGenericVnf, sameBeanAs(expectedModelInfoGenericVnf));
    }

    @Test
    public void testMapCatalogVfModuleToVfModule() throws JsonParseException, JsonMappingException, IOException {
        VfModuleCustomization vfResourceCustomization = mapper
                .readValue(new File(RESOURCE_PATH + "VfModuleCustomizationInput.json"), VfModuleCustomization.class);

        ModelInfoVfModule expectedModelInfoVfModule =
                mapper.readValue(new File(RESOURCE_PATH + "ModelInfoVfModuleExpected.json"), ModelInfoVfModule.class);

        ModelInfoVfModule actualModelInfoVfModule =
                bbInputSetupMapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization);

        assertThat(actualModelInfoVfModule, sameBeanAs(expectedModelInfoVfModule));
    }

    @Test
    public void testMapRequestPlatform() throws JsonParseException, JsonMappingException, IOException {
        org.onap.so.serviceinstancebeans.Platform platform = mapper.readValue(
                new File(RESOURCE_PATH + "RequestPlatformInput.json"), org.onap.so.serviceinstancebeans.Platform.class);

        Platform expectedPlatform = mapper.readValue(new File(RESOURCE_PATH + "PlatformExpected.json"), Platform.class);

        Platform actualPlatform = bbInputSetupMapperLayer.mapRequestPlatform(platform);

        assertThat(actualPlatform, sameBeanAs(expectedPlatform));
    }

    @Test
    public void testMapRequestLineOfBusiness() throws JsonParseException, JsonMappingException, IOException {
        org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness =
                mapper.readValue(new File(RESOURCE_PATH + "RequestLineOfBusinessInput.json"),
                        org.onap.so.serviceinstancebeans.LineOfBusiness.class);

        LineOfBusiness expectedLineOfBusiness =
                mapper.readValue(new File(RESOURCE_PATH + "LineOfBusinessExpected.json"), LineOfBusiness.class);

        LineOfBusiness actualLineOfBusiness = bbInputSetupMapperLayer.mapRequestLineOfBusiness(lineOfBusiness);

        assertThat(actualLineOfBusiness, sameBeanAs(expectedLineOfBusiness));
    }

    @Test
    public void testMapAAIConfiguration() throws JsonParseException, JsonMappingException, IOException {
        org.onap.aai.domain.yang.Configuration configurationAAI = mapper.readValue(
                new File(RESOURCE_PATH + "ConfigurationInput.json"), org.onap.aai.domain.yang.Configuration.class);

        Configuration expectedConfiguration =
                mapper.readValue(new File(RESOURCE_PATH + "ConfigurationExpected.json"), Configuration.class);

        Configuration actualConfiguration = bbInputSetupMapperLayer.mapAAIConfiguration(configurationAAI);

        assertThat(actualConfiguration, sameBeanAs(expectedConfiguration));
    }

    @Test
    public void testMapRequestContext() throws IOException {
        RequestContext expected =
                mapper.readValue(new File(RESOURCE_PATH + "RequestContextExpected.json"), RequestContext.class);

        RequestDetails requestDetails = mapper
                .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
        RequestContext actual = bbInputSetupMapperLayer.mapRequestContext(requestDetails);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapOrchestrationContext() throws IOException {
        OrchestrationContext expected = new OrchestrationContext();
        expected.setIsRollbackEnabled(true);

        RequestDetails requestDetails = mapper
                .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);

        OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapOrchestrationContextNoRequestInfo() throws IOException {
        OrchestrationContext expected = new OrchestrationContext();
        expected.setIsRollbackEnabled(false);

        RequestDetails requestDetails = mapper.readValue(
                new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContextNoRequestInfo.json"), RequestDetails.class);

        OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapLocationContext() {
        CloudRegion expected = new CloudRegion();
        expected.setCloudOwner("test-owner-name");
        expected.setLcpCloudRegionId("cloudRegionId");
        expected.setComplex("complexName");
        expected.setTenantId("tenantId");
        CloudConfiguration cloudConfig = new CloudConfiguration();
        cloudConfig.setTenantId("tenantId");
        cloudConfig.setLcpCloudRegionId("cloudRegionId");
        cloudConfig.setAicNodeClli("aicNodeClli");
        org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion();
        cloudRegion.setCloudOwner("test-owner-name");
        cloudRegion.setCloudRegionId("cloudRegionId");
        cloudRegion.setComplexName("complexName");

        CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapCloudRegion() {
        CloudRegion expected = new CloudRegion();
        expected.setCloudOwner("test-owner-name");
        expected.setLcpCloudRegionId("cloudRegionId");
        expected.setTenantId("tenantId");
        expected.setCloudRegionVersion("cloudRegionVersion");

        CloudConfiguration cloudConfig = new CloudConfiguration();
        cloudConfig.setTenantId("tenantId");
        cloudConfig.setLcpCloudRegionId("cloudRegionId");
        cloudConfig.setAicNodeClli("aicNodeClli");

        org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion();
        cloudRegion.setCloudOwner("test-owner-name");
        cloudRegion.setCloudRegionId("cloudRegionId");
        cloudRegion.setCloudRegionVersion("cloudRegionVersion");

        CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapTenant() {
        Tenant expected = new Tenant();
        expected.setTenantId("tenantId");
        expected.setTenantName("tenantName");
        expected.setTenantContext("tenantContext");

        org.onap.aai.domain.yang.Tenant aaiTenant = new org.onap.aai.domain.yang.Tenant();
        aaiTenant.setTenantId("tenantId");
        aaiTenant.setTenantName("tenantName");
        aaiTenant.setTenantContext("tenantContext");

        Tenant actual = bbInputSetupMapperLayer.mapTenant(aaiTenant);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapCloudRegionWithNullCheck() {
        CloudRegion expected = new CloudRegion();

        CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testmapCatalogConfigurationToConfiguration() {
        String modelCustUUID = "modelCustomizationUUID";
        String modelInvariantUUID = "modelInvariantUUID";
        String modelVersionUUID = "modelUUID";
        String policyName = "policyName";
        ModelInfoConfiguration expected = new ModelInfoConfiguration();
        expected.setModelCustomizationId(modelCustUUID);
        expected.setModelInvariantId(modelInvariantUUID);
        expected.setModelVersionId(modelVersionUUID);
        expected.setPolicyName(policyName);
        ConfigurationResourceCustomization configurationResourceCustomization =
                new ConfigurationResourceCustomization();
        configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID);
        configurationResourceCustomization.setConfigurationResource(new ConfigurationResource());
        configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID);
        configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID);
        CvnfcConfigurationCustomization policyNameTable = new CvnfcConfigurationCustomization();
        policyNameTable.setCvnfcCustomization(new CvnfcCustomization());
        policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
        policyNameTable.setPolicyName(policyName);

        ModelInfoConfiguration actual = bbInputSetupMapperLayer
                .mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testmapCatalogConfigurationToFabricConfiguration() {
        String modelCustUUID = "modelCustomizationUUID";
        String modelInvariantUUID = "modelInvariantUUID";
        String modelVersionUUID = "modelUUID";
        String policyName = "policyName";
        ModelInfoConfiguration expected = new ModelInfoConfiguration();
        expected.setModelCustomizationId(modelCustUUID);
        expected.setModelInvariantId(modelInvariantUUID);
        expected.setModelVersionId(modelVersionUUID);
        expected.setPolicyName(policyName);

        CvnfcConfigurationCustomization fabricCustomization = new CvnfcConfigurationCustomization();
        fabricCustomization.setCvnfcCustomization(new CvnfcCustomization());
        fabricCustomization.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
        fabricCustomization.setPolicyName(policyName);
        fabricCustomization.setModelCustomizationUUID(modelCustUUID);

        ConfigurationResource configurationResource = new ConfigurationResource();
        configurationResource.setModelUUID(modelVersionUUID);
        configurationResource.setModelInvariantUUID(modelInvariantUUID);
        fabricCustomization.setConfigurationResource(configurationResource);

        ModelInfoConfiguration actual =
                bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(fabricCustomization);

        assertThat(actual, sameBeanAs(expected));
    }

    @Test
    public void testMapNameValueUserParams() throws IOException {
        RequestDetails requestDetails = mapper
                .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
        Map<String, Object> actual =
                bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters());

        assertTrue(actual.containsKey("mns_vfw_protected_route_prefixes"));
        assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString()
                .contains("interface_route_table_routes_route"));
        assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("1.1.1.1/32"));
        assertTrue(actual.get("mns_vfw_protected_route_prefixes").toString().contains("0::1/128"));
        assertTrue(actual.containsKey("name1"));
        assertTrue(actual.containsValue("value1"));
        assertTrue(actual.get("name1").equals("value1"));

        assertFalse(actual.containsKey("ignore"));
        assertFalse(actual.containsValue("ignore"));
    }

    @Test
    public void testMapRequestParameters() throws IOException {
        RequestDetails requestDetails = mapper
                .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
        RequestParameters actual = bbInputSetupMapperLayer.mapRequestParameters(requestDetails.getRequestParameters());

        assertEquals(actual.getUsePreload(), requestDetails.getRequestParameters().getUsePreload());
        assertEquals(actual.getSubscriptionServiceType(),
                requestDetails.getRequestParameters().getSubscriptionServiceType());
        assertEquals(actual.getPayload(), requestDetails.getRequestParameters().getPayload());
    }

    protected RequestParameters mapRequestParameters(
            org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
        RequestParameters requestParams = new RequestParameters();
        requestParams.setaLaCarte(requestParameters.getALaCarte());
        requestParams.setUsePreload(requestParameters.getUsePreload());
        requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
        requestParams.setUserParams(requestParameters.getUserParams());
        requestParams.setPayload(requestParameters.getPayload());
        return requestParams;
    }

}