use of org.onap.so.db.catalog.beans.Service in project so by onap.
the class WorkflowActionTest method selectExecutionListServiceMacroCreateWithUserParams.
@Test
public void selectExecutionListServiceMacroCreateWithUserParams() throws Exception {
String gAction = "createInstance";
String resource = "Service";
String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB", "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ActivateVnfBB", "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
Service service = new Service();
service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
HeatEnvironment volumeHeatEnv = new HeatEnvironment();
vfModuleCustomization.setVolumeHeatEnv(volumeHeatEnv);
org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
HeatTemplate volumeHeatTemplate = new HeatTemplate();
vfModule.setVolumeHeatTemplate(volumeHeatTemplate);
vfModuleCustomization.setVfModule(vfModule);
VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization();
vfModuleCustomization2.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
HeatEnvironment heatEnvironment = new HeatEnvironment();
vfModuleCustomization2.setHeatEnvironment(heatEnvironment);
org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule();
HeatTemplate moduleHeatTemplate = new HeatTemplate();
vfModule2.setModuleHeatTemplate(moduleHeatTemplate);
vfModuleCustomization2.setVfModule(vfModule2);
VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2;
vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString())).thenReturn(prepareListWithResources(false, false));
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3);
when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "AssignVfModuleBB", "AssignVfModuleBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "ActivateServiceInstanceBB");
assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
int randomUUIDLength = UUID.randomUUID().toString().length();
assertEquals(randomUUIDLength, ebbs.get(1).getWorkflowResourceIds().getVnfId().length());
assertEquals(randomUUIDLength, ebbs.get(2).getWorkflowResourceIds().getVolumeGroupId().length());
assertEquals(randomUUIDLength, ebbs.get(3).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(4).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(5).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(6).getWorkflowResourceIds().getVolumeGroupId().length());
assertEquals(randomUUIDLength, ebbs.get(7).getWorkflowResourceIds().getVolumeGroupId().length());
assertEquals(randomUUIDLength, ebbs.get(8).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(9).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(10).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(11).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(12).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(13).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(14).getWorkflowResourceIds().getVnfId().length());
assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
assertEquals(true, execution.getVariable("homing"));
}
use of org.onap.so.db.catalog.beans.Service in project so by onap.
the class WorkflowActionTest method selectExecutionListServiceMacroCreateWithUserParamsAndPriorities.
@Test
public void selectExecutionListServiceMacroCreateWithUserParamsAndPriorities() throws Exception {
String gAction = "createInstance";
String resource = "Service";
String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_JSON);
initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB", "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "AssignPnfBB", "WaitForPnfReadyBB", "ActivatePnfBB", "CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ActivateVnfBB", "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
Service service = new Service();
service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
HeatEnvironment volumeHeatEnv = new HeatEnvironment();
vfModuleCustomization.setVolumeHeatEnv(volumeHeatEnv);
org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
HeatTemplate volumeHeatTemplate = new HeatTemplate();
vfModule.setVolumeHeatTemplate(volumeHeatTemplate);
vfModuleCustomization.setVfModule(vfModule);
VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization();
vfModuleCustomization2.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
HeatEnvironment heatEnvironment = new HeatEnvironment();
vfModuleCustomization2.setHeatEnvironment(heatEnvironment);
org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule();
HeatTemplate moduleHeatTemplate = new HeatTemplate();
vfModule2.setModuleHeatTemplate(moduleHeatTemplate);
vfModuleCustomization2.setVfModule(vfModule2);
VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2;
vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString())).thenReturn(prepareListWithResources(true, true));
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3);
when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "AssignVfModuleBB", "AssignVfModuleBB", "AssignPnfBB", "WaitForPnfReadyBB", "ActivatePnfBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "ActivateServiceInstanceBB");
assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
int randomUUIDLength = UUID.randomUUID().toString().length();
assertEquals(randomUUIDLength, ebbs.get(1).getWorkflowResourceIds().getVnfId().length());
assertEquals(randomUUIDLength, ebbs.get(2).getWorkflowResourceIds().getVolumeGroupId().length());
assertEquals(randomUUIDLength, ebbs.get(3).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(4).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(5).getWorkflowResourceIds().getVfModuleId().length());
assertEquals("72d9d1cd-f46d-447a-abdb-451d6fb05fa8", ebbs.get(3).getBuildingBlock().getKey());
assertEquals("da4d4327-fb7d-4311-ac7a-be7ba60cf969", ebbs.get(4).getBuildingBlock().getKey());
assertEquals("3c40d244-808e-42ca-b09a-256d83d19d0a", ebbs.get(5).getBuildingBlock().getKey());
assertEquals(randomUUIDLength, ebbs.get(6).getWorkflowResourceIds().getPnfId().length());
assertEquals(randomUUIDLength, ebbs.get(7).getWorkflowResourceIds().getPnfId().length());
assertEquals(randomUUIDLength, ebbs.get(8).getWorkflowResourceIds().getPnfId().length());
assertEquals(randomUUIDLength, ebbs.get(9).getWorkflowResourceIds().getVolumeGroupId().length());
assertEquals(randomUUIDLength, ebbs.get(10).getWorkflowResourceIds().getVolumeGroupId().length());
assertEquals(randomUUIDLength, ebbs.get(11).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(12).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(13).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(14).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(15).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(16).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(17).getWorkflowResourceIds().getVnfId().length());
assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
assertEquals(true, execution.getVariable("homing"));
}
use of org.onap.so.db.catalog.beans.Service in project so by onap.
the class WorkflowActionTest method selectExecutionListServiceMacroCreateWithMultipleSameModelVnfAndVfModules.
@Test
public void selectExecutionListServiceMacroCreateWithMultipleSameModelVnfAndVfModules() throws Exception {
String gAction = "createInstance";
String resource = "Service";
String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_SERVICE_MULTIPLE_SAME_MODEL_VNF_VFMODULE);
initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v7/serviceInstances");
execution.setVariable("serviceInstanceId", UUID.randomUUID().toString());
// Service-Macro-Create
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB", "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "ControllerExecutionBB", "AssignPnfBB", "WaitForPnfReadyBB", "ControllerExecutionBB", "ControllerExecutionBB", "ActivatePnfBB", "CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ControllerExecutionBB", "ActivateVnfBB", "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
orchFlows.get(6).setBpmnAction("config-assign");
orchFlows.get(6).setBpmnScope("vnf");
orchFlows.get(9).setBpmnAction("config-assign");
orchFlows.get(9).setBpmnScope("pnf");
orchFlows.get(10).setBpmnAction("config-deploy");
orchFlows.get(10).setBpmnScope("pnf");
orchFlows.get(18).setBpmnAction("config-deploy");
orchFlows.get(18).setBpmnScope("vnf");
northBoundRequest.setOrchestrationFlowList(orchFlows);
Service service = new Service();
service.setModelUUID("f2444885-3c76-4ddc-8668-7741c0631495");
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setModelCustomizationUUID("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0");
vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
vfModule.setVolumeHeatTemplate(new HeatTemplate());
vfModuleCustomization.setVfModule(vfModule);
VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization();
vfModuleCustomization2.setModelCustomizationUUID("83677d89-428a-407b-b4ec-738e68275d84");
vfModuleCustomization2.setHeatEnvironment(new HeatEnvironment());
org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule();
vfModule2.setModuleHeatTemplate(new HeatTemplate());
vfModuleCustomization2.setVfModule(vfModule2);
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "DEFAULT")).thenReturn(northBoundRequest);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0")).thenReturn(vfModuleCustomization);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("83677d89-428a-407b-b4ec-738e68275d84")).thenReturn(vfModuleCustomization2);
when(catalogDbClient.getServiceByID("f2444885-3c76-4ddc-8668-7741c0631495")).thenReturn(service);
Resource serviceResource = new Resource(WorkflowType.SERVICE, "f2444885-3c76-4ddc-8668-7741c0631495", false, null);
Resource vnfResource1 = new Resource(WorkflowType.VNF, "0d0ba1ee-6b7f-47fe-8266-2967993b2c08", false, serviceResource);
vnfResource1.setInstanceName("vnf-instanceName-1");
Resource vfmResource1 = new Resource(WorkflowType.VFMODULE, "3bd19000-6d21-49f1-9eb3-ea76a6eac5e0", false, vnfResource1);
vfmResource1.setInstanceName("demo-network-1");
Resource vfmResource2 = new Resource(WorkflowType.VFMODULE, "83677d89-428a-407b-b4ec-738e68275d84", false, vnfResource1);
vfmResource2.setInstanceName("demo-1");
Resource vnfResource2 = new Resource(WorkflowType.VNF, "0d0ba1ee-6b7f-47fe-8266-2967993b2c08", false, serviceResource);
vnfResource2.setInstanceName("vnf-instanceName-2");
Resource vfmResource3 = new Resource(WorkflowType.VFMODULE, "83677d89-428a-407b-b4ec-738e68275d84", false, vnfResource2);
vfmResource3.setInstanceName("demo-2");
Resource vfmResource4 = new Resource(WorkflowType.VFMODULE, "83677d89-428a-407b-b4ec-738e68275d84", false, vnfResource2);
vfmResource4.setInstanceName("demo-3");
when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), any())).thenReturn(Arrays.asList(serviceResource, vnfResource1, vnfResource2, vfmResource1, vfmResource2, vfmResource3, vfmResource4));
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
Map<String, List<ExecuteBuildingBlock>> flowNamesToEbbList = ebbs.stream().collect(Collectors.groupingBy(e -> e.getBuildingBlock().getBpmnFlowName()));
assertEquals(1, flowNamesToEbbList.get("AssignServiceInstanceBB").size());
assertEquals(2, flowNamesToEbbList.get("AssignVnfBB").size());
assertEquals(4, flowNamesToEbbList.get("AssignVfModuleBB").size());
assertEquals(4, flowNamesToEbbList.get("ControllerExecutionBB").size());
assertEquals(4, flowNamesToEbbList.get("CreateVfModuleBB").size());
assertEquals(4, flowNamesToEbbList.get("ActivateVfModuleBB").size());
assertEquals(2, flowNamesToEbbList.get("ActivateVnfBB").size());
assertEquals(1, flowNamesToEbbList.get("ActivateServiceInstanceBB").size());
String vnfInstanceId1 = flowNamesToEbbList.get("AssignVnfBB").get(0).getWorkflowResourceIds().getVnfId();
String vnfInstanceId2 = flowNamesToEbbList.get("AssignVnfBB").get(1).getWorkflowResourceIds().getVnfId();
// should be 3 = 1 AssignVfModuleBB + 1 CreateVfModuleBB + 1 ActivateVfModuleBB
boolean allEbbsForVfModule1HaveCorrectParentVnfId = 3 == ebbs.stream().map(ExecuteBuildingBlock::getWorkflowResourceIds).filter(w -> "demo-network-1".equals(w.getVfModuleInstanceName()) && vnfInstanceId1.equals(w.getVnfId())).count();
boolean allEbbsForVfModule2HaveCorrectParentVnfId = 3 == ebbs.stream().map(ExecuteBuildingBlock::getWorkflowResourceIds).filter(w -> "demo-1".equals(w.getVfModuleInstanceName()) && vnfInstanceId1.equals(w.getVnfId())).count();
boolean allEbbsForVfModule3HaveCorrectParentVnfId = 3 == ebbs.stream().map(ExecuteBuildingBlock::getWorkflowResourceIds).filter(w -> "demo-2".equals(w.getVfModuleInstanceName()) && vnfInstanceId2.equals(w.getVnfId())).count();
boolean allEbbsForVfModule4HaveCorrectParentVnfId = 3 == ebbs.stream().map(ExecuteBuildingBlock::getWorkflowResourceIds).filter(w -> "demo-3".equals(w.getVfModuleInstanceName()) && vnfInstanceId2.equals(w.getVnfId())).count();
assertTrue(allEbbsForVfModule1HaveCorrectParentVnfId);
assertTrue(allEbbsForVfModule2HaveCorrectParentVnfId);
assertTrue(allEbbsForVfModule3HaveCorrectParentVnfId);
assertTrue(allEbbsForVfModule4HaveCorrectParentVnfId);
boolean controllerExecutionBBsforVnf1HaveCorrectVnfId = flowNamesToEbbList.get("ControllerExecutionBB").stream().filter(e -> vnfInstanceId1.equals(e.getWorkflowResourceIds().getVnfId())).map(ExecuteBuildingBlock::getBuildingBlock).map(BuildingBlock::getBpmnAction).collect(Collectors.toSet()).containsAll(Set.of("config-assign", "config-deploy"));
assertTrue(controllerExecutionBBsforVnf1HaveCorrectVnfId);
boolean controllerExecutionBBsforVnf2HaveCorrectVnfId = flowNamesToEbbList.get("ControllerExecutionBB").stream().filter(e -> vnfInstanceId2.equals(e.getWorkflowResourceIds().getVnfId())).map(ExecuteBuildingBlock::getBuildingBlock).map(BuildingBlock::getBpmnAction).collect(Collectors.toSet()).containsAll(Set.of("config-assign", "config-deploy"));
assertTrue(controllerExecutionBBsforVnf2HaveCorrectVnfId);
}
use of org.onap.so.db.catalog.beans.Service in project so by onap.
the class ServiceEBBLoaderTest method findCatalogNetworkCollectionTest.
@Test
public void findCatalogNetworkCollectionTest() {
Service service = new Service();
NetworkCollectionResourceCustomization networkCustomization = new NetworkCollectionResourceCustomization();
networkCustomization.setModelCustomizationUUID("123");
service.getCollectionResourceCustomizations().add(networkCustomization);
doReturn(networkCustomization).when(mockCatalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
CollectionResourceCustomization customization = serviceEBBLoader.findCatalogNetworkCollection(execution, service);
assertNotNull(customization);
}
use of org.onap.so.db.catalog.beans.Service in project so by onap.
the class ServiceEBBLoaderTest method traverseCatalogDbServiceMultipleNetworkTest.
@Test
public void traverseCatalogDbServiceMultipleNetworkTest() throws IOException, VrfBondingServiceException {
execution.setVariable("testProcessKey", "testProcessKeyValue");
Service service = new Service();
List<NetworkResourceCustomization> networkCustomizations = new ArrayList<>();
NetworkResourceCustomization networkCust = new NetworkResourceCustomization();
networkCust.setModelCustomizationUUID("123");
networkCustomizations.add(networkCust);
service.setNetworkCustomizations(networkCustomizations);
NetworkCollectionResourceCustomization collectionResourceCustomization = new NetworkCollectionResourceCustomization();
collectionResourceCustomization.setModelCustomizationUUID("123");
CollectionResource collectionResource = new CollectionResource();
collectionResource.setToscaNodeType("NetworkCollection");
InstanceGroup instanceGroup = new InstanceGroup();
List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustomizations = new ArrayList<>();
CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization();
collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3);
collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization);
instanceGroup.setCollectionInstanceGroupCustomizations(collectionInstanceGroupCustomizations);
collectionResource.setInstanceGroup(instanceGroup);
collectionResourceCustomization.setCollectionResource(collectionResource);
;
service.setModelUUID("abc");
service.getCollectionResourceCustomizations().add(collectionResourceCustomization);
service.getCollectionResourceCustomizations().add(collectionResourceCustomization);
doReturn(service).when(mockCatalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
doReturn(collectionResourceCustomization).when(mockCatalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
ObjectMapper mapper = new ObjectMapper();
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
List<Resource> resource = new ArrayList<>();
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
serviceEBBLoader.traverseCatalogDbService(execution, sIRequest, resource, aaiResourceIds);
assertEquals(resource.size(), 2);
}
Aggregations