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
160 Scenario: testSubscriberWithTestListenerForServiceInventorCreationEvents
161 * def listenerUrl = nbiBaseUrl + "/test/listener"
162 Given path 'test/listener'
166 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceCreationNotification' }
171 And def hubId = $[0].id
172 Given path 'hub/testaaievents'
175 Given path 'test/listener'
176 And params {serviceInstanceId : 'new-test5'}
177 And retry until responseStatus == 200
179 And assert response.length == 1
180 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceCreationNotification' , eventDate : '#notnull' , event :'#notnull'}
181 And def eventId = $[0].eventId
182 And def eventDate = $[0].eventDate
183 And call checkDateFormat(eventDate)
184 Given path 'hub',hubId
187 Given path 'test/listener',eventId
191 Scenario: testSubscriberWithTestListenerForServiceInventoryUpdateEvents
192 * def listenerUrl = nbiBaseUrl + "/test/listener"
193 Given path 'test/listener'
197 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceAttributeValueChangeNotification' }
202 And def hubId = $[0].id
203 Given path 'hub/testaaievents'
206 Given path 'test/listener'
207 And params {serviceInstanceId : 'new-test5'}
208 And retry until responseStatus == 200
210 And assert response.length == 1
211 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceAttributeValueChangeNotification' , eventDate : '#notnull' , event :'#notnull'}
212 And def eventId = $[0].eventId
213 And def eventDate = $[0].eventDate
214 And call checkDateFormat(eventDate)
215 Given path 'hub',hubId
218 Given path 'test/listener',eventId
222 Scenario: testSubscriberWithTestListenerForServiceInventoryRemoveEvents
223 * def listenerUrl = nbiBaseUrl + "/test/listener"
224 Given path 'test/listener'
228 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceRemoveNotification' }
233 And def hubId = $[0].id
234 Given path 'hub/testaaievents'
237 Given path 'test/listener'
238 And params {serviceInstanceId : 'new-test5'}
239 And retry until responseStatus == 200
241 And assert response.length == 1
242 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceRemoveNotification' , eventDate : '#notnull' , event :'#notnull'}
243 And def eventId = $[0].eventId
244 And def eventDate = $[0].eventDate
245 And call checkDateFormat(eventDate)
246 Given path 'hub',hubId
249 Given path 'test/listener',eventId