|
| 1 | +Feature: Test tutorial 103.NGSI-LD.CRUD Operations (Orion-LD) |
| 2 | + This is feature file of the FIWARE step by step tutorial for CRUD Operations (Orion-LD) |
| 3 | + url: https://ngsi-ld-tutorials.readthedocs.io/en/latest/ngsi-ld-operations.html |
| 4 | + git-clone: https://github.com/FIWARE/tutorials.CRUD-Operations.git |
| 5 | + git-directory: /tmp/tutorials.CRUD-Operations |
| 6 | + shell-commands: git checkout NGSI-LD ; ./services create; ./services orion |
| 7 | + clean-shell-commands: ./services stop |
| 8 | + |
| 9 | + Background: |
| 10 | + Given I set the tutorial 103.NGSI-LD |
| 11 | + |
| 12 | + Scenario: 01 - Create a New Data Entity |
| 13 | + When I set the "Content-Type" header with the value "application/json" |
| 14 | + And I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 15 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities" |
| 16 | + And the body request described in file "request103ld-01.json" |
| 17 | + And I send a POST HTTP request to that url |
| 18 | + Then I receive a HTTP "201" response code |
| 19 | + |
| 20 | + Scenario: 02 - Check if the Entity Exists |
| 21 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 22 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001" |
| 23 | + And I send a GET HTTP request to that url |
| 24 | + Then I receive a HTTP "200" response code |
| 25 | + |
| 26 | + Scenario: 03 - Create New Attributes |
| 27 | + When I set the "Content-Type" header with the value "application/json" |
| 28 | + And I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 29 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001/attrs" |
| 30 | + And the body request described in file "request103ld-03.json" |
| 31 | + And I send a POST HTTP request to that url |
| 32 | + Then I receive a HTTP "204" response code |
| 33 | + |
| 34 | + Scenario: 04 - Read a Data Entity (verbose) |
| 35 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 36 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001" |
| 37 | + And the params equal to "options=sysAttrs" |
| 38 | + And I send a GET HTTP request to that url |
| 39 | + Then I receive a HTTP "200" response code |
| 40 | + |
| 41 | + Scenario: 05 - Batch Create New Data Entities or Attributes |
| 42 | + When I set the "Content-Type" header with the value "application/json" |
| 43 | + And I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 44 | + And I set the "Accept" header with the value "application/ld+json" |
| 45 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entityOperations/create" |
| 46 | + And the body request described in file "request103ld-05.json" |
| 47 | + And I send a POST HTTP request to that url |
| 48 | + Then I receive a HTTP "201" response code from Orion-LD with the body equal to "response103ld-05.json" |
| 49 | + |
| 50 | + Scenario: 06 - Batch Create/Overwrite New Data Entities |
| 51 | + When I set the "Content-Type" header with the value "application/json" |
| 52 | + And I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 53 | + And I set the "Accept" header with the value "application/ld+json" |
| 54 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entityOperations/upsert" |
| 55 | + And the body request described in file "request103ld-06.json" |
| 56 | + And I send a POST HTTP request to that url |
| 57 | + Then I receive a HTTP "204" response code |
| 58 | + |
| 59 | + Scenario: 07 - Read a Data Entity (verbose) |
| 60 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 61 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001" |
| 62 | + And the params equal to "options=sysAttrs" |
| 63 | + And I send a GET HTTP request to that url |
| 64 | + Then I receive a HTTP "200" status code from Orion-LD with the body "response103ld-07.json" and exclusions "response103ld-07.excludes" |
| 65 | + |
| 66 | + Scenario: 08 - Read an Attribute from a Data Entity |
| 67 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 68 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001" |
| 69 | + And the params equal to "attrs=temperature" |
| 70 | + And I send a GET HTTP request to that url |
| 71 | + Then I receive a HTTP "200" response code from Orion-LD with the body equal to "response103ld-08.json" |
| 72 | + |
| 73 | + Scenario: 09 - Read a Data Entity (key-value pairs) |
| 74 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 75 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001" |
| 76 | + And I set the "Accept" header with the value "application/json" |
| 77 | + And the params equal to "options=keyValues" |
| 78 | + And I send a GET HTTP request to that url |
| 79 | + Then I receive a HTTP "200" response code from Orion-LD with the body equal to "response103ld-09.json" |
| 80 | + |
| 81 | + Scenario: 10 - Read Multiple attributes values from a Data Entity |
| 82 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 83 | + And I set the "Accept" header with the value "application/json" |
| 84 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001" |
| 85 | + And the params equal to "options=keyValues" |
| 86 | + And the params equal to "attrs=category,temperature" |
| 87 | + And I send a GET HTTP request to that url |
| 88 | + Then I receive a HTTP "200" response code from Orion-LD with the body equal to "response103ld-10.json" |
| 89 | + |
| 90 | + Scenario: 11 - List all Data Entities (verbose) |
| 91 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 92 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/" |
| 93 | + And the params equal to "type=TemperatureSensor" |
| 94 | + And I send a GET HTTP request to that url |
| 95 | + Then I receive a HTTP "200" response code from Orion-LD with the body equal to "response103ld-11.json" |
| 96 | + |
| 97 | + Scenario: 12 - List all Data Entities (key-value pairs) |
| 98 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 99 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/" |
| 100 | + And I set the "Accept" header with the value "application/json" |
| 101 | + And the params equal to "type=TemperatureSensor" |
| 102 | + And the params equal to "options=keyValues" |
| 103 | + And the params equal to "attrs=temperature" |
| 104 | + And I send a GET HTTP request to that url |
| 105 | + Then I receive a HTTP "200" response code from Orion-LD with the body equal to "response103ld-12.json" |
| 106 | + |
| 107 | + Scenario: 13 - Filter Data Entities by ID |
| 108 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 109 | + And I set the "Accept" header with the value "application/json" |
| 110 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/" |
| 111 | + And the params equal to "id=urn:ngsi-ld:TemperatureSensor:001,urn:ngsi-ld:TemperatureSensor:002" |
| 112 | + And the params equal to "options=keyValues" |
| 113 | + And the params equal to "attrs=temperature" |
| 114 | + And I send a GET HTTP request to that url |
| 115 | + Then I receive a HTTP "200" response code from Orion-LD with the body equal to "response103ld-13.json" |
| 116 | + |
| 117 | + Scenario: 14 - Overwrite the value of an Attribute value |
| 118 | + When I set the "Content-Type" header with the value "application/json" |
| 119 | + And I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 120 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001/attrs/category" |
| 121 | + And the body request described in file "request103ld-14.json" |
| 122 | + And I send a PATCH HTTP request to that url |
| 123 | + Then I receive a HTTP "204" response code |
| 124 | + |
| 125 | + Scenario: 15 - Overwrite Multiple Attributes of a Data Entity |
| 126 | + When I set the "Content-Type" header with the value "application/json" |
| 127 | + And I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 128 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001/attrs" |
| 129 | + And the body request described in file "request103ld-15.json" |
| 130 | + And I send a PATCH HTTP request to that url |
| 131 | + Then I receive a HTTP "204" response code |
| 132 | + |
| 133 | + Scenario: 16 - Batch Update Attributes of Multiple Data Entities |
| 134 | + When I set the "Content-Type" header with the value "application/json" |
| 135 | + And I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 136 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entityOperations/upsert?options=update" |
| 137 | + And the body request described in file "request103ld-16.json" |
| 138 | + And I send a POST HTTP request to that url |
| 139 | + Then I receive a HTTP "204" response code |
| 140 | + |
| 141 | + Scenario: 17 - Batch Replace Entity Data |
| 142 | + When I set the "Content-Type" header with the value "application/json" |
| 143 | + And I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 144 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entityOperations/update?options=replace" |
| 145 | + And the body request described in file "request103ld-17.json" |
| 146 | + And I send a POST HTTP request to that url |
| 147 | + Then I receive a HTTP "204" response code |
| 148 | + |
| 149 | + Scenario: 18 - Delete an Entity |
| 150 | + When I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:004" |
| 151 | + And I send a DELETE HTTP request to that url |
| 152 | + Then I receive a HTTP "204" response code |
| 153 | + |
| 154 | + Scenario: 19 - Delete an Attribute from an Entity |
| 155 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 156 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:001/attrs/batteryLevel" |
| 157 | + And I send a DELETE HTTP request to that url |
| 158 | + Then I receive a HTTP "204" response code |
| 159 | + |
| 160 | + Scenario: 20 - Batch Delete Multiple Entities |
| 161 | + When I set the "Content-Type" header with the value "application/json" |
| 162 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entityOperations/delete" |
| 163 | + And the body request described in file "request103ld-20.json" |
| 164 | + And I send a POST HTTP request to that url |
| 165 | + Then I receive a HTTP "204" response code |
| 166 | + |
| 167 | + Scenario: 21 - Find Existing Data Relationships |
| 168 | + When I set the "Link" header with the value "<http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"" |
| 169 | + And I set the url to "http://localhost:1026/ngsi-ld/v1/entities/?type=TemperatureSensor&limit=0&count=true&q=controlledAsset==%22urn:ngsi-ld:Building:barn002%22" |
| 170 | + And I set the "Accept" header with the value "application/json" |
| 171 | + And I send a GET HTTP request to that url |
| 172 | + Then I receive a HTTP response with the following data in header and payload |
| 173 | + | Status-Code | NGSILD-Results-Count | |
| 174 | + | 200 | 1 | |
0 commit comments