1 # Copyright (c) 2018 Orange
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.swagger: "2.0"
22 * def Context = Java.type('org.onap.nbi.test.Context');
23 * call Context.startServers();
24 * def data = read('../data/subscriber.json')
25 * def serviceOrderData = read('../data/serviceOrder.json')
26 * configure retry = { count: 10, interval: 500 }
27 * def checkDateFormat =
30 var SimpleDateFormat = Java.type("java.text.SimpleDateFormat");
31 var sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
36 Scenario: testFindWhenNoSubscriber
42 Scenario: testCreationAndFindSubscriber
47 And def location = responseHeaders['Location'][0]
55 Scenario: testCreation2SameSubscribers
60 And def location = responseHeaders['Location'][0]
65 And match $ contains { message : 'Bad Request'}
73 Scenario: testGetByIdSubscriber
83 And match $ contains { callback : 'http://localhost:8080/test' , query : 'eventType=ServiceOrderCreationNotification' }
88 Scenario: testFindSubscriber
93 And def location1 = responseHeaders['Location'][0]
98 And def location2 = responseHeaders['Location'][0]
102 And match $ == '#notnull'
110 Scenario: testFindWithFilteringSubscriber
115 And def location = responseHeaders['Location'][0]
117 And params { query.eventType : 'ServiceOrderCreationNotification' }
120 And match $ == '#[1]'
125 Scenario: testSubscriberDeletion
127 And request { id : 'id', callback : 'http://localhost:8080/test' , query : 'eventType = ServiceOrderCreationNotification' }
137 Scenario: testSubscriberWithTestListener
138 * def listenerUrl = nbiBaseUrl + "/test/listener"
139 Given path 'test/listener'
143 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceOrderCreationNotification' }
148 And def hubId = $[0].id
149 Given path 'serviceOrder'
150 And request serviceOrderData[17]
153 And def serviceOrderId = $.id
154 Given path 'test/listener'
155 And params {serviceOrderId : '#(serviceOrderId)'}
156 And retry until responseStatus == 200
158 And assert response.length == 1
159 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceOrderCreationNotification' , eventDate : '#notnull' , event :'#notnull'}
160 And def eventId = $[0].eventId
161 And def eventDate = $[0].eventDate
162 And call checkDateFormat(eventDate)
163 Given path 'hub',hubId
166 Given path 'test/listener',eventId
169 Given path 'serviceOrder',serviceOrderId
174 Scenario: testSubscriberWithTestListenerForServiceInventorCreationEvents
175 * def listenerUrl = nbiBaseUrl + "/test/listener"
176 Given path 'test/listener'
180 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceCreationNotification' }
185 And def hubId = $[0].id
186 Given path 'hub/testaaievents'
189 Given path 'test/listener'
190 And params {serviceInstanceId : 'new-test5'}
191 And retry until responseStatus == 200
193 And assert response.length == 1
194 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceCreationNotification' , eventDate : '#notnull' , event :'#notnull'}
195 And def eventId = $[0].eventId
196 And def eventDate = $[0].eventDate
197 And call checkDateFormat(eventDate)
198 Given path 'hub',hubId
201 Given path 'test/listener',eventId
205 Scenario: testSubscriberWithTestListenerForServiceInventoryUpdateEvents
206 * def listenerUrl = nbiBaseUrl + "/test/listener"
207 Given path 'test/listener'
211 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceAttributeValueChangeNotification' }
216 And def hubId = $[0].id
217 Given path 'hub/testaaievents'
220 Given path 'test/listener'
221 And params {serviceInstanceId : 'new-test5'}
222 And retry until responseStatus == 200
224 And assert response.length == 1
225 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceAttributeValueChangeNotification' , eventDate : '#notnull' , event :'#notnull'}
226 And def eventId = $[0].eventId
227 And def eventDate = $[0].eventDate
228 And call checkDateFormat(eventDate)
229 Given path 'hub',hubId
232 Given path 'test/listener',eventId
236 Scenario: testSubscriberWithTestListenerForServiceInventoryRemoveEvents
237 * def listenerUrl = nbiBaseUrl + "/test/listener"
238 Given path 'test/listener'
242 And request { id : 'id', callback : '#(listenerUrl)' , query : 'eventType = ServiceRemoveNotification' }
247 And def hubId = $[0].id
248 Given path 'hub/testaaievents'
251 Given path 'test/listener'
252 And params {serviceInstanceId : 'new-test5'}
253 And retry until responseStatus == 200
255 And assert response.length == 1
256 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceRemoveNotification' , eventDate : '#notnull' , event :'#notnull'}
257 And def eventId = $[0].eventId
258 And def eventDate = $[0].eventDate
259 And call checkDateFormat(eventDate)
260 Given path 'hub',hubId
263 Given path 'test/listener',eventId