2  * ============LICENSE_START=======================================================
 
   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
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  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=========================================================
 
  21 package org.onap.so.bpmn.servicedecomposition.tasks;
 
  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 import static org.junit.Assert.assertEquals;
 
  27 import static org.junit.Assert.assertFalse;
 
  28 import static org.junit.Assert.assertTrue;
 
  31 import java.io.IOException;
 
  32 import java.util.ArrayList;
 
  33 import java.util.Arrays;
 
  34 import java.util.HashMap;
 
  35 import java.util.List;
 
  38 import org.junit.Test;
 
  39 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 
  40 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
 
  41 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
 
  42 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
 
  43 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 
  44 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 
  45 import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
 
  46 import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
 
  47 import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
 
  48 import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
 
  49 import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
 
  50 import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
 
  51 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 
  52 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
 
  53 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 
  54 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 
  55 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
 
  56 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
 
  57 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
 
  58 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection;
 
  59 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration;
 
  60 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
 
  61 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
 
  62 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
 
  63 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
 
  64 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
 
  65 import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
 
  66 import org.onap.so.db.catalog.beans.CollectionResource;
 
  67 import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
 
  68 import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
 
  69 import org.onap.so.db.catalog.beans.ConfigurationResource;
 
  70 import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
 
  71 import org.onap.so.db.catalog.beans.CvnfcCustomization;
 
  72 import org.onap.so.db.catalog.beans.InstanceGroup;
 
  73 import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
 
  74 import org.onap.so.db.catalog.beans.OrchestrationStatus;
 
  75 import org.onap.so.db.catalog.beans.Service;
 
  76 import org.onap.so.db.catalog.beans.VfModuleCustomization;
 
  77 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
 
  78 import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
 
  79 import org.onap.so.db.catalog.beans.VnfcCustomization;
 
  80 import org.onap.so.serviceinstancebeans.CloudConfiguration;
 
  81 import org.onap.so.serviceinstancebeans.RequestDetails;
 
  83 import com.fasterxml.jackson.core.JsonParseException;
 
  84 import com.fasterxml.jackson.databind.JsonMappingException;
 
  85 import com.fasterxml.jackson.databind.ObjectMapper;
 
  87 public class BBInputSetupMapperLayerTest {
 
  89         BBInputSetupMapperLayer bbInputSetupMapperLayer = new BBInputSetupMapperLayer();
 
  91         ObjectMapper mapper = new ObjectMapper();
 
  93         private static final String RESOURCE_PATH = "src/test/resources/__files/ExecuteBuildingBlock/";
 
  96         public void testMapOrchestrationStatusFromAAI() {
 
  97                 OrchestrationStatus expected = OrchestrationStatus.INVENTORIED;
 
  98                 String orchStatusInput = "Inventoried";
 
  99                 OrchestrationStatus actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
 
 100                 assertThat(actual, sameBeanAs(expected));
 
 102                 expected = OrchestrationStatus.ASSIGNED;
 
 103                 orchStatusInput = "Assigned";
 
 104                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
 
 105                 assertThat(actual, sameBeanAs(expected));
 
 107                 expected = OrchestrationStatus.ACTIVE;
 
 108                 orchStatusInput = "Active";
 
 109                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
 
 110                 assertThat(actual, sameBeanAs(expected));
 
 112                 expected = OrchestrationStatus.CREATED;
 
 113                 orchStatusInput = "Created";
 
 114                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
 
 115                 assertThat(actual, sameBeanAs(expected));
 
 117                 expected = OrchestrationStatus.PRECREATED;
 
 118                 orchStatusInput = "PreCreated";
 
 119                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
 
 120                 assertThat(actual, sameBeanAs(expected));
 
 122                 expected = OrchestrationStatus.PENDING_CREATE;
 
 123                 orchStatusInput = "PendingCreate";
 
 124                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
 
 125                 assertThat(actual, sameBeanAs(expected));
 
 127                 expected = OrchestrationStatus.PENDING_DELETE;
 
 128                 orchStatusInput = "PendingDelete";
 
 129                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
 
 130                 assertThat(actual, sameBeanAs(expected));
 
 132                 expected = OrchestrationStatus.PENDING;
 
 133                 orchStatusInput = "Pending";
 
 134                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
 
 135                 assertThat(actual, sameBeanAs(expected));
 
 137                 expected = OrchestrationStatus.PENDING_ACTIVATION;
 
 138                 orchStatusInput = "PendingActivation";
 
 139                 actual = bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(orchStatusInput);
 
 140                 assertThat(actual, sameBeanAs(expected));
 
 144         public void testMapOrchestrationFuzzyCases() {
 
 145                 List<String> values = Arrays.asList("pending-create", "pending_Create", "pendinggcreate", "PendingCreate");
 
 146                 values.forEach(value -> {
 
 147                         assertThat(bbInputSetupMapperLayer.mapOrchestrationStatusFromAAI(value), equalTo(OrchestrationStatus.PENDING_CREATE));
 
 152         public void testMapAAICustomer() throws IOException {
 
 153                 Customer expected = mapper.readValue(
 
 154                                 new File(RESOURCE_PATH+"Customer.json"),
 
 157                 org.onap.aai.domain.yang.Customer customerAAI = mapper.readValue(
 
 158                                 new File(RESOURCE_PATH+"Customer_AAI.json"), org.onap.aai.domain.yang.Customer.class);
 
 160                 Customer actual = bbInputSetupMapperLayer.mapAAICustomer(customerAAI);
 
 162                 assertThat(actual, sameBeanAs(expected));
 
 166         public void testMapAAIServiceSubscription() throws IOException {
 
 167                 ServiceSubscription expected = mapper.readValue(
 
 168                                 new File(RESOURCE_PATH + "ServiceSubscriptionExpected.json"), ServiceSubscription.class);
 
 170                 org.onap.aai.domain.yang.ServiceSubscription svcSubscriptionAAI = mapper.readValue(
 
 171                                 new File(RESOURCE_PATH + "ServiceSubscription_AAI.json"), org.onap.aai.domain.yang.ServiceSubscription.class);
 
 173                 ServiceSubscription actual = bbInputSetupMapperLayer.mapAAIServiceSubscription(svcSubscriptionAAI);
 
 175                 assertThat(actual, sameBeanAs(expected));
 
 179         public void testMapAAIProject() throws IOException {
 
 180                 Project expected = mapper.readValue(new File(RESOURCE_PATH+"Project.json"),Project.class);
 
 182                 org.onap.aai.domain.yang.Project projectAAI = new org.onap.aai.domain.yang.Project();
 
 183                 projectAAI.setProjectName("projectName");
 
 185                 Project actual = bbInputSetupMapperLayer.mapAAIProject(projectAAI);
 
 187                 assertThat(actual, sameBeanAs(expected));
 
 191         public void testMapRequestProject() throws IOException {
 
 192                 Project expected = mapper.readValue(new File(RESOURCE_PATH+"Project.json"),Project.class);
 
 194                 org.onap.so.serviceinstancebeans.Project requestProject = new org.onap.so.serviceinstancebeans.Project();
 
 195                 requestProject.setProjectName("projectName");
 
 197                 Project actual = bbInputSetupMapperLayer.mapRequestProject(requestProject);
 
 199                 assertThat(actual, sameBeanAs(expected));
 
 203         public void testMapAAIOwningEntity() throws IOException {
 
 204                 OwningEntity expected = mapper.readValue(new File(RESOURCE_PATH+"OwningEntity.json"),OwningEntity.class);
 
 206                 org.onap.aai.domain.yang.OwningEntity entityAAI = new org.onap.aai.domain.yang.OwningEntity();
 
 207                 entityAAI.setOwningEntityId("owningEntityId");
 
 208                 entityAAI.setOwningEntityName("owningEntityName");
 
 210                 OwningEntity actual = bbInputSetupMapperLayer.mapAAIOwningEntity(entityAAI);
 
 212                 assertThat(actual, sameBeanAs(expected));
 
 216         public void testMapRequestOwningEntity() throws IOException {
 
 217                 OwningEntity expected = mapper.readValue(new File(RESOURCE_PATH+"OwningEntity.json"),OwningEntity.class);
 
 219                 org.onap.so.serviceinstancebeans.OwningEntity requestOwningEntity = new org.onap.so.serviceinstancebeans.OwningEntity();
 
 220                 requestOwningEntity.setOwningEntityId("owningEntityId");
 
 221                 requestOwningEntity.setOwningEntityName("owningEntityName");
 
 223                 OwningEntity actual = bbInputSetupMapperLayer.mapRequestOwningEntity(requestOwningEntity);
 
 225                 assertThat(actual, sameBeanAs(expected));
 
 229         public void testMapAAIPlatform() throws IOException {
 
 230                 Platform expected = mapper.readValue(new File(RESOURCE_PATH+"Platform.json"),Platform.class);
 
 232                 org.onap.aai.domain.yang.Platform platformAAI = new org.onap.aai.domain.yang.Platform();
 
 233                 platformAAI.setPlatformName("platformName");
 
 235                 Platform actual = bbInputSetupMapperLayer.mapAAIPlatform(platformAAI);
 
 237                 assertThat(actual, sameBeanAs(expected));
 
 241         public void testMapAAILineOfBusiness() throws IOException {
 
 242                 LineOfBusiness expected = mapper.readValue(new File(RESOURCE_PATH+"LineOfBusiness.json"),LineOfBusiness.class);
 
 244                 org.onap.aai.domain.yang.LineOfBusiness lobAAI = new org.onap.aai.domain.yang.LineOfBusiness();
 
 245                 lobAAI.setLineOfBusinessName("lineOfBusinessName");
 
 247                 LineOfBusiness actual = bbInputSetupMapperLayer.mapAAILineOfBusiness(lobAAI);
 
 249                 assertThat(actual, sameBeanAs(expected));
 
 253         public void testMapAAINetworkPolicy() throws JsonParseException, JsonMappingException, IOException {
 
 254                 NetworkPolicy expectedNetworkPolicy = mapper.readValue(new File(RESOURCE_PATH + "NetworkPolicy.json"), NetworkPolicy.class);
 
 256                 org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy = new org.onap.aai.domain.yang.NetworkPolicy();
 
 257                 aaiNetworkPolicy.setNetworkPolicyId("networkPolicyId");
 
 258                 aaiNetworkPolicy.setNetworkPolicyFqdn("networkPolicyFqdn");
 
 259                 aaiNetworkPolicy.setHeatStackId("heatStackId");
 
 260                 aaiNetworkPolicy.setResourceVersion("resourceVersion");
 
 262                 NetworkPolicy actualNetworkPolicy = bbInputSetupMapperLayer.mapAAINetworkPolicy(aaiNetworkPolicy);
 
 264                 assertThat(actualNetworkPolicy, sameBeanAs(expectedNetworkPolicy));
 
 268         public void testMapAAIVolumeGroup() throws JsonParseException, JsonMappingException, IOException {
 
 269                 VolumeGroup expectedVolumeGroup = mapper.readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class);
 
 271                 org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = mapper.readValue(
 
 272                                 new File(RESOURCE_PATH + "VolumeGroup_AAI.json"), org.onap.aai.domain.yang.VolumeGroup.class);
 
 274                 VolumeGroup actualVolumeGroup = bbInputSetupMapperLayer.mapAAIVolumeGroup(aaiVolumeGroup);
 
 276                 assertThat(actualVolumeGroup, sameBeanAs(expectedVolumeGroup));
 
 280         public void testMapCatalogServiceIntoServiceInstance() throws IOException {
 
 281                 ModelInfoServiceInstance expected = mapper.readValue(
 
 282                                 new File(RESOURCE_PATH + "ModelInfoServiceInstance.json"),
 
 283                                 ModelInfoServiceInstance.class);
 
 285                 Service catalogService = mapper.readValue(
 
 286                                 new File(RESOURCE_PATH + "CatalogServiceInput.json"), Service.class);
 
 288                 ModelInfoServiceInstance actual = bbInputSetupMapperLayer.mapCatalogServiceIntoServiceInstance(catalogService);
 
 290                 assertThat(actual, sameBeanAs(expected));
 
 294         public void testMapCatalogInstanceGroupToInstanceGroup() throws IOException {
 
 295                 ModelInfoInstanceGroup expected = mapper.readValue(
 
 296                                 new File(RESOURCE_PATH + "ModelInfoInstanceGroup.json"),
 
 297                                 ModelInfoInstanceGroup.class);
 
 299                 InstanceGroup instanceGroup = mapper.readValue(
 
 300                                 new File(RESOURCE_PATH + "InstanceGroup.json"), InstanceGroup.class);
 
 301                 instanceGroup.setCollectionInstanceGroupCustomizations(new ArrayList<>());
 
 302                 CollectionResourceInstanceGroupCustomization collectionInstanceGroupCust = new CollectionResourceInstanceGroupCustomization();
 
 303                 collectionInstanceGroupCust.setModelCustomizationUUID("modelCustomizationUUID");
 
 304                 collectionInstanceGroupCust.setFunction("function");
 
 305                 collectionInstanceGroupCust.setDescription("description");
 
 306                 instanceGroup.getCollectionInstanceGroupCustomizations().add(collectionInstanceGroupCust);
 
 307                 CollectionResourceCustomization collectionResourceCust = new CollectionResourceCustomization();
 
 308                 collectionResourceCust.setModelCustomizationUUID("modelCustomizationUUID");
 
 309                 ModelInfoInstanceGroup actual = bbInputSetupMapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionResourceCust, instanceGroup);
 
 311                 assertThat(actual, sameBeanAs(expected));
 
 315         public void testMapCollectionNetworkResourceCustToNetworkResourceCust() {
 
 316                 String modelCustomizationUUID = "modelCustomizationUUID";
 
 317                 String modelInstanceName = "modelInstanceName";
 
 318                 String networkRole = "networkRole";
 
 319                 String networkScope = "networkScope";
 
 320                 String networkTechnology = "networkTechnology";
 
 321                 String networkType = "networkType";
 
 323                 NetworkResourceCustomization expected = new NetworkResourceCustomization();
 
 324                 expected.setModelCustomizationUUID(modelCustomizationUUID);
 
 325                 expected.setModelInstanceName(modelInstanceName);
 
 326                 expected.setNetworkRole(networkRole);
 
 327                 expected.setNetworkScope(networkScope);
 
 328                 expected.setNetworkTechnology(networkTechnology);
 
 329                 expected.setNetworkType(networkType);
 
 330                 CollectionNetworkResourceCustomization collectionNetworkResourceCust = new CollectionNetworkResourceCustomization();
 
 331                 collectionNetworkResourceCust.setModelCustomizationUUID(modelCustomizationUUID);
 
 332                 collectionNetworkResourceCust.setModelInstanceName(modelInstanceName);
 
 333                 collectionNetworkResourceCust.setNetworkRole(networkRole);
 
 334                 collectionNetworkResourceCust.setNetworkScope(networkScope);
 
 335                 collectionNetworkResourceCust.setNetworkTechnology(networkTechnology);
 
 336                 collectionNetworkResourceCust.setNetworkType(networkType);
 
 337                 NetworkResourceCustomization actual = bbInputSetupMapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
 
 339                 assertThat(actual, sameBeanAs(expected));
 
 343         public void testMapCatalogCollectionToCollection() throws IOException {
 
 344                 ModelInfoCollection expected = mapper.readValue(
 
 345                                 new File(RESOURCE_PATH + "ModelInfoCollection.json"),
 
 346                                 ModelInfoCollection.class);
 
 348                 CollectionResourceCustomization collectionCust = mapper.readValue(
 
 349                                 new File(RESOURCE_PATH + "CollectionResourceCustomization.json"),
 
 350                                 CollectionResourceCustomization.class);
 
 352                 CollectionResource collectionResource = mapper.readValue(
 
 353                                 new File(RESOURCE_PATH + "CollectionResource.json"),
 
 354                                 CollectionResource.class);
 
 356                 ModelInfoCollection actual = bbInputSetupMapperLayer.mapCatalogCollectionToCollection(collectionCust, collectionResource);
 
 358                 assertThat(actual, sameBeanAs(expected));
 
 362         public void testMapAAIServiceInstanceIntoServiceInstance() throws IOException {
 
 363                 ServiceInstance expected = mapper.readValue(
 
 364                                 new File(RESOURCE_PATH + "ServiceInstance_aaiServiceInstanceToSI.json"),
 
 365                                 ServiceInstance.class);
 
 367                 org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = mapper.readValue(
 
 368                                 new File(RESOURCE_PATH + "ServiceInstanceAAIInput.json"),
 
 369                                 org.onap.aai.domain.yang.ServiceInstance.class);
 
 371                 ServiceInstance actual = bbInputSetupMapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI);
 
 373                 assertThat(actual, sameBeanAs(expected));
 
 377         public void testSetPlatformAndLOB() throws IOException {
 
 378                 ServiceInstance expected = mapper.readValue(
 
 379                                 new File(RESOURCE_PATH + "ServiceInstance_aaiPlatformAndLOBToSI.json"),
 
 380                                 ServiceInstance.class);
 
 382                 Map<ResourceKey, String> resourcesToBeOrchestrated = new HashMap<>();
 
 383                 resourcesToBeOrchestrated.put(ResourceKey.GENERIC_VNF_ID, "vnfId");
 
 384                 Platform platformMSO = new Platform();
 
 385                 platformMSO.setPlatformName("platformName");
 
 386                 LineOfBusiness lineOfBusinessMSO = new LineOfBusiness();
 
 387                 lineOfBusinessMSO.setLineOfBusinessName("lineOfBusinessName");
 
 389                 ServiceInstance actual = mapper.readValue(
 
 390                                 new File(RESOURCE_PATH + "ServiceInstanceAAIPlatformAndLOBInput.json"),
 
 391                                 ServiceInstance.class);
 
 393                 bbInputSetupMapperLayer.setPlatformAndLOBIntoServiceInstance(platformMSO, lineOfBusinessMSO, actual,
 
 394                                 resourcesToBeOrchestrated);
 
 396                 assertThat(actual, sameBeanAs(expected));
 
 400         public void testMapAAIL3NetworkIntoL3Network() throws IOException {
 
 401                 L3Network expected = mapper.readValue(
 
 402                                 new File(RESOURCE_PATH + "l3NetworkExpected.json"), L3Network.class);
 
 404                 org.onap.aai.domain.yang.L3Network aaiL3Network = mapper.readValue(
 
 405                                 new File(RESOURCE_PATH + "aaiL3NetworkInput.json"),
 
 406                                 org.onap.aai.domain.yang.L3Network.class);
 
 408                 L3Network actual = bbInputSetupMapperLayer.mapAAIL3Network(aaiL3Network);
 
 410                 assertThat(actual, sameBeanAs(expected));
 
 414         public void testMapAAIGenericVnfIntoGenericVnf() throws IOException {
 
 415                 GenericVnf expected = mapper.readValue(new File(RESOURCE_PATH + "GenericVnfExpected.json"), GenericVnf.class);
 
 416                 org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = mapper.readValue(
 
 417                                 new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), org.onap.aai.domain.yang.GenericVnf.class);
 
 419                 GenericVnf actual = bbInputSetupMapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);
 
 421                 assertThat(actual, sameBeanAs(expected));
 
 425         public void testMapAAICollectionIntoCollection() throws JsonParseException, JsonMappingException, IOException {
 
 426                 org.onap.aai.domain.yang.Collection aaiCollection = mapper.readValue(
 
 427                                 new File(RESOURCE_PATH + "CollectionInput.json"), org.onap.aai.domain.yang.Collection.class);
 
 429                 Collection expectedCollection = mapper.readValue(new File(RESOURCE_PATH + "CollectionExpected.json"), Collection.class);
 
 431                 Collection actualCollection = bbInputSetupMapperLayer.mapAAICollectionIntoCollection(aaiCollection);
 
 433                 assertThat(actualCollection, sameBeanAs(expectedCollection));
 
 437         public void testMapAAIInstanceGroupIntoInstanceGroup() throws JsonParseException, JsonMappingException, IOException {
 
 438                 org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = mapper.readValue(
 
 439                                 new File(RESOURCE_PATH + "InstanceGroupInput.json"), org.onap.aai.domain.yang.InstanceGroup.class);
 
 441                 org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup expectedInstanceGroup = mapper.readValue(
 
 442                                 new File(RESOURCE_PATH + "InstanceGroupExpected.json"), org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class);
 
 444                 org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup actualInstanceGroup = 
 
 445                                 bbInputSetupMapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstanceGroup);
 
 447                 assertThat(actualInstanceGroup, sameBeanAs(expectedInstanceGroup));
 
 451         public void testMapAAIRouteTableReferenceIntoRouteTableReference() throws JsonParseException, JsonMappingException, IOException {
 
 452                 org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference = mapper.readValue(
 
 453                                 new File(RESOURCE_PATH + "RouteTableReferenceInput.json"), org.onap.aai.domain.yang.RouteTableReference.class);
 
 455                 RouteTableReference expectedRouteTableReference = mapper.readValue(
 
 456                                 new File(RESOURCE_PATH + "RouteTableReferenceExpected.json"), RouteTableReference.class);
 
 458                 RouteTableReference actualRouteTableReference = bbInputSetupMapperLayer.mapAAIRouteTableReferenceIntoRouteTableReference(aaiRouteTableReference);
 
 460                 assertThat(actualRouteTableReference, sameBeanAs(expectedRouteTableReference));
 
 464         public void testMapCatalogNetworkToNetwork() throws JsonParseException, JsonMappingException, IOException {
 
 465                 NetworkResourceCustomization networkResourceCustomization = mapper.readValue(
 
 466                                 new File(RESOURCE_PATH + "NetworkResourceCustomizationInput.json"), NetworkResourceCustomization.class);
 
 468                 ModelInfoNetwork expectedModelInfoNetwork = mapper.readValue(
 
 469                                 new File(RESOURCE_PATH + "ModelInfoNetworkExpected.json"), ModelInfoNetwork.class);
 
 471                 ModelInfoNetwork actualModelInfoNetwork = bbInputSetupMapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization);
 
 473                 assertThat(actualModelInfoNetwork, sameBeanAs(expectedModelInfoNetwork));
 
 477         public void testMapCatalogVnfToVnf() throws IOException {
 
 478                 VnfResourceCustomization vnfResourceCustomization = mapper.readValue(
 
 479                                 new File(RESOURCE_PATH + "VnfResourceCustomizationInput.json"), VnfResourceCustomization.class);
 
 481                 ModelInfoGenericVnf expectedModelInfoGenericVnf = mapper.readValue(
 
 482                                 new File(RESOURCE_PATH + "ModelInfoGenericVnfExpected.json"), ModelInfoGenericVnf.class);
 
 484                 ModelInfoGenericVnf actualModelInfoGenericVnf = bbInputSetupMapperLayer.mapCatalogVnfToVnf(vnfResourceCustomization);
 
 486                 assertThat(actualModelInfoGenericVnf, sameBeanAs(expectedModelInfoGenericVnf));
 
 490         public void testMapCatalogVfModuleToVfModule() throws JsonParseException, JsonMappingException, IOException {
 
 491                 VfModuleCustomization vfResourceCustomization = mapper.readValue(
 
 492                                 new File(RESOURCE_PATH + "VfModuleCustomizationInput.json"), VfModuleCustomization.class);
 
 494                 ModelInfoVfModule expectedModelInfoVfModule = mapper.readValue(new File(RESOURCE_PATH + "ModelInfoVfModuleExpected.json"), ModelInfoVfModule.class);
 
 496                 ModelInfoVfModule actualModelInfoVfModule = bbInputSetupMapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization);
 
 498                 assertThat(actualModelInfoVfModule, sameBeanAs(expectedModelInfoVfModule));
 
 502         public void testMapRequestPlatform() throws JsonParseException, JsonMappingException, IOException {
 
 503                 org.onap.so.serviceinstancebeans.Platform platform = mapper.readValue(
 
 504                                 new File(RESOURCE_PATH + "RequestPlatformInput.json"), org.onap.so.serviceinstancebeans.Platform.class);
 
 506                 Platform expectedPlatform = mapper.readValue(new File(RESOURCE_PATH + "PlatformExpected.json"), Platform.class);
 
 508                 Platform actualPlatform = bbInputSetupMapperLayer.mapRequestPlatform(platform);
 
 510                 assertThat(actualPlatform, sameBeanAs(expectedPlatform));
 
 514         public void testMapRequestLineOfBusiness() throws JsonParseException, JsonMappingException, IOException {
 
 515                 org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = mapper.readValue(
 
 516                                 new File(RESOURCE_PATH + "RequestLineOfBusinessInput.json"), org.onap.so.serviceinstancebeans.LineOfBusiness.class);
 
 518                 LineOfBusiness expectedLineOfBusiness = mapper.readValue(new File(RESOURCE_PATH + "LineOfBusinessExpected.json"), LineOfBusiness.class);
 
 520                 LineOfBusiness actualLineOfBusiness = bbInputSetupMapperLayer.mapRequestLineOfBusiness(lineOfBusiness);
 
 522                 assertThat(actualLineOfBusiness, sameBeanAs(expectedLineOfBusiness));
 
 526         public void testMapAAIConfiguration() throws JsonParseException, JsonMappingException, IOException {
 
 527                 org.onap.aai.domain.yang.Configuration configurationAAI = mapper.readValue(
 
 528                                 new File(RESOURCE_PATH + "ConfigurationInput.json"), org.onap.aai.domain.yang.Configuration.class);
 
 530                 Configuration expectedConfiguration = mapper.readValue(
 
 531                                 new File(RESOURCE_PATH + "ConfigurationExpected.json"), Configuration.class);
 
 533                 Configuration actualConfiguration = bbInputSetupMapperLayer.mapAAIConfiguration(configurationAAI);
 
 535                 assertThat(actualConfiguration, sameBeanAs(expectedConfiguration));
 
 539         public void testMapRequestContext() throws IOException {
 
 540                 RequestContext expected = mapper.readValue(
 
 541                                 new File(RESOURCE_PATH + "RequestContextExpected.json"),
 
 542                                 RequestContext.class);
 
 544                 RequestDetails requestDetails = mapper.readValue(
 
 545                                 new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"),
 
 546                                 RequestDetails.class);
 
 547                 RequestContext actual = bbInputSetupMapperLayer.mapRequestContext(requestDetails);
 
 549                 assertThat(actual, sameBeanAs(expected));
 
 553         public void testMapOrchestrationContext() throws IOException {
 
 554                 OrchestrationContext expected = new OrchestrationContext();
 
 555                 expected.setIsRollbackEnabled(true);
 
 557                 RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
 
 559                 OrchestrationContext actual = bbInputSetupMapperLayer.mapOrchestrationContext(requestDetails);
 
 561                 assertThat(actual, sameBeanAs(expected));
 
 565         public void testMapLocationContext() {
 
 566                 CloudRegion expected = new CloudRegion();
 
 567                 expected.setCloudOwner("test-owner-name");
 
 568                 expected.setLcpCloudRegionId("cloudRegionId");
 
 569                 expected.setComplex("complexName");
 
 570                 expected.setTenantId("tenantId");
 
 571                 CloudConfiguration cloudConfig = new CloudConfiguration();
 
 572                 cloudConfig.setTenantId("tenantId");
 
 573                 cloudConfig.setLcpCloudRegionId("cloudRegionId");
 
 574                 cloudConfig.setAicNodeClli("aicNodeClli");
 
 575                 org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion();
 
 576                 cloudRegion.setCloudOwner("test-owner-name");
 
 577                 cloudRegion.setCloudRegionId("cloudRegionId");
 
 578                 cloudRegion.setComplexName("complexName");
 
 580                 CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion);
 
 582                 assertThat(actual, sameBeanAs(expected));
 
 586         public void testMapCloudRegion() {
 
 587                 CloudRegion expected = new CloudRegion();
 
 588                 expected.setCloudOwner("test-owner-name");
 
 589                 expected.setLcpCloudRegionId("cloudRegionId");
 
 590                 expected.setTenantId("tenantId");
 
 591                 expected.setCloudRegionVersion("cloudRegionVersion");
 
 593                 CloudConfiguration cloudConfig = new CloudConfiguration();
 
 594                 cloudConfig.setTenantId("tenantId");
 
 595                 cloudConfig.setLcpCloudRegionId("cloudRegionId");
 
 596                 cloudConfig.setAicNodeClli("aicNodeClli");
 
 598                 org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion();
 
 599                 cloudRegion.setCloudOwner("test-owner-name");
 
 600                 cloudRegion.setCloudRegionId("cloudRegionId");
 
 601                 cloudRegion.setCloudRegionVersion("cloudRegionVersion");
 
 603                 CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion);
 
 605                 assertThat(actual, sameBeanAs(expected));
 
 609         public void testMapCloudRegionWithNullCheck() {
 
 610                 CloudRegion expected = new CloudRegion();
 
 612                 CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null);
 
 614                 assertThat(actual, sameBeanAs(expected));
 
 618         public void testmapCatalogConfigurationToConfiguration() {
 
 619                 String modelCustUUID = "modelCustomizationUUID";
 
 620                 String modelInvariantUUID = "modelInvariantUUID";
 
 621                 String modelVersionUUID = "modelUUID";
 
 622                 String policyName = "policyName";
 
 623                 ModelInfoConfiguration expected = new ModelInfoConfiguration();
 
 624                 expected.setModelCustomizationId(modelCustUUID);
 
 625                 expected.setModelInvariantId(modelInvariantUUID);
 
 626                 expected.setModelVersionId(modelVersionUUID);
 
 627                 expected.setPolicyName(policyName);
 
 628                 ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization();
 
 629                 configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID);
 
 630                 configurationResourceCustomization.setConfigurationResource(new ConfigurationResource());
 
 631                 configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID);
 
 632                 configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID);
 
 633                 VnfVfmoduleCvnfcConfigurationCustomization policyNameTable = new VnfVfmoduleCvnfcConfigurationCustomization();
 
 634                 policyNameTable.setCvnfcCustomization(new CvnfcCustomization());
 
 635                 policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
 
 636                 policyNameTable.setPolicyName(policyName);
 
 638                 ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable);
 
 640                 assertThat(actual, sameBeanAs(expected));
 
 644         public void testMapNameValueUserParams() throws IOException {           
 
 645                 RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
 
 646                 Map<String,Object> actual = bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters());
 
 648                 assertTrue(actual.containsKey("name1"));
 
 649                 assertTrue(actual.containsValue("value1"));
 
 650                 assertTrue(actual.get("name1").equals("value1"));
 
 651                 assertTrue(actual.containsKey("name2"));
 
 652                 assertTrue(actual.containsValue("value2"));
 
 653                 assertTrue(actual.get("name2").equals("value2"));               
 
 654                 assertFalse(actual.containsKey("ignore"));
 
 655                 assertFalse(actual.containsValue("ignore"));            
 
 659         public void testMapRequestParameters() throws IOException {             
 
 660                 RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
 
 661                 RequestParameters actual = bbInputSetupMapperLayer.mapRequestParameters(requestDetails.getRequestParameters());
 
 663                 assertEquals(actual.getUsePreload(), requestDetails.getRequestParameters().getUsePreload());
 
 664                 assertEquals(actual.getSubscriptionServiceType(), requestDetails.getRequestParameters().getSubscriptionServiceType());
 
 665                 assertEquals(actual.getPayload(), requestDetails.getRequestParameters().getPayload());                          
 
 668         protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
 
 669                 RequestParameters requestParams = new RequestParameters();
 
 670                 requestParams.setaLaCarte(requestParameters.getALaCarte());
 
 671                 requestParams.setUsePreload(requestParameters.getUsePreload());
 
 672                 requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
 
 673                 requestParams.setUserParams(requestParameters.getUserParams());
 
 674                 requestParams.setPayload(requestParameters.getPayload());
 
 675                 return requestParams;