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));
}
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));
}
Aggregations