From ef8fea9dac61407f29850a34c19a1effd1d4a5b9 Mon Sep 17 00:00:00 2001
From: romaingimbert <romain.gimbert@orange.com>
Date: Fri, 25 Jan 2019 09:42:37 +0100
Subject: force nbi generate id of serviceorder

-fix code
-fix test

Change-Id: Ie6d7802bed61935b5a675e720d060ee9d7e2c865
Issue-ID: EXTAPI-188
Signed-off-by: romaingimbert <romain.gimbert@orange.com>
---
 .../resources/karatetest/data/serviceOrder.json    |  17 ---
 .../karatetest/features/02--ServiceOrder.feature   | 143 ++++++++++++---------
 2 files changed, 82 insertions(+), 78 deletions(-)

(limited to 'src/test/resources/karatetest')

diff --git a/src/test/resources/karatetest/data/serviceOrder.json b/src/test/resources/karatetest/data/serviceOrder.json
index 7ec577e..5437fac 100644
--- a/src/test/resources/karatetest/data/serviceOrder.json
+++ b/src/test/resources/karatetest/data/serviceOrder.json
@@ -1,6 +1,5 @@
 [
   {
-    "id": "test",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -60,7 +59,6 @@
     ]
   },
   {
-    "id": "test1",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -120,7 +118,6 @@
     ]
   },
   {
-    "id": "test2",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -173,7 +170,6 @@
     ]
   },
   {
-    "id": "test3",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -226,7 +222,6 @@
     ]
   },
   {
-    "id": "test4",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -286,7 +281,6 @@
     ]
   },
   {
-    "id": "test5",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -348,7 +342,6 @@
     ]
   },
   {
-    "id": "test6",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -410,7 +403,6 @@
     ]
   },
   {
-    "id": "test7",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -472,7 +464,6 @@
     ]
   },
   {
-    "id": "test8",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -534,7 +525,6 @@
     ]
   },
   {
-    "id": "test9",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -596,7 +586,6 @@
     ]
   },
   {
-    "id": "test10",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -658,7 +647,6 @@
     ]
   },
   {
-    "id": "test11",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -720,7 +708,6 @@
     ]
   },
   {
-    "id": "test12",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -782,7 +769,6 @@
     ]
   },
   {
-    "id": "test13",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -844,7 +830,6 @@
     ]
   },
   {
-    "id": "test14",
     "state": "acknowledged",
     "externalId": "LudONAP001",
     "priority": "1",
@@ -904,7 +889,6 @@
     ]
   },
   {
-    "id": "test15",
     "state": "acknowledged",
     "externalId": "extid1",
     "priority": "1",
@@ -964,7 +948,6 @@
     ]
   },
   {
-    "id": "test16",
     "state": "acknowledged",
     "externalId": "extid2",
     "priority": "1",
diff --git a/src/test/resources/karatetest/features/02--ServiceOrder.feature b/src/test/resources/karatetest/features/02--ServiceOrder.feature
index 6e4b804..4ced372 100644
--- a/src/test/resources/karatetest/features/02--ServiceOrder.feature
+++ b/src/test/resources/karatetest/features/02--ServiceOrder.feature
@@ -18,7 +18,8 @@ When method post
 Then status 201
 And match $.id contains '#notnull'
 And match $.state == 'acknowledged'
-Given path 'serviceOrder','test'
+And def serviceOrderId = $.id
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -27,16 +28,17 @@ Given path 'serviceOrder'
 And request data[0]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
-And match $.id == 'test'
+And match $.id == serviceOrderId
 And match $.state == 'acknowledged'
-Given path 'serviceOrder','test'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -46,17 +48,18 @@ Given path 'serviceOrder'
 And request data[1]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test1'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'rejected'
 And match $.orderItem[0].orderItemMessage ==  '#[1]'
 And match $.orderItem[0].orderItemMessage[0] contains { code : '102'  , field : 'serviceSpecification.id' }
-Given path 'serviceOrder','test1'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test1'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -66,15 +69,16 @@ Given path 'serviceOrder'
 And request data[2]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test2'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'acknowledged'
-Given path 'serviceOrder','test2'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test2'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -83,15 +87,16 @@ Given path 'serviceOrder'
 And request data[3]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test3'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'acknowledged'
-Given path 'serviceOrder','test3'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test3'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -101,15 +106,16 @@ Given path 'serviceOrder'
 And request data[4]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test4'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'acknowledged'
-Given path 'serviceOrder','test4'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test4'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -118,17 +124,18 @@ Given path 'serviceOrder'
 And request data[5]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test5'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'rejected'
 And match $.orderItem[0].orderItemMessage ==  '#[1]'
 And match $.orderItem[0].orderItemMessage[0] contains { code : '106'  , field : 'service.id' }
-Given path 'serviceOrder','test5'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given url 'http://localhost:8080/nbi/api/v3/serviceOrder/test5'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -138,17 +145,18 @@ Given path 'serviceOrder'
 And request data[6]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test6'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'rejected'
 And match $.orderItem[0].orderItemMessage ==  '#[1]'
 And match $.orderItem[0].orderItemMessage[0] contains { code : '106'  , field : 'service.id' }
-Given path 'serviceOrder','test6'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test6'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -158,17 +166,18 @@ Given path 'serviceOrder'
 And request data[7]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test7'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'rejected'
 And match $.orderItem[0].orderItemMessage ==  '#[1]'
 And match $.orderItem[0].orderItemMessage[0] contains { code : '103'  , field : 'service.id' }
-Given path 'serviceOrder','test7'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test7'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -177,17 +186,18 @@ Given path 'serviceOrder'
 And request data[8]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test8'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'rejected'
 And match $.orderMessage ==  '#[1]'
 And match $.orderMessage[0] contains { code : '104'  , field : 'relatedParty.id' }
-Given path 'serviceOrder','test8'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test8'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -197,15 +207,16 @@ Given path 'serviceOrder'
 And request data[9]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test9'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'acknowledged'
-Given path 'serviceOrder','test9'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test9'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -214,17 +225,18 @@ Given path 'serviceOrder'
 And request data[10]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test10'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'rejected'
 And match $.orderItem[0].orderItemMessage ==  '#[1]'
 And match $.orderItem[0].orderItemMessage[0] contains { code : '106'  , field : 'service.id' }
-Given path 'serviceOrder','test10'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test10'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -233,17 +245,18 @@ Given path 'serviceOrder'
 And request data[11]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test11'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'completed'
 And match $.orderItem[0].state == 'completed'
 And match $.orderItem[1].state == 'completed'
-Given path 'serviceOrder','test11'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test11'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -252,16 +265,17 @@ Given path 'serviceOrder'
 And request data[12]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test12'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'acknowledged'
 And match $.orderItem[0].state == 'completed'
-Given path 'serviceOrder','test12'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test12'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -270,16 +284,17 @@ Given path 'serviceOrder'
 And request data[13]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test13'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'rejected'
 And match $.orderItem[0].state == 'rejected'
-Given path 'serviceOrder','test13'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test13'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -288,17 +303,18 @@ Given path 'serviceOrder'
 And request data[14]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test14'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
 And match $.state == 'rejected'
 And match $.orderItem[0].orderItemMessage ==  '#[1]'
 And match $.orderItem[0].orderItemMessage[0] contains { code : '102'  , field : 'serviceSpecification.id' }
-Given path 'serviceOrder','test14'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
-Given path 'serviceOrder','test14'
+Given path 'serviceOrder',serviceOrderId
 When method delete
 Then status 204
 
@@ -308,15 +324,17 @@ Given path 'serviceOrder'
 And request data[15]
 When method post
 Then status 201
+And def serviceOrderId15 = $.id
 Given path 'serviceOrder'
 And request data[16]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test15'
+And def serviceOrderId16 = $.id
+Given path 'serviceOrder','test',serviceOrderId15
 And request $
 When method put
 Then status 201
-Given path 'serviceOrder','test','test16'
+Given path 'serviceOrder','test',serviceOrderId16
 And request $
 When method put
 Then status 201
@@ -330,14 +348,14 @@ And params {externalId : 'extid1' , state : 'acknowledged'}
 When method get
 Then status 200
 And match $ == '#[1]'
-Given path 'serviceOrder','test15'
+Given path 'serviceOrder',serviceOrderId15
 When method get
 Then status 200
 And match $ contains '#notnull'
-Given path 'serviceOrder','test15'
+Given path 'serviceOrder',serviceOrderId15
 When method delete
 Then status 204
-Given path 'serviceOrder','test16'
+Given path 'serviceOrder',serviceOrderId16
 When method delete
 Then status 204
 
@@ -348,15 +366,16 @@ Given path 'serviceOrder'
 And request data[4]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test4'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
-And match $.id == 'test4'
+And match $.id == serviceOrderId
 And match $.state == 'rejected'
 And match $.orderItem == '#[2]'
 And match $.orderMessage[0] contains { code : '501'  , messageInformation : 'Problem with AAI API' }
-Given path 'serviceOrder','test4'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
 * call Context.startServers();
@@ -368,13 +387,14 @@ Given path 'serviceOrder'
 And request data[4]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test4'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
-And match $.id == 'test4'
+And match $.id == serviceOrderId
 And match $.state == 'rejected'
-Given path 'serviceOrder','test4'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
 * call Context.startServers();
@@ -385,14 +405,15 @@ Given path 'serviceOrder'
 And request data[4]
 When method post
 Then status 201
-Given path 'serviceOrder','test','test4'
+And def serviceOrderId = $.id
+Given path 'serviceOrder','test',serviceOrderId
 And request $
 When method put
 Then status 201
-And match $.id == 'test4'
+And match $.id == serviceOrderId
 And match $.state == 'rejected'
 And match $.orderItem[0].orderMessage[0] contains { code : '102'  , field : 'serviceSpecification.id' }
-Given path 'serviceOrder','test4'
+Given path 'serviceOrder',serviceOrderId
 When method get
 Then status 200
 * call Context.startServers();
\ No newline at end of file
-- 
cgit 1.2.3-korg