From b98438ba7b85ca3e384cf5579daa5be9144f9dc4 Mon Sep 17 00:00:00 2001 From: franciscovila Date: Tue, 27 Sep 2022 15:20:55 +0100 Subject: Error in update of Component Inputs Fix error preventing constraints validations Issue-ID: SDC-4191 Signed-off-by: franciscovila Change-Id: I19190a071fe45cf5ac30c7ec44fbf0fbb2b46c03 --- .../sdc/be/components/impl/InputsBusinessLogicTest.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'catalog-be/src/test/java/org') 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 f09f90b4ed..953cc3b801 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 @@ -100,6 +100,7 @@ public class InputsBusinessLogicTest { private static final String LISTINPUT_PROP2_TYPE = "integer"; private static final String OLD_VALUE = "old value"; private static final String NEW_VALUE = "new value"; + private static final String TEST_MODEL = "testModel"; static ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be"); static ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); @@ -770,11 +771,16 @@ public class InputsBusinessLogicTest { oldInputDef.setMetadata(oldMetadata); oldInputDefs.add(oldInputDef); service.setInputs(oldInputDefs); + service.setModel(TEST_MODEL); + + DataTypeDefinition testType = new DataTypeDefinition(); + testType.setName(INPUT_TYPE); + Map dataTypes = Collections.singletonMap(testType.getName(), testType); List newInputDefs = new ArrayList<>(); InputDefinition inputDef = new InputDefinition(); inputDef.setUniqueId(INPUT_ID); - inputDef.setType(INPUT_TYPE); + inputDef.setType(testType.getName()); inputDef.setDefaultValue(NEW_VALUE); // update value inputDef.setRequired(Boolean.TRUE); // update value Map newMetadata = new HashMap<>(); @@ -795,6 +801,7 @@ public class InputsBusinessLogicTest { .thenReturn(Either.left(NEW_VALUE)); when(toscaOperationFacadeMock.updateInputOfComponent(service, oldInputDef)) .thenReturn(Either.left(inputDef)); + when(applicationDataTypeCache.getAll(TEST_MODEL)).thenReturn(Either.left(dataTypes)); Either, ResponseFormat> result = testInstance.updateInputsValue(service.getComponentType(), COMPONENT_ID, newInputDefs, USER_ID, true); -- cgit 1.2.3-korg