aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-06-02 17:02:18 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-06-29 14:54:21 +0000
commitcf0a8b21e85ec41260da802a2b923fabe89c9aaa (patch)
treeb6c67c2670d56da685d213ed7d738a3b80d51e7c /catalog-be/src/test
parent1c9375a06ee65147418b17af2a382e0c6cdb64f1 (diff)
Fix unable to set tosca function on complex type on input operation
Issue-ID: SDC-4527 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: Icc7166978c13f3692dc25d9f33a7613d64f87f6a
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java
index 5158ae7945..5ba29cbbef 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java
@@ -24,6 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.openecomp.sdc.be.components.utils.InterfaceOperationUtils.createMappedOutputDefaultValue;
import static org.openecomp.sdc.be.tosca.InterfacesOperationsConverter.SELF;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -49,6 +50,7 @@ import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition;
import org.openecomp.sdc.be.datatypes.elements.OperationOutputDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ToscaFunctionType;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.DataTypeDefinition;
@@ -238,8 +240,11 @@ class InterfacesOperationsConverterTest {
"name_for_op_0"))
.forEach(operation -> operation.getInputs().getListToscaDataDefinition().stream()
.filter(operationInputDefinition -> operationInputDefinition.getName().contains("integer"))
- .forEach(operationInputDefinition -> operationInputDefinition.setInputId(addedInterfaceType +
- ".name_for_op_1.output_integer_1")));
+ .forEach(operationInputDefinition -> {
+ operationInputDefinition.setInputId(addedInterfaceType + ".name_for_op_1.output_integer_1");
+ operationInputDefinition.setToscaDefaultValue(
+ new Gson().toJson(createMappedOutputDefaultValue(SELF, operationInputDefinition.getInputId())));
+ }));
component.setInterfaces(new HashMap<>());
component.getInterfaces().put(addedInterfaceType, addedInterface);
ToscaNodeType nodeType = new ToscaNodeType();
@@ -572,11 +577,12 @@ class InterfacesOperationsConverterTest {
Map<String, Object> complexInput = (Map<String, Object>) operation0Inputs.get("input_Complex_2");
assertTrue(complexInput.containsKey("stringProp"));
Map<String, Object> complexInputStringProp = (Map<String, Object>) complexInput.get("stringProp");
- assertTrue(complexInputStringProp.containsKey("get_attribute"));
- List<String> complexInputStringPropToscaFunction = (List<String>) complexInputStringProp.get("get_attribute");
- assertEquals(2, complexInputStringPropToscaFunction.size());
- assertEquals("SELF", complexInputStringPropToscaFunction.get(0));
- assertEquals("designer", complexInputStringPropToscaFunction.get(1));
+ assertTrue(complexInputStringProp.containsKey("type"));
+ assertTrue(ToscaFunctionType.findType((String) complexInputStringProp.get("type")).isPresent());
+ assertTrue(complexInputStringProp.containsKey("propertyName"));
+ assertEquals("designer", complexInputStringProp.get("propertyName"));
+ assertTrue(complexInputStringProp.containsKey("propertySource"));
+ assertEquals("SELF", complexInputStringProp.get("propertySource"));
}
private void addComplexTypeToDataTypes() {