summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-10-19 18:37:01 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-10-26 09:23:55 +0000
commit8220d912803cecb22af967173e228867569450c4 (patch)
tree9f0c9b4e9aa4628309c9e061bde46ed756350514 /catalog-model/src/main
parent15c891ef4198a94ebcdf888a6d09e6f5817ae225 (diff)
Fix import policy issues
The following issues are addressed: When a service is imported containing polices, a new name for the policy is generated instead of using the name from the imported service When a service is imported containing policies with a string value set for a property of a policy, then the value is created in the new service surrounded with quotes NPE when service imported with no instances NPE when service imported with instances with no requirements Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-4224 Change-Id: I8403c0564796a045816ae28e52961688ca7804db
Diffstat (limited to 'catalog-model/src/main')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
index c450457855..790499c0da 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
@@ -31,6 +31,7 @@ import java.util.Map.Entry;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
@@ -1585,9 +1586,12 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
}
private void fillPolicyDefinition(GraphVertex componentV, PolicyDefinition policyDefinition, int counter) {
- String policyName = buildSubComponentName((String) componentV.getJsonMetadataField(JsonPresentationFields.NAME),
- policyDefinition.getPolicyTypeName(), counter);
- policyDefinition.setName(policyName);
+ String policyName = policyDefinition.getName();
+ if (StringUtils.isBlank(policyName)) {
+ policyName = buildSubComponentName((String) componentV.getJsonMetadataField(JsonPresentationFields.NAME),
+ policyDefinition.getPolicyTypeName(), counter);
+ policyDefinition.setName(policyName);
+ }
policyDefinition.setInvariantName(policyName);
policyDefinition.setComponentName((String) componentV.getJsonMetadataField(JsonPresentationFields.NAME));
policyDefinition.setUniqueId(UniqueIdBuilder.buildPolicyUniqueId(componentV.getUniqueId(), policyName));