diff options
Diffstat (limited to 'src/test/resources/karatetest/features')
-rw-r--r-- | src/test/resources/karatetest/features/03--Subscriber.feature | 47 |
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 |