Merge "Fixing SO-Monitoring UI tests"
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / onap / so / bpmn / servicedecomposition / tasks / BBInputSetupMapperLayerTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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.onap.so.bpmn.servicedecomposition.tasks;
22
23 import static com.shazam.shazamcrest.MatcherAssert.assertThat;
24 import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
25 import static org.hamcrest.CoreMatchers.equalTo;
26
27 import java.io.File;
28 import java.io.IOException;
29 import java.util.ArrayList;
30 import java.util.Arrays;
31 import java.util.HashMap;
32 import java.util.List;
33 import java.util.Map;
34
35 import org.junit.Test;
36 import org.mockito.InjectMocks;
37 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
38 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
39 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
40 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
41 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
42 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
43 import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
44 import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
45 import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
46 import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
47 import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
48 import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
49 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
50 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
51 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
52 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
53 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
54 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
55 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection;
56 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration;
57 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
58 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
59 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
60 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
61 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
62 import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
63 import org.onap.so.db.catalog.beans.CollectionResource;
64 import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
65 import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
66 import org.onap.so.db.catalog.beans.ConfigurationResource;
67 import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
68 import org.onap.so.db.catalog.beans.CvnfcCustomization;
69 import org.onap.so.db.catalog.beans.InstanceGroup;
70 import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
71 import org.onap.so.db.catalog.beans.OrchestrationStatus;
72 import org.onap.so.db.catalog.beans.Service;
73 import org.onap.so.db.catalog.beans.VfModuleCustomization;
74 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
75 import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
76 import org.onap.so.db.catalog.beans.VnfcCustomization;
77 import org.onap.so.serviceinstancebeans.CloudConfiguration;
78 import org.onap.so.serviceinstancebeans.RequestDetails;
79
80 import com.fasterxml.jackson.core.JsonParseException;
81 import com.fasterxml.jackson.databind.JsonMappingException;
82 import com.fasterxml.jackson.databind.ObjectMapper;
83
84 public class BBInputSetupMapperLayerTest {
85         
86         BBInputSetupMapperLayer bbInputSetupMapperLayer = new BBInputSetupMapperLayer();
87
88         ObjectMapper mapper = new ObjectMapper();
89
90         private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/";
91
92         @Test
93         public void testMapOrchestrationStatusFromAAI() {
94                 OrchestrationStatus expected = OrchestrationStatus.INVENTORIED;
95                 String orchStatusInput = "Inventoried";
96                 OrchestrationStatus actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
97                 assertThat(actual, sameBeanAs(expected));
98                 
99                 expected = OrchestrationStatus.ASSIGNED;
100                 orchStatusInput = "Assigned";
101                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
102                 assertThat(actual, sameBeanAs(expected));
103                 
104                 expected = OrchestrationStatus.ACTIVE;
105                 orchStatusInput = "Active";
106                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
107                 assertThat(actual, sameBeanAs(expected));
108                 
109                 expected = OrchestrationStatus.CREATED;
110                 orchStatusInput = "Created";
111                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
112                 assertThat(actual, sameBeanAs(expected));
113                 
114                 expected = OrchestrationStatus.PRECREATED;
115                 orchStatusInput = "PreCreated";
116                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
117                 assertThat(actual, sameBeanAs(expected));
118                 
119                 expected = OrchestrationStatus.PENDING_CREATE;
120                 orchStatusInput = "PendingCreate";
121                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
122                 assertThat(actual, sameBeanAs(expected));
123                 
124                 expected = OrchestrationStatus.PENDING_DELETE;
125                 orchStatusInput = "PendingDelete";
126                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
127                 assertThat(actual, sameBeanAs(expected));
128                 
129                 expected = OrchestrationStatus.PENDING;
130                 orchStatusInput = "Pending";
131                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
132                 assertThat(actual, sameBeanAs(expected));
133                 
134                 expected = OrchestrationStatus.PENDING_ACTIVATION;
135                 orchStatusInput = "PendingActivation";
136                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
137                 assertThat(actual, sameBeanAs(expected));
138         }
139         
140         @Test
141         public void testMapOrchestrationFuzzyCases() {
142                 List<String> values = Arrays.asList("pending-create", "pending_Create", "pendinggcreate", "PendingCreate");
143                 values.forEach(value -> {
144                         assertThat(bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(value), equalTo(OrchestrationStatus.PENDING_CREATE));
145                 });
146         }
147         
148         @Test
149         public void testMapAAICustomer() throws IOException {
150                 Customer expected = mapper.readValue(
151                                 new File(RESOURCE_PATH+"Customer.json"),
152                                 Customer.class);
153
154                 org.onap.aai.domain.yang.Customer customerAAI = mapper.readValue(
155                                 new File(RESOURCE_PATH+"Customer_AAI.json"), org.onap.aai.domain.yang.Customer.class);
156                 
157                 Customer actual = bbInputSetupMapperLayer.mapAAICustomer(customerAAI);
158                 
159                 assertThat(actual, sameBeanAs(expected));
160         }
161
162         @Test
163         public void testMapAAIServiceSubscription() throws IOException {
164                 ServiceSubscription expected = mapper.readValue(
165                                 new File(RESOURCE_PATH + "ServiceSubscriptionExpected.json"), ServiceSubscription.class);
166
167                 org.onap.aai.domain.yang.ServiceSubscription svcSubscriptionAAI = mapper.readValue(
168                                 new File(RESOURCE_PATH + "ServiceSubscription_AAI.json"), org.onap.aai.domain.yang.ServiceSubscription.class);
169
170                 ServiceSubscription actual = bbInputSetupMapperLayer.mapAAIServiceSubscription(svcSubscriptionAAI);
171
172                 assertThat(actual, sameBeanAs(expected));
173         }
174
175         @Test
176         public void testMapAAIProject() throws IOException {
177                 Project expected = mapper.readValue(new File(RESOURCE_PATH+"Project.json"),Project.class);
178
179                 org.onap.aai.domain.yang.Project projectAAI = new org.onap.aai.domain.yang.Project();
180                 projectAAI.setProjectName("projectName");
181
182                 Project actual = bbInputSetupMapperLayer.mapAAIProject(projectAAI);
183
184                 assertThat(actual, sameBeanAs(expected));
185         }
186
187         @Test
188         public void testMapRequestProject() throws IOException {
189                 Project expected = mapper.readValue(new File(RESOURCE_PATH+"Project.json"),Project.class);
190
191                 org.onap.so.serviceinstancebeans.Project requestProject = new org.onap.so.serviceinstancebeans.Project();
192                 requestProject.setProjectName("projectName");
193
194                 Project actual = bbInputSetupMapperLayer.mapRequestProject(requestProject);
195
196                 assertThat(actual, sameBeanAs(expected));
197         }
198
199         @Test
200         public void testMapAAIOwningEntity() throws IOException {
201                 OwningEntity expected = mapper.readValue(new File(RESOURCE_PATH+"OwningEntity.json"),OwningEntity.class);
202
203                 org.onap.aai.domain.yang.OwningEntity entityAAI = new org.onap.aai.domain.yang.OwningEntity();
204                 entityAAI.setOwningEntityId("owningEntityId");
205                 entityAAI.setOwningEntityName("owningEntityName");
206
207                 OwningEntity actual = bbInputSetupMapperLayer.mapAAIOwningEntity(entityAAI);
208
209                 assertThat(actual, sameBeanAs(expected));
210         }
211
212         @Test
213         public void testMapRequestOwningEntity() throws IOException {
214                 OwningEntity expected = mapper.readValue(new File(RESOURCE_PATH+"OwningEntity.json"),OwningEntity.class);
215
216                 org.onap.so.serviceinstancebeans.OwningEntity requestOwningEntity = new org.onap.so.serviceinstancebeans.OwningEntity();
217                 requestOwningEntity.setOwningEntityId("owningEntityId");
218                 requestOwningEntity.setOwningEntityName("owningEntityName");
219
220                 OwningEntity actual = bbInputSetupMapperLayer.mapRequestOwningEntity(requestOwningEntity);
221
222                 assertThat(actual, sameBeanAs(expected));
223         }
224
225         @Test
226         public void testMapAAIPlatform() throws IOException {
227                 Platform expected = mapper.readValue(new File(RESOURCE_PATH+"Platform.json"),Platform.class);
228
229                 org.onap.aai.domain.yang.Platform platformAAI = new org.onap.aai.domain.yang.Platform();
230                 platformAAI.setPlatformName("platformName");
231
232                 Platform actual = bbInputSetupMapperLayer.mapAAIPlatform(platformAAI);
233
234                 assertThat(actual, sameBeanAs(expected));
235         }
236
237         @Test
238         public void testMapAAILineOfBusiness() throws IOException {
239                 LineOfBusiness expected = mapper.readValue(new File(RESOURCE_PATH+"LineOfBusiness.json"),LineOfBusiness.class);
240
241                 org.onap.aai.domain.yang.LineOfBusiness lobAAI = new org.onap.aai.domain.yang.LineOfBusiness();
242                 lobAAI.setLineOfBusinessName("lineOfBusinessName");
243
244                 LineOfBusiness actual = bbInputSetupMapperLayer.mapAAILineOfBusiness(lobAAI);
245
246                 assertThat(actual, sameBeanAs(expected));
247         }
248         
249         @Test
250         public void testMapAAINetworkPolicy() throws JsonParseException, JsonMappingException, IOException {
251                 NetworkPolicy expectedNetworkPolicy = mapper.readValue(new File(RESOURCE_PATH + "NetworkPolicy.json"), NetworkPolicy.class);
252                 
253                 org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy = new org.onap.aai.domain.yang.NetworkPolicy();
254                 aaiNetworkPolicy.setNetworkPolicyId("networkPolicyId");
255                 aaiNetworkPolicy.setNetworkPolicyFqdn("networkPolicyFqdn");
256                 aaiNetworkPolicy.setHeatStackId("heatStackId");
257                 aaiNetworkPolicy.setResourceVersion("resourceVersion");
258                 
259                 NetworkPolicy actualNetworkPolicy = bbInputSetupMapperLayer.mapAAINetworkPolicy(aaiNetworkPolicy);
260                 
261                 assertThat(actualNetworkPolicy, sameBeanAs(expectedNetworkPolicy));
262         }
263         
264         @Test
265         public void testMapAAIVolumeGroup() throws JsonParseException, JsonMappingException, IOException {
266                 VolumeGroup expectedVolumeGroup = mapper.readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class);
267                 
268                 org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = mapper.readValue(
269                                 new File(RESOURCE_PATH + "VolumeGroup_AAI.json"), org.onap.aai.domain.yang.VolumeGroup.class);
270                 
271                 VolumeGroup actualVolumeGroup = bbInputSetupMapperLayer.mapAAIVolumeGroup(aaiVolumeGroup);
272                 
273                 assertThat(actualVolumeGroup, sameBeanAs(expectedVolumeGroup));
274         }
275
276         @Test
277         public void testMapCatalogServiceIntoServiceInstance() throws IOException {
278                 ModelInfoServiceInstance expected = mapper.readValue(
279                                 new File(RESOURCE_PATH + "ModelInfoServiceInstance.json"),
280                                 ModelInfoServiceInstance.class);
281
282                 Service catalogService = mapper.readValue(
283                                 new File(RESOURCE_PATH + "CatalogServiceInput.json"), Service.class);
284
285                 ModelInfoServiceInstance actual = bbInputSetupMapperLayer.mapCatalogServiceIntoServiceInstance(catalogService);
286
287                 assertThat(actual, sameBeanAs(expected));
288         }
289
290         @Test
291         public void testMapCatalogInstanceGroupToInstanceGroup() throws IOException {
292                 ModelInfoInstanceGroup expected = mapper.readValue(
293                                 new File(RESOURCE_PATH + "ModelInfoInstanceGroup.json"),
294                                 ModelInfoInstanceGroup.class);
295
296                 InstanceGroup instanceGroup = mapper.readValue(
297                                 new File(RESOURCE_PATH + "InstanceGroup.json"), InstanceGroup.class);
298                 instanceGroup.setCollectionInstanceGroupCustomizations(new ArrayList<>());
299                 CollectionResourceInstanceGroupCustomization collectionInstanceGroupCust = new CollectionResourceInstanceGroupCustomization();
300                 collectionInstanceGroupCust.setModelCustomizationUUID("modelCustomizationUUID");
301                 collectionInstanceGroupCust.setFunction("function");
302                 collectionInstanceGroupCust.setDescription("description");
303                 instanceGroup.getCollectionInstanceGroupCustomizations().add(collectionInstanceGroupCust);
304                 CollectionResourceCustomization collectionResourceCust = new CollectionResourceCustomization();
305                 collectionResourceCust.setModelCustomizationUUID("modelCustomizationUUID");
306                 ModelInfoInstanceGroup actual = bbInputSetupMapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionResourceCust, instanceGroup);
307
308                 assertThat(actual, sameBeanAs(expected));
309         }
310         
311         @Test
312         public void testMapCollectionNetworkResourceCustToNetworkResourceCust() {
313                 String modelCustomizationUUID = "modelCustomizationUUID";
314                 String modelInstanceName = "modelInstanceName";
315                 String networkRole = "networkRole";
316                 String networkScope = "networkScope";
317                 String networkTechnology = "networkTechnology";
318                 String networkType = "networkType";
319                 
320                 NetworkResourceCustomization expected = new NetworkResourceCustomization();
321                 expected.setModelCustomizationUUID(modelCustomizationUUID);
322                 expected.setModelInstanceName(modelInstanceName);
323                 expected.setNetworkRole(networkRole);
324                 expected.setNetworkScope(networkScope);
325                 expected.setNetworkTechnology(networkTechnology);
326                 expected.setNetworkType(networkType);
327                 CollectionNetworkResourceCustomization collectionNetworkResourceCust = new CollectionNetworkResourceCustomization();
328                 collectionNetworkResourceCust.setModelCustomizationUUID(modelCustomizationUUID);
329                 collectionNetworkResourceCust.setModelInstanceName(modelInstanceName);
330                 collectionNetworkResourceCust.setNetworkRole(networkRole);
331                 collectionNetworkResourceCust.setNetworkScope(networkScope);
332                 collectionNetworkResourceCust.setNetworkTechnology(networkTechnology);
333                 collectionNetworkResourceCust.setNetworkType(networkType);
334                 NetworkResourceCustomization actual = bbInputSetupMapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
335                 
336                 assertThat(actual, sameBeanAs(expected));
337         }
338
339         @Test
340         public void testMapCatalogCollectionToCollection() throws IOException {
341                 ModelInfoCollection expected = mapper.readValue(
342                                 new File(RESOURCE_PATH + "ModelInfoCollection.json"),
343                                 ModelInfoCollection.class);
344
345                 CollectionResourceCustomization collectionCust = mapper.readValue(
346                                 new File(RESOURCE_PATH + "CollectionResourceCustomization.json"),
347                                 CollectionResourceCustomization.class);
348
349                 CollectionResource collectionResource = mapper.readValue(
350                                 new File(RESOURCE_PATH + "CollectionResource.json"),
351                                 CollectionResource.class);
352
353                 ModelInfoCollection actual = bbInputSetupMapperLayer.mapCatalogCollectionToCollection(collectionCust, collectionResource);
354
355                 assertThat(actual, sameBeanAs(expected));
356         }
357
358         @Test
359         public void testMapAAIServiceInstanceIntoServiceInstance() throws IOException {
360                 ServiceInstance expected = mapper.readValue(
361                                 new File(RESOURCE_PATH + "ServiceInstance_aaiServiceInstanceToSI.json"),
362                                 ServiceInstance.class);
363
364                 org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = mapper.readValue(
365                                 new File(RESOURCE_PATH + "ServiceInstanceAAIInput.json"),
366                                 org.onap.aai.domain.yang.ServiceInstance.class);
367
368                 ServiceInstance actual = bbInputSetupMapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI);
369
370                 assertThat(actual, sameBeanAs(expected));
371         }
372
373         @Test
374         public void testSetPlatformAndLOB() throws IOException {
375                 ServiceInstance expected = mapper.readValue(
376                                 new File(RESOURCE_PATH + "ServiceInstance_aaiPlatformAndLOBToSI.json"),
377                                 ServiceInstance.class);
378
379                 Map<ResourceKey, String> resourcesToBeOrchestrated = new HashMap<>();
380                 resourcesToBeOrchestrated.put(ResourceKey.GENERIC_VNF_ID, "vnfId");
381                 Platform platformMSO = new Platform();
382                 platformMSO.setPlatformName("platformName");
383                 LineOfBusiness lineOfBusinessMSO = new LineOfBusiness();
384                 lineOfBusinessMSO.setLineOfBusinessName("lineOfBusinessName");
385
386                 ServiceInstance actual = mapper.readValue(
387                                 new File(RESOURCE_PATH + "ServiceInstanceAAIPlatformAndLOBInput.json"),
388                                 ServiceInstance.class);
389
390                 bbInputSetupMapperLayer.setPlatformAndLOBIntoServiceInstance(platformMSO, lineOfBusinessMSO, actual,
391                                 resourcesToBeOrchestrated);
392
393                 assertThat(actual, sameBeanAs(expected));
394         }
395
396         @Test
397         public void testMapAAIL3NetworkIntoL3Network() throws IOException {
398                 L3Network expected = mapper.readValue(
399                                 new File(RESOURCE_PATH + "l3NetworkExpected.json"), L3Network.class);
400
401                 org.onap.aai.domain.yang.L3Network aaiL3Network = mapper.readValue(
402                                 new File(RESOURCE_PATH + "aaiL3NetworkInput.json"),
403                                 org.onap.aai.domain.yang.L3Network.class);
404
405                 L3Network actual = bbInputSetupMapperLayer.mapAAIL3Network(aaiL3Network);
406
407                 assertThat(actual, sameBeanAs(expected));
408         }
409
410         @Test
411         public void testMapAAIGenericVnfIntoGenericVnf() throws IOException {
412                 GenericVnf expected = mapper.readValue(new File(RESOURCE_PATH + "GenericVnfExpected.json"), GenericVnf.class);
413                 org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = mapper.readValue(
414                                 new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), org.onap.aai.domain.yang.GenericVnf.class);
415                 
416                 GenericVnf actual = bbInputSetupMapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);
417
418                 assertThat(actual, sameBeanAs(expected));
419         }
420         
421         @Test
422         public void testMapAAICollectionIntoCollection() throws JsonParseException, JsonMappingException, IOException {
423                 org.onap.aai.domain.yang.Collection aaiCollection = mapper.readValue(
424                                 new File(RESOURCE_PATH + "CollectionInput.json"), org.onap.aai.domain.yang.Collection.class);
425                 
426                 Collection expectedCollection = mapper.readValue(new File(RESOURCE_PATH + "CollectionExpected.json"), Collection.class);
427                 
428                 Collection actualCollection = bbInputSetupMapperLayer.mapAAICollectionIntoCollection(aaiCollection);
429                 
430                 assertThat(actualCollection, sameBeanAs(expectedCollection));
431         }
432         
433         @Test
434         public void testMapAAIInstanceGroupIntoInstanceGroup() throws JsonParseException, JsonMappingException, IOException {
435                 org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = mapper.readValue(
436                                 new File(RESOURCE_PATH + "InstanceGroupInput.json"), org.onap.aai.domain.yang.InstanceGroup.class);
437                 
438                 org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup expectedInstanceGroup = mapper.readValue(
439                                 new File(RESOURCE_PATH + "InstanceGroupExpected.json"), org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class);
440                 
441                 org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup actualInstanceGroup = 
442                                 bbInputSetupMapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup);
443                 
444                 assertThat(actualInstanceGroup, sameBeanAs(expectedInstanceGroup));
445         }
446         
447         @Test
448         public void testMapAAIRouteTableReferenceIntoRouteTableReference() throws JsonParseException, JsonMappingException, IOException {
449                 org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference = mapper.readValue(
450                                 new File(RESOURCE_PATH + "RouteTableReferenceInput.json"), org.onap.aai.domain.yang.RouteTableReference.class);
451                 
452                 RouteTableReference expectedRouteTableReference = mapper.readValue(
453                                 new File(RESOURCE_PATH + "RouteTableReferenceExpected.json"), RouteTableReference.class);
454                 
455                 RouteTableReference actualRouteTableReference = bbInputSetupMapperLayer.mapAAIRouteTableReferenceIntoRouteTableReference(aaiRouteTableReference);
456                 
457                 assertThat(actualRouteTableReference, sameBeanAs(expectedRouteTableReference));
458         }
459         
460         @Test
461         public void testMapCatalogNetworkToNetwork() throws JsonParseException, JsonMappingException, IOException {
462                 NetworkResourceCustomization networkResourceCustomization = mapper.readValue(
463                                 new File(RESOURCE_PATH + "NetworkResourceCustomizationInput.json"), NetworkResourceCustomization.class);
464                 
465                 ModelInfoNetwork expectedModelInfoNetwork = mapper.readValue(
466                                 new File(RESOURCE_PATH + "ModelInfoNetworkExpected.json"), ModelInfoNetwork.class);
467                 
468                 ModelInfoNetwork actualModelInfoNetwork = bbInputSetupMapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization);
469                 
470                 assertThat(actualModelInfoNetwork, sameBeanAs(expectedModelInfoNetwork));
471         }
472
473         @Test
474         public void testMapCatalogVnfToVnf() throws IOException {
475                 VnfResourceCustomization vnfResourceCustomization = mapper.readValue(
476                                 new File(RESOURCE_PATH + "VnfResourceCustomizationInput.json"), VnfResourceCustomization.class);
477                 
478                 ModelInfoGenericVnf expectedModelInfoGenericVnf = mapper.readValue(
479                                 new File(RESOURCE_PATH + "ModelInfoGenericVnfExpected.json"), ModelInfoGenericVnf.class);
480                 
481                 ModelInfoGenericVnf actualModelInfoGenericVnf = bbInputSetupMapperLayer.mapCatalogVnfToVnf(vnfResourceCustomization);
482                 
483                 assertThat(actualModelInfoGenericVnf, sameBeanAs(expectedModelInfoGenericVnf));
484         }
485         
486         @Test
487         public void testMapCatalogVfModuleToVfModule() throws JsonParseException, JsonMappingException, IOException {
488                 VfModuleCustomization vfResourceCustomization = mapper.readValue(
489                                 new File(RESOURCE_PATH + "VfModuleCustomizationInput.json"), VfModuleCustomization.class);
490                 
491                 ModelInfoVfModule expectedModelInfoVfModule = mapper.readValue(new File(RESOURCE_PATH + "ModelInfoVfModuleExpected.json"), ModelInfoVfModule.class);
492                 
493                 ModelInfoVfModule actualModelInfoVfModule = bbInputSetupMapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization);
494                 
495                 assertThat(actualModelInfoVfModule, sameBeanAs(expectedModelInfoVfModule));
496         }
497         
498         @Test
499         public void testMapRequestPlatform() throws JsonParseException, JsonMappingException, IOException {
500                 org.onap.so.serviceinstancebeans.Platform platform = mapper.readValue(
501                                 new File(RESOURCE_PATH + "RequestPlatformInput.json"), org.onap.so.serviceinstancebeans.Platform.class);
502                 
503                 Platform expectedPlatform = mapper.readValue(new File(RESOURCE_PATH + "PlatformExpected.json"), Platform.class);
504                 
505                 Platform actualPlatform = bbInputSetupMapperLayer.mapRequestPlatform(platform);
506                 
507                 assertThat(actualPlatform, sameBeanAs(expectedPlatform));
508         }
509         
510         @Test
511         public void testMapRequestLineOfBusiness() throws JsonParseException, JsonMappingException, IOException {
512                 org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = mapper.readValue(
513                                 new File(RESOURCE_PATH + "RequestLineOfBusinessInput.json"), org.onap.so.serviceinstancebeans.LineOfBusiness.class);
514                 
515                 LineOfBusiness expectedLineOfBusiness = mapper.readValue(new File(RESOURCE_PATH + "LineOfBusinessExpected.json"), LineOfBusiness.class);
516                 
517                 LineOfBusiness actualLineOfBusiness = bbInputSetupMapperLayer.mapRequestLineOfBusiness(lineOfBusiness);
518                 
519                 assertThat(actualLineOfBusiness, sameBeanAs(expectedLineOfBusiness));
520         }
521         
522         @Test
523         public void testMapAAIConfiguration() throws JsonParseException, JsonMappingException, IOException {
524                 org.onap.aai.domain.yang.Configuration configurationAAI = mapper.readValue(
525                                 new File(RESOURCE_PATH + "ConfigurationInput.json"), org.onap.aai.domain.yang.Configuration.class);
526                 
527                 Configuration expectedConfiguration = mapper.readValue(
528                                 new File(RESOURCE_PATH + "ConfigurationExpected.json"), Configuration.class);
529                 
530                 Configuration actualConfiguration = bbInputSetupMapperLayer.mapAAIConfiguration(configurationAAI);
531                 
532                 assertThat(actualConfiguration, sameBeanAs(expectedConfiguration));
533         }
534
535         @Test
536         public void testMapRequestContext() throws IOException {
537                 RequestContext expected = mapper.readValue(
538                                 new File(RESOURCE_PATH + "RequestContextExpected.json"),
539                                 RequestContext.class);
540
541                 RequestDetails requestDetails = mapper.readValue(
542                                 new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"),
543                                 RequestDetails.class);
544                 RequestContext actual = bbInputSetupMapperLayer.mapRequestContext(requestDetails);
545
546                 assertThat(actual, sameBeanAs(expected));
547         }
548
549         @Test
550         public void testMapOrchestrationContext() throws IOException {
551                 OrchestrationContext expected = new OrchestrationContext();
552                 expected.setIsRollbackEnabled(true);
553
554                 RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
555
556                 OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails);
557
558                 assertThat(actual, sameBeanAs(expected));
559         }
560
561         @Test
562         public void testMapLocationContext() {
563                 CloudRegion expected = new CloudRegion();
564                 expected.setCloudOwner("test-owner-name");
565                 expected.setLcpCloudRegionId("cloudRegionId");
566                 expected.setComplex("complexName");
567                 expected.setTenantId("tenantId");
568                 CloudConfiguration cloudConfig = new CloudConfiguration();
569                 cloudConfig.setTenantId("tenantId");
570                 cloudConfig.setLcpCloudRegionId("cloudRegionId");
571                 cloudConfig.setAicNodeClli("aicNodeClli");
572                 org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion();
573                 cloudRegion.setCloudOwner("test-owner-name");
574                 cloudRegion.setCloudRegionId("cloudRegionId");
575                 cloudRegion.setComplexName("complexName");
576
577                 CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion);
578
579                 assertThat(actual, sameBeanAs(expected));
580         }
581
582         @Test
583         public void testMapCloudRegion() {
584                 CloudRegion expected = new CloudRegion();
585                 expected.setCloudOwner("test-owner-name");
586                 expected.setLcpCloudRegionId("cloudRegionId");
587                 expected.setTenantId("tenantId");
588                 expected.setCloudRegionVersion("cloudRegionVersion");
589
590                 CloudConfiguration cloudConfig = new CloudConfiguration();
591                 cloudConfig.setTenantId("tenantId");
592                 cloudConfig.setLcpCloudRegionId("cloudRegionId");
593                 cloudConfig.setAicNodeClli("aicNodeClli");
594
595                 org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion();
596                 cloudRegion.setCloudOwner("test-owner-name");
597                 cloudRegion.setCloudRegionId("cloudRegionId");
598                 cloudRegion.setCloudRegionVersion("cloudRegionVersion");
599
600                 CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion);
601
602                 assertThat(actual, sameBeanAs(expected));
603         }
604
605         @Test
606         public void testMapCloudRegionWithNullCheck() {
607                 CloudRegion expected = new CloudRegion();
608
609                 CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null);
610
611                 assertThat(actual, sameBeanAs(expected));
612         }
613         
614         @Test
615         public void testmapCatalogConfigurationToConfiguration() {
616                 String modelCustUUID = "modelCustomizationUUID";
617                 String modelInvariantUUID = "modelInvariantUUID";
618                 String modelVersionUUID = "modelUUID";
619                 String policyName = "policyName";
620                 ModelInfoConfiguration expected = new ModelInfoConfiguration();
621                 expected.setModelCustomizationId(modelCustUUID);
622                 expected.setModelInvariantId(modelInvariantUUID);
623                 expected.setModelVersionId(modelVersionUUID);
624                 expected.setPolicyName(policyName);
625                 ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization();
626                 configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID);
627                 configurationResourceCustomization.setConfigurationResource(new ConfigurationResource());
628                 configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID);
629                 configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID);
630                 VnfVfmoduleCvnfcConfigurationCustomization policyNameTable = new VnfVfmoduleCvnfcConfigurationCustomization();
631                 policyNameTable.setCvnfcCustomization(new CvnfcCustomization());
632                 policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
633                 policyNameTable.setPolicyName(policyName);
634                 
635                 ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable);
636
637                 assertThat(actual, sameBeanAs(expected));
638         }
639 }