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 * def eventData = read('../data/Event.json')
13 * configure retry = { count: 10, interval: 500 }
14 * def checkDateFormat =
17 var SimpleDateFormat = Java.type("java.text.SimpleDateFormat");
18 var sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
23 Scenario: testFindWhenNoSubscriber
29 Scenario: testCreationAndFindSubscriber
34 And def location = responseHeaders['Location'][0]
42 Scenario: testCreation2SameSubscribers
47 And def location = responseHeaders['Location'][0]
52 And match $ contains { message : 'Bad Request'}
60 Scenario: testGetByIdSubscriber
70 And match $ contains { callback : 'http://localhost:8080/test' , query : 'eventType=ServiceOrderCreationNotification' }
75 Scenario: testFindSubscriber
80 And def location1 = responseHeaders['Location'][0]
85 And def location2 = responseHeaders['Location'][0]
89 And match $ == '#notnull'
97 Scenario: testFindWithFilteringSubscriber
102 And def location = responseHeaders['Location'][0]
104 And params { query.eventType : 'ServiceOrderCreationNotification' }
107 And match $ == '#[1]'
112 Scenario: testSubscriberDeletion
114 And request { id : 'id', callback : 'http://localhost:8080/test' , query : 'eventType = ServiceOrderCreationNotification' }
124 Scenario: testSubscriberWithTestListener
125 * def listenerUrl = nbiBaseUrl + "/test/listener"
126 Given path 'test/listener'
130 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceOrderCreationNotification' }
135 And def hubId = $[0].id
136 Given path 'serviceOrder'
137 And request serviceOrderData[17]
140 And def serviceOrderId = $.id
141 Given path 'test/listener'
142 And params {serviceOrderId : '#(serviceOrderId)'}
143 And retry until responseStatus == 200
145 And assert response.length == 1
146 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceOrderCreationNotification' , eventDate : '#notnull' , event :'#notnull'}
147 And def eventId = $[0].eventId
148 And def eventDate = $[0].eventDate
149 And call checkDateFormat(eventDate)
150 Given path 'hub',hubId
153 Given path 'test/listener',eventId
156 Given path 'serviceOrder',serviceOrderId
161 Scenario: testSubscriberWithTestListenerForServiceInventorCreationEvents
162 * def listenerUrl = nbiBaseUrl + "/test/listener"
163 Given path 'test/listener'
167 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceCreationNotification' }
172 And def hubId = $[0].id
173 Given path 'hub/testaaievents'
176 Given path 'test/listener'
177 And params {serviceInstanceId : 'new-test5'}
178 And retry until responseStatus == 200
180 And assert response.length == 1
181 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceCreationNotification' , eventDate : '#notnull' , event :'#notnull'}
182 And def eventId = $[0].eventId
183 And def eventDate = $[0].eventDate
184 And call checkDateFormat(eventDate)
185 Given path 'hub',hubId
188 Given path 'test/listener',eventId
192 Scenario: testSubscriberWithTestListenerForServiceInventoryUpdateEvents
193 * def listenerUrl = nbiBaseUrl + "/test/listener"
194 Given path 'test/listener'
198 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceAttributeValueChangeNotification' }
203 And def hubId = $[0].id
204 Given path 'hub/testaaievents'
207 Given path 'test/listener'
208 And params {serviceInstanceId : 'new-test5'}
209 And retry until responseStatus == 200
211 And assert response.length == 1
212 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceAttributeValueChangeNotification' , eventDate : '#notnull' , event :'#notnull'}
213 And def eventId = $[0].eventId
214 And def eventDate = $[0].eventDate
215 And call checkDateFormat(eventDate)
216 Given path 'hub',hubId
219 Given path 'test/listener',eventId
223 Scenario: testSubscriberWithTestListenerForServiceInventoryRemoveEvents
224 * def listenerUrl = nbiBaseUrl + "/test/listener"
225 Given path 'test/listener'
229 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceRemoveNotification' }
234 And def hubId = $[0].id
235 Given path 'hub/testaaievents'
238 Given path 'test/listener'
239 And params {serviceInstanceId : 'new-test5'}
240 And retry until responseStatus == 200
242 And assert response.length == 1
243 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceRemoveNotification' , eventDate : '#notnull' , event :'#notnull'}
244 And def eventId = $[0].eventId
245 And def eventDate = $[0].eventDate
246 And call checkDateFormat(eventDate)
247 Given path 'hub',hubId
250 Given path 'test/listener',eventId
255 Scenario: testHubAndListenerResourceWhenTargetURLIsPresent
257 And header targetURL = '127.0.0.1'
261 And def location = responseHeaders['Location'][0]
262 Given path "listener"
263 And request eventData[0]
266 Given path "test/listener/12345"
272 "eventType": "ServiceOrderStateChangeNotification",
273 "eventDate": "2019-03-27T14:58:32.740Z",
277 "href": "www.testHref.com",
278 "externalId": "testExternalId",
279 "state": "acknowledged",
280 "orderDate": "2019-03-27T04:58:32.740Z"