forked from telefonicaid/fiware-orion
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1438 from FIWARE/feature/notifyAll
Feature/notify all
- Loading branch information
Showing
4 changed files
with
148 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
test/functionalTest/cases/0000_ngsild/ngsild_subscription-on-type-star.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# Copyright 2023 FIWARE Foundation e.V. | ||
# | ||
# This file is part of Orion-LD Context Broker. | ||
# | ||
# Orion-LD Context Broker is free software: you can redistribute it and/or | ||
# modify it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# Orion-LD Context Broker is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero | ||
# General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with Orion-LD Context Broker. If not, see http://www.gnu.org/licenses/. | ||
# | ||
# For those usages not covered by this license please contact with | ||
# orionld at fiware dot org | ||
|
||
# VALGRIND_READY - to mark the test ready for valgrindTestSuite.sh | ||
|
||
--NAME-- | ||
Subscription with type: "*", and test of notifications | ||
|
||
--SHELL-INIT-- | ||
dbInit CB | ||
orionldStart CB -experimental | ||
accumulatorStart --pretty-print | ||
|
||
--SHELL-- | ||
|
||
# | ||
# 01. Create a subscription on EVERYTHING | ||
# 02. Create an entity, any | ||
# 03. See the notification in the accumulator | ||
# | ||
|
||
|
||
echo "01. Create a subscription on EVERYTHING" | ||
echo "=======================================" | ||
payload='{ | ||
"id": "urn:S1", | ||
"description": "Notify ALL", | ||
"type": "Subscription", | ||
"entities": [ | ||
{ | ||
"type": "*" | ||
} | ||
], | ||
"notification": { | ||
"endpoint": { | ||
"uri": "http://localhost:'$LISTENER_PORT'/notify" | ||
} | ||
} | ||
}' | ||
orionCurl --url /ngsi-ld/v1/subscriptions --payload "$payload" | ||
echo | ||
echo | ||
|
||
|
||
echo "02. Create an entity, any" | ||
echo "=========================" | ||
payload='{ | ||
"id": "urn:ngsi-ld:Blower:bd01", | ||
"type": "BlowerDevice", | ||
"airflow": 127 | ||
}' | ||
orionCurl --url /ngsi-ld/v1/entities --payload "$payload" | ||
echo | ||
echo | ||
|
||
|
||
echo "03. See the notification in the accumulator" | ||
echo "===========================================" | ||
accumulatorDump | ||
echo | ||
echo | ||
|
||
|
||
--REGEXPECT-- | ||
01. Create a subscription on EVERYTHING | ||
======================================= | ||
HTTP/1.1 201 Created | ||
Content-Length: 0 | ||
Date: REGEX(.*) | ||
Location: /ngsi-ld/v1/subscriptions/urn:S1 | ||
|
||
|
||
|
||
02. Create an entity, any | ||
========================= | ||
HTTP/1.1 201 Created | ||
Content-Length: 0 | ||
Date: REGEX(.*) | ||
Location: /ngsi-ld/v1/entities/urn:ngsi-ld:Blower:bd01 | ||
|
||
|
||
|
||
03. See the notification in the accumulator | ||
=========================================== | ||
POST http://REGEX(.*)/notify?subscriptionId=urn:S1 | ||
Content-Length: 264 | ||
User-Agent: REGEX(.*) | ||
Host: REGEX(.*) | ||
Accept: application/json | ||
Content-Type: application/json | ||
Link: <https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-contextREGEX(.*) | ||
Ngsild-Attribute-Format: Normalized | ||
|
||
{ | ||
"data": [ | ||
{ | ||
"airflow": { | ||
"type": "Property", | ||
"value": 127 | ||
}, | ||
"id": "urn:ngsi-ld:Blower:bd01", | ||
"type": "BlowerDevice" | ||
} | ||
], | ||
"id": "urn:ngsi-ld:Notification:REGEX(.*)", | ||
"notifiedAt": "REGEX(.*)", | ||
"subscriptionId": "urn:S1", | ||
"type": "Notification" | ||
} | ||
======================================= | ||
|
||
|
||
--TEARDOWN-- | ||
brokerStop CB | ||
accumulatorStop | ||
dbDrop CB | ||
dbDrop CB openiot |