Support INDEX in node filter tosca functions
[sdc.git] / common-be / src / test / java / org / openecomp / sdc / be / utils / PropertyFilterConstraintDataDefinitionHelperTest.java
index 86548fa..5684db2 100644 (file)
@@ -76,6 +76,17 @@ class PropertyFilterConstraintDataDefinitionHelperTest {
             List.of("property", "subProperty"), "subProperty", "Instance Name");
     }
 
+    @Test
+    void convertLegacyConstraintGetInputFromSelfTest() throws IOException {
+        final PropertyFilterConstraintDataDefinition propertyFilterConstraint =
+            PropertyFilterConstraintDataDefinitionHelper.convertLegacyConstraint(readConstraintFile("legacy-get_input-from-self.yaml"));
+        assertPropertyFilterConstraint(propertyFilterConstraint, "flavour_id", null, ConstraintType.EQUAL, FilterValueType.GET_INPUT);
+        assertTrue(propertyFilterConstraint.getValue() instanceof ToscaGetFunctionDataDefinition);
+        final var toscaGetFunction = (ToscaGetFunctionDataDefinition) propertyFilterConstraint.getValue();
+        assertToscaGetFunction(toscaGetFunction, ToscaFunctionType.GET_INPUT, ToscaGetFunctionType.GET_INPUT, PropertySource.SELF,
+            List.of("SELF", "input", "subInput"), "subInput", null);
+    }
+
     @Test
     void convertLegacyConstraintGetAttributeFromInstanceTest() throws IOException {
         final PropertyFilterConstraintDataDefinition propertyFilterConstraint =