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