summaryrefslogtreecommitdiffstats
path: root/src/test/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/resources')
-rw-r--r--src/test/resources/karatetest/data/Event.json13
-rw-r--r--src/test/resources/karatetest/data/subscriber.json4
-rw-r--r--src/test/resources/karatetest/features/02--ServiceOrder.feature27
-rw-r--r--src/test/resources/karatetest/features/03--Subscriber.feature36
-rw-r--r--src/test/resources/karatetest/features/05--ListenerResourceTestTarget.feature74
5 files changed, 87 insertions, 67 deletions
diff --git a/src/test/resources/karatetest/data/Event.json b/src/test/resources/karatetest/data/Event.json
deleted file mode 100644
index 5887deb..0000000
--- a/src/test/resources/karatetest/data/Event.json
+++ /dev/null
@@ -1,13 +0,0 @@
-[{
- "eventType": "ServiceOrderStateChangeNotification",
- "eventDate": "2019-03-27T14:58:32.740Z",
- "eventId": "12345",
- "event": {
- "id": "testEventId",
- "href": "www.testHref.com",
- "externalId": "testExternalId",
- "state": "acknowledged",
- "orderDate": "2019-03-27T04:58:32.740Z"
-
- }
-}] \ No newline at end of file
diff --git a/src/test/resources/karatetest/data/subscriber.json b/src/test/resources/karatetest/data/subscriber.json
index 14dfdb8..5fceb9f 100644
--- a/src/test/resources/karatetest/data/subscriber.json
+++ b/src/test/resources/karatetest/data/subscriber.json
@@ -11,9 +11,5 @@
{
"callback": "http://localhost/test",
"query": "eventType=ServiceOrderItemStateChangeNotification"
- },
- {
- "callback": "http://localhost:8080/nbi/api/v4/test/listener",
- "query": "eventType=ServiceOrderStateChangeNotification"
}
] \ No newline at end of file
diff --git a/src/test/resources/karatetest/features/02--ServiceOrder.feature b/src/test/resources/karatetest/features/02--ServiceOrder.feature
index 756a00e..4b4891d 100644
--- a/src/test/resources/karatetest/features/02--ServiceOrder.feature
+++ b/src/test/resources/karatetest/features/02--ServiceOrder.feature
@@ -359,6 +359,19 @@ Given path 'serviceOrder',serviceOrderId16
When method delete
Then status 204
+Scenario: testCheckServiceOrderWithTargetHeader
+Given path 'serviceOrder'
+And header Target = 'http://localhost:8080/nbi/api/v4'
+And request data[0]
+When method post
+Then status 201
+And match $.id contains '#notnull'
+And match $.state == 'acknowledged'
+And def serviceOrderId = $.id
+Given path 'serviceOrder',serviceOrderId
+And header Target = 'http://localhost:8080/nbi/api/v4'
+When method get
+Then status 200
Scenario: testCheckServiceOrderWithCustomerAAINotResponding
* call Context.removeWireMockMapping("/aai/v14/business/customers/customer/new");
@@ -436,17 +449,3 @@ Given path 'serviceOrder',serviceOrderId
When method get
Then status 200
* call Context.startServers();
-
-Scenario: testCheckServiceOrderWithTargetURLPresent
-Given path 'serviceOrder'
-And header targetURL = '127.0.0.1'
-And request data[0]
-When method post
-Then status 201
-And match $.id contains '#notnull'
-And match $.state == 'acknowledged'
-And def serviceOrderId = $.id
-Given path 'serviceOrder', serviceOrderId
-And header targetURL = '127.0.0.1'
-When method get
-Then status 200 \ No newline at end of file
diff --git a/src/test/resources/karatetest/features/03--Subscriber.feature b/src/test/resources/karatetest/features/03--Subscriber.feature
index ea8c24a..1d9bfdf 100644
--- a/src/test/resources/karatetest/features/03--Subscriber.feature
+++ b/src/test/resources/karatetest/features/03--Subscriber.feature
@@ -9,7 +9,6 @@ Background:
* call Context.startServers();
* def data = read('../data/subscriber.json')
* def serviceOrderData = read('../data/serviceOrder.json')
-* def eventData = read('../data/Event.json')
* configure retry = { count: 10, interval: 500 }
* def checkDateFormat =
"""
@@ -250,38 +249,3 @@ Then status 204
Given path 'test/listener',eventId
When method delete
Then status 204
-
-
-Scenario: testHubAndListenerResourceWhenTargetURLIsPresent
-Given path 'hub'
-And header targetURL = '127.0.0.1'
-And request data[3]
-When method post
-Then status 201
-And def location = responseHeaders['Location'][0]
-Given path "listener"
-And request eventData[0]
-When method post
-Then status 200
-Given path "test/listener/12345"
-When method get
-Then status 200
-And match $ contains
-"""
-{
- "eventType": "ServiceOrderStateChangeNotification",
- "eventDate": "2019-03-27T14:58:32.740Z",
- "eventId": "12345",
- "event": {
- "id": "testEventId",
- "href": "www.testHref.com",
- "externalId": "testExternalId",
- "state": "acknowledged",
- "orderDate": "2019-03-27T04:58:32.740Z"
-
- }
-}
-"""
-Given url location
-When method delete
-Then status 204
diff --git a/src/test/resources/karatetest/features/05--ListenerResourceTestTarget.feature b/src/test/resources/karatetest/features/05--ListenerResourceTestTarget.feature
new file mode 100644
index 0000000..a42f9b7
--- /dev/null
+++ b/src/test/resources/karatetest/features/05--ListenerResourceTestTarget.feature
@@ -0,0 +1,74 @@
+# new feature
+# Tags: optional
+
+Feature: Listener
+
+Background:
+* url nbiBaseUrl
+* def Context = Java.type('org.onap.nbi.test.Context');
+* call Context.startServers();
+* def data = read('../data/subscriber.json')
+* def serviceOrderData = read('../data/serviceOrder.json')
+* configure retry = { count: 10, interval: 500 }
+* def checkDateFormat =
+"""
+function(s) {
+ var SimpleDateFormat = Java.type("java.text.SimpleDateFormat");
+ var sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ return sdf.parse(s);
+}
+"""
+
+Scenario: testcreateEventSubscription
+Given path 'hub'
+And header Target = 'http://localhost:8080/nbi/api/v4'
+And request data[0]
+When method post
+Then status 201
+And def hubId = $.id
+And header Target = 'http://localhost:8080/nbi/api/v4'
+Given path 'hub',hubId
+When method get
+Then status 200
+And match hubId == $.id
+Given path 'hub',hubId
+And header Target = 'http://localhost:8080/nbi/api/v4'
+When method delete
+Then status 204
+
+Scenario: testPostListenerResource
+* def listenerUrl = nbiBaseUrl + "/test/listener"
+Given path 'test/listener'
+When method delete
+Then status 204
+Given path 'hub'
+And header Target = 'http://localhost:8080/nbi/api/v4'
+And request { callback : '#(listenerUrl)' , query : 'eventType = ServiceOrderCreationNotification' }
+When method post
+Then status 201
+And def hubId = $.id
+Given path 'serviceOrder'
+And request serviceOrderData[17]
+And header Target = 'http://localhost:8080/nbi/api/v4'
+When method post
+Then status 201
+And def serviceOrderId = $.id
+Given path 'test/listener'
+And params {serviceOrderId : '#(serviceOrderId)'}
+And retry until responseStatus == 200
+When method get
+And assert response.length == 1
+And match $[0] contains { eventId : '#notnull' , eventType : 'ServiceOrderCreationNotification' , eventDate : '#notnull' , event :'#notnull'}
+And def eventId = $[0].eventId
+And def eventDate = $[0].eventDate
+And call checkDateFormat(eventDate)
+Given path 'serviceOrder',serviceOrderId
+When method delete
+Then status 204
+Given path 'hub',hubId
+And header Target = 'http://localhost:8080/nbi/api/v4'
+When method delete
+Then status 204
+Given path 'test/listener',eventId
+When method delete
+Then status 204 \ No newline at end of file