aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-07-14 10:27:14 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-07-14 16:58:46 +0000
commit9ef20cdefa00d8a3c1535c60ddc2a183bff135b2 (patch)
tree87689809af581164f344016021c69708c37d152d /catalog-be
parentc970dbd2d109f57af2adcaf6e641e19342a0f142 (diff)
Fix error in upgrading instance version
Exception thrown when upgrading the version of a component instance in a component composition Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-4096 Change-Id: Ice98ab72f9bb69d3fa088a94e4c7c3f903de1f99
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java
index 6f5dd03e6d..ecbeb21fea 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceInterfacesMerge.java
@@ -93,10 +93,10 @@ public class ComponentInstanceInterfacesMerge implements ComponentInstanceMergeI
mergeOperationInputDefinitions(oldOperationDef.getInputs(), newOperationDefKeyValue.getInputs(),
originalOperationDef.getInputs());
}
- if (!originalOperationDef.getImplementation().equals(oldOperationDef.getImplementation())) {
+ if (originalValueOverwritten(originalOperationDef.getImplementation(), oldOperationDef.getImplementation()) ) {
newOperationDefKeyValue.setImplementation(oldOperationDef.getImplementation());
}
- if (!originalOperationDef.getDescription().equals(oldOperationDef.getDescription())) {
+ if (originalValueOverwritten(originalOperationDef.getDescription(), oldOperationDef.getDescription())) {
newOperationDefKeyValue.setDescription(oldOperationDef.getDescription());
}
newInterfaceDefOperationMap.put(newOperationDefKey, newOperationDefKeyValue);
@@ -106,6 +106,13 @@ public class ComponentInstanceInterfacesMerge implements ComponentInstanceMergeI
StorageOperationStatus updateStatus = toscaOperationFacade.updateComponentInstanceInterfaces(currentComponent, instanceId);
return componentsUtils.convertFromStorageResponse(updateStatus);
}
+
+ private <T> boolean originalValueOverwritten(final T originalValue, final T oldValue) {
+ if (originalValue == null) {
+ return oldValue != null;
+ }
+ return !originalValue.equals(oldValue);
+ }
private void mergeOperationInputDefinitions(ListDataDefinition<OperationInputDefinition> oldInputs,
ListDataDefinition<OperationInputDefinition> newInputs,