summaryrefslogtreecommitdiffstats
path: root/catalog-model/src
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2023-04-18 15:08:07 +0100
committerMichael Morris <michael.morris@est.tech>2023-04-26 07:59:43 +0000
commit6c9da5ab227fa535249e8bb56c7cef01a74c6fb1 (patch)
tree7e12a48558122980ce877452d1055ce77d4e8bff /catalog-model/src
parent3405456c46937352863ce19c39266a51dd7760db (diff)
VFC Property default value enforced forced to comply with restraints
Issue-ID: SDC-4477 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: Ib9115aae9019e2d36990147dc0ec9f4058352d88
Diffstat (limited to 'catalog-model/src')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/AbstractPropertyConstraint.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/EqualConstraint.java2
3 files changed, 3 insertions, 3 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/AbstractPropertyConstraint.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/AbstractPropertyConstraint.java
index 8e09648804..59510c4c89 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/AbstractPropertyConstraint.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/AbstractPropertyConstraint.java
@@ -36,7 +36,7 @@ public abstract class AbstractPropertyConstraint implements PropertyConstraint {
@Override
public void validate(PropertyDefinition property) throws ConstraintViolationException {
- validate(ToscaType.isValidType(property.getType()), property.getValue());
+ validate(ToscaType.isValidType(property.getType()), property.getValue() != null ? property.getValue() : property.getDefaultValue());
}
protected void validate(ToscaType toscaType, String propertyTextValue) throws ConstraintViolationException {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java
index 83b3ab82d8..c356970d60 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/constraints/ConstraintUtil.java
@@ -81,7 +81,7 @@ public final class ConstraintUtil {
* @throws ConstraintValueDoNotMatchPropertyTypeException if the property type cannot be compared
*/
public static void checkComparableType(final ToscaType propertyType) throws ConstraintValueDoNotMatchPropertyTypeException {
- if (!isComparableType(propertyType)) {
+ if (!isComparableType(propertyType) && !ToscaType.BOOLEAN.equals(propertyType)) {
throw new ConstraintValueDoNotMatchPropertyTypeException("Constraint is invalid for property type <" + propertyType.getType() + ">");
}
}
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 a565580d38..5e9e598475 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
@@ -54,7 +54,7 @@ public class EqualConstraint extends AbstractComparablePropertyConstraint {
public void initialize(ToscaType propertyType) throws ConstraintValueDoNotMatchPropertyTypeException {
if (propertyType.isValidValue(String.valueOf(equal))) {
typed = propertyType.convert(String.valueOf(equal));
- if (ConstraintUtil.isComparableType(propertyType)) {
+ if (ConstraintUtil.isComparableType(propertyType) || ToscaType.BOOLEAN.equals(propertyType)) {
initialize(String.valueOf(equal), propertyType);
}
} else {