summaryrefslogtreecommitdiffstats
path: root/src/test/resources/karatetest/features/03--Subscriber.feature
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2019-01-24 11:01:03 +0100
committerromaingimbert <romain.gimbert@orange.com>2019-01-24 12:28:42 +0100
commit69197a8abc78ee825d38908cd46690b3c150caa1 (patch)
treecd6db2a41e42ca5b7204851ccd8c34c76527a381 /src/test/resources/karatetest/features/03--Subscriber.feature
parent05733ab5105f440e44eb56dc37e6d14615c36454 (diff)
hub resource format date
-fix code -add listener for testing -add karate test Change-Id: Ife2d7812c77316b75c55e86056f59d838e117069 Issue-ID: EXTAPI-180 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/test/resources/karatetest/features/03--Subscriber.feature')
-rw-r--r--src/test/resources/karatetest/features/03--Subscriber.feature47
1 files changed, 46 insertions, 1 deletions
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