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: testcreateEventSubscription
38 And header Target = 'http://localhost:8080/nbi/api/v4'
43 And header Target = 'http://localhost:8080/nbi/api/v4'
44 Given path 'hub',hubId
47 And match hubId == $.id
48 Given path 'hub',hubId
49 And header Target = 'http://localhost:8080/nbi/api/v4'
53 Scenario: testPostListenerResource
54 * def listenerUrl = nbiBaseUrl + "/test/listener"
55 Given path 'test/listener'
59 And header Target = 'http://localhost:8080/nbi/api/v4'
60 And request { callback : '#(listenerUrl)' , query : 'eventType = ServiceOrderCreationNotification' }
64 Given path 'serviceOrder'
65 And request serviceOrderData[17]
66 And header Target = 'http://localhost:8080/nbi/api/v4'
69 And def serviceOrderId = $.id
70 Given path 'test/listener'
71 And params {serviceOrderId : '#(serviceOrderId)'}
72 And retry until responseStatus == 200
74 And assert response.length == 1
75 And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceOrderCreationNotification' , eventDate : '#notnull' , event :'#notnull'}
76 And def eventId = $[0].eventId
77 And def eventDate = $[0].eventDate
78 And call checkDateFormat(eventDate)
79 Given path 'serviceOrder',serviceOrderId
82 Given path 'hub',hubId
83 And header Target = 'http://localhost:8080/nbi/api/v4'
86 Given path 'test/listener',eventId