Skip to content

Commit 1ec29d6

Browse files
authored
Merge pull request telefonicaid#4650 from telefonicaid/hardening/improve-doc-and-test
ADD unique not supported in attrsFormat test and side doc
2 parents 7636552 + a07d7af commit 1ec29d6

File tree

2 files changed

+84
-1
lines changed

2 files changed

+84
-1
lines changed

doc/manuals/orion-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ representations of entities.
362362
[ 'Ford', 'black', 78.3 ]
363363
```
364364

365-
* *unique mode*. This mode is just like *values mode*, except that values are not repeated.
365+
* *unique mode*. This mode is just like *values mode*, except that values are not repeated. Note this mode is not supported in `attrsFormat` in subscriptions (see [Notification Messages section](#notification-messages)).
366366

367367
## Partial Representations
368368

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Copyright 2016 Telefonica Investigacion y Desarrollo, S.A.U
2+
#
3+
# This file is part of Orion Context Broker.
4+
#
5+
# Orion Context Broker is free software: you can redistribute it and/or
6+
# modify it under the terms of the GNU Affero General Public License as
7+
# published by the Free Software Foundation, either version 3 of the
8+
# License, or (at your option) any later version.
9+
#
10+
# Orion Context Broker is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
13+
# General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Affero General Public License
16+
# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/.
17+
#
18+
# For those usages not covered by this license please contact with
19+
# iot_support at tid dot es
20+
21+
# VALGRIND_READY - to mark the test ready for valgrindTestSuite.sh
22+
23+
--NAME--
24+
NGSIv2 notification formats (unique not supported)
25+
26+
--SHELL-INIT--
27+
dbInit CB
28+
brokerStart CB 0
29+
accumulatorStart --pretty-print
30+
31+
--SHELL--
32+
33+
#
34+
# 01. Create NGSIv2 subscription with attrsFormat set to unique, see error
35+
#
36+
37+
38+
echo "01. Create NGSIv2 subscription with attrsFormat set to unique, see error"
39+
echo "========================================================================"
40+
payload='
41+
{
42+
"subject": {
43+
"entities": [
44+
{
45+
"id": "E1"
46+
}
47+
],
48+
"condition": {
49+
"attrs": [ "A1" ]
50+
}
51+
},
52+
"notification": {
53+
"http": {
54+
"url": "http://localhost:'$LISTENER_PORT'/notify"
55+
},
56+
"attrs": [ "A2", "A4", "A6", "A5", "A3", "A1" ],
57+
"attrsFormat": "unique"
58+
},
59+
"expires": "2050-04-05T14:00:00.00Z"
60+
}'
61+
orionCurl --url /v2/subscriptions --payload "$payload"
62+
echo
63+
echo
64+
65+
66+
--REGEXPECT--
67+
01. Create NGSIv2 subscription with attrsFormat set to unique, see error
68+
========================================================================
69+
HTTP/1.1 400 Bad Request
70+
Date: REGEX(.*)
71+
Fiware-Correlator: REGEX([0-9a-f\-]{36})
72+
Content-Type: application/json
73+
Content-Length: 149
74+
75+
{
76+
"description": "invalid attrsFormat, accepted values: normalized, simplifiedNormalized, keyValues, simplifiedkeyValues, values",
77+
"error": "BadRequest"
78+
}
79+
80+
81+
--TEARDOWN--
82+
brokerStop CB
83+
dbDrop CB

0 commit comments

Comments
 (0)