diff options
author | 2020-05-05 12:45:46 +0300 | |
---|---|---|
committer | 2020-05-06 06:44:24 +0000 | |
commit | 8fcd0f2ea7f52b8984288329726ed7f2f7d29cc6 (patch) | |
tree | 62185b9d2ae29f086b8623146ca1dbd474818b63 /catalog-be/src | |
parent | 7a8c0b3f47d4c602b5d240fa77eb7f9491836128 (diff) |
fix bug - Unable to link CSAR artifact
Change-Id: I586637f988b84b3b858e2c8d567c6844be38322b
Issue-ID: SDC-2972
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
(cherry picked from commit a02add03b465de2adf8f5b05cf9d428af914287f)
Diffstat (limited to 'catalog-be/src')
2 files changed, 13 insertions, 5 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index 51eb22d527..05ef7867b4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -665,7 +665,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { protected ActionStatus addComponentInstanceArtifacts(org.openecomp.sdc.be.model.Component containerComponent, ComponentInstance componentInstance, org.openecomp.sdc.be.model.Component originComponent, User user, Map<String, String> existingEnvVersions) { log.debug("add artifacts to resource instance"); - List<GroupDefinition> filteredGroups = null; + List<GroupDefinition> filteredGroups = new ArrayList<>(); ActionStatus status = setResourceArtifactsOnResourceInstance(componentInstance); if (ActionStatus.OK != status) { throw new ByResponseFormatComponentException(componentsUtils.getResponseFormatForResourceInstance(status, "", null)); @@ -679,6 +679,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { Map<String, List<ArtifactDefinition>> groupInstancesArtifacts = new HashMap<>(); Integer defaultHeatTimeout = ConfigurationManager.getConfigurationManager().getConfiguration() .getHeatArtifactDeploymentTimeout().getDefaultMinutes(); + List<ArtifactDefinition> listOfCloudSpecificArts = new ArrayList<>(); for (ArtifactDefinition artifact : componentDeploymentArtifacts.values()) { String type = artifact.getArtifactType(); if (!type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_ENV.getType())) { @@ -700,6 +701,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (CollectionUtils.isNotEmpty(originComponent.getGroups())) { filteredGroups = originComponent.getGroups().stream().filter(g -> g.getType().equals(VF_MODULE)).collect(Collectors.toList()); } + if (isCloudSpecificArtifact(artifactDefinition.getArtifactName())) { + listOfCloudSpecificArts.add(artifact); + } if (CollectionUtils.isNotEmpty(filteredGroups)) { filteredGroups.stream().filter(g -> g.getArtifacts() @@ -710,6 +714,11 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } } } + groupInstancesArtifacts.forEach((k,v) -> v.addAll(listOfCloudSpecificArts)); + filteredGroups.forEach(g -> listOfCloudSpecificArts.forEach((e) -> { + g.getArtifactsUuid().add(e.getArtifactUUID()); + g.getArtifacts().add(e.getUniqueId()); + })); artStatus = toscaOperationFacade.addDeploymentArtifactsToInstance(containerComponent.getUniqueId(), componentInstance, finalDeploymentArtifacts); if (artStatus != StorageOperationStatus.OK) { log.debug("Failed to add instance deployment artifacts for instance {} in conatiner {} error {}", componentInstance.getUniqueId(), containerComponent.getUniqueId(), artStatus); @@ -743,9 +752,6 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { } artifactsUid.add(artifactDefinition); groupInstancesArtifacts.put(groupInstance.getUniqueId(), artifactsUid); - if (isCloudSpecificArtifact(artifactDefinition.getArtifactName())) { - groupInstance.getArtifacts().add(artifactDefinition.getGeneratedFromId()); - } } private ActionStatus setResourceArtifactsOnResourceInstance(ComponentInstance resourceInstance) { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java index 1bbe0fac88..cae53fa31d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java @@ -555,10 +555,11 @@ public class ComponentInstanceBusinessLogicTest { NodeTypeEnum.ResourceInstance, componentInstance.getName(), user, containerComponent, null)).thenReturn(heatEnvPlaceHolder2); + componentInstanceBusinessLogic.setToscaOperationFacade(toscaOperationFacade); when(toscaOperationFacade.addDeploymentArtifactsToInstance(containerComponent.getUniqueId(), componentInstance, finalDeploymentArtifacts)).thenReturn(StorageOperationStatus.OK); when(toscaOperationFacade - .addGroupInstancesToComponentInstance(containerComponent, componentInstance, null, new HashMap<>())) + .addGroupInstancesToComponentInstance(containerComponent, componentInstance, new ArrayList<>(), new HashMap<>())) .thenReturn(StorageOperationStatus.OK); when(toscaOperationFacade .addInformationalArtifactsToInstance(containerComponent.getUniqueId(), componentInstance, null)) @@ -586,6 +587,7 @@ public class ComponentInstanceBusinessLogicTest { artifactDefinition.setArtifactGroupType(ArtifactGroupTypeEnum.DEPLOYMENT); artifactDefinition.setEsId("esId" + artifactLabel); artifactDefinition.setArtifactType(artifactType); + artifactDefinition.setArtifactName("artifactName"); return artifactDefinition; } |