summaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java8
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java9
2 files changed, 12 insertions, 5 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 bca901ee8b..21327ea29d 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
@@ -338,13 +338,13 @@ public class InputsBusinessLogic extends BaseBusinessLogic {
List<InputDefinition> inputDefinitions = new ArrayList<>();
for (InputDefinition inputDefinition : inputs) {
InputDefinition inputDef = new InputDefinition();
- inputDefinition.setDefaultValue(inputDefinition.getDefaultValue());
- inputDefinition.setInputPath(inputDefinition.getSubPropertyInputPath());
- inputDefinition.setType(inputDefinition.getType());
+ inputDef.setDefaultValue(inputDefinition.getDefaultValue());
+ inputDef.setInputPath(inputDefinition.getSubPropertyInputPath());
+ inputDef.setType(inputDefinition.getType());
if (Objects.nonNull(inputDefinition.getParentPropertyType())) {
ComponentInstanceProperty propertyDefinition = new ComponentInstanceProperty();
propertyDefinition.setType(inputDefinition.getParentPropertyType());
- inputDefinition.setProperties(Collections.singletonList(propertyDefinition));
+ inputDef.setProperties(Collections.singletonList(propertyDefinition));
}
inputDefinitions.add(inputDef);
}
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<String, DataTypeDefinition> dataTypes = Collections.singletonMap(testType.getName(), testType);
List<InputDefinition> 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<String, String> 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<List<InputDefinition>, ResponseFormat> result =
testInstance.updateInputsValue(service.getComponentType(), COMPONENT_ID, newInputDefs, USER_ID, true);