diff options
author | vasraz <vasyl.razinkov@est.tech> | 2023-01-25 19:09:41 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-01-27 15:06:22 +0000 |
commit | a522b7eb8346617883227c0a6621420cfdf44dc5 (patch) | |
tree | 975c31e045de5042c6d18432d0f8c324f82d7f81 /catalog-model/src/main | |
parent | 8571d98d5b0eb81a80c35b07ae0d0bc7b16948ab (diff) |
Add TCs to cover Constraints
Fix wrong Comparable Property Type and Comparable Constraint Type
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: I59968861834a0f8859fcaf3e590c83bbf223338f
Issue-ID: SDC-4347
Diffstat (limited to 'catalog-model/src/main')
2 files changed, 6 insertions, 6 deletions
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 35f036b9c6..91205359ce 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 @@ -36,10 +36,10 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraint @Setter @AllArgsConstructor @EqualsAndHashCode -public class GreaterOrEqualConstraint extends AbstractComparablePropertyConstraint { +public class GreaterOrEqualConstraint<T> extends AbstractComparablePropertyConstraint { @NotNull - private Object greaterOrEqual; + private T greaterOrEqual; @Override public void initialize(ToscaType propertyType) throws ConstraintValueDoNotMatchPropertyTypeException { @@ -90,7 +90,7 @@ public class GreaterOrEqualConstraint extends AbstractComparablePropertyConstrai public void changeConstraintValueTypeTo(String propertyType) throws ConstraintValueDoNotMatchPropertyTypeException { ToscaType toscaType = ToscaType.getToscaType(propertyType); try { - greaterOrEqual = toscaType.convert(String.valueOf(greaterOrEqual)); + greaterOrEqual = (T) toscaType.convert(String.valueOf(greaterOrEqual)); } catch (Exception e) { throw new ConstraintValueDoNotMatchPropertyTypeException( "greaterOrEqual constraint has invalid values <" + greaterOrEqual.toString() + "> property type is <" + propertyType + ">"); 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 d071dbaa07..b2f5a47302 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 @@ -36,10 +36,10 @@ import org.openecomp.sdc.be.model.tosca.constraints.exception.PropertyConstraint @Setter @AllArgsConstructor @EqualsAndHashCode -public class LessThanConstraint extends AbstractComparablePropertyConstraint { +public class LessThanConstraint<T> extends AbstractComparablePropertyConstraint { @NotNull - private Object lessThan; + private T lessThan; @Override public void initialize(ToscaType propertyType) throws ConstraintValueDoNotMatchPropertyTypeException { @@ -90,7 +90,7 @@ public class LessThanConstraint extends AbstractComparablePropertyConstraint { public void changeConstraintValueTypeTo(String propertyType) throws ConstraintValueDoNotMatchPropertyTypeException { ToscaType toscaType = ToscaType.getToscaType(propertyType); try { - lessThan = toscaType.convert(String.valueOf(lessThan)); + lessThan = (T) toscaType.convert(String.valueOf(lessThan)); } catch (Exception e) { throw new ConstraintValueDoNotMatchPropertyTypeException( "lessThan constraint has invalid values <" + lessThan.toString() + "> property type is <" + propertyType + ">"); |