summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorsujitsatapathy <SS00626741@techmahindra.com>2020-09-09 10:18:15 +0000
committersujitsatapathy <SS00626741@techmahindra.com>2020-09-09 10:32:31 +0000
commitc8cd23a64ef20436bac38923f6dc7f77e7b95c08 (patch)
treea00946c019dc3372e9e00d7ee2889f95e5d6049e /src/test
parente44331581196644015a40dcaa38a86ce0f84c76c (diff)
Preparing the request payload (action = delete) for calling SO macro flow
code changes for delete action. Issue-ID: EXTAPI-448 Change-Id: I6bb9786660f6760c15008132e2c254e7f9b89654 Signed-off-by: sujitsatapathy <SS00626741@techmahindra.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/nbi/test/ExecutionTaskTest.java36
-rw-r--r--src/test/resources/karatetest/data/serviceOrder.json62
-rw-r--r--src/test/resources/karatetest/features/02--ServiceOrder.feature13
-rw-r--r--src/test/resources/mappings/so/so_delete_macro_service_instance.json19
4 files changed, 129 insertions, 1 deletions
diff --git a/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java b/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java
index b58fb1c..99f6044 100644
--- a/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java
+++ b/src/test/java/org/onap/nbi/test/ExecutionTaskTest.java
@@ -365,7 +365,41 @@ public class ExecutionTaskTest {
assertThat(executionTaskRepository.count()).isEqualTo(0);
}
-
+ //Test Macro Execution Delete
+ @Test
+ public void testMacroExecutionTaskDeleteSuccess() throws Exception {
+
+ ExecutionTask executionTaskA =ServiceOrderExecutionTaskAssertions.setUpBddForMacroExecutionTaskSucess(
+ serviceOrderRepository, executionTaskRepository, ActionType.DELETE);
+ ExecutionTask executionTaskB;
+
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
+
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ serviceOrderChecked = getServiceOrder("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+
+ }
+
+ assertThat(executionTaskRepository.count()).isEqualTo(0);
+
+ }
// Macro Flow Execution Task
@Test
public void testMacroExecutionTaskSuccess() throws Exception {
diff --git a/src/test/resources/karatetest/data/serviceOrder.json b/src/test/resources/karatetest/data/serviceOrder.json
index 5437fac..aee4ce9 100644
--- a/src/test/resources/karatetest/data/serviceOrder.json
+++ b/src/test/resources/karatetest/data/serviceOrder.json
@@ -1064,5 +1064,67 @@
]
}
]
+ },
+ {
+ "state": "acknowledged",
+ "externalId": "LudONAP001",
+ "priority": "1",
+ "description": "Ludo first ONAP order",
+ "category": "Consumer",
+ "requestedStartDate": "2019-01-23T12:34:56.123456789Z",
+ "requestedCompletionDate": "2019-01-23T12:34:56.123456789Z",
+ "@baseType": "toto",
+ "completionDateTime": "2019-01-23T12:34:56.123456789Z",
+ "expectedCompletionDate": "2019-01-23T12:34:56.123456789Z",
+ "@schemaLocation": "/tutu",
+ "orderRelationship": [
+ {
+ "id": "test",
+ "href": "test",
+ "referredType": "test",
+ "type": "test"
+ }
+ ],
+ "relatedParty": [
+ {
+ "id": "6490",
+ "role": "ONAPcustomer",
+ "referredType": "individual",
+ "name": "Jean Pontus"
+ }
+ ],
+ "orderItem": [
+ {
+ "id": "A",
+ "action": "delete",
+ "state": "active",
+ "service": {
+ "id": "null",
+ "state": "active",
+ "serviceSpecification": {
+ "id": "82c9fbb4-656c-4973-8c7f-172b22b5fa8f"
+ }
+ }
+ },
+ {
+ "id": "B",
+ "action": "delete",
+ "state": "active",
+ "service": {
+ "id": "null",
+ "state": "active",
+ "serviceSpecification": {
+ "id": "82c9fbb4-656c-4973-8c7f-172b22b5fa8f"
+ }
+ },
+ "orderItemRelationship": [
+ {
+ "id": "A",
+ "type": "reliesOn"
+ }
+ ]
+ }
+ ]
}
]
+
diff --git a/src/test/resources/karatetest/features/02--ServiceOrder.feature b/src/test/resources/karatetest/features/02--ServiceOrder.feature
index f5985a9..4f89c1a 100644
--- a/src/test/resources/karatetest/features/02--ServiceOrder.feature
+++ b/src/test/resources/karatetest/features/02--ServiceOrder.feature
@@ -234,6 +234,19 @@ Given path 'serviceOrder',serviceOrderId
When method delete
Then status 204
+Scenario: testCheckServiceOrderDeleteActionForMacro
+Given path 'serviceOrder'
+And request data[18]
+When method post
+Then status 201
+And def serviceOrderId = $.id
+Given path 'serviceOrder',serviceOrderId
+When method get
+Then status 200
+Given path 'serviceOrder',serviceOrderId
+When method delete
+Then status 204
+
Scenario: testCheckServiceOrderDeleteRejected
Given path 'serviceOrder'
And request data[10]
diff --git a/src/test/resources/mappings/so/so_delete_macro_service_instance.json b/src/test/resources/mappings/so/so_delete_macro_service_instance.json
new file mode 100644
index 0000000..ce57a27
--- /dev/null
+++ b/src/test/resources/mappings/so/so_delete_macro_service_instance.json
@@ -0,0 +1,19 @@
+{
+ "request": {
+ "method": "DELETE",
+ "url": "/onap/so/infra/serviceInstantiation/v7/serviceInstances/82c9fbb4-656c-4973-8c7f-172b22b5fa8f"
+ },
+ "response": {
+ "status": 202,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "jsonBody": {
+ "requestReferences": {
+ "instanceId": "instanceId",
+ "requestId": "requestId"
+ }
+ }
+ }
+}
+