summaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src')
-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;
}