Search in sources :

Example 71 with ResourceKey

use of org.onap.so.bpmn.servicedecomposition.entities.ResourceKey in project so by onap.

the class BBInputSetupTest method testGetAlaCarteServiceInstance.

@Test
public void testGetAlaCarteServiceInstance() throws Exception {
    ServiceInstance expected = mapper.readValue(new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), ServiceInstance.class);
    RequestDetails requestDetails = new RequestDetails();
    RequestInfo requestInfo = new RequestInfo();
    requestInfo.setInstanceName("SharansInstanceName");
    requestDetails.setRequestInfo(requestInfo);
    Customer customer = new Customer();
    String serviceInstanceId = "SharansInstanceId";
    boolean aLaCarte = true;
    Service service = new Service();
    service.setModelUUID("modelUUID");
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelUuid("modelUUID");
    expected.setModelInfoServiceInstance(modelInfoServiceInstance);
    org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance();
    serviceInstanceAAI.setModelVersionId("modelUUIDDifferent");
    Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
    String bbName = AssignFlows.SERVICE_INSTANCE.toString();
    Service differentService = new Service();
    differentService.setModelUUID("modelUUIDDifferent");
    doReturn(expected).when(SPY_bbInputSetup).getServiceInstanceHelper(requestDetails, customer, null, null, lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName);
    doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(serviceInstanceId);
    doReturn(differentService).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(serviceInstanceAAI.getModelVersionId());
    doReturn(expected.getModelInfoServiceInstance()).when(bbInputSetupMapperLayer).mapCatalogServiceIntoServiceInstance(differentService);
    ServiceInstance actual = SPY_bbInputSetup.getALaCarteServiceInstance(service, requestDetails, customer, null, null, lookupKeyMap, serviceInstanceId, aLaCarte, bbName);
    assertThat(actual, sameBeanAs(expected));
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Service(org.onap.so.db.catalog.beans.Service) RequestInfo(org.onap.so.serviceinstancebeans.RequestInfo) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) File(java.io.File) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Test(org.junit.Test)

Example 72 with ResourceKey

use of org.onap.so.bpmn.servicedecomposition.entities.ResourceKey in project so by onap.

the class BBInputSetupTest method testCreateVolumeGroup.

@Test
public void testCreateVolumeGroup() {
    String volumeGroupId = "volumeGroupId";
    String instanceName = "vfModuleName";
    String vnfType = "vnfType";
    Map<String, String> cloudParams = new HashMap<>();
    cloudParams.put("param1", "param1Value");
    VolumeGroup expected = new VolumeGroup();
    expected.setVolumeGroupId(volumeGroupId);
    expected.setVolumeGroupName(instanceName);
    expected.setCloudParams(cloudParams);
    expected.setVnfType(vnfType);
    expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
    Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
    List<Map<String, String>> instanceParams = new ArrayList<>();
    instanceParams.add(cloudParams);
    VolumeGroup actual = SPY_bbInputSetup.createVolumeGroup(lookupKeyMap, volumeGroupId, instanceName, vnfType, instanceParams);
    assertThat(actual, sameBeanAs(expected));
    assertEquals("LookupKeyMap is populated", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
    expected.getCloudParams().clear();
    actual = SPY_bbInputSetup.createVolumeGroup(lookupKeyMap, volumeGroupId, instanceName, vnfType, null);
    assertThat(actual, sameBeanAs(expected));
}
Also used : HashMap(java.util.HashMap) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) ArrayList(java.util.ArrayList) Map(java.util.Map) BaseBBInputSetupTestHelper.prepareLookupKeyMap(org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap) HashMap(java.util.HashMap) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) Test(org.junit.Test)

Aggregations

ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)72 Test (org.junit.Test)66 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)51 File (java.io.File)50 HashMap (java.util.HashMap)48 Service (org.onap.so.db.catalog.beans.Service)45 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)41 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)41 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)41 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)39 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)25 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)23 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)22 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)22 ConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys)19 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)19 BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys)18 ServiceModel (org.onap.so.bpmn.servicedecomposition.entities.ServiceModel)13 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)11 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)11