summaryrefslogtreecommitdiffstats
path: root/src/test/resources/karatetest
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/resources/karatetest')
-rw-r--r--src/test/resources/karatetest/data/serviceOrder.json59
-rw-r--r--src/test/resources/karatetest/features/03--Subscriber.feature47
2 files changed, 105 insertions, 1 deletions
diff --git a/src/test/resources/karatetest/data/serviceOrder.json b/src/test/resources/karatetest/data/serviceOrder.json
index 89cc6e8..7ec577e 100644
--- a/src/test/resources/karatetest/data/serviceOrder.json
+++ b/src/test/resources/karatetest/data/serviceOrder.json
@@ -1022,5 +1022,64 @@
]
}
]
+ },
+ {
+ "state": "acknowledged",
+ "externalId": "extid2",
+ "priority": "1",
+ "description": "toto",
+ "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": "add",
+ "state": "active",
+ "service": {
+ "state": "active",
+ "serviceSpecification": {
+ "id": "1e3feeb0-8e36-46c6-862c-236d9c626439"
+ }
+ }
+ },
+ {
+ "id": "B",
+ "action": "add",
+ "state": "active",
+ "service": {
+ "state": "active",
+ "serviceSpecification": {
+ "id": "1e3feeb0-8e36-46c6-862c-236d9c626439"
+ }
+ },
+ "orderItemRelationship": [
+ {
+ "id": "A",
+ "type": "reliesOn"
+ }
+ ]
+ }
+ ]
}
]
diff --git a/src/test/resources/karatetest/features/03--Subscriber.feature b/src/test/resources/karatetest/features/03--Subscriber.feature
index 851ac73..3a41c34 100644
--- a/src/test/resources/karatetest/features/03--Subscriber.feature
+++ b/src/test/resources/karatetest/features/03--Subscriber.feature
@@ -8,7 +8,16 @@ Background:
* def Context = Java.type('org.onap.nbi.test.Context');
* call Context.startServers();
* def data = read('../data/subscriber.json')
-
+* def serviceOrderData = read('../data/serviceOrder.json')
+* def checkDateFormat =
+"""
+function(s) {
+ var SimpleDateFormat = Java.type("java.text.SimpleDateFormat");
+ var sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ return sdf.parse(s);
+}
+"""
+
Scenario: testFindWhenNoSubscriber
Given path 'hub'
When method get
@@ -64,3 +73,39 @@ And def Id = $[0].id
Given path 'hub',Id
When method delete
Then status 204
+
+Scenario: testSubscriberWithTestListener
+* def listenerUrl = nbiBaseUrl + "/test/listener"
+Given path 'test/listener'
+When method delete
+Then status 204
+Given path 'hub'
+And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceOrderCreationNotification' }
+When method post
+Then status 201
+Given path 'hub'
+When method get
+And def hubId = $[0].id
+Given path 'serviceOrder'
+And request serviceOrderData[17]
+When method post
+Then status 201
+And def serviceOrderId = $.id
+Given path 'test/listener'
+And params {serviceOrderId : '#(serviceOrderId)'}
+When method get
+Then status 200
+And assert response.length == 1
+And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceOrderCreationNotification' , eventDate : '#notnull' , event :'#notnull'}
+And def eventId = $[0].eventId
+And def eventDate = $[0].eventDate
+And call checkDateFormat(eventDate)
+Given path 'hub',hubId
+When method delete
+Then status 204
+Given path 'test/listener',eventId
+When method delete
+Then status 204
+Given path 'serviceOrder',serviceOrderId
+When method delete
+Then status 204 \ No newline at end of file