summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2018-09-11 11:32:52 +0200
committerromaingimbert <romain.gimbert@orange.com>2018-09-11 11:32:52 +0200
commitbf18ae431c5e12fc7c480392d6a4881c080942f9 (patch)
tree1eb5655fcb95932cf6aa1a72a1056c31be4eca94 /src/test
parente1e184ce87a59d632253de00ebeedfe4e3f46796 (diff)
service order constraints control
-check data constraints of the service order -add test Change-Id: I73a0c405555938f191b594a4cfd2737c9c1563ec Issue-ID: EXTAPI-148 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/nbi/apis/ApiTest.java10
-rw-r--r--src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/test/java/org/onap/nbi/apis/ApiTest.java b/src/test/java/org/onap/nbi/apis/ApiTest.java
index 4d24062..489af4e 100644
--- a/src/test/java/org/onap/nbi/apis/ApiTest.java
+++ b/src/test/java/org/onap/nbi/apis/ApiTest.java
@@ -47,6 +47,7 @@ import org.onap.nbi.apis.serviceorder.model.RelatedParty;
import org.onap.nbi.apis.serviceorder.model.Service;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
+import org.onap.nbi.apis.serviceorder.model.ServiceSpecificationRef;
import org.onap.nbi.apis.serviceorder.model.StateType;
import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository;
@@ -736,6 +737,15 @@ public class ApiTest {
violations = validator.validate(serviceOrder);
assertThat(violations).isNotEmpty();
+
+ ServiceOrder serviceOrder2 = ServiceOrderAssertions.createTestServiceOrder(ActionType.ADD);
+ serviceOrder2.getOrderItem().get(0).getService().getServiceSpecification().setId("");
+ serviceOrder2.getOrderItem().get(1).getService().getServiceSpecification().setId(" ");
+
+ violations = validator.validate(serviceOrder2);
+ assertThat(violations).isNotEmpty();
+ assertThat(violations.size()).isEqualTo(2);
+
}
diff --git a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java
index 65686d2..5ff1816 100644
--- a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java
+++ b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java
@@ -23,6 +23,7 @@ import org.onap.nbi.apis.serviceorder.model.ActionType;
import org.onap.nbi.apis.serviceorder.model.OrderItemRelationship;
import org.onap.nbi.apis.serviceorder.model.OrderRelationship;
import org.onap.nbi.apis.serviceorder.model.RelatedParty;
+import org.onap.nbi.apis.serviceorder.model.RelationshipType;
import org.onap.nbi.apis.serviceorder.model.ResourceSpecification;
import org.onap.nbi.apis.serviceorder.model.Service;
import org.onap.nbi.apis.serviceorder.model.ServiceCharacteristic;
@@ -155,6 +156,7 @@ public class ServiceOrderAssertions {
List<OrderItemRelationship> orderItemRelationships = new ArrayList<>();
OrderItemRelationship orderItemRelationship = new OrderItemRelationship();
orderItemRelationship.setId("A");
+ orderItemRelationship.setType(RelationshipType.RELIESON);
orderItemRelationships.add(orderItemRelationship);
itemB.setOrderItemRelationship(orderItemRelationships);
items.add(itemB);