aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
authorYuli Shlosberg <ys9693@att.com>2020-05-05 12:45:46 +0300
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-05-06 06:44:15 +0000
commita02add03b465de2adf8f5b05cf9d428af914287f (patch)
treec1f1ec12243060c34bc89ff0aa69c796e9d63e70 /catalog-be
parent339d29c714f60de6e4e50b883259fc1a9a16ee84 (diff)
fix bug - Unable to link CSAR artifact
Change-Id: I586637f988b84b3b858e2c8d567c6844be38322b Issue-ID: SDC-2972 Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java14
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java4
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 93e31e2ea2..da9e0f9444 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 84efb81ad0..9fc6b5493c 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
@@ -553,10 +553,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))
@@ -584,6 +585,7 @@ public class ComponentInstanceBusinessLogicTest {
artifactDefinition.setArtifactGroupType(ArtifactGroupTypeEnum.DEPLOYMENT);
artifactDefinition.setEsId("esId" + artifactLabel);
artifactDefinition.setArtifactType(artifactType);
+ artifactDefinition.setArtifactName("artifactName");
return artifactDefinition;
}