use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.
the class UserParamsServiceTraversal method setResourceListForVnfs.
private void setResourceListForVnfs(DelegateExecution execution, List<Resource> resourceList, Resource serviceResource, Service validate) {
for (Vnfs vnf : validate.getResources().getVnfs()) {
setVnfCustomizationUUID(vnf);
Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getModelInfo().getModelCustomizationId(), false, serviceResource);
vnfResource.setProcessingPriority(vnf.getProcessingPriority());
vnfResource.setInstanceName(vnf.getInstanceName());
ModelInfo modelInfo = vnf.getModelInfo();
if (modelInfo != null) {
vnfResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid());
vnfResource.setModelVersionId(modelInfo.getModelVersionId());
}
resourceList.add(vnfResource);
setResourceListForVfModules(execution, resourceList, vnfResource, validate, vnf);
}
}
use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.
the class RequestHandlerUtilsUnitTest method getIsBaseVfModuleFalseTest.
@Test
public void getIsBaseVfModuleFalseTest() throws ApiException {
VfModule vfModule = new VfModule();
vfModule.setIsBase(false);
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelVersionId(MODEL_VERSION_ID);
doReturn(vfModule).when(catDbClient).getVfModuleByModelUUID(MODEL_VERSION_ID);
Boolean expected = false;
Boolean result = requestHandler.getIsBaseVfModule(modelInfo, action, vnfType, sdcServiceModelVersion, currentActiveRequest);
assertEquals(result, expected);
}
use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.
the class ServiceInstancesTest method setServiceTypeTestDefault.
@Test
public void setServiceTypeTestDefault() throws JsonProcessingException {
String requestScope = ModelType.service.toString();
Boolean aLaCarteFlag = false;
ServiceInstancesRequest sir = new ServiceInstancesRequest();
RequestDetails requestDetails = new RequestDetails();
RequestInfo requestInfo = new RequestInfo();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelVersionId("0dd91181-49da-446b-b839-cd959a96f04a");
requestInfo.setSource("VID");
requestDetails.setModelInfo(modelInfo);
requestDetails.setRequestInfo(requestInfo);
sir.setRequestDetails(requestDetails);
Service defaultService = new Service();
defaultService.setServiceType("testServiceType");
wireMockServer.stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_NOT_FOUND)));
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
String serviceType = requestHandlerUtils.getServiceType(requestScope, sir, aLaCarteFlag);
assertEquals(serviceType, "testServiceType");
}
use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.
the class RequestHandlerUtilsUnitTest method getIsBaseVfModuleModelInfoNotSetTest.
@Test
public void getIsBaseVfModuleModelInfoNotSetTest() throws ApiException {
ModelInfo modelInfo = new ModelInfo();
Boolean expected = false;
Boolean result = requestHandler.getIsBaseVfModule(modelInfo, Action.deleteInstance, vnfType, sdcServiceModelVersion, currentActiveRequest);
assertEquals(result, expected);
}
use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.
the class RequestHandlerUtilsUnitTest method getIsBaseVfModuleNullTest.
@Test
public void getIsBaseVfModuleNullTest() throws ApiException {
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelVersionId(MODEL_VERSION_ID);
modelInfo.setModelName(MODEL_NAME);
String errorMessage = "VnfType vnfType and VF Module Model Name modelName with version 7 not found in MSO Catalog DB";
doNothing().when(requestHandler).updateStatus(currentActiveRequest, Status.FAILED, errorMessage);
doReturn(null).when(catDbClient).getVfModuleByModelUUID(MODEL_VERSION_ID);
thrown.expect(VfModuleNotFoundException.class);
thrown.expectMessage(errorMessage);
requestHandler.getIsBaseVfModule(modelInfo, action, vnfType, sdcServiceModelVersion, currentActiveRequest);
}
Aggregations