From a99abdf5317f4f0f7435af71278701b3b43282a2 Mon Sep 17 00:00:00 2001 From: vasraz Date: Mon, 4 Jul 2022 15:47:48 +0100 Subject: [PATCH] Fix 'Fail to declare Input for duplicated name of property' Signed-off-by: Vasyl Razinkov Change-Id: Ib9ef09944b0ae31b1cfd0dc42d9e7026b5a6ba8f Issue-ID: SDC-4081 --- .../openecomp/sdc/be/components/impl/InputsBusinessLogic.java | 11 +++++------ .../sdc/be/components/property/DefaultPropertyDeclarator.java | 4 ++-- .../java/org/openecomp/sdc/be/servlets/InputsServlet.java | 2 +- .../sdc/be/components/impl/InputsBusinessLogicTest.java | 2 +- .../sdc/be/datatypes/elements/PropertyDataDefinition.java | 7 +++---- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java index 33bb8650ae..18993e8f65 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java @@ -91,7 +91,6 @@ public class InputsBusinessLogic extends BaseBusinessLogic { private static final String UPDATE_INPUT = "UpdateInput"; private static final Logger log = Logger.getLogger(InputsBusinessLogic.class); private static final String FAILED_TO_FOUND_COMPONENT_ERROR = "Failed to found component {}, error: {}"; - private static final String GET_PROPERTIES_BY_INPUT = "get Properties by input"; private static final String FAILED_TO_FOUND_INPUT_UNDER_COMPONENT_ERROR = "Failed to found input {} under component {}, error: {}"; private static final String GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP = "Going to execute rollback on create group."; private static final String GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP = "Going to execute commit on create group."; @@ -264,8 +263,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } public Either, ResponseFormat> updateInputsValue(ComponentTypeEnum componentType, String componentId, - List inputs, String userId, boolean shouldLockComp, - boolean inTransaction) { + List inputs, String userId, boolean shouldLockComp) { List returnInputs = new ArrayList<>(); Either, ResponseFormat> result = null; org.openecomp.sdc.be.model.Component component = null; @@ -385,9 +383,10 @@ public class InputsBusinessLogic extends BaseBusinessLogic { return createMultipleInputs(userId, componentId, componentTypeEnum, componentInstInputsMap, true, false); } - public Either, ResponseFormat> createMultipleInputs(String userId, String componentId, ComponentTypeEnum componentType, - ComponentInstInputsMap componentInstInputsMapUi, boolean shouldLockComp, - boolean inTransaction) { + private Either, ResponseFormat> createMultipleInputs(String userId, String componentId, ComponentTypeEnum componentType, + ComponentInstInputsMap componentInstInputsMapUi, + boolean shouldLockComp, + boolean inTransaction) { Either, ResponseFormat> result = null; org.openecomp.sdc.be.model.Component component = null; try { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java index 07fb64f3b4..0412516390 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/property/DefaultPropertyDeclarator.java @@ -72,7 +72,7 @@ public abstract class DefaultPropertyDeclarator, ResponseFormat> actionResponse = inputsBusinessLogic - .updateInputsValue(componentType, componentId, inputsToUpdate, userId, true, false); + .updateInputsValue(componentType, componentId, inputsToUpdate, userId, true); if (actionResponse.isRight()) { return buildErrorResponse(actionResponse.right().value()); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java index fd057607a1..f09f90b4ed 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java @@ -797,7 +797,7 @@ public class InputsBusinessLogicTest { .thenReturn(Either.left(inputDef)); Either, ResponseFormat> result = - testInstance.updateInputsValue(service.getComponentType(), COMPONENT_ID, newInputDefs, USER_ID, true, false); + testInstance.updateInputsValue(service.getComponentType(), COMPONENT_ID, newInputDefs, USER_ID, true); assertThat(result.isLeft()).isTrue(); // check if values are updated assertEquals(NEW_VALUE, service.getInputs().get(0).getDefaultValue()); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java index 6b17c419e4..845eee808a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java @@ -71,10 +71,6 @@ public class PropertyDataDefinition extends ToscaDataDefinition { private String parentPropertyType; private String subPropertyInputPath; private List annotations; - /** - * The resource id which this property belongs to - */ - private String parentUniqueId; private List getInputValues; private Boolean isDeclaredListInput = Boolean.FALSE; private List getPolicyValues; @@ -188,6 +184,9 @@ public class PropertyDataDefinition extends ToscaDataDefinition { return mappedToComponentProperty; } + /** + * The resource id which this property belongs to + */ public String getParentUniqueId() { return getOwnerId(); } -- 2.16.6