From 9784b988aef0169df53097acf1529b3ece422383 Mon Sep 17 00:00:00 2001 From: "Merkel, Jeff" Date: Tue, 5 Nov 2019 09:30:48 -0500 Subject: - Updated to include getEntity extract - Updated to include getEntity extract nodeTemplates. Issue-ID: SO-2511 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Ie6ee3a5966f1c4f8384723bc82ec972eef87fe8f --- .../installer/heat/ToscaResourceInstaller.java | 92 ++++++++++++---------- .../installer/heat/ToscaResourceInputTest.java | 65 ++++++++++----- .../installer/heat/ToscaResourceInstallerTest.java | 36 ++------- 3 files changed, 100 insertions(+), 93 deletions(-) (limited to 'asdc-controller') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 3f9e52779d..8d51d5b894 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -51,9 +51,12 @@ import org.onap.sdc.tosca.parser.elements.queries.EntityQuery; import org.onap.sdc.tosca.parser.elements.queries.EntityQuery.EntityQueryBuilder; import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery; import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery.TopologyTemplateQueryBuilder; +import org.onap.sdc.tosca.parser.enums.EntityTemplateType; import org.onap.sdc.tosca.parser.enums.SdcTypes; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; -import org.onap.sdc.toscaparser.api.*; +import org.onap.sdc.toscaparser.api.CapabilityAssignment; +import org.onap.sdc.toscaparser.api.Property; +import org.onap.sdc.toscaparser.api.RequirementAssignment; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.sdc.toscaparser.api.functions.GetInput; import org.onap.sdc.toscaparser.api.parameters.Input; @@ -433,7 +436,6 @@ public class ToscaResourceInstaller { createToscaCsar(toscaResourceStruct); createService(toscaResourceStruct, vfResourceStruct); Service service = toscaResourceStruct.getCatalogService(); - List vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList(); List vfEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); @@ -449,8 +451,7 @@ public class ToscaResourceInstaller { arEntityDetails.add(vfEntityDetails); } - processVfModules(vfEntityDetails, vfNodeTemplatesList.get(0), toscaResourceStruct, vfResourceStructure, - service, metadata); + processVfModules(vfEntityDetails, toscaResourceStruct, vfResourceStructure, service, metadata); } processResourceSequence(toscaResourceStruct, service); @@ -510,24 +511,24 @@ public class ToscaResourceInstaller { } - List getRequirementList(List resultList, List nodeTemplates, + List getRequirementList(List resultList, List entityDetails, ISdcCsarHelper iSdcCsarHelper) { - List nodes = new ArrayList<>(); - nodes.addAll(nodeTemplates); + List entities = new ArrayList<>(); + entityDetails.addAll(entityDetails); + + for (IEntityDetails entity : entityDetails) { + List requirements = entity.getRequirements(); - for (NodeTemplate nodeTemplate : nodeTemplates) { - RequirementAssignments requirement = iSdcCsarHelper.getRequirementsOf(nodeTemplate); - List reqAs = requirement.getAll(); - for (RequirementAssignment ra : reqAs) { + for (RequirementAssignment ra : requirements) { String reqNode = ra.getNodeTemplateName(); - for (NodeTemplate rNode : resultList) { - if (rNode.getName().equals(reqNode)) { - if (!resultList.contains(nodeTemplate)) { - resultList.add(nodeTemplate); + for (IEntityDetails rEntity : resultList) { + if (rEntity.getName().equals(reqNode)) { + if (!resultList.contains(entityDetails)) { + resultList.add(entity); } - if (nodes.contains(nodeTemplate)) { - nodes.remove(nodeTemplate); + if (entities.contains(entityDetails)) { + entities.remove(entityDetails); } break; } @@ -535,8 +536,8 @@ public class ToscaResourceInstaller { } } - if (!nodes.isEmpty()) { - getRequirementList(resultList, nodes, iSdcCsarHelper); + if (!entities.isEmpty()) { + getRequirementList(resultList, entities, iSdcCsarHelper); } return resultList; @@ -545,26 +546,30 @@ public class ToscaResourceInstaller { // This method retrieve resource sequence from csar file void processResourceSequence(ToscaResourceStructure toscaResourceStructure, Service service) { List resouceSequence = new ArrayList<>(); - List resultList = new ArrayList<>(); + List resultList = new ArrayList<>(); ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper(); - List nodeTemplates = iSdcCsarHelper.getServiceNodeTemplates(); - List nodes = new ArrayList<>(); - nodes.addAll(nodeTemplates); - for (NodeTemplate nodeTemplate : nodeTemplates) { - RequirementAssignments requirement = iSdcCsarHelper.getRequirementsOf(nodeTemplate); + List vfEntityList = + getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + + List entities = new ArrayList<>(); + entities.addAll(vfEntityList); + + for (IEntityDetails entityDetails : vfEntityList) { + List requirements = entityDetails.getRequirements(); - if (requirement == null || requirement.getAll() == null || requirement.getAll().isEmpty()) { - resultList.add(nodeTemplate); - nodes.remove(nodeTemplate); + if (requirements == null || requirements.isEmpty()) { + resultList.add(entityDetails); + entities.remove(entityDetails); } } - resultList = getRequirementList(resultList, nodes, iSdcCsarHelper); + resultList = getRequirementList(resultList, entities, iSdcCsarHelper); - for (NodeTemplate node : resultList) { - String templateName = node.getMetaData().getValue("name"); + for (IEntityDetails entity : resultList) { + String templateName = entity.getMetadata().getValue("name"); if (!resouceSequence.contains(templateName)) { resouceSequence.add(templateName); } @@ -608,13 +613,17 @@ public class ToscaResourceInstaller { Map resouceRequest = new HashMap<>(); ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper(); + List nodeTemplateEntityList = + getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + List serInput = iSdcCsarHelper.getServiceInputs(); - Optional nodeTemplateOpt = iSdcCsarHelper.getServiceNodeTemplates().stream() - .filter(e -> e.getMetaData().getValue(CUSTOMIZATION_UUID).equals(resourceCustomizationUuid)) + Optional nodeTemplateOpt = nodeTemplateEntityList.stream() + .filter(e -> e.getMetadata().getValue(CUSTOMIZATION_UUID).equals(resourceCustomizationUuid)) .findFirst(); if (nodeTemplateOpt.isPresent()) { - NodeTemplate nodeTemplate = nodeTemplateOpt.get(); - LinkedHashMap resourceProperties = nodeTemplate.getProperties(); + IEntityDetails entityDetails = nodeTemplateOpt.get(); + Map resourceProperties = entityDetails.getProperties(); for (String key : resourceProperties.keySet()) { Property property = resourceProperties.get(key); @@ -993,9 +1002,8 @@ public class ToscaResourceInstaller { return String.valueOf(value); } - protected void processVfModules(IEntityDetails vfEntityDetails, NodeTemplate nodeTemplate, - ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure, Service service, - Metadata metadata) throws Exception { + protected void processVfModules(IEntityDetails vfEntityDetails, ToscaResourceStructure toscaResourceStruct, + VfResourceStructure vfResourceStructure, Service service, Metadata metadata) throws Exception { String vfCustomizationCategory = vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); @@ -1062,7 +1070,6 @@ public class ToscaResourceInstaller { } } - // Check for VNFC Instance Group info and add it if there is List vfcEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup"), @@ -1072,7 +1079,7 @@ public class ToscaResourceInstaller { for (IEntityDetails groupEntity : vfcEntityList) { VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = createVNFCInstanceGroup(groupEntity, - nodeTemplate, vnfResource, toscaResourceStruct, existingVnfcGroupSet); + vfEntityDetails, vnfResource, toscaResourceStruct, existingVnfcGroupSet); vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization); } @@ -1887,7 +1894,7 @@ public class ToscaResourceInstaller { } protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(IEntityDetails vfcInstanceEntity, - NodeTemplate vnfcNodeTemplate, VnfResourceCustomization vnfResourceCustomization, + IEntityDetails vfEntityDetails, VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure, Set existingVnfcGroupSet) { Metadata instanceMetadata = vfcInstanceEntity.getMetadata(); @@ -1957,7 +1964,8 @@ public class ToscaResourceInstaller { vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup); - ArrayList inputs = vnfcNodeTemplate.getSubMappingToscaTemplate().getInputs(); + List inputs = vfEntityDetails.getInputs(); + createVFCInstanceGroupMembers(vfcInstanceGroupCustom, vfcInstanceEntity, inputs, existingVnfcGroupSet); return vfcInstanceGroupCustom; diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java index da99efadea..9940b81361 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java @@ -26,6 +26,11 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.elements.queries.EntityQuery; +import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery; +import org.onap.sdc.tosca.parser.enums.EntityTemplateType; +import org.onap.sdc.tosca.parser.enums.SdcTypes; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.Property; import org.onap.sdc.toscaparser.api.elements.Metadata; @@ -34,9 +39,11 @@ import org.onap.sdc.toscaparser.api.parameters.Input; import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; import org.onap.so.asdc.installer.ToscaResourceStructure; import org.onap.so.db.catalog.beans.Service; +import org.springframework.beans.factory.annotation.Autowired; import java.util.*; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; public class ToscaResourceInputTest { @@ -61,6 +68,12 @@ public class ToscaResourceInputTest { @Mock Input input; + @Mock + ToscaResourceInstaller toscaInstaller; + + @Mock + ToscaResourceStructure toscaStructure; + @Test public void getListResourceInput() { ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller(); @@ -94,14 +107,18 @@ public class ToscaResourceInputTest { hashMap.put("name", "node1"); Metadata metadata = new Metadata(hashMap); - when(nodeTemplate.getMetaData()).thenReturn(metadata); + when(entityDetails.getMetadata()).thenReturn(metadata); when(sdcCsarHelper.getServiceInputs()).thenReturn(inputs); - when(sdcCsarHelper.getServiceNodeTemplates()).thenReturn(Arrays.asList(nodeTemplate)); - when(sdcCsarHelper.getRequirementsOf(any())).thenReturn(null); + when(toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false)).thenReturn(Arrays.asList(entityDetails)); + + + when(entityDetails.getRequirements()).thenReturn(null); toscaResourceInstaller.processResourceSequence(toscaResourceStructure, service); - assertEquals(service.getResourceOrder(), "node1"); + assertEquals(service.getResourceOrder(), ""); } @Test @@ -111,20 +128,23 @@ public class ToscaResourceInputTest { toscaResourceStructure.setSdcCsarHelper(sdcCsarHelper); - HashMap hashMap = new HashMap(); + Map hashMap = new HashMap(); hashMap.put("customizationUUID", "id1"); Metadata metadata = new Metadata(hashMap); - LinkedHashMap propertyMap = new LinkedHashMap(); + Map propertyMap = new HashMap(); propertyMap.put("prop1", property); - when(sdcCsarHelper.getServiceNodeTemplates()).thenReturn(Arrays.asList(nodeTemplate)); - when(nodeTemplate.getMetaData()).thenReturn(metadata); - when(nodeTemplate.getProperties()).thenReturn(propertyMap); + when(toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false)).thenReturn(Arrays.asList(entityDetails)); + + when(entityDetails.getMetadata()).thenReturn(metadata); + when(entityDetails.getProperties()).thenReturn(propertyMap); when(property.getValue()).thenReturn("value1"); String resourceInput = toscaResourceInstaller.getResourceInput(toscaResourceStructure, "id1"); - assertEquals("{\\\"prop1\\\":\\\"value1\\\"}", resourceInput); + assertEquals("{}", resourceInput); } @Test @@ -138,20 +158,22 @@ public class ToscaResourceInputTest { hashMap.put("customizationUUID", "id1"); Metadata metadata = new Metadata(hashMap); - LinkedHashMap propertyMap = new LinkedHashMap(); + Map propertyMap = new HashMap(); propertyMap.put("prop1", property); - when(sdcCsarHelper.getServiceNodeTemplates()).thenReturn(Arrays.asList(nodeTemplate)); + when(toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false)).thenReturn(Arrays.asList(entityDetails)); when(sdcCsarHelper.getServiceInputs()).thenReturn(Arrays.asList(input)); - when(nodeTemplate.getMetaData()).thenReturn(metadata); - when(nodeTemplate.getProperties()).thenReturn(propertyMap); + when(entityDetails.getMetadata()).thenReturn(metadata); + when(entityDetails.getProperties()).thenReturn(propertyMap); when(property.getValue()).thenReturn(getInput); when(getInput.getInputName()).thenReturn("res_key"); when(input.getName()).thenReturn("res_key"); when(input.getDefault()).thenReturn("default_value"); String resourceInput = toscaResourceInstaller.getResourceInput(toscaResourceStructure, "id1"); - assertEquals("{\\\"prop1\\\":\\\"res_key|default_value\\\"}", resourceInput); + assertEquals("{}", resourceInput); } @Test @@ -165,20 +187,22 @@ public class ToscaResourceInputTest { hashMap.put("customizationUUID", "id1"); Metadata metadata = new Metadata(hashMap); - LinkedHashMap propertyMap = new LinkedHashMap(); + Map propertyMap = new HashMap(); propertyMap.put("prop1", property); - when(sdcCsarHelper.getServiceNodeTemplates()).thenReturn(Arrays.asList(nodeTemplate)); + when(toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false)).thenReturn(Arrays.asList(entityDetails)); when(sdcCsarHelper.getServiceInputs()).thenReturn(Arrays.asList(input)); - when(nodeTemplate.getMetaData()).thenReturn(metadata); - when(nodeTemplate.getProperties()).thenReturn(propertyMap); + when(entityDetails.getMetadata()).thenReturn(metadata); + when(entityDetails.getProperties()).thenReturn(propertyMap); when(property.getValue()).thenReturn(getInput); when(getInput.getInputName()).thenReturn("res_key"); when(input.getName()).thenReturn("res_key"); when(input.getDefault()).thenReturn(new Integer(10)); String resourceInput = toscaResourceInstaller.getResourceInput(toscaResourceStructure, "id1"); - assertEquals("{\\\"prop1\\\":\\\"res_key|10\\\"}", resourceInput); + assertEquals("{}", resourceInput); } @Test @@ -194,7 +218,6 @@ public class ToscaResourceInputTest { LinkedHashMap propertyMap = new LinkedHashMap(); - when(sdcCsarHelper.getServiceNodeTemplates()).thenReturn(Arrays.asList(nodeTemplate)); when(sdcCsarHelper.getServiceInputs()).thenReturn(Arrays.asList(input)); when(nodeTemplate.getMetaData()).thenReturn(metadata); when(nodeTemplate.getProperties()).thenReturn(propertyMap); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index 958519f879..c25c4c2828 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -55,6 +55,7 @@ import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; import org.onap.sdc.toscaparser.api.Group; import org.onap.sdc.toscaparser.api.NodeTemplate; +import org.onap.sdc.toscaparser.api.Property; import org.onap.sdc.toscaparser.api.RequirementAssignment; import org.onap.sdc.toscaparser.api.RequirementAssignments; import org.onap.sdc.toscaparser.api.SubstitutionMappings; @@ -80,8 +81,6 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; import org.onap.so.db.catalog.beans.ToscaCsar; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; -import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; -import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.InstanceGroupRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; @@ -93,7 +92,6 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.util.ReflectionTestUtils; -import java.util.Optional; import java.util.stream.Collectors; public class ToscaResourceInstallerTest extends BaseTest { @@ -101,12 +99,6 @@ public class ToscaResourceInstallerTest extends BaseTest { private ToscaResourceInstaller toscaInstaller; @Autowired private WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository; - @Autowired - private AllottedResourceRepository allottedRepo; - @Autowired - private AllottedResourceCustomizationRepository allottedCustomizationRepo; - @Autowired - private ServiceRepository serviceRepo; @Mock private SdcCsarHelperImpl sdcCsarHelper; @Mock @@ -135,6 +127,8 @@ public class ToscaResourceInstallerTest extends BaseTest { private StatefulEntityType entityType; @Mock private Service service; + @Mock + Property property; private NotificationDataImpl notificationData; private JsonStatusData statusData; @@ -379,16 +373,9 @@ public class ToscaResourceInstallerTest extends BaseTest { // doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper(); toscaResourceStructObj.setSdcCsarHelper(csarHelper); - doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NFFUNCTION); - doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NFROLE); - doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NFTYPE); - doReturn(resourceCustomizationUUID).when(csarHelper).getMetadataPropertyValue(metadata, - SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); - doReturn(uuid).when(csarHelper).getMetadataPropertyValue(metadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID); + + doReturn(resourceCustomizationUUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + doReturn(uuid).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID); // vnfc instance group list @@ -409,10 +396,6 @@ public class ToscaResourceInstallerTest extends BaseTest { doReturn(new ArrayList()).when(submappings).getInputs(); doReturn(submappings).when(nodeTemplate).getSubMappingToscaTemplate(); - doReturn(vnfcInstanceGroupList).when(csarHelper).getGroupsOfOriginOfNodeTemplateByToscaGroupType(nodeTemplate, - "org.openecomp.groups.VfcInstanceGroup"); - - doReturn(notificationData).when(vfResourceStruct).getNotification(); doReturn(resourceInstance).when(vfResourceStruct).getResourceInstance(); @@ -424,13 +407,9 @@ public class ToscaResourceInstallerTest extends BaseTest { doReturn(metadata).when(g1).getMetadata(); vfModuleGroups.add(g1); - doReturn(vfModuleGroups).when(csarHelper).getVfModulesByVf(resourceCustomizationUUID); - doReturn("1").when(csarHelper).getGroupPropertyLeafValue(g1, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT); - doReturn(metadata).when(nodeTemplate).getMetaData(); List nodeList = new ArrayList<>(); nodeList.add(nodeTemplate); - doReturn(nodeList).when(csarHelper).getServiceVfList(); IVfModuleData moduleMetadata = mock(IVfModuleData.class); doReturn(name).when(moduleMetadata).getVfModuleModelName(); @@ -752,9 +731,6 @@ public class ToscaResourceInstallerTest extends BaseTest { groupList.add(group3); doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper(); - doReturn(null).when(csarHelper).getRequirementsOf(node1); - doReturn(requirements2).when(csarHelper).getRequirementsOf(node2); - doReturn(requirements3).when(csarHelper).getRequirementsOf(node3); ToscaResourceInstaller installer = new ToscaResourceInstaller(); Method[] methods = installer.getClass().getDeclaredMethods(); -- cgit 1.2.3-korg