From 0c54db816bcadb231b007ce56c5c90d7b96d0706 Mon Sep 17 00:00:00 2001 From: vasraz Date: Wed, 1 Feb 2023 19:28:28 +0000 Subject: Validate service input default values against constraints Signed-off-by: Vasyl Razinkov Change-Id: Ifd4e3cc5c8dd93282233e4c6bb77fa763d52f922 Issue-ID: SDC-4366 --- .../org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java | 2 +- .../sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java | 2 +- .../openecomp/sdc/be/model/tosca/constraints/GreaterThanConstraint.java | 2 +- .../openecomp/sdc/be/model/tosca/constraints/LessOrEqualConstraint.java | 2 +- .../openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java | 2 +- .../openecomp/sdc/be/model/tosca/constraints/ValidValuesConstraint.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'catalog-model') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java index 8ba6da514c..3017a0532d 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java @@ -78,7 +78,7 @@ public class EqualConstraint extends AbstractComparablePropertyConstraint { @Override public String getErrorMessage(ToscaType toscaType, ConstraintFunctionalException e, String propertyName) { - return getErrorMessage(toscaType, e, propertyName, "%s property value must be %s", String.valueOf(equal)); + return getErrorMessage(toscaType, e, propertyName, "'%s' value must be %s", String.valueOf(equal)); } @Override diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java index 91205359ce..c0311c81ab 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterOrEqualConstraint.java @@ -64,7 +64,7 @@ public class GreaterOrEqualConstraint extends AbstractComparablePropertyConst @Override public String getErrorMessage(ToscaType toscaType, ConstraintFunctionalException e, String propertyName) { - return getErrorMessage(toscaType, e, propertyName, "%s property value must be greater than or equal to %s", String.valueOf(greaterOrEqual)); + return getErrorMessage(toscaType, e, propertyName, "'%s' value must be greater than or equal to %s", String.valueOf(greaterOrEqual)); } @Override diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterThanConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterThanConstraint.java index 7ecec8aad3..3da45e1204 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterThanConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/GreaterThanConstraint.java @@ -64,7 +64,7 @@ public class GreaterThanConstraint extends AbstractComparablePropertyConstrai @Override public String getErrorMessage(ToscaType toscaType, ConstraintFunctionalException e, String propertyName) { - return getErrorMessage(toscaType, e, propertyName, "%s property value must be greater than %s", String.valueOf(greaterThan)); + return getErrorMessage(toscaType, e, propertyName, "'%s' value must be greater than %s", String.valueOf(greaterThan)); } @Override diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessOrEqualConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessOrEqualConstraint.java index ece5e403ee..86b1d27243 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessOrEqualConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessOrEqualConstraint.java @@ -64,7 +64,7 @@ public class LessOrEqualConstraint extends AbstractComparablePropertyConstrai @Override public String getErrorMessage(ToscaType toscaType, ConstraintFunctionalException e, String propertyName) { - return getErrorMessage(toscaType, e, propertyName, "%s property value must be less than or equal to %s", String.valueOf(lessOrEqual)); + return getErrorMessage(toscaType, e, propertyName, "'%s' value must be less than or equal to %s", String.valueOf(lessOrEqual)); } @Override diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java index b2f5a47302..8307184173 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/LessThanConstraint.java @@ -64,7 +64,7 @@ public class LessThanConstraint extends AbstractComparablePropertyConstraint @Override public String getErrorMessage(ToscaType toscaType, ConstraintFunctionalException e, String propertyName) { - return getErrorMessage(toscaType, e, propertyName, "%s value must be less than %s", String.valueOf(lessThan)); + return getErrorMessage(toscaType, e, propertyName, "'%s' value must be less than %s", String.valueOf(lessThan)); } @Override diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ValidValuesConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ValidValuesConstraint.java index bf979feea1..1fd1adf015 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ValidValuesConstraint.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ValidValuesConstraint.java @@ -118,7 +118,7 @@ public class ValidValuesConstraint extends AbstractPropertyConstraint { @Override public String getErrorMessage(ToscaType toscaType, ConstraintFunctionalException e, String propertyName) { - return getErrorMessage(toscaType, e, propertyName, "%s valid value must be one of the following: [%s]", String.join(",", String.valueOf(validValues))); + return getErrorMessage(toscaType, e, propertyName, "'%s' value must be one of the following: [%s]", String.join(",", String.valueOf(validValues))); } public boolean validateValueType(String propertyType) throws ConstraintValueDoNotMatchPropertyTypeException { -- cgit 1.2.3-korg