diff options
Diffstat (limited to 'common-be/src')
2 files changed, 7 insertions, 24 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java index f88514ac49..adfef9c426 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java @@ -173,11 +173,8 @@ public class PropertyDataDefinition extends ToscaDataDefinition { } public ToscaGetFunctionType getToscaGetFunctionType() { - if (isToscaGetFunction()) { - if (toscaFunction != null) { - return ((ToscaGetFunctionDataDefinition) toscaFunction).getFunctionType(); - } - return toscaGetFunctionType; + if (isToscaGetFunction() && toscaFunction != null) { + return ((ToscaGetFunctionDataDefinition) toscaFunction).getFunctionType(); } return null; @@ -337,10 +334,10 @@ public class PropertyDataDefinition extends ToscaDataDefinition { @JsonIgnoreProperties public boolean isToscaGetFunction() { - return this.toscaGetFunctionType != null || (this.toscaFunction != null + return this.toscaFunction != null && (this.toscaFunction.getType() == ToscaFunctionType.GET_ATTRIBUTE - || this.toscaFunction.getType() == ToscaFunctionType.GET_INPUT - || this.toscaFunction.getType() == ToscaFunctionType.GET_PROPERTY)); + || this.toscaFunction.getType() == ToscaFunctionType.GET_INPUT + || this.toscaFunction.getType() == ToscaFunctionType.GET_PROPERTY); } @JsonIgnoreProperties diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java index 2d73faf41e..f83eb9d069 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinitionTest.java @@ -694,16 +694,6 @@ class PropertyDataDefinitionTest { toscaGetFunction.setFunctionType(ToscaGetFunctionType.GET_ATTRIBUTE); assertEquals(ToscaGetFunctionType.GET_ATTRIBUTE, propertyDataDefinition.getToscaGetFunctionType()); - - propertyDataDefinition = new PropertyDataDefinition(); - propertyDataDefinition.setToscaGetFunctionType(ToscaGetFunctionType.GET_INPUT); - assertEquals(ToscaGetFunctionType.GET_INPUT, propertyDataDefinition.getToscaGetFunctionType()); - - propertyDataDefinition.setToscaGetFunctionType(ToscaGetFunctionType.GET_PROPERTY); - assertEquals(ToscaGetFunctionType.GET_PROPERTY, propertyDataDefinition.getToscaGetFunctionType()); - - propertyDataDefinition.setToscaGetFunctionType(ToscaGetFunctionType.GET_ATTRIBUTE); - assertEquals(ToscaGetFunctionType.GET_ATTRIBUTE, propertyDataDefinition.getToscaGetFunctionType()); } @Test @@ -721,12 +711,8 @@ class PropertyDataDefinitionTest { @Test void isToscaGetFunctionTest() { - var propertyDataDefinition = new PropertyDataDefinition(); - propertyDataDefinition.setToscaGetFunctionType(ToscaGetFunctionType.GET_PROPERTY); - assertTrue(propertyDataDefinition.isToscaGetFunction()); - - propertyDataDefinition = new PropertyDataDefinition(); - final ToscaGetFunctionDataDefinition toscaGetFunction = new ToscaGetFunctionDataDefinition(); + final var propertyDataDefinition = new PropertyDataDefinition(); + final var toscaGetFunction = new ToscaGetFunctionDataDefinition(); toscaGetFunction.setFunctionType(ToscaGetFunctionType.GET_INPUT); propertyDataDefinition.setToscaFunction(toscaGetFunction); assertTrue(propertyDataDefinition.isToscaGetFunction()); |