From b206d04b36eb66fc69c1ac96c700d19ca0fbbd37 Mon Sep 17 00:00:00 2001 From: franciscovila Date: Tue, 30 May 2023 17:03:07 +0100 Subject: Support INDEX in node filter tosca functions Issue-ID: SDC-4517 Signed-off-by: franciscovila Change-Id: I36e33821ef72c3375d9525513f2394b9b772c696 --- .../PropertyFilterConstraintDataDefinitionHelperTest.java | 11 +++++++++++ .../nodeFilter/constraints/legacy-get_input-from-self.yaml | 6 ++++++ 2 files changed, 17 insertions(+) create mode 100644 common-be/src/test/resources/nodeFilter/constraints/legacy-get_input-from-self.yaml (limited to 'common-be/src/test') diff --git a/common-be/src/test/java/org/openecomp/sdc/be/utils/PropertyFilterConstraintDataDefinitionHelperTest.java b/common-be/src/test/java/org/openecomp/sdc/be/utils/PropertyFilterConstraintDataDefinitionHelperTest.java index 86548fa1d5..5684db2332 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/utils/PropertyFilterConstraintDataDefinitionHelperTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/utils/PropertyFilterConstraintDataDefinitionHelperTest.java @@ -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 = diff --git a/common-be/src/test/resources/nodeFilter/constraints/legacy-get_input-from-self.yaml b/common-be/src/test/resources/nodeFilter/constraints/legacy-get_input-from-self.yaml new file mode 100644 index 0000000000..a12444e8c1 --- /dev/null +++ b/common-be/src/test/resources/nodeFilter/constraints/legacy-get_input-from-self.yaml @@ -0,0 +1,6 @@ +flavour_id: + equal: + get_input: + - SELF + - input + - subInput \ No newline at end of file -- cgit 1.2.3-korg