diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_15.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_15.robot new file mode 100644 index 0000000000000000000000000000000000000000..7c070816514acc3dc98ec705a3f240c8dce13950 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_15.robot @@ -0,0 +1,47 @@ +*** Settings *** +Documentation Check that one can retrieve the temporal evolution of an entity with a JSON property + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Temporal Entity +Suite Teardown Delete Initial Temporal Entity +Test Template Retrieve Temporal Entity + + +*** Variables *** +${vehicle_payload_file}= vehicle-json-property-temporal-representation.jsonld + + +*** Test Cases *** REPRESENTATION EXPECTATION_FILENAME +020_15_01 Retrieve the normalized temporal representation of an entity with a JSON property + [Tags] te-retrieve 5_7_3 4_5_7 since_v1.8.1 + ${EMPTY} vehicle-json-property-temporal-representation.json +020_15_02 Retrieve the simplified temporal representation of an entity with a JSON property + [Tags] te-retrieve 5_7_3 4_5_9 since_v1.8.1 + temporalValues vehicle-json-property-simplified-temporal-representation.json + + +*** Keywords *** +Retrieve Temporal Entity + [Documentation] Check that you can retrieve the temporal evolution of an entity with a JSON property + [Arguments] ${representation} ${expectation_filename} + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... options=${representation} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing EntityTemporal element + ... ${expectation_filename} + ... ${temporal_entity_representation_id} + ... ${response.json()} + +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Vehicle Entity Id + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_14.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_14.robot new file mode 100644 index 0000000000000000000000000000000000000000..814e7a5f7f2353a09d332cf1dc3ebb7e372364f1 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_14.robot @@ -0,0 +1,44 @@ +*** Settings *** +Documentation Check that you can create an entity with a JsonProperty property + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entity +Test Template Create Entity Scenarios + + +*** Test Cases *** FILENAME CONTENT_TYPE +001_14_01 EntityWithJsonPropertyAsObject + [Tags] e-create 5_6_1 4_5_24 since_v1.8.1 + building-json-property-object.jsonld application/ld+json +001_14_02 EntityWithJsonPropertyAsArray + [Tags] e-create 5_6_1 4_5_24 since_v1.8.1 + building-json-property-array.jsonld application/ld+json + + +*** Keywords *** +Create Entity Scenarios + [Documentation] Check that you can create an entity with a JsonProperty property + [Arguments] ${filename} ${content_type} + ${entity_id}= Generate Random Building Entity Id + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${content_type} + Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${entity_id} ${response.headers} + ${created_entity}= Load Test Sample entities/${filename} ${entity_id} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... accept=${content_type} + ... context=${ngsild_test_suite_context} + Check Created Resource Set To + ... created_resource=${created_entity} + ... response_body=${response1.json()} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_10.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_10.robot new file mode 100644 index 0000000000000000000000000000000000000000..14386a1817878e23e18da4e40d33d60a3a430360 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_10.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that you can append a JsonProperty property to an entity + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Initial Entity +Test Template Append Attributes Without Params + + +*** Variables *** +${filename}= vehicle-speed-two-datasetid.jsonld + + +*** Test Cases *** STATUS_CODE FRAGMENT_FILENAME EXPECTATION_FILENAME +010_10_01 Append a JSON property + [Tags] ea-append 5_6_3 4_5_24 since_v1.8.1 + 204 vehicle-new-json-property-fragment.jsonld vehicle-json-property-appended.jsonld + + +*** Keywords *** +Append Attributes Without Params + [Documentation] Check that you can append a JsonProperty property to an entity + [Arguments] ${status_code} ${fragment_filename} ${expectation_filename} + ${response}= Append Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resource Set To + ... updated_resource=${entity_expectation_payload} + ... response_body=${response1.json()} + +Create Initial Entity + ${entity_id}= Generate Random Vehicle Entity Id + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + Set Suite Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_08.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..8f629e6a64dcc90fd6d411e28d606485cb76ef6c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_08.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that you can perform a partial update on a JSON property + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Initiate Test Case +Test Teardown Delete Initial Entities +Test Template Update Attributes + + +*** Variables *** +${filename}= building-json-property-object-sub-property.jsonld +${status_code}= 204 + + +*** Test Cases *** FRAGMENT_FILENAME ATTRIBUTE_ID EXPECTATION_FILENAME +012_08_01 Check that you can partially update a JSON property + [Tags] ea-partial-update 5_6_4 4_5_24 since_v1.8.1 + building-json-property-fragment.jsonld jsonProperty building-json-property-update.jsonld + + +*** Keywords *** +Update Attributes + [Documentation] Check that you can perform a partial update on a JSON property + [Arguments] ${fragment_filename} ${attribute_id} ${expectation_filename} + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attribute_id} + ... fragment_filename=${fragment_filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List @context + Check Updated Resource Set To ${entity_expectation_payload} ${response1.json()} ${ignored_attributes} + +Initiate Test Case + ${entity_id}= Generate Random Vehicle Entity Id + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Entities + Delete Entity by Id ${entity_id} diff --git a/data/entities/building-json-property-array.jsonld b/data/entities/building-json-property-array.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..1928b6e98301ecdc243d55321d58c1f9638f2da8 --- /dev/null +++ b/data/entities/building-json-property-array.jsonld @@ -0,0 +1,20 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "jsonProperty": { + "type": "JsonProperty", + "json": [ + { + "id": "some-id-1", + "anythingElse": "anything-else-1" + }, + { + "id": "some-id-2", + "anythingElse": "anything-else-2" + } + ] + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/building-json-property-object-sub-property.jsonld b/data/entities/building-json-property-object-sub-property.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..648198dc7542b785e23a08d2ecf2f84ed2e0b764 --- /dev/null +++ b/data/entities/building-json-property-object-sub-property.jsonld @@ -0,0 +1,20 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "jsonProperty": { + "type": "JsonProperty", + "json": { + "id": "some-id", + "type": "some-type", + "null": null, + "anythingElse": "anything-else" + }, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/building-json-property-object.jsonld b/data/entities/building-json-property-object.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..7d6807ac8b9c27fb8be158b12da38ae87b792576 --- /dev/null +++ b/data/entities/building-json-property-object.jsonld @@ -0,0 +1,16 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "jsonProperty": { + "type": "JsonProperty", + "json": { + "id": "some-id", + "type": "some-type", + "null": null, + "anythingElse": "anything-else" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/building-json-property-update.jsonld b/data/entities/expectations/building-json-property-update.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..62ceaba4400fd2e17d0d304f5924eaf436b0750c --- /dev/null +++ b/data/entities/expectations/building-json-property-update.jsonld @@ -0,0 +1,23 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "jsonProperty": { + "type": "JsonProperty", + "json": { + "id": "another-id", + "type": "another-type", + "anythingElse": "another-anything-else" + }, + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:JohnDoe" + }, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-json-property-appended.jsonld b/data/entities/expectations/vehicle-json-property-appended.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..1547cce49a4f2cacb6e58af632e8b79fbe6a5ce9 --- /dev/null +++ b/data/entities/expectations/vehicle-json-property-appended.jsonld @@ -0,0 +1,49 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "speed": [ + { + "type": "Property", + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometer", + "value": 55 + }, + { + "type": "Property", + "source": { + "type": "Property", + "value": "GPS" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed", + "value": 54.5 + } + ], + "jsonProperty": { + "type": "JsonProperty", + "json": { + "id": "some-id", + "type": "some-type", + "null": null, + "anythingElse": "anything-else" + } + }, + "isParked": { + "type": "Relationship", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + }, + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/building-json-property-fragment.jsonld b/data/entities/fragmentEntities/building-json-property-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..9028ecce1d6d1c9e2b380c9e24a2efa01ef4def4 --- /dev/null +++ b/data/entities/fragmentEntities/building-json-property-fragment.jsonld @@ -0,0 +1,14 @@ +{ + "json": { + "id": "another-id", + "type": "another-type", + "anythingElse": "another-anything-else" + }, + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:JohnDoe" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/fragmentEntities/vehicle-new-json-property-fragment.jsonld b/data/entities/fragmentEntities/vehicle-new-json-property-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..3fa4584f5765e1d2ef25e314cc6e28e8f6fe94af --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-new-json-property-fragment.jsonld @@ -0,0 +1,14 @@ +{ + "jsonProperty": { + "type": "JsonProperty", + "json": { + "id": "some-id", + "type": "some-type", + "null": null, + "anythingElse": "anything-else" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-json-property-simplified-temporal-representation.json b/data/temporalEntities/expectations/vehicle-json-property-simplified-temporal-representation.json new file mode 100644 index 0000000000000000000000000000000000000000..ee68f5f3b9bedf8ab54dc03308b370c8021d3304 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-json-property-simplified-temporal-representation.json @@ -0,0 +1,33 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "JsonProperty", + "jsons": [ + [ + { + "json": { + "value": 120 + } + }, + "2020-08-01T12:03:00Z" + ], + [ + { + "json": { + "value": 80 + } + }, + "2020-08-01T12:05:00Z" + ], + [ + { + "json": { + "value": 100 + } + }, + "2020-08-01T12:07:00Z" + ] + ] + } +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-json-property-temporal-representation.json b/data/temporalEntities/expectations/vehicle-json-property-temporal-representation.json new file mode 100644 index 0000000000000000000000000000000000000000..8cff3e179fe98268e9c46690e3c7c6e15d8ea0e4 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-json-property-temporal-representation.json @@ -0,0 +1,27 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"JsonProperty", + "json": { + "value": 120 + }, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"JsonProperty", + "json": { + "value": 80 + }, + "observedAt":"2020-08-01T12:05:00Z" + }, + { + "type":"JsonProperty", + "json": { + "value": 100 + }, + "observedAt":"2020-08-01T12:07:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/vehicle-json-property-temporal-representation.jsonld b/data/temporalEntities/vehicle-json-property-temporal-representation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..aa196ff2fad8449af66c0b01587c37bb6b477ee8 --- /dev/null +++ b/data/temporalEntities/vehicle-json-property-temporal-representation.jsonld @@ -0,0 +1,30 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"JsonProperty", + "json": { + "value": 120 + }, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"JsonProperty", + "json": { + "value": 80 + }, + "observedAt":"2020-08-01T12:05:00Z" + }, + { + "type":"JsonProperty", + "json": { + "value": 100 + }, + "observedAt":"2020-08-01T12:07:00Z" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_15.json b/doc/files/ContextInformation/Consumption/020_15.json new file mode 100644 index 0000000000000000000000000000000000000000..945e594ce9fd38b3a0e4d46adaed0107ee377cd9 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_15.json @@ -0,0 +1,64 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_15", + "test_objective": "Check that one can retrieve the temporal evolution of an entity with a JSON property", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.7, 4.5.9, 5.7.3", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.7", + "4.5.9", + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Temporal Entity", + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "Delete Initial Temporal Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "020_15_01 Retrieve the normalized temporal representation of an entity with a JSON property", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_15_01", + "doc": "Check that you can retrieve the temporal evolution of an entity with a JSON property", + "tags": [ + "4_5_7", + "5_7_3", + "since_v1.8.1", + "te-retrieve" + ], + "setup": null, + "teardown": null, + "template": "Retrieve Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-json-property-temporal-representation.json'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: options set to '${EMPTY}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + }, + { + "name": "020_15_02 Retrieve the simplified temporal representation of an entity with a JSON property", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_15_02", + "doc": "Check that you can retrieve the temporal evolution of an entity with a JSON property", + "tags": [ + "4_5_9", + "5_7_3", + "since_v1.8.1", + "te-retrieve" + ], + "setup": null, + "teardown": null, + "template": "Retrieve Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-json-property-simplified-temporal-representation.json'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: options set to 'temporalValues' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_15" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_14.json b/doc/files/ContextInformation/Provision/001_14.json new file mode 100644 index 0000000000000000000000000000000000000000..c4184e450d74fc27431bd237cd6bfab043feffae --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_14.json @@ -0,0 +1,61 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_14", + "test_objective": "Check that you can create an entity with a JsonProperty property", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.24, 5.6.1", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.24", + "5.6.1" + ], + "pics_selection": "", + "keywords": [ + "Create Entity Scenarios", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_14_01 EntityWithJsonPropertyAsObject", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_14_01", + "doc": "Check that you can create an entity with a JsonProperty property", + "tags": [ + "4_5_24", + "5_6_1", + "e-create", + "since_v1.8.1" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": "Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'created_entity' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-json-property-object.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "001_14_02 EntityWithJsonPropertyAsArray", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_14_02", + "doc": "Check that you can create an entity with a JsonProperty property", + "tags": [ + "4_5_24", + "5_6_1", + "e-create", + "since_v1.8.1" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": "Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'created_entity' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-json-property-array.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_14" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/010_10.json b/doc/files/ContextInformation/Provision/010_10.json new file mode 100644 index 0000000000000000000000000000000000000000..a36a88adf6f6f98fd2b4f174aa18bfbbbacdffaa --- /dev/null +++ b/doc/files/ContextInformation/Provision/010_10.json @@ -0,0 +1,42 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/010_10", + "test_objective": "Check that you can append a JsonProperty property to an entity", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.24, 5.6.3", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.24", + "5.6.3" + ], + "pics_selection": "", + "keywords": [ + "Append Attributes Without Params", + "Create Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "010_10_01 Append a JSON property", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_10_01", + "doc": "Check that you can append a JsonProperty property to an entity", + "tags": [ + "4_5_24", + "5_6_3", + "ea-append", + "since_v1.8.1" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Append Attributes Without Params", + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Check Updated Entity and\n Query Parameter: 'updated_resource' set to 'entity_expectation_payload' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}/attrs'\n method set to 'POST'\n Append Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'vehicle-new-json-property-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entities/{id}/attrs" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/EntityAttributes/AppendEntityAttributes", + "robotfile": "010_10" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/012_08.json b/doc/files/ContextInformation/Provision/012_08.json new file mode 100644 index 0000000000000000000000000000000000000000..104adf948c752df126d03f41663a85422434d731 --- /dev/null +++ b/doc/files/ContextInformation/Provision/012_08.json @@ -0,0 +1,42 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/012_08", + "test_objective": "Check that you can perform a partial update on a JSON property", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.24, 5.6.4", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.24", + "5.6.4" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Initiate Test Case", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n and an attribute with an id set to ${atrId}\n}", + "test_cases": [ + { + "name": "012_08_01 Check that you can partially update a JSON property", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_08_01", + "doc": "Check that you can perform a partial update on a JSON property", + "tags": [ + "4_5_24", + "5_6_4", + "ea-partial-update", + "since_v1.8.1" + ], + "setup": "Initiate Test Case", + "teardown": "Delete Initial Entities", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Check Updated Entity and\n Query Parameter: 'ignored_keys' set to '${None}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'jsonProperty' and\n Query Parameter: fragment_filename set to 'building-json-property-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate", + "robotfile": "012_08" +} \ No newline at end of file diff --git a/doc/tests/test_ContextInformation_Consumption.py b/doc/tests/test_ContextInformation_Consumption.py index a216a21f1820821e3b0c1ff2c9647aed1a5774f1..6ff9d995d2a088a3cd64c507abd4212674a8f0ac 100644 --- a/doc/tests/test_ContextInformation_Consumption.py +++ b/doc/tests/test_ContextInformation_Consumption.py @@ -551,3 +551,10 @@ class TestCIConsumptions(TestCase): difference_file = f'{self.folder_test_suites}/doc/results/out_020_14.json' self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_15(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_15.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_15.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_15.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) diff --git a/doc/tests/test_ContextInformation_Provision.py b/doc/tests/test_ContextInformation_Provision.py index 1c4fb73645c74df3089f155a429fa373e8d26d42..4d482b6a8e55961dc56a9230f16f25b9bae31367 100644 --- a/doc/tests/test_ContextInformation_Provision.py +++ b/doc/tests/test_ContextInformation_Provision.py @@ -322,6 +322,13 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_001_14(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_14.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_14.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_14.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_002_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/002_01.json' @@ -434,6 +441,13 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_010_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/010_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_010_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_013_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/013_01.json' @@ -525,6 +539,13 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_012_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/012_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_012_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_011_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/011_01.json' diff --git a/resources/ApiUtils/ContextInformationProvision.resource b/resources/ApiUtils/ContextInformationProvision.resource index 18b26358b364f4b2059d8db0495171894c176264..c8b7c6a0a58b9769e555de3fce93cc029268b88e 100755 --- a/resources/ApiUtils/ContextInformationProvision.resource +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -155,7 +155,7 @@ Create Entity &{params}= Create Dictionary IF '${local}'!='' Set To Dictionary ${params} local=${local} ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${filename} - ${entity}= Update Value To JSON ${entity_payload} $..id ${entity_id} + ${entity}= Update Value To JSON ${entity_payload} $.id ${entity_id} &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST ... url=${url}/${ENTITIES_ENDPOINT_PATH} @@ -187,7 +187,7 @@ Create Entity selecting @context Create Entity Selecting Content Type [Arguments] ${filename} ${entity_id} ${content_type} ${context}=${EMPTY} ${accept}=${EMPTY} ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${filename} - ${entity}= Update Value To JSON ${entity_payload} $..id ${entity_id} + ${entity}= Update Value To JSON ${entity_payload} $.id ${entity_id} &{headers}= Create Dictionary Content-Type=${content_type} IF '${accept}'!='${EMPTY}' Set To Dictionary ${headers} Accept=${accept}