8 * def Context = Java.type('org.onap.nbi.test.Context');
9 * call Context.startServers();
10 * def data = read('../data/subscriber.json')
11 * def serviceOrderData = read('../data/serviceOrder.json')
12 * configure retry = { count: 10, interval: 500 }
13 * def checkDateFormat =
16 var SimpleDateFormat = Java.type("java.text.SimpleDateFormat");
17 var sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
22 Scenario: testFindWhenNoSubscriber
28 Scenario: testCreationAndFindSubscriber
33 And def location = responseHeaders['Location'][0]
41 Scenario: testCreation2SameSubscribers
46 And def location = responseHeaders['Location'][0]
51 And match $ contains { message : 'Bad Request'}
59 Scenario: testGetByIdSubscriber
69 And match $ contains { callback : 'http://localhost:8080/test' , query : 'eventType=ServiceOrderCreationNotification' }
74 Scenario: testFindSubscriber
79 And def location1 = responseHeaders['Location'][0]
84 And def location2 = responseHeaders['Location'][0]
88 And match $ == '#notnull'
96 Scenario: testFindWithFilteringSubscriber
101 And def location = responseHeaders['Location'][0]
103 And params { query.eventType : 'ServiceOrderCreationNotification' }
106 And match $ == '#[1]'
111 Scenario: testSubscriberDeletion
113 And request { id : 'id', callback : 'http://localhost:8080/test' , query : 'eventType = ServiceOrderCreationNotification' }
123 Scenario: testSubscriberWithTestListener
124 * def listenerUrl = nbiBaseUrl + "/test/listener"
125 Given path 'test/listener'
129 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceOrderCreationNotification' }
134 And def hubId = $[0].id
135 Given path 'serviceOrder'
136 And request serviceOrderData[17]
139 And def serviceOrderId = $.id
140 Given path 'test/listener'
141 And params {serviceOrderId : '#(serviceOrderId)'}
142 And retry until responseStatus == 200
144 And assert response.length == 1
145 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceOrderCreationNotification' , eventDate : '#notnull' , event :'#notnull'}
146 And def eventId = $[0].eventId
147 And def eventDate = $[0].eventDate
148 And call checkDateFormat(eventDate)
149 Given path 'hub',hubId
152 Given path 'test/listener',eventId
155 Given path 'serviceOrder',serviceOrderId