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.
- Loading branch information
Showing
4 changed files
with
279 additions
and
1 deletion.
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
91 changes: 91 additions & 0 deletions
91
test/functionalTest/cases/0000_ngsild/ngsild_subscription_count.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,91 @@ | ||
# Copyright 2024 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-- | ||
GET Subscriptions with count - issue #1647 | ||
|
||
--SHELL-INIT-- | ||
dbInit CB | ||
orionldStart CB -experimental | ||
|
||
--SHELL-- | ||
|
||
# | ||
# 01. GET all subscriptions, with count set - see 0 and [] | ||
# 02. Create subscription urn:S1 | ||
# 03. GET all subscriptions, with count set - see 1 and urn:S1 | ||
# 04. GET all subscriptions, with count set and limit=0- see 1 and [] | ||
# | ||
|
||
echo "01. GET all subscriptions, with count set - see 0 and []" | ||
echo "========================================================" | ||
orionCurl --url /ngsi-ld/v1/subscriptions?count=true | ||
echo | ||
echo | ||
|
||
|
||
echo "02. Create subscription urn:S1" | ||
echo "==============================" | ||
payload='{ | ||
"id": "urn:S1", | ||
"type": "Subscription", | ||
"entities": [ | ||
{ | ||
"idPattern": "urn:WeatherObserved", | ||
"type": "WeatherObserved" | ||
} | ||
], | ||
"watchedAttributes": [ | ||
"dateObserved" | ||
], | ||
"isActive": true, | ||
"notification": { | ||
"format": "normalized", | ||
"endpoint": { | ||
"uri": "http://localhost:'$LISTENER_PORT'/notify", | ||
"accept": "application/json" | ||
} | ||
} | ||
}' | ||
orionCurl --url /ngsi-ld/v1/subscriptions --payload "$payload" | ||
echo | ||
echo | ||
|
||
|
||
echo "03. GET all subscriptions, with count set - see 1 and urn:S1" | ||
echo "============================================================" | ||
orionCurl --url /ngsi-ld/v1/subscriptions?count=true | ||
echo | ||
echo | ||
|
||
|
||
echo "04. GET all subscriptions, with count set and limit=0- see 1 and []" | ||
echo "===================================================================" | ||
orionCurl --url '/ngsi-ld/v1/subscriptions?count=true&limit=0' | ||
echo | ||
echo | ||
|
||
|
||
--REGEXPECT-- | ||
--TEARDOWN-- | ||
brokerStop CB | ||
dbDrop CB |
116 changes: 116 additions & 0 deletions
116
test/functionalTest/cases/0000_troe/troe_urlencode_attr_value.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,116 @@ | ||
# Copyright 2024 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-- | ||
Attribute with strange chars in attribute value | ||
|
||
--SHELL-INIT-- | ||
export BROKER=orionld | ||
dbInit CB | ||
pgInit $CB_DB_NAME | ||
orionldStart CB -experimental -troe | ||
|
||
--SHELL-- | ||
|
||
# | ||
# 01. Create an entity E1 with an attribute P1 with a string value with 'strange' characters | ||
# 02. See all entities in TRoE DB | ||
# 03. See all attributes in TRoE DB | ||
# 04. See all sub-attributes in TRoE DB - there aren't any | ||
# | ||
|
||
echo "01. Create an entity E1 with an attribute P1 with a string value with 'strange' characters" | ||
echo "==========================================================================================" | ||
payload='{ | ||
"id": "urn:ngsi-ld:entity:E1", | ||
"type": "Device", | ||
"P1": "'\'0\''", | ||
"P2": { | ||
"value": { | ||
"a": "1" | ||
} | ||
}, | ||
"P3": { | ||
"value": { | ||
"a": "'\'2\''" | ||
} | ||
} | ||
}' | ||
orionCurl --url /ngsi-ld/v1/entities --payload "$payload" | ||
echo | ||
echo | ||
|
||
|
||
echo "02. See all entities in TRoE DB" | ||
echo "===============================" | ||
postgresCmd -sql "SELECT opMode,id,type,ts FROM entities" | ||
echo | ||
echo | ||
|
||
|
||
echo "03. See all attributes in TRoE DB" | ||
echo "=================================" | ||
postgresCmd -sql "SELECT opMode,id,valueType,entityId,subProperties,unitcode,datasetid,text,number,boolean,compound,observedAt,ts FROM attributes" | ||
echo | ||
echo | ||
|
||
|
||
echo "04. See all sub-attributes in TRoE DB - there aren't any" | ||
echo "========================================================" | ||
postgresCmd -sql "SELECT id,valueType,entityId,attrInstanceId,unitcode,text,number,boolean FROM subAttributes" | ||
echo | ||
echo | ||
|
||
|
||
--REGEXPECT-- | ||
01. Create an entity E1 with an attribute P1 with a string value with 'strange' characters | ||
========================================================================================== | ||
HTTP/1.1 201 Created | ||
Content-Length: 0 | ||
Date: REGEX(.*) | ||
Location: /ngsi-ld/v1/entities/urn:ngsi-ld:entity:E1 | ||
|
||
|
||
|
||
02. See all entities in TRoE DB | ||
=============================== | ||
opmode,id,type,ts | ||
Create,urn:ngsi-ld:entity:E1,https://uri.etsi.org/ngsi-ld/default-context/Device,202REGEX(.*) | ||
|
||
|
||
03. See all attributes in TRoE DB | ||
================================= | ||
opmode,id,valuetype,entityid,subproperties,unitcode,datasetid,text,number,boolean,compound,observedat,ts | ||
Create,https://uri.etsi.org/ngsi-ld/default-context/P1,String,urn:ngsi-ld:entity:E1,f,,None,%270%27,,,,,202REGEX(.*) | ||
Create,https://uri.etsi.org/ngsi-ld/default-context/P2,Compound,urn:ngsi-ld:entity:E1,f,,None,,,,"{""a"": ""1""}",,202REGEX(.*) | ||
Create,https://uri.etsi.org/ngsi-ld/default-context/P3,Compound,urn:ngsi-ld:entity:E1,f,,None,,,,"{""a"": ""%272%27""}",,202REGEX(.*) | ||
|
||
|
||
04. See all sub-attributes in TRoE DB - there aren't any | ||
======================================================== | ||
id,valuetype,entityid,attrinstanceid,unitcode,text,number,boolean | ||
|
||
|
||
--TEARDOWN-- | ||
brokerStop CB | ||
dbDrop CB | ||
pgDrop $CB_DB_NAME |