aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model/src/test/java
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-10-13 14:12:47 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-10-24 15:06:02 +0000
commit2edea35f59360fbc8b4f451fc573e02dc5f65010 (patch)
tree1b1ead43f07d813562b55e9dbad80efcd5308ea8 /catalog-model/src/test/java
parentaa361f84ec4d137e7a64df8c7feaec6d2304c03e (diff)
Support import of VFCs with property constraints
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-4216 Change-Id: I19dce9f929535aa22cad6a1d95a213f42dd6e99c
Diffstat (limited to 'catalog-model/src/test/java')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java47
1 files changed, 41 insertions, 6 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java
index ff41d5dd02..33322ecfb6 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java
@@ -60,9 +60,16 @@ import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
import org.openecomp.sdc.be.model.tosca.ToscaType;
+import org.openecomp.sdc.be.model.tosca.constraints.EqualConstraint;
+import org.openecomp.sdc.be.model.tosca.constraints.GreaterOrEqualConstraint;
import org.openecomp.sdc.be.model.tosca.constraints.GreaterThanConstraint;
import org.openecomp.sdc.be.model.tosca.constraints.InRangeConstraint;
+import org.openecomp.sdc.be.model.tosca.constraints.LengthConstraint;
import org.openecomp.sdc.be.model.tosca.constraints.LessOrEqualConstraint;
+import org.openecomp.sdc.be.model.tosca.constraints.LessThanConstraint;
+import org.openecomp.sdc.be.model.tosca.constraints.MaxLengthConstraint;
+import org.openecomp.sdc.be.model.tosca.constraints.MinLengthConstraint;
+import org.openecomp.sdc.be.model.tosca.constraints.ValidValuesConstraint;
import org.openecomp.sdc.be.resources.data.DataTypeData;
import org.openecomp.sdc.be.resources.data.PropertyData;
import org.openecomp.sdc.be.resources.data.PropertyValueData;
@@ -137,17 +144,45 @@ public class PropertyOperationTest extends ModelTestBase {
private List<PropertyConstraint> buildConstraints() {
List<PropertyConstraint> constraints = new ArrayList<>();
- GreaterThanConstraint propertyConstraint1 = new GreaterThanConstraint("0");
- LessOrEqualConstraint propertyConstraint2 = new LessOrEqualConstraint("10");
- List<String> range = new ArrayList<>();
- range.add("0");
- range.add("100");
- InRangeConstraint propertyConstraint3 = new InRangeConstraint(range);
+ EqualConstraint propertyConstraint1 = new EqualConstraint("0");
+ GreaterThanConstraint propertyConstraint2 = new GreaterThanConstraint("1");
+ GreaterOrEqualConstraint propertyConstraint3 = new GreaterOrEqualConstraint("3");
+ LessThanConstraint propertyConstraint4 = new LessThanConstraint("5");
+ LessOrEqualConstraint propertyConstraint5 = new LessOrEqualConstraint("7");
+ InRangeConstraint propertyConstraint6 = buildInRangeConstraint();
+ ValidValuesConstraint propertyConstraint7 = buildValidValuesConstraint();
+ LengthConstraint propertyConstraint8 = new LengthConstraint(9);
+ MinLengthConstraint propertyConstraint9 = new MinLengthConstraint(11);
+ MaxLengthConstraint propertyConstraint10 = new MaxLengthConstraint(13);
constraints.add(propertyConstraint1);
constraints.add(propertyConstraint2);
constraints.add(propertyConstraint3);
+ constraints.add(propertyConstraint4);
+ constraints.add(propertyConstraint5);
+ constraints.add(propertyConstraint6);
+ constraints.add(propertyConstraint7);
+ constraints.add(propertyConstraint8);
+ constraints.add(propertyConstraint9);
+ constraints.add(propertyConstraint10);
return constraints;
}
+
+ private InRangeConstraint buildInRangeConstraint() {
+ List<String> range = new ArrayList<>();
+ range.add("23");
+ range.add("67");
+ InRangeConstraint inRangeConstraint = new InRangeConstraint(range);
+ return inRangeConstraint;
+ }
+
+ private ValidValuesConstraint buildValidValuesConstraint() {
+ List<String> validValues = new ArrayList<>();
+ validValues.add("abc");
+ validValues.add("def");
+ validValues.add("fhi");
+ ValidValuesConstraint validValuesConstraint = new ValidValuesConstraint(validValues);
+ return validValuesConstraint;
+ }
@Test
public void findPropertyValueBestMatch1() {