Skip to content

Commit

Permalink
Merge pull request #1778 from telefonicaid/feature/change_json_in_ret…
Browse files Browse the repository at this point in the history
…rieve_entity_request

[FEATURE] changes in json format in retrieve entity response
  • Loading branch information
Fermín Galán Márquez committed Feb 15, 2016
2 parents a10f563 + 13c0860 commit bacc19a
Show file tree
Hide file tree
Showing 11 changed files with 721 additions and 349 deletions.
6 changes: 3 additions & 3 deletions test/acceptance/behave/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ The log is stored in `logs` folder (if this folder does not exist it is created)
| list_entities | 510 | GET | /v2/entities/ | No | Yes |
| create_entity | 693 | POST | /v2/entities/ | Yes | Yes |
| |
| retrieve_entity | 212 | GET | /v2/entities/`<entity_id>` | No | Yes |
| retrieve_entity | 220 | GET | /v2/entities/`<entity_id>` | No | Yes |
| update_or_append_entity_attributes | 768 | POST | /v2/entities/`<entity_id>` | Yes | Yes |
| update_existing_entity_attributes | 657 | PATCH | /v2/entities/`<entity_id>` | Yes | No |
| replace_all_entity_attributes | 563 | PUT | /v2/entities/`<entity_id>` | Yes | No |
Expand Down Expand Up @@ -316,6 +316,7 @@ The log is stored in `logs` folder (if this folder does not exist it is created)
`entity_id=room_0, entity_id=room_1, ..., entity_id=room_N`
- If entity type prefix is true, the entity type is value plus a suffix (consecutive), ex:
`entity_type=room_0, entity_type=room_1, ..., entity_type=room_N`
- The prefixes function (id or type) are used if entities_number is greater than 1.
- If attributes number is equal to "1", the attribute name has not suffix, ex: `attributes_name=temperature`
else attributes number is major than "1" the attributes name are value plus a suffix (consecutive), ex:
`attributes_name=temperature_0, attributes_name=temperature_1, ..., temperature_N`
Expand All @@ -326,8 +327,7 @@ The log is stored in `logs` folder (if this folder does not exist it is created)
- the `-harakiri` option is used to kill contextBroker (must be compiled in DEBUG mode)
- It is possible to use the same value of the previous request in another request using this string:
`the same value of the previous request`.
## Tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#

# Missing Tests:
# - verification of Maximum Length Allowed in Fields
# - verification of headers response
# - verification of Special Attribute Types
#

Expand Down Expand Up @@ -157,8 +157,8 @@ Feature: create entities requests (POST) using NGSI v2. "POST" - /v2/entities/ p
| description | Entity already exists |

@maximum_size @BUG_1199
# 8013 is a way of generating a request longer than 1MB (in fact, 1048624 bytes)
Scenario: try to create a new entity NGSI v2 with maximum size in payload (8013 attributes = 1048624 bytes)
# 8137 is a way of generating a request longer than 1MB (in fact, 1048594 bytes)
Scenario: try to create a new entity NGSI v2 with maximum size in payload (8137 attributes = 1048594 bytes)
Given a definition of headers
| parameter | value |
| Fiware-Service | test_maximum_size |
Expand All @@ -168,7 +168,7 @@ Feature: create entities requests (POST) using NGSI v2. "POST" - /v2/entities/ p
| parameter | value |
| entities_type | room |
| entities_id | room2 |
| attributes_number | 8013 |
| attributes_number | 8137 |
| attributes_name | max_size |
| attributes_value | temperatur |
| attributes_type | my_type |
Expand All @@ -181,7 +181,7 @@ Feature: create entities requests (POST) using NGSI v2. "POST" - /v2/entities/ p
And verify several error responses
| parameter | value |
| error | RequestEntityTooLarge |
| description | payload size: 1048624, max size supported: 1048576 |
| description | payload size: 1048594, max size supported: 1048576 |
And verify that entities are not stored in mongo

@content_type_without @BUG_1199
Expand Down Expand Up @@ -1923,12 +1923,11 @@ Feature: create entities requests (POST) using NGSI v2. "POST" - /v2/entities/ p
| entities_id | room |
| attributes_name | temperature |
| attributes_value | 56 |
| attributes_type | celcius |
| metadatas_name | random=255 |
| attributes_type | celsius |
| metadatas_name | random=257 |
| metadatas_value | random=5 |
When create entity group with "1" entities in "normalized" mode
Then verify that receive several "Bad Request" http code
# the metadata name is incremented in 2 chars because it is added with a suffix. Ex: "_0"
And verify several error responses
| parameter | value |
| error | BadRequest |
Expand Down Expand Up @@ -2602,7 +2601,7 @@ Feature: create entities requests (POST) using NGSI v2. "POST" - /v2/entities/ p
| entities_id | room |
| attributes_name | temperature |
| attributes_value | 56 |
| attributes_type | celcius |
| attributes_type | celsius |
| metadatas_name | temperature |
| metadatas_value | random=5 |
| metadatas_type | random=257 |
Expand Down Expand Up @@ -2877,7 +2876,6 @@ Feature: create entities requests (POST) using NGSI v2. "POST" - /v2/entities/ p
| "room17" | {"x": [{"a":78, "b":"r"}, 45, "rt"],"x2": "b"} |
| "room18" | {"x": "x1","x2": "b"} |


@qp_key_values_on_only_value
Scenario Outline: create an entity using NGSI v2 with keyValues mode activated, but in only values format
Given a definition of headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
Feature: list all entities with get request and queries parameters using NGSI v2. "GET" - /v2/entities/
Queries parameters
tested : limit, offset, id, idPattern, type, q and option=count,keyValues
pending: georel, geometry, coords and option=values
pending: georel, geometry, coords and option=values,distinct
As a context broker user
I would like to list all entities with get request and queries parameter using NGSI v2
So that I can manage and use them in my scripts
Expand Down Expand Up @@ -539,7 +539,7 @@ Feature: list all entities with get request and queries parameters using NGSI v2
| attributes_number | 2 |
| attributes_name | temperature |
| attributes_value | <attribute value> |
| attributes_type | celcius |
| attributes_type | celsius |
And create entity group with "5" entities in "normalized" mode
| entity | prefix |
| id | true |
Expand Down Expand Up @@ -587,7 +587,7 @@ Feature: list all entities with get request and queries parameters using NGSI v2
| entities_id | <entity_id> |
| attributes_name | "temperature" |
| attributes_value | <attributes_value> |
| attributes_type | "celcius" |
| attributes_type | "celsius" |
And create an entity in raw and "normalized" modes
And verify that receive an "Created" http code
And record entity group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ Feature: list all entities with get request and queries parameters using NGSI v2
| entities_id | "<entities_id>" |
| attributes_name | "temperature" |
| attributes_value | 34 |
| attributes_type | "celcius" |
| attributes_type | "celsius" |
| metadatas_name | "very_hot" |
| metadatas_type | "alarm" |
| metadatas_value | "hot" |
Expand Down Expand Up @@ -750,7 +750,7 @@ Feature: list all entities with get request and queries parameters using NGSI v2
| random=256 |

@only_type_list.row<row.id>
@only_type_list @BUG_1749 @skip
@only_type_list @BUG_1749
Scenario Outline: list all entities using NGSI v2 with only type query parameter with a list of types
Given a definition of headers
| parameter | value |
Expand Down Expand Up @@ -836,7 +836,7 @@ Feature: list all entities with get request and queries parameters using NGSI v2
| entities_id | "bedroom" |
| attributes_name | "temperature" |
| attributes_value | 34 |
| attributes_type | "celcius" |
| attributes_type | "celsius" |
| metadatas_name | "very_hot" |
| metadatas_type | "alarm" |
| metadatas_value | "hot" |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
This file is part of Orion Context Broker.
Orion 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 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 Context Broker. If not, see http://www.gnu.org/licenses/.
For those usages not covered by this license please contact with
iot_support at tid dot es
"""
__author__ = 'Iván Arias León (ivan dot ariasleon at telefonica dot com)'



Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
"""
Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
This file is part of Orion Context Broker.
Orion 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 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 Context Broker. If not, see http://www.gnu.org/licenses/.
For those usages not covered by this license please contact with
iot_support at tid dot es
"""
__author__ = 'Iván Arias León (ivan dot ariasleon at telefonica dot com)'

# see generic environment.py in root path

from environment import *
Loading

0 comments on commit bacc19a

Please sign in to comment.