From a50ef884c49d9ccd8ad801647e33c8a58e3223f3 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 1 Feb 2021 12:09:23 +0000 Subject: [PATCH 1/7] added common behaviours test --- TP/NGSI-LD/CommonBehaviours/043.robot | 28 +++++++++++ ...registration-without-context-sample.jsonld | 14 ++++++ ...subscription-without-context-sample.jsonld | 16 +++++++ ...presentation-without-context-sample.jsonld | 48 +++++++++++++++++++ resources/ApiUtils.resource | 10 ++++ 5 files changed, 116 insertions(+) create mode 100644 TP/NGSI-LD/CommonBehaviours/043.robot create mode 100644 data/csourceRegistrations/context-source-registration-without-context-sample.jsonld create mode 100644 data/csourceSubscriptions/subscription-without-context-sample.jsonld create mode 100644 data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld diff --git a/TP/NGSI-LD/CommonBehaviours/043.robot b/TP/NGSI-LD/CommonBehaviours/043.robot new file mode 100644 index 00000000..072e0528 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/043.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Get Entity With Invalid/Missing Id + +*** Variable *** +${expected_status_code}= 503 + +*** Test Cases *** ENDPOINT FILENAME_PATH +043_01_endpoint /entities/ ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld +#043_02_endpoint /csourceRegistrations/ ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld +#043_03_endpoint /subscriptions/ ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +#043_04_endpoint /csourceSubscriptions/ ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +#043_05_endpoint /temporal/entities/ ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld + +*** Keywords *** +Get Entity With Invalid/Missing Id + [Arguments] ${endpoint} ${filename_path} + [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved + [Tags] mandatory + + ${response}= Create Request By Selecting Endpoint ${endpoint} ${filename_path} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-without-context-sample.jsonld b/data/csourceRegistrations/context-source-registration-without-context-sample.jsonld new file mode 100644 index 00000000..b4a6b06e --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-without-context-sample.jsonld @@ -0,0 +1,14 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ] + } + ], + "endpoint":"http://my.csource.org:1026" +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-without-context-sample.jsonld b/data/csourceSubscriptions/subscription-without-context-sample.jsonld new file mode 100644 index 00000000..36860f5b --- /dev/null +++ b/data/csourceSubscriptions/subscription-without-context-sample.jsonld @@ -0,0 +1,16 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + } +} \ No newline at end of file diff --git a/data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld b/data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld new file mode 100644 index 00000000..22efffc5 --- /dev/null +++ b/data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld @@ -0,0 +1,48 @@ +{ + "id":"urn:ngsi-ld:Bus:randomUUID", + "type":"Bus", + "brandName":[ + { + "type":"Property", + "value":"Mercedes" + } + ], + "speed":[ + { + "type":"Property", + "value":45, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":25, + "observedAt":"2020-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:07:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":210, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":145, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":124, + "observedAt":"2020-08-01T14:07:00Z" + } + ], + "@context":[ + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 1256b7b1..1e1527f7 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -17,6 +17,7 @@ ${ENTITY_OPERATIONS_QUERY_ENDPOINT_PATH} entityOperations/query ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporal/entities ${TEMPORAL_ENTITY_OPERATIONS_ENDPOINT_PATH} temporal/entityOperations ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations +${SUBSCRIPTION_ENDPOINT_PATH} subscriptions/ ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions ${CONTENT_TYPE_JSON} application/json @@ -26,6 +27,7 @@ ${ERROR_TYPE_BAD_REQUEST_DATA} http://uri.etsi.org/ngsi-ld/errors/BadReques ${ERROR_TYPE_INVALID_REQUEST} http://uri.etsi.org/ngsi-ld/errors/InvalidRequest ${ERROR_TYPE_RESOURCE_NOT_FOUND} http://uri.etsi.org/ngsi-ld/errors/ResourceNotFound ${ERROR_TYPE_ALREADY_EXISTS} http://uri.etsi.org/ngsi-ld/errors/AlreadyExists +${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} http://uri.etsi.org/ngsi-ld/errors/LDContextNotAvailable ${response} @@ -219,6 +221,14 @@ Delete Context Source Registration Output response [return] ${response} +Create Request By Selecting Endpoint + [Arguments] ${endpoint} ${filename_path} + ${entity_payload}= Load Json From File ${EXECDIR}/data/${filename_path} + ${entity}= Update Value To Json ${entity_payload} $..id ${entity_id} + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST ${endpoint} body=${entity} headers=${headers} + Output response + Create Entity [Arguments] ${filename} ${entity_id} ${entity_payload}= Load Json From File ${EXECDIR}/data/entities/${filename} -- GitLab From f102c281b478cb632166290464340d7e24757675 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Tue, 2 Feb 2021 10:37:49 +0000 Subject: [PATCH 2/7] common behaviours --- TP/NGSI-LD/CommonBehaviours/043.robot | 30 +++++++----- TP/NGSI-LD/CommonBehaviours/044_01.robot | 47 +++++++++++++++++++ TP/NGSI-LD/CommonBehaviours/044_02.robot | 46 ++++++++++++++++++ TP/NGSI-LD/CommonBehaviours/044_03.robot | 46 ++++++++++++++++++ TP/NGSI-LD/CommonBehaviours/044_04.robot | 46 ++++++++++++++++++ TP/NGSI-LD/CommonBehaviours/044_05.robot | 46 ++++++++++++++++++ ...presentation-without-context-sample.jsonld | 4 -- resources/ApiUtils.resource | 32 ++++++++++--- 8 files changed, 275 insertions(+), 22 deletions(-) create mode 100644 TP/NGSI-LD/CommonBehaviours/044_01.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_02.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_03.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_04.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_05.robot diff --git a/TP/NGSI-LD/CommonBehaviours/043.robot b/TP/NGSI-LD/CommonBehaviours/043.robot index 072e0528..fe35908c 100644 --- a/TP/NGSI-LD/CommonBehaviours/043.robot +++ b/TP/NGSI-LD/CommonBehaviours/043.robot @@ -4,25 +4,33 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Test Template Get Entity With Invalid/Missing Id +Test Template Throw 503 LDContextNotAvaliable error *** Variable *** ${expected_status_code}= 503 +${building_id_prefix}= urn:ngsi-ld:Building: +${registration_id_prefix}= urn:ngsi-ld:Registration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: -*** Test Cases *** ENDPOINT FILENAME_PATH -043_01_endpoint /entities/ ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld -#043_02_endpoint /csourceRegistrations/ ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld -#043_03_endpoint /subscriptions/ ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -#043_04_endpoint /csourceSubscriptions/ ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -#043_05_endpoint /temporal/entities/ ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld +*** Test Cases *** PREFIX DELETE_PREFIX ENDPOINT FILENAME_PATH +043_01_endpoint /entities/ ${building_id_prefix} ${EMPTY} ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld +043_02_endpoint /csourceRegistrations/ ${registration_id_prefix} ${EMPTY} ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld +043_03_endpoint /subscriptions/ ${subscription_id_prefix} ${EMPTY} ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +043_04_endpoint /csourceSubscriptions/ ${subscription_id_prefix} / ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +043_05_endpoint /temporal/entities/ ${building_id_prefix} / ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld *** Keywords *** -Get Entity With Invalid/Missing Id - [Arguments] ${endpoint} ${filename_path} +Throw 503 LDContextNotAvaliable error + [Arguments] ${prefix} ${delete_prefix} ${endpoint} ${filename_path} [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved [Tags] mandatory - ${response}= Create Request By Selecting Endpoint ${endpoint} ${filename_path} + ${create_id}= Generate Random Entity Id ${prefix} + ${delete_id}= Set Variable ${delete_prefix}${create_id} + + ${response}= Create Request By Selecting Endpoint ${create_id} ${endpoint} ${filename_path} Check Response Status Code ${expected_status_code} ${response['status']} Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} - Check Response Body Containing ProblemDetails Element Containing Title Element ${response} \ No newline at end of file + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01.robot b/TP/NGSI-LD/CommonBehaviours/044_01.robot new file mode 100644 index 00000000..440d958a --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_01.robot @@ -0,0 +1,47 @@ +*** Settings *** +Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Generate Random Ids +Test Template Throw 503 LDContextNotAvaliable error + +*** Variable *** +${expected_status_code}= 503 +${building_id_prefix}= urn:ngsi-ld:Building: +${registration_id_prefix}= urn:ngsi-ld:Registration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: + +*** Test Cases *** ID DELETE_ID ENDPOINT FILENAME_PATH +044_01_01_endpoint /entities/{entityId}/attrs/ ${entity_id} ${entity_id} ${ENTITIES_ENDPOINT_PATH}{entityId}/attrs/ entities/building-minimal-without-context-sample.jsonld +044_01_02_endpoint /entities/{entityId}/attrs/{attrId} ${csourceRegistration_id} ${csourceRegistration_id} /entities/{entityId}/attrs/{attrId} csourceRegistrations/context-source-registration-without-context-sample.jsonld +044_01_03_endpoint /subscriptions/{subscriptionId} ${subscription_id} ${subscription_id} /subscriptions/{subscriptionId} csourceSubscriptions/subscription-without-context-sample.jsonld +044_01_04_endpoint /csourceRegistrations/{registrationId} ${csourceSubscription_id} ${csourceSubscription_id} /csourceRegistrations/{registrationId} csourceSubscriptions/subscription-without-context-sample.jsonld +044_01_05_endpoint /csourceSubscriptions/{subscriptionId} ${temporal_entity_id} ${temporal_entity_id} /csourceSubscriptions/{subscriptionId} temporalEntities/bus-temporal-representation-without-context-sample.jsonld +044_01_06_endpoint /temporal/entities/{entityId}/attrs/{attrId}/{instanceId} /temporal/entities/{entityId}/attrs/{attrId}/{instanceId} + +*** Keywords *** +PATCH HTTP requests via "application/merge-patch+json" + [Arguments] ${id} ${delete_id} ${endpoint} ${filename_path} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + + ${response}= Merge Request By Selecting Endpoint ${id} ${endpoint} ${filename_path} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} + +Generate Random Ids + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${temporal_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${csourceRegistration_id}= Generate Random Entity Id ${registration_id_prefix} + ${csourceSubscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${entity_id} + Set Suite Variable ${temporal_entity_id} + Set Suite Variable ${csourceRegistration_id} + Set Suite Variable ${csourceSubscription_id} + Set Suite Variable ${subscription_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_02.robot b/TP/NGSI-LD/CommonBehaviours/044_02.robot new file mode 100644 index 00000000..0db0694c --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_02.robot @@ -0,0 +1,46 @@ +*** Settings *** +Documentation Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Generate Random Ids +Test Template Throw 503 LDContextNotAvaliable error + +*** Variable *** +${expected_status_code}= 503 +${building_id_prefix}= urn:ngsi-ld:Building: +${registration_id_prefix}= urn:ngsi-ld:Registration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: + +*** Test Cases *** ID DELETE_ID ENDPOINT FILENAME_PATH +043_01_endpoint /entities/ ${entity_id} ${entity_id} ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld +043_02_endpoint /csourceRegistrations/ ${csourceRegistration_id} ${csourceRegistration_id} ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld +043_03_endpoint /subscriptions/ ${subscription_id} ${subscription_id} ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +043_04_endpoint /csourceSubscriptions/ ${csourceSubscription_id} /${csourceSubscription_id} ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +043_05_endpoint /temporal/entities/ ${temporal_entity_id} /${temporal_entity_id} ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld + +*** Keywords *** +Throw 503 LDContextNotAvaliable error + [Arguments] ${id} ${delete_id} ${endpoint} ${filename_path} + [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved + [Tags] mandatory + + ${response}= Create Request By Selecting Endpoint ${id} ${endpoint} ${filename_path} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} + +Generate Random Ids + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${temporal_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${csourceRegistration_id}= Generate Random Entity Id ${registration_id_prefix} + ${csourceSubscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${entity_id} + Set Suite Variable ${temporal_entity_id} + Set Suite Variable ${csourceRegistration_id} + Set Suite Variable ${csourceSubscription_id} + Set Suite Variable ${subscription_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_03.robot b/TP/NGSI-LD/CommonBehaviours/044_03.robot new file mode 100644 index 00000000..0db0694c --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_03.robot @@ -0,0 +1,46 @@ +*** Settings *** +Documentation Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Generate Random Ids +Test Template Throw 503 LDContextNotAvaliable error + +*** Variable *** +${expected_status_code}= 503 +${building_id_prefix}= urn:ngsi-ld:Building: +${registration_id_prefix}= urn:ngsi-ld:Registration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: + +*** Test Cases *** ID DELETE_ID ENDPOINT FILENAME_PATH +043_01_endpoint /entities/ ${entity_id} ${entity_id} ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld +043_02_endpoint /csourceRegistrations/ ${csourceRegistration_id} ${csourceRegistration_id} ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld +043_03_endpoint /subscriptions/ ${subscription_id} ${subscription_id} ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +043_04_endpoint /csourceSubscriptions/ ${csourceSubscription_id} /${csourceSubscription_id} ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +043_05_endpoint /temporal/entities/ ${temporal_entity_id} /${temporal_entity_id} ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld + +*** Keywords *** +Throw 503 LDContextNotAvaliable error + [Arguments] ${id} ${delete_id} ${endpoint} ${filename_path} + [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved + [Tags] mandatory + + ${response}= Create Request By Selecting Endpoint ${id} ${endpoint} ${filename_path} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} + +Generate Random Ids + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${temporal_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${csourceRegistration_id}= Generate Random Entity Id ${registration_id_prefix} + ${csourceSubscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${entity_id} + Set Suite Variable ${temporal_entity_id} + Set Suite Variable ${csourceRegistration_id} + Set Suite Variable ${csourceSubscription_id} + Set Suite Variable ${subscription_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_04.robot b/TP/NGSI-LD/CommonBehaviours/044_04.robot new file mode 100644 index 00000000..0db0694c --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_04.robot @@ -0,0 +1,46 @@ +*** Settings *** +Documentation Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Generate Random Ids +Test Template Throw 503 LDContextNotAvaliable error + +*** Variable *** +${expected_status_code}= 503 +${building_id_prefix}= urn:ngsi-ld:Building: +${registration_id_prefix}= urn:ngsi-ld:Registration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: + +*** Test Cases *** ID DELETE_ID ENDPOINT FILENAME_PATH +043_01_endpoint /entities/ ${entity_id} ${entity_id} ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld +043_02_endpoint /csourceRegistrations/ ${csourceRegistration_id} ${csourceRegistration_id} ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld +043_03_endpoint /subscriptions/ ${subscription_id} ${subscription_id} ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +043_04_endpoint /csourceSubscriptions/ ${csourceSubscription_id} /${csourceSubscription_id} ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +043_05_endpoint /temporal/entities/ ${temporal_entity_id} /${temporal_entity_id} ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld + +*** Keywords *** +Throw 503 LDContextNotAvaliable error + [Arguments] ${id} ${delete_id} ${endpoint} ${filename_path} + [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved + [Tags] mandatory + + ${response}= Create Request By Selecting Endpoint ${id} ${endpoint} ${filename_path} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} + +Generate Random Ids + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${temporal_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${csourceRegistration_id}= Generate Random Entity Id ${registration_id_prefix} + ${csourceSubscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${entity_id} + Set Suite Variable ${temporal_entity_id} + Set Suite Variable ${csourceRegistration_id} + Set Suite Variable ${csourceSubscription_id} + Set Suite Variable ${subscription_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_05.robot b/TP/NGSI-LD/CommonBehaviours/044_05.robot new file mode 100644 index 00000000..0db0694c --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_05.robot @@ -0,0 +1,46 @@ +*** Settings *** +Documentation Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Generate Random Ids +Test Template Throw 503 LDContextNotAvaliable error + +*** Variable *** +${expected_status_code}= 503 +${building_id_prefix}= urn:ngsi-ld:Building: +${registration_id_prefix}= urn:ngsi-ld:Registration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: + +*** Test Cases *** ID DELETE_ID ENDPOINT FILENAME_PATH +043_01_endpoint /entities/ ${entity_id} ${entity_id} ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld +043_02_endpoint /csourceRegistrations/ ${csourceRegistration_id} ${csourceRegistration_id} ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld +043_03_endpoint /subscriptions/ ${subscription_id} ${subscription_id} ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +043_04_endpoint /csourceSubscriptions/ ${csourceSubscription_id} /${csourceSubscription_id} ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld +043_05_endpoint /temporal/entities/ ${temporal_entity_id} /${temporal_entity_id} ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld + +*** Keywords *** +Throw 503 LDContextNotAvaliable error + [Arguments] ${id} ${delete_id} ${endpoint} ${filename_path} + [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved + [Tags] mandatory + + ${response}= Create Request By Selecting Endpoint ${id} ${endpoint} ${filename_path} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} + +Generate Random Ids + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${temporal_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${csourceRegistration_id}= Generate Random Entity Id ${registration_id_prefix} + ${csourceSubscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${entity_id} + Set Suite Variable ${temporal_entity_id} + Set Suite Variable ${csourceRegistration_id} + Set Suite Variable ${csourceSubscription_id} + Set Suite Variable ${subscription_id} \ No newline at end of file diff --git a/data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld b/data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld index 22efffc5..9a70e2bd 100644 --- a/data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld +++ b/data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld @@ -40,9 +40,5 @@ "value":124, "observedAt":"2020-08-01T14:07:00Z" } - ], - "@context":[ - "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" ] } \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 1e1527f7..ef40ee55 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -179,7 +179,7 @@ Partial Update Entity Attributes Output response [return] ${response} -Create Context Source Registration +Create Context Source Registration With Return [Arguments] ${payload} &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} body=${payload} headers=${headers} @@ -196,7 +196,7 @@ Create Context Source Registration Using Session Output ${response.json()} [return] ${response} -Update Context Source Registration +Update Context Source Registration With Return [Arguments] ${registration_id} ${fragment} &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= PATCH ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} body=${fragment} headers=${headers} @@ -214,7 +214,7 @@ Update Context Source Registration Using Session Output response [return] ${response} -Delete Context Source Registration +Delete Context Source Registration With Return [Arguments] ${registration_id} ${response}= DELETE ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} Output request @@ -222,11 +222,29 @@ Delete Context Source Registration [return] ${response} Create Request By Selecting Endpoint - [Arguments] ${endpoint} ${filename_path} - ${entity_payload}= Load Json From File ${EXECDIR}/data/${filename_path} - ${entity}= Update Value To Json ${entity_payload} $..id ${entity_id} + [Arguments] ${id} ${endpoint} ${filename_path} + ${item_payload}= Load Json From File ${EXECDIR}/data/${filename_path} + ${item}= Update Value To Json ${item_payload} $..id ${id} + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST ${endpoint} body=${item} headers=${headers} + Output request + Output response + [return] ${response} + +Merge Request By Selecting Endpoint + [Arguments] ${id} ${endpoint} ${filename_path} + ${item_payload}= Load Json From File ${EXECDIR}/data/${filename_path} + ${item}= Update Value To Json ${item_payload} $..id ${id} &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${endpoint} body=${entity} headers=${headers} + ${response}= POST ${endpoint} body=${item} headers=${headers} + Output request + Output response + [return] ${response} + +Delete Request By Selecting Endpoint/Id + [Arguments] ${id} ${delete_endpoint} + ${response}= DELETE ${delete_endpoint}${id} + Output request Output response Create Entity -- GitLab From 588914ea5e1b3599534c23306b81e4cd5b6ba573 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 8 Feb 2021 11:57:57 +0000 Subject: [PATCH 3/7] added some common behaviours tests --- TP/NGSI-LD/CommonBehaviours/044_01.robot | 47 ---------------- TP/NGSI-LD/CommonBehaviours/044_01_01.robot | 23 ++++++++ TP/NGSI-LD/CommonBehaviours/044_01_02.robot | 24 ++++++++ TP/NGSI-LD/CommonBehaviours/044_01_03.robot | 23 ++++++++ TP/NGSI-LD/CommonBehaviours/044_01_04.robot | 27 +++++++++ TP/NGSI-LD/CommonBehaviours/044_01_05.robot | 25 +++++++++ TP/NGSI-LD/CommonBehaviours/044_01_06.robot | 27 +++++++++ .../034_01.robot | 2 +- .../034_02.robot | 2 +- .../034_03.robot | 2 +- ...t-source-registration-update-sample.jsonld | 6 ++ .../subscription-update-sample.jsonld | 10 ++++ .../vehicle-fragment-brandname-sample.jsonld | 7 +++ ...cle-fragment-equal-datasetid-sample.jsonld | 3 +- .../vehicle-simple-attributes-sample.jsonld | 5 +- ...cle-two-datasetid-attributes-sample.jsonld | 4 +- ...le-temporal-representation-fragment.jsonld | 10 ++++ ...icle-temporal-representation-sample.jsonld | 15 +---- resources/ApiUtils.resource | 56 ++++++++++++++++++- 19 files changed, 243 insertions(+), 75 deletions(-) delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_01.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_01.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_02.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_03.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_04.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_05.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_06.robot create mode 100644 data/csourceRegistrations/fragments/context-source-registration-update-sample.jsonld create mode 100644 data/csourceSubscriptions/fragments/subscription-update-sample.jsonld create mode 100644 data/entities/fragmentEntities/vehicle-fragment-brandname-sample.jsonld create mode 100644 data/temporalEntities/fragments/vehicle-temporal-representation-fragment.jsonld diff --git a/TP/NGSI-LD/CommonBehaviours/044_01.robot b/TP/NGSI-LD/CommonBehaviours/044_01.robot deleted file mode 100644 index 440d958a..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_01.robot +++ /dev/null @@ -1,47 +0,0 @@ -*** Settings *** -Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -Suite Setup Generate Random Ids -Test Template Throw 503 LDContextNotAvaliable error - -*** Variable *** -${expected_status_code}= 503 -${building_id_prefix}= urn:ngsi-ld:Building: -${registration_id_prefix}= urn:ngsi-ld:Registration: -${subscription_id_prefix}= urn:ngsi-ld:Subscription: - -*** Test Cases *** ID DELETE_ID ENDPOINT FILENAME_PATH -044_01_01_endpoint /entities/{entityId}/attrs/ ${entity_id} ${entity_id} ${ENTITIES_ENDPOINT_PATH}{entityId}/attrs/ entities/building-minimal-without-context-sample.jsonld -044_01_02_endpoint /entities/{entityId}/attrs/{attrId} ${csourceRegistration_id} ${csourceRegistration_id} /entities/{entityId}/attrs/{attrId} csourceRegistrations/context-source-registration-without-context-sample.jsonld -044_01_03_endpoint /subscriptions/{subscriptionId} ${subscription_id} ${subscription_id} /subscriptions/{subscriptionId} csourceSubscriptions/subscription-without-context-sample.jsonld -044_01_04_endpoint /csourceRegistrations/{registrationId} ${csourceSubscription_id} ${csourceSubscription_id} /csourceRegistrations/{registrationId} csourceSubscriptions/subscription-without-context-sample.jsonld -044_01_05_endpoint /csourceSubscriptions/{subscriptionId} ${temporal_entity_id} ${temporal_entity_id} /csourceSubscriptions/{subscriptionId} temporalEntities/bus-temporal-representation-without-context-sample.jsonld -044_01_06_endpoint /temporal/entities/{entityId}/attrs/{attrId}/{instanceId} /temporal/entities/{entityId}/attrs/{attrId}/{instanceId} - -*** Keywords *** -PATCH HTTP requests via "application/merge-patch+json" - [Arguments] ${id} ${delete_id} ${endpoint} ${filename_path} - [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type - [Tags] mandatory - - ${response}= Merge Request By Selecting Endpoint ${id} ${endpoint} ${filename_path} - Check Response Status Code ${expected_status_code} ${response['status']} - Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} - Check Response Body Containing ProblemDetails Element Containing Title Element ${response} - - [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} - -Generate Random Ids - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${temporal_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${csourceRegistration_id}= Generate Random Entity Id ${registration_id_prefix} - ${csourceSubscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - Set Suite Variable ${entity_id} - Set Suite Variable ${temporal_entity_id} - Set Suite Variable ${csourceRegistration_id} - Set Suite Variable ${csourceSubscription_id} - Set Suite Variable ${subscription_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_01.robot b/TP/NGSI-LD/CommonBehaviours/044_01_01.robot new file mode 100644 index 00000000..fc0274bd --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_01_01.robot @@ -0,0 +1,23 @@ +*** Settings *** +Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-two-datasetid-attributes-sample.jsonld +${fragment_filename}= vehicle-two-datasetid-attributes-sample-01.jsonld + +*** Test Cases *** +044_01_01_endpoint /entities/{entityId}/attrs/ + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_MERGE_PATCH_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Entity by Id ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_02.robot b/TP/NGSI-LD/CommonBehaviours/044_01_02.robot new file mode 100644 index 00000000..35dc5c35 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_01_02.robot @@ -0,0 +1,24 @@ +*** Settings *** +Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-simple-attributes-sample.jsonld +${fragment_filename}= vehicle-fragment-brandname-sample.jsonld +${attribute_id}= brandName + +*** Test Cases *** +044_01_02_endpoint /entities/{entityId}/attrs/{attrId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Partial Update Entity Attributes ${entity_id} ${attribute_id} ${fragment_filename} ${CONTENT_TYPE_MERGE_PATCH_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Entity by Id ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_03.robot b/TP/NGSI-LD/CommonBehaviours/044_01_03.robot new file mode 100644 index 00000000..1960878b --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_01_03.robot @@ -0,0 +1,23 @@ +*** Settings *** +Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${filename_path}= csourceSubscriptions/subscription-sample.jsonld +${fragment_filename_path}= csourceSubscriptions/fragments/subscription-update-sample.jsonld + +*** Test Cases *** +044_01_03_endpoint /subscriptions/{subscriptionId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${subscription_id} ${filename_path} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Update Subscription ${subscription_id} ${fragment_filename_path} ${CONTENT_TYPE_MERGE_PATCH_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Subscription ${subscription_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_04.robot b/TP/NGSI-LD/CommonBehaviours/044_01_04.robot new file mode 100644 index 00000000..83877508 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_01_04.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= registration-sample.jsonld +${fragment_filename_path}= context-source-registration-update-sample.jsonld + +*** Test Cases *** +044_01_04_endpoint /csourceRegistrations/{registrationId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + + ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_payload_file_path} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response['status']} + + ${fragment}= Load Json From File ${EXECDIR}/data/csourceRegistrations/fragments/${fragment_filename_path} + ${response}= Update Context Source Registration With Return ${registration_id} ${fragment} ${CONTENT_TYPE_MERGE_PATCH_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Context Source Registration ${registration_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_05.robot b/TP/NGSI-LD/CommonBehaviours/044_01_05.robot new file mode 100644 index 00000000..a2986056 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_01_05.robot @@ -0,0 +1,25 @@ +*** Settings *** +Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path}= csourceSubscriptions/fragments/subscription-update-sample.json + +*** Test Cases *** +044_01_05_endpoint /csourceSubscriptions/{subscriptionId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + Check Response Status Code Set To 201 + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + ${response}= Update Context Source Registration Subscription By Selecting Content Type ${subscription_id} ${subscription_update_fragment} ${CONTENT_TYPE_MERGE_PATCH_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Context Source Registration Subscription ${subscription_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_06.robot b/TP/NGSI-LD/CommonBehaviours/044_01_06.robot new file mode 100644 index 00000000..d5249424 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_01_06.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${temporal_entity_filename}= vehicle-temporal-representation-sample.jsonld +${temporal_entity_fragment_file_path}= vehicle-temporal-representation-fragment.jsonld +${attribute_id}= speed + +*** Test Cases *** +044_01_06_endpoint /temporal/entities/{entityId}/attrs/{attrId}/{instanceId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${temporal_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Create Temporal Representation Of Entity Selecting Content Type ${temporal_entity_id} ${temporal_entity_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Get Temporal Representation Of Entity ${temporal_entity_id} ${CONTENT_TYPE_LD_JSON} + ${instance_id}= Set Variable ${response["body"]["speed"][0]["instanceId"]} + + ${response}= Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_id} ${attribute_id} ${instance_id} ${temporal_entity_fragment_file_path} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_01.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_01.robot index 26c54f63..75d2a924 100644 --- a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_01.robot +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_01.robot @@ -26,7 +26,7 @@ Update Context Source ${fragment}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${update_filename} ${fragment_with_id}= Update Value To Json ${fragment} $..id ${registration_id} - ${response}= Update Context Source Registration With Return ${registration_id} ${fragment_with_id} + ${response}= Update Context Source Registration With Return ${registration_id} ${fragment_with_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 204 ${response['status']} [Teardown] Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot index 1068f5b2..d60abd5f 100644 --- a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot @@ -29,7 +29,7 @@ Update Context Source ${fragment}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${fragment_filename} ${fragment_with_id}= Update Value To Json ${fragment} $..id ${registration_id} - ${response}= Update Context Source Registration With Return ${registration_id} ${fragment_with_id} + ${response}= Update Context Source Registration With Return ${registration_id} ${fragment_with_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 400 ${response['status']} Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_03.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_03.robot index 9bdb1b5c..58d14bad 100644 --- a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_03.robot +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_03.robot @@ -15,7 +15,7 @@ Update a context source registration by id if the id is not known to the system ${registration_id}= Generate Random Entity Id ${registration_id_prefix} ${fragment}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${filename} ${fragment_with_id}= Update Value To Json ${fragment} $..id ${registration_id} - ${response}= Update Context Source Registration With Return ${registration_id} ${fragment_with_id} + ${response}= Update Context Source Registration With Return ${registration_id} ${fragment_with_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 404 ${response['status']} Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/data/csourceRegistrations/fragments/context-source-registration-update-sample.jsonld b/data/csourceRegistrations/fragments/context-source-registration-update-sample.jsonld new file mode 100644 index 00000000..795d209e --- /dev/null +++ b/data/csourceRegistrations/fragments/context-source-registration-update-sample.jsonld @@ -0,0 +1,6 @@ +{ + "endpoint":"http://my.new.csource.org:1026", + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/fragments/subscription-update-sample.jsonld b/data/csourceSubscriptions/fragments/subscription-update-sample.jsonld new file mode 100644 index 00000000..f721ed26 --- /dev/null +++ b/data/csourceSubscriptions/fragments/subscription-update-sample.jsonld @@ -0,0 +1,10 @@ +{ + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.second.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-fragment-brandname-sample.jsonld b/data/entities/fragmentEntities/vehicle-fragment-brandname-sample.jsonld new file mode 100644 index 00000000..cf7ce5ac --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-fragment-brandname-sample.jsonld @@ -0,0 +1,7 @@ +{ + "brandName": { + "type": "Property", + "value": "BMW" + }, + "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-fragment-equal-datasetid-sample.jsonld b/data/entities/fragmentEntities/vehicle-fragment-equal-datasetid-sample.jsonld index 9b220bf4..11dd4a9b 100644 --- a/data/entities/fragmentEntities/vehicle-fragment-equal-datasetid-sample.jsonld +++ b/data/entities/fragmentEntities/vehicle-fragment-equal-datasetid-sample.jsonld @@ -8,6 +8,5 @@ }, "datasetId": "urn:ngsi-ld:Property:speedometerA4567-speed" }, - "@context": - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" } \ No newline at end of file diff --git a/data/entities/vehicle-simple-attributes-sample.jsonld b/data/entities/vehicle-simple-attributes-sample.jsonld index 2da4522d..1c9a0d20 100644 --- a/data/entities/vehicle-simple-attributes-sample.jsonld +++ b/data/entities/vehicle-simple-attributes-sample.jsonld @@ -14,8 +14,5 @@ "object": "urn:ngsi-ld:Person:Bob" } }, - "@context": [ - "https://fiware.github.io/data-models/context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" - ] + "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" } \ No newline at end of file diff --git a/data/entities/vehicle-two-datasetid-attributes-sample.jsonld b/data/entities/vehicle-two-datasetid-attributes-sample.jsonld index 334902b0..3c575a10 100644 --- a/data/entities/vehicle-two-datasetid-attributes-sample.jsonld +++ b/data/entities/vehicle-two-datasetid-attributes-sample.jsonld @@ -32,7 +32,5 @@ }, "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" }], - "@context": [ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" - ] + "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" } \ No newline at end of file diff --git a/data/temporalEntities/fragments/vehicle-temporal-representation-fragment.jsonld b/data/temporalEntities/fragments/vehicle-temporal-representation-fragment.jsonld new file mode 100644 index 00000000..44298dd4 --- /dev/null +++ b/data/temporalEntities/fragments/vehicle-temporal-representation-fragment.jsonld @@ -0,0 +1,10 @@ +{ + "speed":[ + { + "type":"Property", + "value":129, + "observedAt":"2020-09-01T12:03:00Z" + } + ], + "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" +} \ No newline at end of file diff --git a/data/temporalEntities/vehicle-temporal-representation-sample.jsonld b/data/temporalEntities/vehicle-temporal-representation-sample.jsonld index 4f095bf1..e03f01be 100644 --- a/data/temporalEntities/vehicle-temporal-representation-sample.jsonld +++ b/data/temporalEntities/vehicle-temporal-representation-sample.jsonld @@ -17,11 +17,6 @@ "type":"Property", "value":80, "observedAt":"2020-09-01T12:05:00Z" - }, - { - "type":"Property", - "value":100, - "observedAt":"2020-09-01T12:07:00Z" } ], "fuelLevel":[ @@ -34,15 +29,7 @@ "type":"Property", "value":53, "observedAt":"2020-09-01T13:05:00Z" - }, - { - "type":"Property", - "value":40, - "observedAt":"2020-09-01T14:07:00Z" } ], - "@context":[ - "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" - ] + "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" } \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 14b75348..d4a0ee21 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -22,6 +22,7 @@ ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscript ${CONTENT_TYPE_JSON} application/json ${CONTENT_TYPE_LD_JSON} application/ld+json +${CONTENT_TYPE_MERGE_PATCH_JSON} application/merge-patch+json ${ERROR_TYPE_BAD_REQUEST_DATA} http://uri.etsi.org/ngsi-ld/errors/BadRequestData ${ERROR_TYPE_INVALID_REQUEST} http://uri.etsi.org/ngsi-ld/errors/InvalidRequest @@ -193,8 +194,8 @@ Create Context Source Registration Using Session [return] ${response} Update Context Source Registration With Return - [Arguments] ${registration_id} ${fragment} - &{headers}= Create Dictionary Content-Type=application/ld+json + [Arguments] ${registration_id} ${fragment} ${content_type} + &{headers}= Create Dictionary Content-Type=${content_type} ${response}= PATCH ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} body=${fragment} headers=${headers} ${request}= Output request Output response @@ -263,6 +264,24 @@ Create Temporal Representation Of Entity Selecting Content Type Output response [return] ${response} +Update Temporal Representation Of Entity Selecting Content Type + [Arguments] ${temporal_entity_representation_id} ${attrId} ${instanceId} ${fragment_filename} ${content_type} + ${temporal_entity_fragment}= Load Json From File ${EXECDIR}/data/temporalEntities/fragments/${fragment_filename} + &{headers}= Create Dictionary Content-Type=${content_type} + ${response}= PATCH ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id}/attrs/${attrId}/${instanceId} body=${temporal_entity_fragment} headers=${headers} + Output request + Output response + [return] ${response} + +Get Temporal Representation Of Entity + [Arguments] ${temporal_entity_representation_id} ${accept}=${CONTENT_TYPE_LD_JSON} + ${headers}= Create Dictionary + &{headers}= Create Dictionary Accept ${accept} + ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} headers=${headers} + Output request + Output response + [return] ${response} + Batch Create Entities [Arguments] @{entities_to_be_created} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${headers}= Create Dictionary @@ -461,3 +480,36 @@ Update Context Source Registration Subscription From File Create Session CsrsUpdateRequest ${url} ${response}= PATCH On Session CsrsUpdateRequest ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}/${subscription_id} data=${file_content} expected_status=any Set Test Variable ${response} + +Create Subscription + [Arguments] ${subscription_id} ${filename_path} ${content_type} + &{headers}= Create Dictionary Content-Type=${content_type} + ${subscription_payload}= Load Json From File ${EXECDIR}/data/${filename_path} + ${subscription}= Update Value To Json ${subscription_payload} $..id ${subscription_id} + ${response}= POST ${SUBSCRIPTION_ENDPOINT_PATH} body=${subscription} headers=${headers} + Output response + [return] ${response} + +Update Subscription + [Arguments] ${subscription_id} ${fragment_filename} ${content_type} + &{headers}= Create Dictionary Content-Type=${content_type} + ${subscription_update_fragment}= Load Json From File ${EXECDIR}/data/${fragment_filename} + ${response}= PATCH ${SUBSCRIPTION_ENDPOINT_PATH}${subscription_id} body=${subscription_update_fragment} headers=${headers} + Output request + Output response + [return] ${response} + +Delete Subscription + [Arguments] ${subscription_id} + ${response}= DELETE ${SUBSCRIPTION_ENDPOINT_PATH}${subscription_id} + Output request + Output response + [return] ${response} + +Update Context Source Registration Subscription By Selecting Content Type + [Arguments] ${subscription_id} ${subscription_update_fragment} ${content_type} + &{headers}= Create Dictionary Content-Type=${content_type} + ${response}= PATCH ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}/${subscription_id} body=${subscription_update_fragment} headers=${headers} + Output request + Output response + [return] ${response} \ No newline at end of file -- GitLab From a9520625fa16fc75f64c43f5a96adc6c632a1c70 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Thu, 4 Mar 2021 21:01:55 +0000 Subject: [PATCH 4/7] added common behaviours --- TP/NGSI-LD/CommonBehaviours/044_02.robot | 255 ++++++++++++--- TP/NGSI-LD/CommonBehaviours/044_03.robot | 297 +++++++++++++++--- TP/NGSI-LD/CommonBehaviours/044_04.robot | 212 ++++++++++--- TP/NGSI-LD/CommonBehaviours/044_05.robot | 144 ++++++--- .../Consumption/Entity/019_01_02.robot | 2 +- ...on-with-expiration-expectation-sample.json | 60 ++++ .../subscription-sample-expectation.json | 16 + data/entities/building-minimal-sample.jsonld | 3 +- .../building-simple-attributes-sample.jsonld | 3 +- ...sample-expectation-query-attributes.jsonld | 2 +- ...-simple-attributes-sample-expectation.json | 22 ++ ...imple-attributes-sample-expectation.jsonld | 2 +- .../vehicle-parking-sample-expectation.json | 54 ++++ .../vehicle-parking-sample-expectation.jsonld | 4 +- ...cle-fragment-empty-datasetid-sample.jsonld | 3 +- .../parking-simple-attributes-sample.jsonld | 3 +- ...vehicle-datasetid-attributes-sample.jsonld | 3 +- .../vehicle-simple-attributes-sample.jsonld | 3 +- ...e-temporal-representation-expectation.json | 44 +++ ...le-temporal-intanceid-update-sample.jsonld | 2 +- resources/ApiUtils.resource | 178 ++++++++--- resources/AssertionUtils.resource | 14 + 22 files changed, 1126 insertions(+), 200 deletions(-) create mode 100644 data/csourceRegistrations/expectations/registration-with-expiration-expectation-sample.json create mode 100644 data/csourceSubscriptions/expectations/subscription-sample-expectation.json create mode 100644 data/entities/expectations/building-simple-attributes-sample-expectation.json create mode 100644 data/entities/expectations/vehicle-parking-sample-expectation.json create mode 100644 data/temporalEntities/expectations/vehicle-temporal-representation-expectation.json diff --git a/TP/NGSI-LD/CommonBehaviours/044_02.robot b/TP/NGSI-LD/CommonBehaviours/044_02.robot index 0db0694c..bccd74d2 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_02.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_02.robot @@ -1,46 +1,229 @@ *** Settings *** -Documentation Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved +Documentation Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Suite Setup Generate Random Ids -Test Template Throw 503 LDContextNotAvaliable error - *** Variable *** -${expected_status_code}= 503 ${building_id_prefix}= urn:ngsi-ld:Building: -${registration_id_prefix}= urn:ngsi-ld:Registration: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${building_filename}= building-simple-attributes-sample.jsonld +${vehicle_filename}= vehicle-simple-attributes-sample.json +${building_expectation}= building-simple-attributes-sample-expectation.json +${entity_type}= https://ngsi-ld-test-suite/context#Building + ${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld +${subscription_expectation}= subscription-sample-expectation.json + +${types_expectation}= types/expectations/entity-type-list-022-01-01-expectation.json +${type_expectation}= types/expectations/entity-type-info-024-01-expectation.json + +${attributes_expectation}= types/expectations/attribute-list-025-01-01-expectation.json +${attribute_expectation}= types/expectations/attribute-027-01-expectation.json + +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_filename}= csourceRegistrations/registration-with-expiration-sample.jsonld +${registration_expectation}= registration-with-expiration-expectation-sample.json +${registration_type}= Vehicle + +${tea_id_prefix}= urn:ngsi-ld:Vehicle: +${tea_filename}= vehicle-temporal-representation-sample.jsonld +${tea_expectation}= vehicle-temporal-representation-expectation.json +${teatype}= Vehicle + + +*** Test Cases *** +044_02_01_endpoint /entities/ + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/entities/) + ${id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_compared}= Create List ${id} + ${entities_ids_to_be_retrieved}= Set Variable ${id} + + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${response}= Query Entities entity_ids=${entities_ids_to_be_retrieved} entity_types=${entity_types_to_be_retrieved} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing List Containing Entity elements ${building_expectation} ${entities_ids_to_be_compared} ${response['body']} + + [Teardown] Delete Entity by Id Returning Response ${id} + +044_02_02_endpoint /entities/{entityId} + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/entities/{entityId}) + ${id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Query Entity ${id} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing Entity element ${building_expectation} ${id} ${response['body']} + + [Teardown] Delete Entity by Id Returning Response ${id} + +044_02_03_endpoint /subscriptions/ + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/subscriptions/) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Query Subscriptions + Check Response Status Code 200 ${response['status']} + Check Response Body Containing One Subscription element ${subscription_expectation} ${response['body']} + + [Teardown] Delete Subscription ${id} + +044_02_04_endpoint /subscriptions/{subscriptionId} + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/subscriptions/{subscriptionId}) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Retrieve Subscription ${id} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing One Subscription element ${subscription_expectation} ${response['body']} + + [Teardown] Delete Subscription ${id} + +044_02_05_endpoint /types/ + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/types/) + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + + Create Entity Selecting Content Type ${building_filename} ${first_entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} + Create Entity Selecting Content Type ${vehicle_filename} ${second_entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} + + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + + Retrieve Entity Types context=${EMPTY} accept=${EMPTY} + + Check Response Status Code Set To 200 + Check Response Body Containing EntityTypeList element ${types_expectation} + + [Teardown] Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True + +044_02_06_endpoint /types/{type} + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/types/{type}) + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + + Create Entity Selecting Content Type ${building_filename} ${first_entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} + Create Entity Selecting Content Type ${building_filename} ${second_entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} -*** Test Cases *** ID DELETE_ID ENDPOINT FILENAME_PATH -043_01_endpoint /entities/ ${entity_id} ${entity_id} ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld -043_02_endpoint /csourceRegistrations/ ${csourceRegistration_id} ${csourceRegistration_id} ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld -043_03_endpoint /subscriptions/ ${subscription_id} ${subscription_id} ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -043_04_endpoint /csourceSubscriptions/ ${csourceSubscription_id} /${csourceSubscription_id} ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -043_05_endpoint /temporal/entities/ ${temporal_entity_id} /${temporal_entity_id} ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld - -*** Keywords *** -Throw 503 LDContextNotAvaliable error - [Arguments] ${id} ${delete_id} ${endpoint} ${filename_path} - [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved - [Tags] mandatory - - ${response}= Create Request By Selecting Endpoint ${id} ${endpoint} ${filename_path} - Check Response Status Code ${expected_status_code} ${response['status']} - Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} - Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + + Retrieve Entity Type type=Building context=${EMPTY} accept=${EMPTY} + + Check Response Status Code Set To 200 + Check Response Body Containing EntityTypeInfo element ${type_expectation} + + [Teardown] Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True + +044_02_07_endpoint /attributes/ + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/attributes/) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} + + Retrieve Attributes context=${EMPTY} accept=${EMPTY} + Check Response Status Code Set To 200 + Check Response Body Containing AttributeList element ${attributes_expectation} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_02_08_endpoint /attributes/{attrId} + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/attributes/{attrId}) - [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} - -Generate Random Ids - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${temporal_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${csourceRegistration_id}= Generate Random Entity Id ${registration_id_prefix} - ${csourceSubscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - Set Suite Variable ${entity_id} - Set Suite Variable ${temporal_entity_id} - Set Suite Variable ${csourceRegistration_id} - Set Suite Variable ${csourceSubscription_id} - Set Suite Variable ${subscription_id} \ No newline at end of file + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} + + Retrieve Attribute attribute_name=airQualityLevel context=${ngsild_test_suite_context} accept=${EMPTY} + Check Response Status Code Set To 200 + Check Response Body Containing Attribute element ${attribute_expectation} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_02_09_endpoint /csourceRegistrations/ + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceRegistrations/) + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load Json From File ${EXECDIR}/data/${registration_filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response['status']} + + Query Context Source Registrations id=${registration_id} type=${registration_type} + Check Response Status Code Set To 200 + Check Response Body Containing One Registration element ${registration_expectation} ${response['body']} + + [Teardown] Delete Context Source Registration ${registration_id} + +044_02_10_endpoint /csourceRegistrations/{registrationId} + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceRegistrations/{registrationId}) + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load Json From File ${EXECDIR}/data/${registration_filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response['status']} + + Retrieve Context Source Registration ${registration_id} + Check Response Status Code Set To 200 + Check Response Body Containing One Registration element ${registration_expectation} ${response['body']} + + [Teardown] Delete Context Source Registration ${registration_id} + +044_02_11_endpoint /csourceSubscriptions/ + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceSubscriptions/) + + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + + Query Context Source Registration Subscriptions + Check Response Status Code Set To 200 + Check Response Body Containing Subscription element ${subscription_expectation} ${subscription_id} + + [Teardown] Delete Context Source Registration Subscription ${subscription_id} + +044_02_12_endpoint /csourceSubscriptions/{subscriptionId} + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceSubscriptions/{subscriptionId}) + + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + + Retrieve Context Source Registration Subscription ${subscription_id} + Check Response Status Code Set To 200 + Check Response Body Containing Subscription element ${subscription_expectation} ${subscription_id} + + [Teardown] Delete Context Source Registration Subscription ${subscription_id} + +044_02_13_endpoint /temporal/entities + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/temporal/entities) + + ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + Create Temporal Representation Of Entity ${tea_filename} ${temporal_entity_representation_id} + + Query Temporal Representation Of Entities entity_types=${teatype} timerel=after timeAt=2020-08-01T12:05:00Z + Check Response Status Code Set To 200 + Check Response Body Containing EntityTemporal element ${tea_expectation} ${temporal_entity_representation_id} + + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} + +044_02_14_endpoint /temporal/entities/{entityId} + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/temporal/entities/{entityId}) + + ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + Create Temporal Representation Of Entity ${tea_filename} ${temporal_entity_representation_id} + + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} + Check Response Status Code Set To 200 + Check Response Body Containing EntityTemporal element ${tea_expectation} ${temporal_entity_representation_id} + + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/CommonBehaviours/044_03.robot b/TP/NGSI-LD/CommonBehaviours/044_03.robot index 0db0694c..02bdff5f 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_03.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_03.robot @@ -1,46 +1,269 @@ *** Settings *** -Documentation Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved +Documentation Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Suite Setup Generate Random Ids -Test Template Throw 503 LDContextNotAvaliable error - *** Variable *** -${expected_status_code}= 503 -${building_id_prefix}= urn:ngsi-ld:Building: -${registration_id_prefix}= urn:ngsi-ld:Registration: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_filename}= vehicle-datasetid-attributes-sample.jsonld +${vehicle_attribute}= speed +${vehicle_fragment}= vehicle-fragment-empty-datasetid-sample.jsonld + ${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld +${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.jsonld + +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_filename}= csourceRegistrations/registration-sample.jsonld +${registration_fragment}= csourceRegistrations/registration-with-expiration-sample.jsonld + +${tea_id_prefix}= urn:ngsi-ld:Vehicle: +${tea_filename}= vehicle-temporal-representation-sample.jsonld +${tea_fragment}= vehicle-temporal-intanceid-update-sample.jsonld +${tea_attribute}= speed +${tea_first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${tea_second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld + +${building_id_prefix}= urn:ngsi-ld:Building: +${building_filename}= building-simple-attributes-sample.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building + +*** Test Cases *** +044_03_01_endpoint patch /entities/{entityId}/attrs/ + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /entities/{entityId}/attrs/) + + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Update Entity Attributes ${entity_id} ${vehicle_fragment} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_03_02_endpoint patch /entities/{entityId}/attrs/{attrId} + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /entities/{entityId}/attrs/{attrId}) + + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Partial Update Entity Attributes ${entity_id} ${vehicle_attribute} ${vehicle_fragment} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_03_03_endpoint patch /subscriptions/{subscriptionId} + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /subscriptions/{subscriptionId}) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Update Subscription ${id} ${subscription_fragment} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Subscription ${id} -*** Test Cases *** ID DELETE_ID ENDPOINT FILENAME_PATH -043_01_endpoint /entities/ ${entity_id} ${entity_id} ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld -043_02_endpoint /csourceRegistrations/ ${csourceRegistration_id} ${csourceRegistration_id} ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld -043_03_endpoint /subscriptions/ ${subscription_id} ${subscription_id} ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -043_04_endpoint /csourceSubscriptions/ ${csourceSubscription_id} /${csourceSubscription_id} ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -043_05_endpoint /temporal/entities/ ${temporal_entity_id} /${temporal_entity_id} ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld - -*** Keywords *** -Throw 503 LDContextNotAvaliable error - [Arguments] ${id} ${delete_id} ${endpoint} ${filename_path} - [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved - [Tags] mandatory - - ${response}= Create Request By Selecting Endpoint ${id} ${endpoint} ${filename_path} - Check Response Status Code ${expected_status_code} ${response['status']} - Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} - Check Response Body Containing ProblemDetails Element Containing Title Element ${response} +044_03_04_endpoint patch /csourceRegistrations/{registrationId} + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /csourceRegistrations/{registrationId}) - [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} - -Generate Random Ids - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${temporal_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${csourceRegistration_id}= Generate Random Entity Id ${registration_id_prefix} - ${csourceSubscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - Set Suite Variable ${entity_id} - Set Suite Variable ${temporal_entity_id} - Set Suite Variable ${csourceRegistration_id} - Set Suite Variable ${csourceSubscription_id} - Set Suite Variable ${subscription_id} \ No newline at end of file + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load Json From File ${EXECDIR}/data/${registration_filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response['status']} + + ${response}= Update Context Source Registration With Return ${registration_id} ${registration_fragment} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Context Source Registration ${registration_id} + +044_03_05_endpoint patch /csourceSubscriptions/{subscriptionId} + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /csourceSubscriptions/{subscriptionId}) + + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + + ${subscription_update_fragment}= Load Test Sample ${subscription_fragment} + ${response}= Update Context Source Registration Subscription By Selecting Content Type ${subscription_id} ${subscription_update_fragment} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Context Source Registration Subscription ${subscription_id} + + +044_03_06_endpoint patch /temporal/entities/{entityId}/attrs/{attrId}/{instanceId} + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /temporal/entities/{entityId}/attrs/{attrId}/{instanceId}) + + ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + Set Suite Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} sysAttrs + ${instanceId}= Set Variable ${response['body']['https://ngsi-ld-test-suite/context#speed'][0]['instanceId']} + + ${response}= Partial Update Attribute From Temporal Entity ${temporal_entity_representation_id} ${tea_attribute} ${instanceId} ${tea_fragment} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} + + +044_03_07_endpoint post /entities/ + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entities/) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Entity by Id ${entity_id} + +044_03_08_endpoint post /entities/{entityId}/attrs/ + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entities/{entityId}/attrs/) + + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Append Entity Attributes ${entity_id} ${vehicle_fragment} ${EMPTY} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_03_09_endpoint post /subscriptions/ + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /subscriptions/) + + ${subscriptions_id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${subscriptions_id} ${subscription_filename} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Subscription ${subscriptions_id} + +044_03_10_endpoint post /csourceRegistrations/ + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /csourceRegistrations/) + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + + ${payload}= Load Json From File ${EXECDIR}/data/${registration_filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} content_type=${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Context Source Registration ${registration_id} + +044_03_11_endpoint post /csourceSubscriptions/ + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /csourceSubscriptions/) + + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} + ${request} ${response}= Create Context Source Registration Subscription With Return ${subscription_payload} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Context Source Registration Subscription ${subscription_id} + +044_03_12_endpoint post /entityOperations/create + + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/create) + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity ${building_filename} ${first_entity_id} + ${second_entity}= Load Entity ${building_filename} ${second_entity_id} + @{entities_to_be_created}= Create List ${first_entity} ${second_entity} + + Batch Create Entities @{entities_to_be_created} content_type=${EMPTY} + + @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + Check Response Status Code Set To 415 + + [Teardown] Batch Delete Entities @{expected_entities_ids} + + +044_03_13_endpoint post /entityOperations/upsert + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/upsert) + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity ${building_filename} ${first_entity_id} + ${second_entity}= Load Entity ${building_filename} ${second_entity_id} + @{entities_to_be_upserted}= Create List ${first_entity} ${second_entity} + @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + + Batch Upsert Entities By Selecting Content Type @{entities_to_be_upserted} ${EMPTY} + Check Response Status Code Set To 415 + + [Teardown] Batch Delete Entities @{expected_entities_ids} + +044_03_14_endpoint post /entityOperations/update + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/update) + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity building-simple-attributes-sample.jsonld ${first_entity_id} + Create Entity building-simple-attributes-sample.jsonld ${second_entity_id} + + ${first_entity}= Load Entity ${building_filename} ${first_entity_id} + ${second_entity}= Load Entity ${building_filename} ${second_entity_id} + @{entities_to_be_updated}= Create List ${first_entity} ${second_entity} + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + + Batch Update Entities @{entities_to_be_updated} ${EMPTY} + Check Response Status Code Set To 415 + + [Teardown] Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True + + +044_03_15_endpoint post /entityOperations/delete + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/delete) + + ${first_entity_id}= Generate Random Entity Id ${id_prefix} + ${second_entity_id}= Generate Random Entity Id ${id_prefix} + Create Entity ${building_filename} ${first_entity_id} + Create Entity ${building_filename} ${second_entity_id} + + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + Batch Delete Entities By Selecting Content Type @{entities_ids_to_be_deleted} ${EMPTY} + Check Response Status Code Set To 415 + +044_03_16_endpoint post /entityOperations/query + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/query) + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + Query Entity ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + ${entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${first_entity_id} ${second_entity_id} + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${response}= Query Entities Via POST entity_ids=${entities_ids_to_be_retrieved} entity_types=${entity_types_to_be_retrieved} content_type=${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True + +044_03_17_endpoint post /temporal/entities/ + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /temporal/entities/) + + ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} + +044_03_18_endpoint post /temporal/entityOperations/query + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /temporal/entityOperations/query) + + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + Create Temporal Representation Of Entity ${tea_first_vehicle_payload_file} ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity ${tea_second_vehicle_payload_file} ${second_temporal_entity_representation_id} + @{temporal_entity_representation_ids}= Create List ${first_temporal_entity_representation_id} ${second_temporal_entity_representation_id} + + Query Temporal Representation Of Entities Via Post entity-operations-after-query.jsonld ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Several Temporal Representations Of Entities @{temporal_entity_representation_ids} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_04.robot b/TP/NGSI-LD/CommonBehaviours/044_04.robot index 0db0694c..aa010577 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_04.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_04.robot @@ -1,46 +1,184 @@ *** Settings *** -Documentation Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved +Documentation Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Suite Setup Generate Random Ids -Test Template Throw 503 LDContextNotAvaliable error - *** Variable *** -${expected_status_code}= 503 +${accept}= application/xml +${status_code}= 406 + ${building_id_prefix}= urn:ngsi-ld:Building: -${registration_id_prefix}= urn:ngsi-ld:Registration: +${building_filename}= building-simple-attributes-sample.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building + ${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld + +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_filename}= csourceRegistrations/registration-sample.jsonld + +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_filename}= vehicle-datasetid-attributes-sample.jsonld +${vehicle_attribute}= speed + +${tea_id_prefix}= urn:ngsi-ld:Vehicle: +${tea_filename}= vehicle-temporal-representation-sample.jsonld + +*** Test Cases *** +044_04_01_endpoint get /entities/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /entities/) + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + ${entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${first_entity_id} ${second_entity_id} + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${response}= Query Entities entity_ids=${entities_ids_to_be_retrieved} entity_types=${entity_types_to_be_retrieved} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True + + +044_04_02_endpoint get /entities/{entityId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /entities/{entityId}) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Query Entity ${entity_id} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_04_03_endpoint get /subscriptions/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /subscriptions/) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Query Subscriptions accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Subscription ${id} + +044_04_04_endpoint get /subscriptions/{subscriptionId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /subscriptions/{subscriptionId}) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Retrieve Subscription ${id} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Subscription ${id} + +044_04_05_endpoint get /types/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /types/) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Retrieve Entity Types With Return ${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_04_06_endpoint get /types/{type} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /types/{type}) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Retrieve Entity Type With Return ${entity_type} ${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_04_07_endpoint get /attributes/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /attributes/) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + + ${response}= Retrieve Attributes With Return ${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_04_08_endpoint get /attributes/{attrId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /attributes/{attrId}) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${response}= Retrieve Attribute With Return airQualityLevel ${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_04_09_endpoint get /csourceRegistrations/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceRegistrations/) + + Query Context Source Registrations type=Building accept=${accept} + Check Response Status Code Set To ${status_code} + + +044_04_10_endpoint get /csourceRegistrations/{registrationId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceRegistrations/{registrationId}) + + ${context_source_registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample ${registration_filename} ${context_source_registration_id} + Create Context Source Registration ${context_source_registration_payload} + + + Retrieve Context Source Registration ${context_source_registration_id} accept=${accept} + Check Response Status Code Set To ${status_code} + + [Teardown] Delete Context Source Registration ${context_source_registration_id} + + +044_04_11_endpoint get /csourceSubscriptions/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceSubscriptions/) + + Query Context Source Registration Subscriptions accept=${accept} + Check Response Status Code Set To ${status_code} + +044_04_12_endpoint get /csourceSubscriptions/{subscriptionId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceSubscriptions/{subscriptionId}) + + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + + Retrieve Context Source Registration Subscription ${subscription_id} accept=${accept} + Check Response Status Code Set To ${status_code} + + [Teardown] Delete Context Source Registration Subscription ${subscription_id} + +044_04_13_endpoint get /temporal/entities + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /temporal/entities) + + @{entity_types_to_be_retrieved}= Create List Vehicle + Query Temporal Representation Of Entities entity_types=${entity_types_to_be_retrieved} timerel=after timeAt=2020-08-01T12:05:00Z accept=${accept} + Check Response Status Code Set To ${status_code} + +044_04_14_endpoint get /temporal/entities/{entityId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /temporal/entities/{entityId}) + + ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + Create Temporal Representation Of Entity ${tea_filename} ${temporal_entity_representation_id} + + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} accept=${accept} + Check Response Status Code Set To ${status_code} -*** Test Cases *** ID DELETE_ID ENDPOINT FILENAME_PATH -043_01_endpoint /entities/ ${entity_id} ${entity_id} ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld -043_02_endpoint /csourceRegistrations/ ${csourceRegistration_id} ${csourceRegistration_id} ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld -043_03_endpoint /subscriptions/ ${subscription_id} ${subscription_id} ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -043_04_endpoint /csourceSubscriptions/ ${csourceSubscription_id} /${csourceSubscription_id} ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -043_05_endpoint /temporal/entities/ ${temporal_entity_id} /${temporal_entity_id} ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld - -*** Keywords *** -Throw 503 LDContextNotAvaliable error - [Arguments] ${id} ${delete_id} ${endpoint} ${filename_path} - [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved - [Tags] mandatory - - ${response}= Create Request By Selecting Endpoint ${id} ${endpoint} ${filename_path} - Check Response Status Code ${expected_status_code} ${response['status']} - Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} - Check Response Body Containing ProblemDetails Element Containing Title Element ${response} - - [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} - -Generate Random Ids - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${temporal_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${csourceRegistration_id}= Generate Random Entity Id ${registration_id_prefix} - ${csourceSubscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - Set Suite Variable ${entity_id} - Set Suite Variable ${temporal_entity_id} - Set Suite Variable ${csourceRegistration_id} - Set Suite Variable ${csourceSubscription_id} - Set Suite Variable ${subscription_id} \ No newline at end of file + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_05.robot b/TP/NGSI-LD/CommonBehaviours/044_05.robot index 0db0694c..de22aa7c 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_05.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_05.robot @@ -1,46 +1,116 @@ *** Settings *** -Documentation Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved +Documentation Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Suite Setup Generate Random Ids -Test Template Throw 503 LDContextNotAvaliable error - *** Variable *** -${expected_status_code}= 503 +${accept}= application/geo+json +${status_code}= 406 + ${building_id_prefix}= urn:ngsi-ld:Building: -${registration_id_prefix}= urn:ngsi-ld:Registration: +${building_filename}= building-simple-attributes-sample.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building + ${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld +${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.json + +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_filename}= registration-sample.jsonld +${registration_fragment}= registration-with-expiration-sample.jsonld + +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_filename}= vehicle-datasetid-attributes-sample.jsonld +${vehicle_attribute}= speed + +${tea_id_prefix}= urn:ngsi-ld:Vehicle: +${tea_filename}= vehicle-temporal-representation-sample.jsonld + +*** comment *** +044_05_01_endpoint /subscriptions/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/subscriptions/) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Subscription ${id} + +044_05_02_endpoint /subscriptions/{subscriptionId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/subscriptions/{subscriptionId}) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + + ${response}= Update Subscription ${id} ${subscription_fragment} ${CONTENT_TYPE_LD_JSON} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Subscription ${id} + +#044_05_03_endpoint /types/ +# [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/types/) + +#044_05_04_endpoint /types/{type} +# [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/types/{type}) + +#044_05_05_endpoint /attributes/ +# [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/attributes/) + + +#044_05_06_endpoint /attributes/{attrId} +# [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/attributes/{attrId}) + +044_05_07_endpoint /csourceRegistrations/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/csourceRegistrations/) + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Context Source Registration ${registration_id} + + + +044_05_08_endpoint /csourceRegistrations/{registrationId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/csourceRegistrations/{registrationId}) + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response['status']} + + ${fragment}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_fragment} + ${fragment_with_id}= Update Value To Json ${fragment} $..id ${registration_id} + ${response}= Update Context Source Registration With Return ${registration_id} ${fragment_with_id} ${CONTENT_TYPE_LD_JSON} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Context Source Registration ${registration_id} + + +044_05_09_endpoint /csourceSubscriptions/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/csourceSubscriptions/) + + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} accept=${accept} + Check Response Status Code Set To ${status_code} + + [Teardown] Delete Context Source Registration Subscription ${subscription_id} + +*** Test Cases *** +044_05_10_endpoint /csourceSubscriptions/{subscriptionId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/csourceSubscriptions/{subscriptionId}) + + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + + ${subscription_update_fragment}= Load Test Sample ${subscription_fragment} + ${response}= Update Context Source Registration Subscription By Selecting Content Type ${subscription_id} ${subscription_update_fragment} ${CONTENT_TYPE_LD_JSON} #accept=${accept} + Check Response Status Code ${status_code} ${response['status']} -*** Test Cases *** ID DELETE_ID ENDPOINT FILENAME_PATH -043_01_endpoint /entities/ ${entity_id} ${entity_id} ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld -043_02_endpoint /csourceRegistrations/ ${csourceRegistration_id} ${csourceRegistration_id} ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld -043_03_endpoint /subscriptions/ ${subscription_id} ${subscription_id} ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -043_04_endpoint /csourceSubscriptions/ ${csourceSubscription_id} /${csourceSubscription_id} ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -043_05_endpoint /temporal/entities/ ${temporal_entity_id} /${temporal_entity_id} ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld - -*** Keywords *** -Throw 503 LDContextNotAvaliable error - [Arguments] ${id} ${delete_id} ${endpoint} ${filename_path} - [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved - [Tags] mandatory - - ${response}= Create Request By Selecting Endpoint ${id} ${endpoint} ${filename_path} - Check Response Status Code ${expected_status_code} ${response['status']} - Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} - Check Response Body Containing ProblemDetails Element Containing Title Element ${response} - - [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} - -Generate Random Ids - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${temporal_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${csourceRegistration_id}= Generate Random Entity Id ${registration_id_prefix} - ${csourceSubscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - Set Suite Variable ${entity_id} - Set Suite Variable ${temporal_entity_id} - Set Suite Variable ${csourceRegistration_id} - Set Suite Variable ${csourceSubscription_id} - Set Suite Variable ${subscription_id} \ No newline at end of file + [Teardown] Delete Context Source Registration Subscription ${subscription_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_02.robot index a4cbc5f3..0ba110b1 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_02.robot @@ -11,7 +11,7 @@ ${parking_id_prefix}= urn:ngsi-ld:OffStreetParking: ${building_filename}= building-minimal-sample.jsonld ${vehicle_filename}= vehicle-simple-attributes-sample.jsonld ${parking_filename}= parking-simple-attributes-sample.jsonld -${expectation_filename}= vehicle-parking-sample-expectation.jsonld +${expectation_filename}= vehicle-parking-sample-expectation.json ${building_entity_type}= https://ngsi-ld-test-suite/context#Building ${vehicle_entity_type}= https://ngsi-ld-test-suite/context#Vehicle ${parking_entity_type}= https://ngsi-ld-test-suite/context#OffStreetParking diff --git a/data/csourceRegistrations/expectations/registration-with-expiration-expectation-sample.json b/data/csourceRegistrations/expectations/registration-with-expiration-expectation-sample.json new file mode 100644 index 00000000..ee6679e4 --- /dev/null +++ b/data/csourceRegistrations/expectations/registration-with-expiration-expectation-sample.json @@ -0,0 +1,60 @@ + { + "id": "urn:ngsi-ld:Registration:randomUUID", + "type": "ContextSourceRegistration", + "timestamp": {}, + "endpoint": "http://my.csource.org:1026", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Registration:3911535208644330", + "type": "Vehicle" + } + ], + "ngsi-ld:properties": [], + "ngsi-ld:relationships": [] + }, + { + "entities": [ + { + "type": "OffStreetParking", + "idPattern": ".*downtown$" + }, + { + "type": "OffStreetParking", + "idPattern": ".*47$" + } + ], + "ngsi-ld:properties": [], + "ngsi-ld:relationships": [] + } + ], + "ngsi-ld:internal": false, + "location": { + "type": "Polygon", + "coordinates": [ + [ + [ + 100.0, + 0.0 + ], + [ + 101.0, + 0.0 + ], + [ + 101.0, + 1.0 + ], + [ + 100.0, + 1.0 + ], + [ + 100.0, + 0.0 + ] + ] + ] + } + } \ No newline at end of file diff --git a/data/csourceSubscriptions/expectations/subscription-sample-expectation.json b/data/csourceSubscriptions/expectations/subscription-sample-expectation.json new file mode 100644 index 00000000..42d6c58f --- /dev/null +++ b/data/csourceSubscriptions/expectations/subscription-sample-expectation.json @@ -0,0 +1,16 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type": "Subscription", + "entities": [ + { + "type": "https://ngsi-ld-test-suite/context#Building" + } + ], + "notification": { + "endpoint": { + "accept": "application/json", + "uri": "http://my.endpoint.org/notify" + }, + "format": "keyValues" + } +} \ No newline at end of file diff --git a/data/entities/building-minimal-sample.jsonld b/data/entities/building-minimal-sample.jsonld index 2af764ed..e49a2c9a 100644 --- a/data/entities/building-minimal-sample.jsonld +++ b/data/entities/building-minimal-sample.jsonld @@ -2,7 +2,6 @@ "id": "urn:ngsi-ld:Building:randomUUID", "type": "Building", "@context": [ - "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" ] } \ No newline at end of file diff --git a/data/entities/building-simple-attributes-sample.jsonld b/data/entities/building-simple-attributes-sample.jsonld index e4394e7c..821498e6 100644 --- a/data/entities/building-simple-attributes-sample.jsonld +++ b/data/entities/building-simple-attributes-sample.jsonld @@ -20,7 +20,6 @@ "value": false }, "@context": [ - "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" ] } \ No newline at end of file diff --git a/data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld b/data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld index 93f2fb86..6f8083d0 100644 --- a/data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld +++ b/data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld @@ -12,6 +12,6 @@ "value": "tourism" }, "@context": [ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" ] } \ No newline at end of file diff --git a/data/entities/expectations/building-simple-attributes-sample-expectation.json b/data/entities/expectations/building-simple-attributes-sample-expectation.json new file mode 100644 index 00000000..f23a0d02 --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-sample-expectation.json @@ -0,0 +1,22 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://ngsi-ld-test-suite/context#Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "https://ngsi-ld-test-suite/context#airQualityLevel": { + "type": "Property", + "value": 4, + "observedAt": "2020-09-09T16:40:00.000Z", + "unitCode": "C62" + }, + "https://ngsi-ld-test-suite/context#almostFull": { + "type": "Property", + "value": false + }, + "https://ngsi-ld-test-suite/context#subCategory": { + "type": "Property", + "value": "tourism" + } +} \ No newline at end of file diff --git a/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld b/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld index 35862406..fb18f016 100644 --- a/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld +++ b/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld @@ -20,6 +20,6 @@ "value": "tourism" }, "@context": [ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" ] } \ No newline at end of file diff --git a/data/entities/expectations/vehicle-parking-sample-expectation.json b/data/entities/expectations/vehicle-parking-sample-expectation.json new file mode 100644 index 00000000..0205a53f --- /dev/null +++ b/data/entities/expectations/vehicle-parking-sample-expectation.json @@ -0,0 +1,54 @@ +[ + { + "id": "urn:ngsi-ld:OffStreetParking:randomUUID", + "type": "https://ngsi-ld-test-suite/context#OffStreetParking", + "availableSpotNumber": { + "type": "Property", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Camera:C1" + }, + "reliability": { + "type": "Property", + "value": 0.7 + }, + "value": 121, + "observedAt": "2017-07-29T12:05:02Z" + }, + "totalSpotNumber": { + "type": "Property", + "value": 200 + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + -8.5, + 41.2 + ] + } + }, + "name": { + "type": "Property", + "value": "Downtown One" + } + }, + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "https://ngsi-ld-test-suite/context#Vehicle", + "https://ngsi-ld-test-suite/context#brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + }, + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z" + } + } +] \ No newline at end of file diff --git a/data/entities/expectations/vehicle-parking-sample-expectation.jsonld b/data/entities/expectations/vehicle-parking-sample-expectation.jsonld index 3eb294f5..363e4eee 100644 --- a/data/entities/expectations/vehicle-parking-sample-expectation.jsonld +++ b/data/entities/expectations/vehicle-parking-sample-expectation.jsonld @@ -1,6 +1,6 @@ [ { - "id": "urn:ngsi-ld:OffStreetParking:1149507078845158", + "id": "urn:ngsi-ld:OffStreetParking:randomUUID", "type": "https://uri.fiware.org/ns/data-models#OffStreetParking", "location": { "type": "GeoProperty", @@ -38,7 +38,7 @@ ] }, { - "id": "urn:ngsi-ld:Vehicle:8601152883544931", + "id": "urn:ngsi-ld:Vehicle:randomUUID", "type": "https://uri.fiware.org/ns/data-models#Vehicle", "isParked": { "type": "Relationship", diff --git a/data/entities/fragmentEntities/vehicle-fragment-empty-datasetid-sample.jsonld b/data/entities/fragmentEntities/vehicle-fragment-empty-datasetid-sample.jsonld index af875bdd..4cfc15e3 100644 --- a/data/entities/fragmentEntities/vehicle-fragment-empty-datasetid-sample.jsonld +++ b/data/entities/fragmentEntities/vehicle-fragment-empty-datasetid-sample.jsonld @@ -8,7 +8,6 @@ } }, "@context": [ - "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" ] } \ No newline at end of file diff --git a/data/entities/parking-simple-attributes-sample.jsonld b/data/entities/parking-simple-attributes-sample.jsonld index 385f1929..982cfb89 100644 --- a/data/entities/parking-simple-attributes-sample.jsonld +++ b/data/entities/parking-simple-attributes-sample.jsonld @@ -30,7 +30,6 @@ } }, "@context": [ - "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" ] } \ No newline at end of file diff --git a/data/entities/vehicle-datasetid-attributes-sample.jsonld b/data/entities/vehicle-datasetid-attributes-sample.jsonld index c5298899..6f0a34e5 100644 --- a/data/entities/vehicle-datasetid-attributes-sample.jsonld +++ b/data/entities/vehicle-datasetid-attributes-sample.jsonld @@ -33,7 +33,6 @@ "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" }], "@context": [ - "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" ] } \ No newline at end of file diff --git a/data/entities/vehicle-simple-attributes-sample.jsonld b/data/entities/vehicle-simple-attributes-sample.jsonld index 556d5af4..0553c272 100644 --- a/data/entities/vehicle-simple-attributes-sample.jsonld +++ b/data/entities/vehicle-simple-attributes-sample.jsonld @@ -15,7 +15,6 @@ } }, "@context": [ - "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" ] } \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-expectation.json b/data/temporalEntities/expectations/vehicle-temporal-representation-expectation.json new file mode 100644 index 00000000..7917df3c --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-expectation.json @@ -0,0 +1,44 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type": "https://ngsi-ld-test-suite/context#Vehicle", + "https://ngsi-ld-test-suite/context#brandName": { + "type": "Property", + "value": "BMW", + "instanceId": "urn:ngsi-ld:76739600-3d5c-4cfd-939d-34742a13b52d" + }, + "https://ngsi-ld-test-suite/context#fuelLevel": [ + { + "type": "Property", + "datasetId": "urn:ngsi-ld:Vehicle:12345-fuel", + "value": 40, + "instanceId": "urn:ngsi-ld:0f6e7514-e3ed-46a6-9e9f-6bb02ff687bf", + "observedAt": "2020-09-01T14:07:00Z" + }, + { + "type": "Property", + "value": 53, + "instanceId": "urn:ngsi-ld:59ebe244-14d6-4428-87e1-cd313748125c", + "observedAt": "2020-09-01T13:05:00Z" + }, + { + "type": "Property", + "value": 67, + "instanceId": "urn:ngsi-ld:8bfeea42-8ed3-4d4e-a942-c389229bd6ff", + "observedAt": "2020-09-01T12:03:00Z" + } + ], + "https://ngsi-ld-test-suite/context#speed": [ + { + "type": "Property", + "value": 120, + "instanceId": "urn:ngsi-ld:ec47b86f-656e-4182-b1c2-fbe5af5b4862", + "observedAt": "2020-09-01T12:03:00Z" + }, + { + "type": "Property", + "value": 80, + "instanceId": "urn:ngsi-ld:f3ffc7ad-e562-4081-bd8a-5dda92ab0ffd", + "observedAt": "2020-09-01T12:05:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/fragments/vehicle-temporal-intanceid-update-sample.jsonld b/data/temporalEntities/fragments/vehicle-temporal-intanceid-update-sample.jsonld index 60e19dde..d7433ad6 100644 --- a/data/temporalEntities/fragments/vehicle-temporal-intanceid-update-sample.jsonld +++ b/data/temporalEntities/fragments/vehicle-temporal-intanceid-update-sample.jsonld @@ -7,6 +7,6 @@ } ], "@context":[ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" ] } \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index fdadc5cd..745a2d28 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -49,12 +49,13 @@ Delete Entity by Id Output response Query Entity - [Arguments] ${id} ${accept} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${options}=${EMPTY} + [Arguments] ${id} ${accept}=${EMPTY} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${options}=${EMPTY} ${attrs_length} = Get Length ${attrs} + ${accept_length} = Get Length ${accept} ${options_length} = Get Length ${options} &{headers}= Create Dictionary &{params}= Create Dictionary - Set To Dictionary ${headers} Accept ${accept} + Run Keyword If ${accept_length}>0 Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type=${accept} Run Keyword If ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} Run Keyword If '${geoproperty}'!='' Set To Dictionary ${params} geoproperty=${geoproperty} @@ -66,14 +67,15 @@ Query Entity [return] ${response} Query Entities - [Arguments] ${entity_ids}=${EMPTY} ${entity_types}=${EMPTY} ${accept}=${CONTENT_TYPE_LD_JSON} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${options}=${EMPTY} ${limit}=${EMPTY} ${entity_id_pattern}=${EMPTY} + [Arguments] ${entity_ids}=${EMPTY} ${entity_types}=${EMPTY} ${accept}=${EMPTY} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${options}=${EMPTY} ${limit}=${EMPTY} ${entity_id_pattern}=${EMPTY} ${attrs_length} = Get Length ${attrs} + ${accept_length} = Get Length ${accept} ${options_length} = Get Length ${options} ${entity_ids_length} = Get Length ${entity_ids} ${entity_types_length} = Get Length ${entity_types} &{headers}= Create Dictionary &{params}= Create Dictionary - Set To Dictionary ${headers} Accept ${accept} + Run Keyword If ${accept_length}>0 Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type=${accept} Run Keyword If ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} Run Keyword If '${geoproperty}'!='' Set To Dictionary ${params} geoproperty=${geoproperty} @@ -180,22 +182,24 @@ Partial Update Entity Attributes [return] ${response} Retrieve Entity Types - [Arguments] ${context}=${EMPTY} ${details}=${FALSE} + [Arguments] ${context}=${EMPTY} ${details}=${FALSE} ${accept}=${EMPTY} &{headers}= Create Dictionary &{params}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" Run Keyword If ${details} Set To Dictionary ${params} details=${details} - ${response}= GET ${ENTITIES_TYPES_ENDPOINT_PATH} headers=${headers} query=${params} + ${response}= GET ${ENTITIES_TYPES_ENDPOINT_PATH}/ headers=${headers} query=${params} Output request Output response Set Test Variable ${response} Retrieve Entity Type - [Arguments] ${type} ${context}=${EMPTY} + [Arguments] ${type} ${context}=${EMPTY} ${accept}=${EMPTY} &{headers}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${response}= GET ${ENTITIES_TYPES_ENDPOINT_PATH}/${type} headers=${headers} Output request @@ -204,10 +208,11 @@ Retrieve Entity Type Set Test Variable ${response} Retrieve Attributes - [Arguments] ${context}=${EMPTY} ${details}=${FALSE} + [Arguments] ${context}=${EMPTY} ${details}=${FALSE} ${accept}=${EMPTY} &{headers}= Create Dictionary &{params}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" Run Keyword If ${details} Set To Dictionary ${params} details=${details} ${response}= GET ${ATTRIBUTES_ENDPOINT_PATH} headers=${headers} query=${params} @@ -217,9 +222,10 @@ Retrieve Attributes Set Test Variable ${response} Retrieve Attribute - [Arguments] ${attribute_name} ${context}=${EMPTY} + [Arguments] ${attribute_name} ${context}=${EMPTY} ${accept}=${EMPTY} &{headers}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${response}= GET ${ATTRIBUTES_ENDPOINT_PATH}/${attribute_name} headers=${headers} Output request @@ -228,8 +234,9 @@ Retrieve Attribute Set Test Variable ${response} Create Context Source Registration With Return - [Arguments] ${payload} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} + [Arguments] ${payload} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${accept}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept=${context} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${response}= POST ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} body=${payload} headers=${headers} ${request}= Output request @@ -246,8 +253,9 @@ Create Context Source Registration Using Session [return] ${response} Update Context Source Registration With Return - [Arguments] ${registration_id} ${fragment} ${content_type} + [Arguments] ${registration_id} ${fragment} ${content_type} ${accept}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} ${response}= PATCH ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} body=${fragment} headers=${headers} ${request}= Output request Output response @@ -368,11 +376,18 @@ Delete Temporal Representation Of Entity With Returning Response Output response [return] ${response} +Delete Several Temporal Representations Of Entities + [Arguments] @{temporal_entity_representation_ids} + FOR ${temporal_entity_representation_id} IN @{temporal_entity_representation_ids} + Delete Temporal Representation Of Entity With Returning Response ${temporal_entity_representation_id} + END + Get Temporal Representation Of Entity - [Arguments] ${temporal_entity_representation_id} ${content_type} ${options}=${EMPTY} - &{headers}= Create Dictionary Content-Type=${content_type} + [Arguments] ${temporal_entity_representation_id} ${accept}=${EMPTY} ${options}=${EMPTY} + &{headers}= Create Dictionary &{params}= Create Dictionary ${options_length} = Get Length ${options} + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} Run Keyword If ${options_length}>0 Set To Dictionary ${params} options=${options} ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} headers=${headers} query=${params} Output request @@ -395,15 +410,6 @@ Update Temporal Representation Of Entity Selecting Content Type Output response [return] ${response} -Get Temporal Representation Of Entity - [Arguments] ${temporal_entity_representation_id} ${accept}=${CONTENT_TYPE_LD_JSON} - ${headers}= Create Dictionary - &{headers}= Create Dictionary Accept ${accept} - ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} headers=${headers} - Output request - Output response - [return] ${response} - Batch Create Entities [Arguments] @{entities_to_be_created} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${headers}= Create Dictionary @@ -466,12 +472,13 @@ Create Temporal Representation Of Entity Output response Retrieve Temporal Representation Of Entity - [Arguments] ${temporal_entity_representation_id} ${attrs}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} ${timerel}=${EMPTY} ${timeAt}=${EMPTY} ${endTimeAt}=${EMPTY} ${lastN}=${EMPTY} + [Arguments] ${temporal_entity_representation_id} ${attrs}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} ${timerel}=${EMPTY} ${timeAt}=${EMPTY} ${endTimeAt}=${EMPTY} ${lastN}=${EMPTY} ${accept}=${EMPTY} ${attrs_length} = Get Length ${attrs} ${options_length} = Get Length ${options} &{headers}= Create Dictionary &{params}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" Run Keyword If ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} Run Keyword If ${options_length}>0 Set To Dictionary ${params} options=${options} @@ -486,12 +493,13 @@ Retrieve Temporal Representation Of Entity Set Test Variable ${response} Query Temporal Representation Of Entities - [Arguments] ${context}=${EMPTY} ${entity_types}=${EMPTY} ${entity_ids}=${EMPTY} ${entity_id_pattern}=${EMPTY} ${ngsild_query}=${EMPTY} ${csf}=${EMPTY} ${georel}=${EMPTY} ${geometry}=${EMPTY} ${coordinates}=${EMPTY} ${geoproperty}=${EMPTY} ${timerel}=${EMPTY} ${timeAt}=${EMPTY} ${attrs}=${EMPTY} ${limit}=${EMPTY} ${lastN}=${EMPTY} + [Arguments] ${context}=${EMPTY} ${entity_types}=${EMPTY} ${entity_ids}=${EMPTY} ${entity_id_pattern}=${EMPTY} ${ngsild_query}=${EMPTY} ${csf}=${EMPTY} ${georel}=${EMPTY} ${geometry}=${EMPTY} ${coordinates}=${EMPTY} ${geoproperty}=${EMPTY} ${timerel}=${EMPTY} ${timeAt}=${EMPTY} ${attrs}=${EMPTY} ${limit}=${EMPTY} ${lastN}=${EMPTY} ${accept}=${EMPTY} ${entity_types_length} = Get Length ${entity_types} ${entity_ids_length} = Get Length ${entity_ids} ${attrs_length} = Get Length ${attrs} &{headers}= Create Dictionary &{params}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" Run Keyword If ${entity_types_length}>0 Set To Dictionary ${params} type=${entity_types} Run Keyword If ${entity_ids_length}>0 Set To Dictionary ${params} id=${entity_ids} @@ -514,9 +522,9 @@ Query Temporal Representation Of Entities Set Test Variable ${response} Query Temporal Representation Of Entities Via Post - [Arguments] ${query_file_name} + [Arguments] ${query_file_name} ${content_type}=${CONTENT_TYPE_LD_JSON} ${headers}= Create Dictionary - Set To Dictionary ${headers} Content-Type ${CONTENT_TYPE_LD_JSON} + Set To Dictionary ${headers} Content-Type ${content_type} ${query_payload}= Load Json From File ${EXECDIR}/data/temporalEntities/${query_file_name} ${response}= POST ${TEMPORAL_ENTITY_OPERATIONS_ENDPOINT_PATH}/query body=${query_payload} headers=${headers} Output request @@ -551,11 +559,12 @@ Update Context Source Registration Set Test Variable ${response} Query Context Source Registrations - [Arguments] ${context}=${EMPTY} ${id}=${EMPTY} ${type}=${EMPTY} ${attrs}=${EMPTY} ${q}=${EMPTY} ${georel}=${EMPTY} ${geometry}=${EMPTY} ${coordinates}=${EMPTY} ${geoproperty}=${EMPTY} ${timeproperty}=${EMPTY} ${timerel}=${EMPTY} ${timeAt}=${EMPTY} ${limit}=${EMPTY} ${page}=${EMPTY} + [Arguments] ${context}=${EMPTY} ${id}=${EMPTY} ${type}=${EMPTY} ${attrs}=${EMPTY} ${q}=${EMPTY} ${georel}=${EMPTY} ${geometry}=${EMPTY} ${coordinates}=${EMPTY} ${geoproperty}=${EMPTY} ${timeproperty}=${EMPTY} ${timerel}=${EMPTY} ${timeAt}=${EMPTY} ${limit}=${EMPTY} ${page}=${EMPTY} ${accept}=${EMPTY} &{headers}= Create Dictionary &{params}= Create Dictionary Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} accept=${accept} Run Keyword If '${id}'!='' Set To Dictionary ${params} id=${id} Run Keyword If '${type}'!='' Set To Dictionary ${params} type=${type} Run Keyword If '${attrs}'!='' Set To Dictionary ${params} attrs=${attrs} @@ -586,9 +595,10 @@ Delete Context Source Registration Set Suite Variable ${response} Retrieve Context Source Registration - [Arguments] ${context_source_registration_id} ${context}=${EMPTY} + [Arguments] ${context_source_registration_id} ${context}=${EMPTY} ${accept}=${EMPTY} &{headers}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${response}= GET ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} headers=${headers} Output request @@ -597,9 +607,10 @@ Retrieve Context Source Registration Set Test Variable ${response} Create Context Source Registration Subscription - [Arguments] ${subscription_payload} + [Arguments] ${subscription_payload} ${accept}=${EMPTY} &{headers}= Create Dictionary Content-Type=application/ld+json + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} ${response}= POST ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} body=${subscription_payload} headers=${headers} ${request}= Output request Output response @@ -617,9 +628,10 @@ Update Context Source Registration Subscription Set Test Variable ${response} Retrieve Context Source Registration Subscription - [Arguments] ${subscription_id} ${context}=${EMPTY} + [Arguments] ${subscription_id} ${context}=${EMPTY} ${accept}=${EMPTY} &{headers}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${response}= GET ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}/${subscription_id} headers=${headers} Output request @@ -628,10 +640,11 @@ Retrieve Context Source Registration Subscription Set Test Variable ${response} Query Context Source Registration Subscriptions - [Arguments] ${context}=${EMPTY} ${limit}=${EMPTY} ${page}=${EMPTY} + [Arguments] ${context}=${EMPTY} ${limit}=${EMPTY} ${page}=${EMPTY} ${accept}=${EMPTY} &{headers}= Create Dictionary &{params}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" Run Keyword If '${limit}'!='' Set To Dictionary ${params} limit=${limit} Run Keyword If '${page}'!='' Set To Dictionary ${params} page=${page} @@ -659,17 +672,20 @@ Update Context Source Registration Subscription From File Set Test Variable ${response} Create Subscription - [Arguments] ${subscription_id} ${filename_path} ${content_type} + [Arguments] ${subscription_id} ${filename_path} ${content_type} ${accept}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} ${subscription_payload}= Load Json From File ${EXECDIR}/data/${filename_path} ${subscription}= Update Value To Json ${subscription_payload} $..id ${subscription_id} ${response}= POST ${SUBSCRIPTION_ENDPOINT_PATH} body=${subscription} headers=${headers} + Output request Output response [return] ${response} Update Subscription - [Arguments] ${subscription_id} ${fragment_filename} ${content_type} + [Arguments] ${subscription_id} ${fragment_filename} ${content_type} ${accept}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} ${subscription_update_fragment}= Load Json From File ${EXECDIR}/data/${fragment_filename} ${response}= PATCH ${SUBSCRIPTION_ENDPOINT_PATH}${subscription_id} body=${subscription_update_fragment} headers=${headers} Output request @@ -683,10 +699,102 @@ Delete Subscription Output response [return] ${response} +Query Subscriptions + [Arguments] ${limit}=${EMPTY} ${accept}=${EMPTY} + &{headers}= Create Dictionary + &{params}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} + Run Keyword If '${limit}'!='' Set To Dictionary ${params} limit=${limit} + + ${response}= GET ${SUBSCRIPTION_ENDPOINT_PATH} headers=${headers} query=${params} + Output request + Output response + [return] ${response} + +Retrieve Subscription + [Arguments] ${id} ${accept}=${EMPTY} + &{headers}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} + + ${response}= GET ${SUBSCRIPTION_ENDPOINT_PATH}${id} headers=${headers} + Output request + Output response + [return] ${response} + Update Context Source Registration Subscription By Selecting Content Type - [Arguments] ${subscription_id} ${subscription_update_fragment} ${content_type} + [Arguments] ${subscription_id} ${subscription_update_fragment} ${content_type} ${accept}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} ${response}= PATCH ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}/${subscription_id} body=${subscription_update_fragment} headers=${headers} Output request Output response - [return] ${response} \ No newline at end of file + [return] ${response} + +Retrieve Entity Types With Return + [Arguments] ${accept}=${EMPTY} + &{headers}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} + ${response}= GET ${ENTITIES_TYPES_ENDPOINT_PATH} headers=${headers} + Output request + Output response + [return] ${response} + +Retrieve Entity Type With Return + [Arguments] ${type} ${accept}=${EMPTY} + &{headers}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} + ${response}= GET ${ENTITIES_TYPES_ENDPOINT_PATH}/${type} headers=${headers} + Output request + Output response + [return] ${response} + +Retrieve Attributes With Return + [Arguments] ${accept}=${EMPTY} + &{headers}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} + ${response}= GET ${ATTRIBUTES_ENDPOINT_PATH} headers=${headers} + Output request + Output response + [return] ${response} + +Retrieve Attribute With Return + [Arguments] ${attribute_name} ${accept}=${EMPTY} + &{headers}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} + ${response}= GET ${ATTRIBUTES_ENDPOINT_PATH}/${attribute_name} headers=${headers} + Output request + Output response + [return] ${response} + +Create Context Source Registration Subscription With Return + [Arguments] ${subscription_payload} ${content_type} + &{headers}= Create Dictionary Content-Type=${content_type} + ${response}= POST ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} body=${subscription_payload} headers=${headers} + ${request}= Output request + Output ${response} + [return] ${request} ${response} + +Batch Upsert Entities By Selecting Content Type + [Arguments] @{entities_to_be_upserted} ${content_type}=${CONTENT_TYPE_LD_JSON} ${update_option}=replace + &{headers}= Create Dictionary Content-Type=${content_type} + ${response}= POST ${BATCH_UPSERT_ENDPOINT_PATH}?options=${update_option} body=@{entities_to_be_upserted} headers=${headers} + Output request + Output response + Set Test Variable ${response} + +Batch Update Entities By Selecting Content Type + [Arguments] @{entities_to_be_updated} ${content_type}=${CONTENT_TYPE_LD_JSON} ${overwrite_option}=overwrite + &{headers}= Create Dictionary Content-Type=${content_type} + ${response}= POST ${BATCH_UPDATE_ENDPOINT_PATH}?options=${overwrite_option} body=@{entities_to_be_updated} headers=${headers} + Output request + Output response + Set Test Variable ${response} + +Batch Delete Entities By Selecting Content Type + [Arguments] @{entities_ids_to_be_deleted} ${content_type}=${CONTENT_TYPE_LD_JSON} ${teardown}=False + &{headers}= Create Dictionary Content-Type=${content_type} + ${response}= POST ${BATCH_DELETE_ENDPOINT_PATH} body=@{entities_ids_to_be_deleted} headers=${headers} + Output request + Output response + Run Keyword If not ${teardown} Set Test Variable ${response} + Set Test Variable ${response} \ No newline at end of file diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 60545bf1..ae045c3d 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -285,3 +285,17 @@ Check Pagination Prev And Next Headers Run Keyword If '${prev_link}'!='' and '${next_link}'!='' Lists Should Be Equal ${response['headers']['Link']} ${expected_links} ignore_order=True Run Keyword If '${prev_link}'!='' and '${next_link}'=='' Should Be Equal ${response['headers']['Link']} ${prev_link} Run Keyword If '${prev_link}'=='' and '${next_link}'!='' Should Be Equal ${response['headers']['Link']} ${next_link} + +Check Response Body Containing One Subscription element + [Arguments] ${expectation_filename} ${response_body} + ${payload}= Load Json From File ${EXECDIR}/data/csourceSubscriptions/expectations/${expectation_filename} + ${subscription}= Update Value To Json ${payload} $..id ${response_body['id']} + ${comparison_result}= Compare Dictionaries Ignoring Keys ${response_body} ${subscription} ${instance_id_regex_expr} + Should Be True ${comparison_result} msg=Entity Comparison Failed + +Check Response Body Containing One Registration element + [Arguments] ${expectation_filename} ${response_body} + ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/expectations/${expectation_filename} + ${subscription}= Update Value To Json ${payload} $..id ${response_body['id']} + ${comparison_result}= Compare Dictionaries Ignoring Keys ${response_body} ${subscription} ${instance_id_regex_expr} + Should Be True ${comparison_result} msg=Entity Comparison Failed \ No newline at end of file -- GitLab From eb65009857fca256b49ec179e01d25479959f075 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Thu, 11 Mar 2021 15:33:37 +0000 Subject: [PATCH 5/7] refactored common behaviors --- TP/NGSI-LD/CommonBehaviours/043.robot | 86 +++++++++++--- TP/NGSI-LD/CommonBehaviours/044_01.robot | 41 +++++++ TP/NGSI-LD/CommonBehaviours/044_01_01.robot | 73 +++++++++++- TP/NGSI-LD/CommonBehaviours/044_02.robot | 4 +- TP/NGSI-LD/CommonBehaviours/044_02b.robot | 84 ++++++++++++++ TP/NGSI-LD/CommonBehaviours/044_03b.robot | 92 +++++++++++++++ TP/NGSI-LD/CommonBehaviours/044_04.robot | 4 +- TP/NGSI-LD/CommonBehaviours/044_04b.robot | 61 ++++++++++ TP/NGSI-LD/CommonBehaviours/044_05b.robot | 107 +++++++++++++++++ .../Consumption/Entity/018_01_01.robot | 2 +- .../Consumption/Entity/018_01_02.robot | 2 +- .../Consumption/Entity/018_01_03.robot | 2 +- .../Consumption/Entity/018_02.robot | 2 +- .../Consumption/Entity/018_03_01.robot | 2 +- .../Consumption/Entity/018_03_02.robot | 2 +- .../Consumption/Entity/018_04.robot | 2 +- .../Consumption/Entity/018_05.robot | 2 +- .../Consumption/Entity/018_06.robot | 2 +- .../vehicle-fragment-brandname-sample.jsonld | 2 +- resources/ApiUtils.resource | 108 ++++++++++++------ resources/AssertionUtils.resource | 10 +- 21 files changed, 617 insertions(+), 73 deletions(-) create mode 100644 TP/NGSI-LD/CommonBehaviours/044_01.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_02b.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_03b.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_04b.robot create mode 100644 TP/NGSI-LD/CommonBehaviours/044_05b.robot diff --git a/TP/NGSI-LD/CommonBehaviours/043.robot b/TP/NGSI-LD/CommonBehaviours/043.robot index fe35908c..b372613b 100644 --- a/TP/NGSI-LD/CommonBehaviours/043.robot +++ b/TP/NGSI-LD/CommonBehaviours/043.robot @@ -4,33 +4,81 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Test Template Throw 503 LDContextNotAvaliable error - *** Variable *** ${expected_status_code}= 503 + ${building_id_prefix}= urn:ngsi-ld:Building: -${registration_id_prefix}= urn:ngsi-ld:Registration: +${building_filename}= building-minimal-without-context-sample.jsonld + ${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= csourceSubscriptions/subscription-without-context-sample.jsonld + +${tea_id_prefix}= urn:ngsi-ld:Vehicle: +${tea_filename}= bus-temporal-representation-without-context-sample.jsonld + +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_filename}= csourceRegistrations/context-source-registration-without-context-sample.jsonld + +*** Test Cases *** +043_01 Create entity + [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved (Create entity) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Entity by Id ${entity_id} + +043_02 Create subscription + [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved (Create subscription) -*** Test Cases *** PREFIX DELETE_PREFIX ENDPOINT FILENAME_PATH -043_01_endpoint /entities/ ${building_id_prefix} ${EMPTY} ${ENTITIES_ENDPOINT_PATH} entities/building-minimal-without-context-sample.jsonld -043_02_endpoint /csourceRegistrations/ ${registration_id_prefix} ${EMPTY} ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations/context-source-registration-without-context-sample.jsonld -043_03_endpoint /subscriptions/ ${subscription_id_prefix} ${EMPTY} ${SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -043_04_endpoint /csourceSubscriptions/ ${subscription_id_prefix} / ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions/subscription-without-context-sample.jsonld -043_05_endpoint /temporal/entities/ ${building_id_prefix} / ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporalEntities/bus-temporal-representation-without-context-sample.jsonld + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${subscription_id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Subscription ${subscription_id} -*** Keywords *** -Throw 503 LDContextNotAvaliable error - [Arguments] ${prefix} ${delete_prefix} ${endpoint} ${filename_path} - [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved - [Tags] mandatory - ${create_id}= Generate Random Entity Id ${prefix} - ${delete_id}= Set Variable ${delete_prefix}${create_id} +043_03 Create Temporal Representation of Entities + [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved (Create Temporal Representation of Entities) - ${response}= Create Request By Selecting Endpoint ${create_id} ${endpoint} ${filename_path} + ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${CONTENT_TYPE_LD_JSON} Check Response Status Code ${expected_status_code} ${response['status']} Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} Check Response Body Containing ProblemDetails Element Containing Title Element ${response} - - [Teardown] Delete Request By Selecting Endpoint/Id ${delete_id} ${endpoint} \ No newline at end of file + + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} + +043_04 Batch entity create + [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved (Batch entity create) + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity ${building_filename} ${first_entity_id} + ${second_entity}= Load Entity ${building_filename} ${second_entity_id} + @{entities_to_be_created}= Create List ${first_entity} ${second_entity} + + Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code Set To ${expected_status_code} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Batch Delete Entities @{entities_to_be_created} + +043_05 Create context source registration + [Documentation] Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved (Create context source registration) + + ${registration_id_prefix}= Generate Random Entity Id ${registration_id_prefix} + + ${payload}= Load Json From File ${EXECDIR}/data/${registration_filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id_prefix} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Headers Containing URI set to ${request['path']}/ ${registration_id} ${response} + + [Teardown] Delete Context Source Registration ${registration_id_prefix} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01.robot b/TP/NGSI-LD/CommonBehaviours/044_01.robot new file mode 100644 index 00000000..2502ed43 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_01.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${vehicle_fragment}= vehicle-fragment-brandname-sample.jsonld +${attribute_id}= brandName + +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld +${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.jsonld + +*** Test Cases *** +044_01_02_endpoint /entities/{entityId}/attrs/{attrId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Partial Update Entity Attributes ${entity_id} ${attribute_id} ${vehicle_fragment} ${CONTENT_TYPE_MERGE_PATCH_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Entity by Id ${entity_id} + +044_01_03_endpoint /subscriptions/{subscriptionId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${subscription_id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Update Subscription ${subscription_id} ${subscription_fragment} ${CONTENT_TYPE_MERGE_PATCH_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Subscription ${subscription_id} + diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_01.robot b/TP/NGSI-LD/CommonBehaviours/044_01_01.robot index fc0274bd..5717b5da 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_01_01.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_01_01.robot @@ -9,6 +9,22 @@ ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: ${filename}= vehicle-two-datasetid-attributes-sample.jsonld ${fragment_filename}= vehicle-two-datasetid-attributes-sample-01.jsonld + +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-simple-attributes-sample.jsonld +${fragment_filename}= vehicle-fragment-brandname-sample.jsonld +${attribute_id}= brandName + + +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${filename_path}= csourceSubscriptions/subscription-sample.jsonld +${fragment_filename_path}= csourceSubscriptions/fragments/subscription-update-sample.jsonld + +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= registration-sample.jsonld +${fragment_filename_path}= context-source-registration-update-sample.jsonld + + *** Test Cases *** 044_01_01_endpoint /entities/{entityId}/attrs/ [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type @@ -20,4 +36,59 @@ ${fragment_filename}= vehicle-two-datasetid-attributes-sample-01.jsonld ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_MERGE_PATCH_JSON} Check Response Status Code 204 ${response['status']} - [Teardown] Delete Entity by Id ${entity_id} \ No newline at end of file + [Teardown] Delete Entity by Id ${entity_id} + +044_01_02_endpoint /entities/{entityId}/attrs/{attrId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Partial Update Entity Attributes ${entity_id} ${attribute_id} ${fragment_filename} ${CONTENT_TYPE_MERGE_PATCH_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Entity by Id ${entity_id} + +044_01_03_endpoint /subscriptions/{subscriptionId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${subscription_id} ${filename_path} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Update Subscription ${subscription_id} ${fragment_filename_path} ${CONTENT_TYPE_MERGE_PATCH_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Subscription ${subscription_id} + +044_01_04_endpoint /csourceRegistrations/{registrationId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] mandatory + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + + ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_payload_file_path} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response['status']} + + ${fragment}= Load Json From File ${EXECDIR}/data/csourceRegistrations/fragments/${fragment_filename_path} + ${response}= Update Context Source Registration With Return ${registration_id} ${fragment} ${CONTENT_TYPE_MERGE_PATCH_JSON} + Check Response Status Code 204 ${response['status']} + + [Teardown] Delete Context Source Registration ${registration_id} + +*** comment *** +043_01 Create entity +043_02 Retrieve entity by id +043_03 Partial attribute update + +043_04 Create subscription +043_05 Retrieve subscription by id +043_06 Update subscription + +043_07 Create Temporal Representation of Entities +043_08 Query temporal entities +043_09 Batch entity create +043_10 Create context source registration +043_11 Query context source registration \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_02.robot b/TP/NGSI-LD/CommonBehaviours/044_02.robot index bccd74d2..9a787c2e 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_02.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_02.robot @@ -56,7 +56,7 @@ ${teatype}= Vehicle ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Query Entity ${id} + ${request} ${response}= Query Entity ${id} Check Response Status Code 200 ${response['status']} Check Response Body Containing Entity element ${building_expectation} ${id} ${response['body']} @@ -82,7 +82,7 @@ ${teatype}= Vehicle ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Retrieve Subscription ${id} + ${request} ${response}= Retrieve Subscription ${id} Check Response Status Code 200 ${response['status']} Check Response Body Containing One Subscription element ${subscription_expectation} ${response['body']} diff --git a/TP/NGSI-LD/CommonBehaviours/044_02b.robot b/TP/NGSI-LD/CommonBehaviours/044_02b.robot new file mode 100644 index 00000000..07b009a5 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_02b.robot @@ -0,0 +1,84 @@ +*** Settings *** +Documentation Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${building_filename}= building-simple-attributes-sample.jsonld +${building_expectation}= building-simple-attributes-sample-expectation.json +${entity_type}= https://ngsi-ld-test-suite/context#Building + +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld +${subscription_expectation}= subscription-sample-expectation.json + +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_filename}= csourceRegistrations/registration-with-expiration-sample.jsonld +${registration_expectation}= registration-with-expiration-expectation-sample.json +${registration_type}= Vehicle + +${tea_id_prefix}= urn:ngsi-ld:Vehicle: +${tea_filename}= vehicle-temporal-representation-sample.jsonld +${tea_expectation}= vehicle-temporal-representation-expectation.json +${teatype}= Vehicle + +*** Test Cases *** +044_02_01_endpoint /entities/{entityId} + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/entities/{entityId}) + ${id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${request} ${response}= Query Entity ${id} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing Entity element ${building_expectation} ${id} ${response['body']} + Check Request Containing Accept Header Set To ${request} application/json, */* + + [Teardown] Delete Entity by Id Returning Response ${id} + + +044_02_02_endpoint /subscriptions/{subscriptionId} + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/subscriptions/{subscriptionId}) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${request} ${response}= Retrieve Subscription ${id} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing One Subscription element ${subscription_expectation} ${response['body']} + Check Request Containing Accept Header Set To ${request} application/json, */* + + [Teardown] Delete Subscription ${id} + +044_02_03_endpoint /csourceRegistrations/ + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceRegistrations/) + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load Json From File ${EXECDIR}/data/${registration_filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response['status']} + + ${request} ${response}= Query Context Source Registrations With Return id=${registration_id} type=${registration_type} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing One Registration element ${registration_expectation} ${response['body']} + Check Request Containing Accept Header Set To ${request} application/json, */* + + [Teardown] Delete Context Source Registration ${registration_id} + +044_02_04_endpoint /temporal/entities + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/temporal/entities) + + ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + Create Temporal Representation Of Entity ${tea_filename} ${temporal_entity_representation_id} + + ${request} ${response}= Query Temporal Representation Of Entities With Return entity_types=${teatype} timerel=after timeAt=2020-08-01T12:05:00Z + Check Response Status Code 200 ${response['status']} + Set Test Variable ${response} + Check Response Body Containing EntityTemporal element ${tea_expectation} ${temporal_entity_representation_id} + Check Request Containing Accept Header Set To ${request} application/json, */* + + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_03b.robot b/TP/NGSI-LD/CommonBehaviours/044_03b.robot new file mode 100644 index 00000000..79c9916e --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_03b.robot @@ -0,0 +1,92 @@ +*** Settings *** +Documentation Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_filename}= vehicle-datasetid-attributes-sample.jsonld +${vehicle_attribute}= speed +${vehicle_fragment}= vehicle-fragment-empty-datasetid-sample.jsonld + +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld +${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.jsonld + +${tea_id_prefix}= urn:ngsi-ld:Vehicle: +${tea_filename}= vehicle-temporal-representation-sample.jsonld + +${building_id_prefix}= urn:ngsi-ld:Building: +${building_filename}= building-simple-attributes-sample.jsonld + + +*** Test Cases *** +044_03_01_endpoint patch /entities/{entityId}/attrs/{attrId} + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /entities/{entityId}/attrs/{attrId}) + + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Partial Update Entity Attributes ${entity_id} ${vehicle_attribute} ${vehicle_fragment} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_03_02_endpoint patch /subscriptions/{subscriptionId} + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /subscriptions/{subscriptionId}) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Update Subscription ${id} ${subscription_fragment} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Subscription ${id} + + +044_03_03_endpoint post /entities/ + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entities/) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Entity by Id ${entity_id} + +044_03_04_endpoint post /subscriptions/ + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /subscriptions/) + + ${subscriptions_id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${subscriptions_id} ${subscription_filename} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Subscription ${subscriptions_id} + +044_03_05_endpoint post /entityOperations/create + + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/create) + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity ${building_filename} ${first_entity_id} + ${second_entity}= Load Entity ${building_filename} ${second_entity_id} + @{entities_to_be_created}= Create List ${first_entity} ${second_entity} + + Batch Create Entities @{entities_to_be_created} content_type=${EMPTY} + + @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + Check Response Status Code Set To 415 + + [Teardown] Batch Delete Entities @{expected_entities_ids} + +044_03_06_endpoint post /temporal/entities/ + [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /temporal/entities/) + + ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${EMPTY} + Check Response Status Code 415 ${response['status']} + + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_04.robot b/TP/NGSI-LD/CommonBehaviours/044_04.robot index aa010577..b4239d0d 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_04.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_04.robot @@ -52,7 +52,7 @@ ${tea_filename}= vehicle-temporal-representation-sample.jsonld ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Query Entity ${entity_id} accept=${accept} + ${request} ${response}= Query Entity ${entity_id} accept=${accept} Check Response Status Code ${status_code} ${response['status']} [Teardown] Delete Entity by Id Returning Response ${entity_id} @@ -76,7 +76,7 @@ ${tea_filename}= vehicle-temporal-representation-sample.jsonld ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Retrieve Subscription ${id} accept=${accept} + ${request} ${response}= Retrieve Subscription ${id} accept=${accept} Check Response Status Code ${status_code} ${response['status']} [Teardown] Delete Subscription ${id} diff --git a/TP/NGSI-LD/CommonBehaviours/044_04b.robot b/TP/NGSI-LD/CommonBehaviours/044_04b.robot new file mode 100644 index 00000000..a80de3b3 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_04b.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${accept}= application/xml +${status_code}= 406 + +${building_id_prefix}= urn:ngsi-ld:Building: +${building_filename}= building-simple-attributes-sample.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building + +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld + +*** Test Cases *** +044_04_01_endpoint get /entities/{entityId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /entities/{entityId}) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${request} ${response}= Query Entity ${entity_id} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_04_02_endpoint get /subscriptions/{subscriptionId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /subscriptions/{subscriptionId}) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${request} ${response}= Retrieve Subscription ${id} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Subscription ${id} + +044_04_03_endpoint get /csourceRegistrations/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceRegistrations/) + + Query Context Source Registrations type=Building accept=${accept} + Check Response Status Code Set To ${status_code} + +044_04_04_endpoint get /csourceSubscriptions/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceSubscriptions/) + + Query Context Source Registration Subscriptions accept=${accept} + Check Response Status Code Set To ${status_code} + +044_04_05_endpoint get /temporal/entities + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /temporal/entities) + + @{entity_types_to_be_retrieved}= Create List Vehicle + Query Temporal Representation Of Entities entity_types=${entity_types_to_be_retrieved} timerel=after timeAt=2020-08-01T12:05:00Z accept=${accept} + Check Response Status Code Set To ${status_code} + diff --git a/TP/NGSI-LD/CommonBehaviours/044_05b.robot b/TP/NGSI-LD/CommonBehaviours/044_05b.robot new file mode 100644 index 00000000..f6d40827 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/044_05b.robot @@ -0,0 +1,107 @@ +*** Settings *** +Documentation Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${accept}= application/geo+json +${status_code}= 406 + +${building_id_prefix}= urn:ngsi-ld:Building: +${building_filename}= building-simple-attributes-sample.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building + +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld +${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.json + +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_filename}= registration-sample.jsonld +${registration_fragment}= registration-with-expiration-sample.jsonld + +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${vehicle_attribute}= brandName +${vehicle_fragment}= vehicle-fragment-brandname-sample.jsonld + +${tea_id_prefix}= urn:ngsi-ld:Vehicle: +${tea_filename}= vehicle-temporal-representation-sample.jsonld + +*** Test Cases *** +044_05_01_endpoint create /entities/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /entities/) + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Entity by Id ${entity_id} + +044_05_02_endpoint update /entities/{entityId}/attrs/{attrId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (update /entities/{entityId}/attrs/{attrId}) + + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + Retrieve Entity by Id ${entity_id} + ${response}= Partial Update Entity Attributes ${entity_id} ${vehicle_attribute} ${vehicle_fragment} ${CONTENT_TYPE_LD_JSON} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +044_05_03_endpoint create /subscriptions/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /subscriptions/) + + ${subscriptions_id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${subscriptions_id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Subscription ${subscriptions_id} + +044_05_04_endpoint update /subscriptions/{subscriptionId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (update /subscriptions/{subscriptionId}) + + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} + + ${response}= Update Subscription ${id} ${subscription_fragment} ${CONTENT_TYPE_LD_JSON} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Subscription ${id} + +044_05_05_endpoint create /temporal/entities/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /temporal/entities/) + + ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${CONTENT_TYPE_LD_JSON} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} + +044_05_06_endpoint create /entityOperations/create + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /entityOperations/create) + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity ${building_filename} ${first_entity_id} + ${second_entity}= Load Entity ${building_filename} ${second_entity_id} + @{entities_to_be_created}= Create List ${first_entity} ${second_entity} + + Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} accept=${accept} + + @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + Check Response Status Code Set To ${status_code} + + [Teardown] Batch Delete Entities @{expected_entities_ids} + +044_05_07_endpoint create /csourceRegistrations/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /csourceRegistrations/) + + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Context Source Registration ${registration_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_01.robot index 381f3b60..a862d667 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_01.robot @@ -18,7 +18,7 @@ ${expectation_filename}= building-simple-attributes-sample-expectation.jsonld ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${request} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 200 ${response['status']} Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response['body']} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_02.robot index 4fe17c79..f7697e2e 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_02.robot @@ -21,7 +21,7 @@ ${attribute_subcategory}= https://ngsi-ld-test-suite/context#subCategory Check Response Status Code 201 ${response['status']} ${attributes_to_be_retrieved}= Create List ${attribute_airqualitylevel} ${attribute_subcategory} - ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} + ${request} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} Check Response Status Code 200 ${response['status']} Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response['body']} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_03.robot index 8ccd23fa..90ebce62 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_03.robot @@ -19,7 +19,7 @@ ${geometry_property}= location ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} geoproperty=${geometry_property} + ${request} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} geoproperty=${geometry_property} Check Response Status Code 200 ${response['status']} Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response['body']} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_02.robot index 548f50ed..3ac7d19a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_02.robot @@ -15,7 +15,7 @@ Get Entity With Invalid/Missing Id [Documentation] Check that you cannot get an entity with invalid/missing id [Tags] mandatory - ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${request} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code ${expected_status_code} ${response['status']} Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${problem_type} Check Response Body Containing ProblemDetails Element Containing Title Element ${response} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_01.robot index 5bad223c..af115a4a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_01.robot @@ -13,7 +13,7 @@ Get an entity if the Entity Id is not known to the system [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${request} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 404 ${response['status']} Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_RESOURCE_NOT_FOUND} Check Response Body Containing ProblemDetails Element Containing Title Element ${response} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_02.robot index 534477a0..a277c41d 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_02.robot @@ -19,7 +19,7 @@ Get an entity if an atris not known to the system Check Response Status Code 201 ${response['status']} ${attributes_to_be_retrieved}= Create List ${attribute_not_known} - ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} + ${request} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} Check Response Status Code 404 ${response['status']} Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_RESOURCE_NOT_FOUND} Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_04.robot index 366e2126..5d6b02f7 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_04.robot @@ -19,7 +19,7 @@ Get an entity in a simplified representation ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} options=${options_parameter} + ${request} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} options=${options_parameter} Check Response Status Code 200 ${response['status']} Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response['body']} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_05.robot index d7e60109..2ad1b79c 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_05.robot @@ -20,7 +20,7 @@ Get an entity by id that can be returned in a geoJSON format ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Query Entity ${entity_id} ${accept_header} options=${options_parameter} + ${request} ${response}= Query Entity ${entity_id} ${accept_header} options=${options_parameter} Check Response Status Code 200 ${response['status']} Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_06.robot index 48e921f2..c380f352 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_06.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_06.robot @@ -25,7 +25,7 @@ Check Json-LD Resolution When retrieving an entity [Documentation] Check that the JSON-LD @context is obtained from a Link header if present and that the default JSON-LD @context is used if not present [Tags] mandatory - ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_JSON} context=${context} + ${request} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_JSON} context=${context} Check Response Status Code 200 ${response['status']} Check Response Body Containing Entity element ${expected_payload} ${entity_id} ${response['body']} diff --git a/data/entities/fragmentEntities/vehicle-fragment-brandname-sample.jsonld b/data/entities/fragmentEntities/vehicle-fragment-brandname-sample.jsonld index cf7ce5ac..819eca55 100644 --- a/data/entities/fragmentEntities/vehicle-fragment-brandname-sample.jsonld +++ b/data/entities/fragmentEntities/vehicle-fragment-brandname-sample.jsonld @@ -1,5 +1,5 @@ { - "brandName": { + "https://ngsi-ld-test-suite/context#brandName": { "type": "Property", "value": "BMW" }, diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 745a2d28..7a035b90 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -62,9 +62,9 @@ Query Entity Run Keyword If ${options_length}>0 Set To Dictionary ${params} options=${options} ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} query=${params} - Output request + ${request}= Output request Output response - [return] ${response} + [return] ${request} ${response} Query Entities [Arguments] ${entity_ids}=${EMPTY} ${entity_types}=${EMPTY} ${accept}=${EMPTY} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${options}=${EMPTY} ${limit}=${EMPTY} ${entity_id_pattern}=${EMPTY} @@ -119,10 +119,11 @@ Retrieve Entity by Id Set Test Variable ${response} Create Entity Selecting Content Type - [Arguments] ${filename} ${entity_id} ${content_type} ${context}=${EMPTY} + [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} &{headers}= Create Dictionary Content-Type=${content_type} + Run Keyword If '${accept}'!='${EMPTY}' Set To Dictionary ${headers} Accept=${accept} Run Keyword If '${context}'!='${EMPTY}' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${response}= POST ${ENTITIES_ENDPOINT_PATH} body=${entity} headers=${headers} ${request}= Output request @@ -173,8 +174,9 @@ Delete Entity Attributes [return] ${response} Partial Update Entity Attributes - [Arguments] ${entityId} ${attributeId} ${fragment_filename} ${content_type} + [Arguments] ${entityId} ${attributeId} ${fragment_filename} ${content_type} ${accept}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} ${fragment_payload}= Load Json From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} ${response}= PATCH ${ENTITIES_ENDPOINT_PATH}${entityId}/attrs/${attributeId} body=${fragment_payload} headers=${headers} Output request @@ -278,32 +280,6 @@ Delete Context Source Registration With Return Output response [return] ${response} -Create Request By Selecting Endpoint - [Arguments] ${id} ${endpoint} ${filename_path} - ${item_payload}= Load Json From File ${EXECDIR}/data/${filename_path} - ${item}= Update Value To Json ${item_payload} $..id ${id} - &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${endpoint} body=${item} headers=${headers} - Output request - Output response - [return] ${response} - -Merge Request By Selecting Endpoint - [Arguments] ${id} ${endpoint} ${filename_path} - ${item_payload}= Load Json From File ${EXECDIR}/data/${filename_path} - ${item}= Update Value To Json ${item_payload} $..id ${id} - &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${endpoint} body=${item} headers=${headers} - Output request - Output response - [return] ${response} - -Delete Request By Selecting Endpoint/Id - [Arguments] ${id} ${delete_endpoint} - ${response}= DELETE ${delete_endpoint}${id} - Output request - Output response - Create Entity [Arguments] ${filename} ${entity_id} ${entity_payload}= Load Json From File ${EXECDIR}/data/entities/${filename} @@ -314,10 +290,11 @@ Create Entity Output response Create Or Update Temporal Representation Of Entity Selecting Content Type - [Arguments] ${temporal_entity_representation_id} ${filename} ${content_type} + [Arguments] ${temporal_entity_representation_id} ${filename} ${content_type} ${accept}=${EMPTY} ${temporal_entity_representation_payload}= Load Json From File ${EXECDIR}/data/temporalEntities/${filename} ${temporal_entity_representation}= Update Value To Json ${temporal_entity_representation_payload} $..id ${temporal_entity_representation_id} &{headers}= Create Dictionary Content-Type=${content_type} + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} ${response}= POST ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/ body=${temporal_entity_representation} headers=${headers} Output request Output response @@ -411,9 +388,10 @@ Update Temporal Representation Of Entity Selecting Content Type [return] ${response} Batch Create Entities - [Arguments] @{entities_to_be_created} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} + [Arguments] @{entities_to_be_created} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${accept}=${EMPTY} ${headers}= Create Dictionary Set To Dictionary ${headers} Content-Type ${content_type} + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${response}= POST ${BATCH_CREATE_ENDPOINT_PATH} body=@{entities_to_be_created} headers=${headers} Output request @@ -607,9 +585,9 @@ Retrieve Context Source Registration Set Test Variable ${response} Create Context Source Registration Subscription - [Arguments] ${subscription_payload} ${accept}=${EMPTY} + [Arguments] ${subscription_payload} ${accept}=${EMPTY} ${content_type}=${CONTENT_TYPE_LD_JSON} - &{headers}= Create Dictionary Content-Type=application/ld+json + &{headers}= Create Dictionary Content-Type=${content_type} Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} ${response}= POST ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} body=${subscription_payload} headers=${headers} ${request}= Output request @@ -717,9 +695,9 @@ Retrieve Subscription Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} ${response}= GET ${SUBSCRIPTION_ENDPOINT_PATH}${id} headers=${headers} - Output request + ${request}= Output request Output response - [return] ${response} + [return] ${request} ${response} Update Context Source Registration Subscription By Selecting Content Type [Arguments] ${subscription_id} ${subscription_update_fragment} ${content_type} ${accept}=${EMPTY} @@ -797,4 +775,60 @@ Batch Delete Entities By Selecting Content Type Output request Output response Run Keyword If not ${teardown} Set Test Variable ${response} - Set Test Variable ${response} \ No newline at end of file + Set Test Variable ${response} + +Query Context Source Registrations With Return + [Arguments] ${context}=${EMPTY} ${id}=${EMPTY} ${type}=${EMPTY} ${attrs}=${EMPTY} ${q}=${EMPTY} ${georel}=${EMPTY} ${geometry}=${EMPTY} ${coordinates}=${EMPTY} ${geoproperty}=${EMPTY} ${timeproperty}=${EMPTY} ${timerel}=${EMPTY} ${timeAt}=${EMPTY} ${limit}=${EMPTY} ${page}=${EMPTY} ${accept}=${EMPTY} + + &{headers}= Create Dictionary + &{params}= Create Dictionary + Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} accept=${accept} + Run Keyword If '${id}'!='' Set To Dictionary ${params} id=${id} + Run Keyword If '${type}'!='' Set To Dictionary ${params} type=${type} + Run Keyword If '${attrs}'!='' Set To Dictionary ${params} attrs=${attrs} + Run Keyword If '${q}'!='' Set To Dictionary ${params} q=${q} + Run Keyword If '${georel}'!='' Set To Dictionary ${params} georel=${georel} + Run Keyword If '${geometry}'!='' Set To Dictionary ${params} geometry=${geometry} + Run Keyword If '${coordinates}'!='' Set To Dictionary ${params} coordinates=${coordinates} + Run Keyword If '${geoproperty}'!='' Set To Dictionary ${params} geoproperty=${geoproperty} + Run Keyword If '${timeproperty}'!='' Set To Dictionary ${params} timeproperty=${timeproperty} + Run Keyword If '${timerel}'!='' Set To Dictionary ${params} timerel=${timerel} + Run Keyword If '${timeAt}'!='' Set To Dictionary ${params} timeAt=${timeAt} + Run Keyword If '${limit}'!='' Set To Dictionary ${params} limit=${limit} + Run Keyword If '${page}'!='' Set To Dictionary ${params} page=${page} + + ${response}= GET ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} headers=${headers} query=${params} + ${request}= Output request + Output response + + [return] ${request} ${response} + +Query Temporal Representation Of Entities With Return + [Arguments] ${context}=${EMPTY} ${entity_types}=${EMPTY} ${entity_ids}=${EMPTY} ${entity_id_pattern}=${EMPTY} ${ngsild_query}=${EMPTY} ${csf}=${EMPTY} ${georel}=${EMPTY} ${geometry}=${EMPTY} ${coordinates}=${EMPTY} ${geoproperty}=${EMPTY} ${timerel}=${EMPTY} ${timeAt}=${EMPTY} ${attrs}=${EMPTY} ${limit}=${EMPTY} ${lastN}=${EMPTY} ${accept}=${EMPTY} + ${entity_types_length} = Get Length ${entity_types} + ${entity_ids_length} = Get Length ${entity_ids} + ${attrs_length} = Get Length ${attrs} + &{headers}= Create Dictionary + &{params}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} + Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + Run Keyword If ${entity_types_length}>0 Set To Dictionary ${params} type=${entity_types} + Run Keyword If ${entity_ids_length}>0 Set To Dictionary ${params} id=${entity_ids} + Run Keyword If '${timerel}'!='' Set To Dictionary ${params} timerel=${timerel} + Run Keyword If '${timeAt}'!='' Set To Dictionary ${params} timeAt=${timeAt} + Run Keyword If ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + Run Keyword If '${lastN}'!='' Set To Dictionary ${params} lastN=${lastN} + Run Keyword If '${entity_id_pattern}'!='' Set To Dictionary ${params} idPattern=${entity_id_pattern} + Run Keyword If '${ngsild_query}'!='' Set To Dictionary ${params} q=${ngsild_query} + Run Keyword If '${csf}'!='' Set To Dictionary ${params} csf=${csf} + Run Keyword If '${georel}'!='' Set To Dictionary ${params} georel=${georel} + Run Keyword If '${geometry}'!='' Set To Dictionary ${params} geometry=${geometry} + Run Keyword If '${coordinates}'!='' Set To Dictionary ${params} coordinates=${coordinates} + Run Keyword If '${geoproperty}'!='' Set To Dictionary ${params} geoproperty=${geoproperty} + Run Keyword If '${limit}'!='' Set To Dictionary ${params} limit=${limit} + + ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH} headers=${headers} query=${params} + ${request}= Output request + Output response + [return] ${request} ${response} \ No newline at end of file diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index ae045c3d..a58483d4 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -40,6 +40,12 @@ Check Response Body Content ${comparison_result}= Compare Dictionaries Ignoring Keys ${response_body} ${entity_payload} ${instance_id_regex_expr} Should Be True ${comparison_result} msg=Entity Comparison Failed +Check Request Containing Accept Header Set To + [Arguments] ${request} ${expected_accept_content} + + Run Keyword If 'Accept' in ${request['headers']} Should Be Equal ${expected_accept_content} ${request['headers']['Accept']} ignore_order=True + Run Keyword If 'accept' in ${request['headers']} Should Be Equal ${expected_accept_content} ${request['headers']['accept']} ignore_order=True + # Since Http headers names are case-insensitive (from Http specification) # We check both Location and location headers Check Response Headers Containing URI set to @@ -296,6 +302,6 @@ Check Response Body Containing One Subscription element Check Response Body Containing One Registration element [Arguments] ${expectation_filename} ${response_body} ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/expectations/${expectation_filename} - ${subscription}= Update Value To Json ${payload} $..id ${response_body['id']} - ${comparison_result}= Compare Dictionaries Ignoring Keys ${response_body} ${subscription} ${instance_id_regex_expr} + ${registration}= Update Value To Json ${payload} $..id ${response_body['id']} + ${comparison_result}= Compare Dictionaries Ignoring Keys ${response_body} ${registration} ${instance_id_regex_expr} Should Be True ${comparison_result} msg=Entity Comparison Failed \ No newline at end of file -- GitLab From 839665ae59d909283eb0439f0d044275ca4e2003 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Tue, 16 Mar 2021 16:28:31 +0000 Subject: [PATCH 6/7] adapt tests to the new defined endpoints --- TP/NGSI-LD/CommonBehaviours/044_01.robot | 8 +- TP/NGSI-LD/CommonBehaviours/044_01_01.robot | 94 --------- TP/NGSI-LD/CommonBehaviours/044_01_02.robot | 24 --- TP/NGSI-LD/CommonBehaviours/044_01_03.robot | 23 -- TP/NGSI-LD/CommonBehaviours/044_01_04.robot | 27 --- TP/NGSI-LD/CommonBehaviours/044_01_05.robot | 25 --- TP/NGSI-LD/CommonBehaviours/044_01_06.robot | 27 --- TP/NGSI-LD/CommonBehaviours/044_02.robot | 179 ++-------------- TP/NGSI-LD/CommonBehaviours/044_02b.robot | 84 -------- TP/NGSI-LD/CommonBehaviours/044_03.robot | 197 +----------------- TP/NGSI-LD/CommonBehaviours/044_03b.robot | 92 -------- TP/NGSI-LD/CommonBehaviours/044_04.robot | 140 +------------ TP/NGSI-LD/CommonBehaviours/044_04b.robot | 61 ------ TP/NGSI-LD/CommonBehaviours/044_05.robot | 117 +++++------ TP/NGSI-LD/CommonBehaviours/044_05b.robot | 107 ---------- ...stration-with-expiration-expectation.json} | 0 ...onld => vehicle-brandname-fragment.jsonld} | 0 17 files changed, 91 insertions(+), 1114 deletions(-) delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_01.robot delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_02.robot delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_03.robot delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_04.robot delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_05.robot delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_01_06.robot delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_02b.robot delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_03b.robot delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_04b.robot delete mode 100644 TP/NGSI-LD/CommonBehaviours/044_05b.robot rename data/csourceRegistrations/expectations/{registration-with-expiration-expectation-sample.json => context-source-registration-with-expiration-expectation.json} (100%) rename data/entities/fragmentEntities/{vehicle-fragment-brandname-sample.jsonld => vehicle-brandname-fragment.jsonld} (100%) diff --git a/TP/NGSI-LD/CommonBehaviours/044_01.robot b/TP/NGSI-LD/CommonBehaviours/044_01.robot index 2502ed43..76c1db84 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_01.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_01.robot @@ -7,7 +7,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: ${vehicle_filename}= vehicle-simple-attributes-sample.jsonld -${vehicle_fragment}= vehicle-fragment-brandname-sample.jsonld +${vehicle_fragment}= vehicle-brandname-fragment.jsonld ${attribute_id}= brandName ${subscription_id_prefix}= urn:ngsi-ld:Subscription: @@ -15,7 +15,7 @@ ${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld ${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.jsonld *** Test Cases *** -044_01_02_endpoint /entities/{entityId}/attrs/{attrId} +044_01_01_endpoint /entities/{entityId}/attrs/{attrId} [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type [Tags] mandatory ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} @@ -26,8 +26,8 @@ ${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sa Check Response Status Code 204 ${response['status']} [Teardown] Delete Entity by Id ${entity_id} - -044_01_03_endpoint /subscriptions/{subscriptionId} + +044_01_02_endpoint /subscriptions/{subscriptionId} [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type [Tags] mandatory ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_01.robot b/TP/NGSI-LD/CommonBehaviours/044_01_01.robot deleted file mode 100644 index 5717b5da..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_01_01.robot +++ /dev/null @@ -1,94 +0,0 @@ -*** Settings *** -Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -*** Variable *** -${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${filename}= vehicle-two-datasetid-attributes-sample.jsonld -${fragment_filename}= vehicle-two-datasetid-attributes-sample-01.jsonld - - -${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${filename}= vehicle-simple-attributes-sample.jsonld -${fragment_filename}= vehicle-fragment-brandname-sample.jsonld -${attribute_id}= brandName - - -${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${filename_path}= csourceSubscriptions/subscription-sample.jsonld -${fragment_filename_path}= csourceSubscriptions/fragments/subscription-update-sample.jsonld - -${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_payload_file_path}= registration-sample.jsonld -${fragment_filename_path}= context-source-registration-update-sample.jsonld - - -*** Test Cases *** -044_01_01_endpoint /entities/{entityId}/attrs/ - [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type - [Tags] mandatory - ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_MERGE_PATCH_JSON} - Check Response Status Code 204 ${response['status']} - - [Teardown] Delete Entity by Id ${entity_id} - -044_01_02_endpoint /entities/{entityId}/attrs/{attrId} - [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type - [Tags] mandatory - ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Partial Update Entity Attributes ${entity_id} ${attribute_id} ${fragment_filename} ${CONTENT_TYPE_MERGE_PATCH_JSON} - Check Response Status Code 204 ${response['status']} - - [Teardown] Delete Entity by Id ${entity_id} - -044_01_03_endpoint /subscriptions/{subscriptionId} - [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type - [Tags] mandatory - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${subscription_id} ${filename_path} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Update Subscription ${subscription_id} ${fragment_filename_path} ${CONTENT_TYPE_MERGE_PATCH_JSON} - Check Response Status Code 204 ${response['status']} - - [Teardown] Delete Subscription ${subscription_id} - -044_01_04_endpoint /csourceRegistrations/{registrationId} - [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type - [Tags] mandatory - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - - ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_payload_file_path} - ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} - ${request} ${response}= Create Context Source Registration With Return ${updated_payload} - Check Response Status Code 201 ${response['status']} - - ${fragment}= Load Json From File ${EXECDIR}/data/csourceRegistrations/fragments/${fragment_filename_path} - ${response}= Update Context Source Registration With Return ${registration_id} ${fragment} ${CONTENT_TYPE_MERGE_PATCH_JSON} - Check Response Status Code 204 ${response['status']} - - [Teardown] Delete Context Source Registration ${registration_id} - -*** comment *** -043_01 Create entity -043_02 Retrieve entity by id -043_03 Partial attribute update - -043_04 Create subscription -043_05 Retrieve subscription by id -043_06 Update subscription - -043_07 Create Temporal Representation of Entities -043_08 Query temporal entities -043_09 Batch entity create -043_10 Create context source registration -043_11 Query context source registration \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_02.robot b/TP/NGSI-LD/CommonBehaviours/044_01_02.robot deleted file mode 100644 index 35dc5c35..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_01_02.robot +++ /dev/null @@ -1,24 +0,0 @@ -*** Settings *** -Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -*** Variable *** -${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${filename}= vehicle-simple-attributes-sample.jsonld -${fragment_filename}= vehicle-fragment-brandname-sample.jsonld -${attribute_id}= brandName - -*** Test Cases *** -044_01_02_endpoint /entities/{entityId}/attrs/{attrId} - [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type - [Tags] mandatory - ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Partial Update Entity Attributes ${entity_id} ${attribute_id} ${fragment_filename} ${CONTENT_TYPE_MERGE_PATCH_JSON} - Check Response Status Code 204 ${response['status']} - - [Teardown] Delete Entity by Id ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_03.robot b/TP/NGSI-LD/CommonBehaviours/044_01_03.robot deleted file mode 100644 index 1960878b..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_01_03.robot +++ /dev/null @@ -1,23 +0,0 @@ -*** Settings *** -Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -*** Variable *** -${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${filename_path}= csourceSubscriptions/subscription-sample.jsonld -${fragment_filename_path}= csourceSubscriptions/fragments/subscription-update-sample.jsonld - -*** Test Cases *** -044_01_03_endpoint /subscriptions/{subscriptionId} - [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type - [Tags] mandatory - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${subscription_id} ${filename_path} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Update Subscription ${subscription_id} ${fragment_filename_path} ${CONTENT_TYPE_MERGE_PATCH_JSON} - Check Response Status Code 204 ${response['status']} - - [Teardown] Delete Subscription ${subscription_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_04.robot b/TP/NGSI-LD/CommonBehaviours/044_01_04.robot deleted file mode 100644 index 83877508..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_01_04.robot +++ /dev/null @@ -1,27 +0,0 @@ -*** Settings *** -Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -*** Variable *** -${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_payload_file_path}= registration-sample.jsonld -${fragment_filename_path}= context-source-registration-update-sample.jsonld - -*** Test Cases *** -044_01_04_endpoint /csourceRegistrations/{registrationId} - [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type - [Tags] mandatory - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - - ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_payload_file_path} - ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} - ${request} ${response}= Create Context Source Registration With Return ${updated_payload} - Check Response Status Code 201 ${response['status']} - - ${fragment}= Load Json From File ${EXECDIR}/data/csourceRegistrations/fragments/${fragment_filename_path} - ${response}= Update Context Source Registration With Return ${registration_id} ${fragment} ${CONTENT_TYPE_MERGE_PATCH_JSON} - Check Response Status Code 204 ${response['status']} - - [Teardown] Delete Context Source Registration ${registration_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_05.robot b/TP/NGSI-LD/CommonBehaviours/044_01_05.robot deleted file mode 100644 index a2986056..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_01_05.robot +++ /dev/null @@ -1,25 +0,0 @@ -*** Settings *** -Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -*** Variable *** -${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld -${subscription_update_fragment_file_path}= csourceSubscriptions/fragments/subscription-update-sample.json - -*** Test Cases *** -044_01_05_endpoint /csourceSubscriptions/{subscriptionId} - [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type - [Tags] mandatory - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Context Source Registration Subscription ${subscription_payload} - Check Response Status Code Set To 201 - - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - ${response}= Update Context Source Registration Subscription By Selecting Content Type ${subscription_id} ${subscription_update_fragment} ${CONTENT_TYPE_MERGE_PATCH_JSON} - Check Response Status Code 204 ${response['status']} - - [Teardown] Delete Context Source Registration Subscription ${subscription_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_01_06.robot b/TP/NGSI-LD/CommonBehaviours/044_01_06.robot deleted file mode 100644 index d5249424..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_01_06.robot +++ /dev/null @@ -1,27 +0,0 @@ -*** Settings *** -Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -*** Variable *** -${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${temporal_entity_filename}= vehicle-temporal-representation-sample.jsonld -${temporal_entity_fragment_file_path}= vehicle-temporal-representation-fragment.jsonld -${attribute_id}= speed - -*** Test Cases *** -044_01_06_endpoint /temporal/entities/{entityId}/attrs/{attrId}/{instanceId} - [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type - [Tags] mandatory - ${temporal_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} - ${response}= Create Temporal Representation Of Entity Selecting Content Type ${temporal_entity_id} ${temporal_entity_filename} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Get Temporal Representation Of Entity ${temporal_entity_id} ${CONTENT_TYPE_LD_JSON} - ${instance_id}= Set Variable ${response["body"]["speed"][0]["instanceId"]} - - ${response}= Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_id} ${attribute_id} ${instance_id} ${temporal_entity_fragment_file_path} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 204 ${response['status']} - - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_02.robot b/TP/NGSI-LD/CommonBehaviours/044_02.robot index 9a787c2e..df734374 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_02.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_02.robot @@ -6,9 +6,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: ${building_filename}= building-simple-attributes-sample.jsonld -${vehicle_filename}= vehicle-simple-attributes-sample.json ${building_expectation}= building-simple-attributes-sample-expectation.json ${entity_type}= https://ngsi-ld-test-suite/context#Building @@ -16,15 +14,9 @@ ${subscription_id_prefix}= urn:ngsi-ld:Subscription: ${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld ${subscription_expectation}= subscription-sample-expectation.json -${types_expectation}= types/expectations/entity-type-list-022-01-01-expectation.json -${type_expectation}= types/expectations/entity-type-info-024-01-expectation.json - -${attributes_expectation}= types/expectations/attribute-list-025-01-01-expectation.json -${attribute_expectation}= types/expectations/attribute-027-01-expectation.json - ${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_filename}= csourceRegistrations/registration-with-expiration-sample.jsonld -${registration_expectation}= registration-with-expiration-expectation-sample.json +${registration_filename}= csourceRegistrations/context-source-registration-with-expiration-sample.jsonld +${registration_expectation}= context-source-registration-with-expiration-expectation.json ${registration_type}= Vehicle ${tea_id_prefix}= urn:ngsi-ld:Vehicle: @@ -32,25 +24,8 @@ ${tea_filename}= vehicle-temporal-representation-sample.jsonld ${tea_expectation}= vehicle-temporal-representation-expectation.json ${teatype}= Vehicle - *** Test Cases *** -044_02_01_endpoint /entities/ - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/entities/) - ${id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - @{entities_ids_to_be_compared}= Create List ${id} - ${entities_ids_to_be_retrieved}= Set Variable ${id} - - @{entity_types_to_be_retrieved}= Create List ${entity_type} - ${response}= Query Entities entity_ids=${entities_ids_to_be_retrieved} entity_types=${entity_types_to_be_retrieved} - Check Response Status Code 200 ${response['status']} - Check Response Body Containing List Containing Entity elements ${building_expectation} ${entities_ids_to_be_compared} ${response['body']} - - [Teardown] Delete Entity by Id Returning Response ${id} - -044_02_02_endpoint /entities/{entityId} +044_02_01_endpoint /entities/{entityId} [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/entities/{entityId}) ${id}= Generate Random Entity Id ${building_id_prefix} ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${id} ${CONTENT_TYPE_LD_JSON} @@ -59,23 +34,12 @@ ${teatype}= Vehicle ${request} ${response}= Query Entity ${id} Check Response Status Code 200 ${response['status']} Check Response Body Containing Entity element ${building_expectation} ${id} ${response['body']} + Check Request Containing Accept Header Set To ${request} application/json, */* [Teardown] Delete Entity by Id Returning Response ${id} + -044_02_03_endpoint /subscriptions/ - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/subscriptions/) - - ${id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Query Subscriptions - Check Response Status Code 200 ${response['status']} - Check Response Body Containing One Subscription element ${subscription_expectation} ${response['body']} - - [Teardown] Delete Subscription ${id} - -044_02_04_endpoint /subscriptions/{subscriptionId} +044_02_02_endpoint /subscriptions/{subscriptionId} [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/subscriptions/{subscriptionId}) ${id}= Generate Random Entity Id ${subscription_id_prefix} @@ -85,70 +49,11 @@ ${teatype}= Vehicle ${request} ${response}= Retrieve Subscription ${id} Check Response Status Code 200 ${response['status']} Check Response Body Containing One Subscription element ${subscription_expectation} ${response['body']} + Check Request Containing Accept Header Set To ${request} application/json, */* [Teardown] Delete Subscription ${id} -044_02_05_endpoint /types/ - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/types/) - - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${second_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} - - Create Entity Selecting Content Type ${building_filename} ${first_entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} - Create Entity Selecting Content Type ${vehicle_filename} ${second_entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} - - @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} - - Retrieve Entity Types context=${EMPTY} accept=${EMPTY} - - Check Response Status Code Set To 200 - Check Response Body Containing EntityTypeList element ${types_expectation} - - [Teardown] Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True - -044_02_06_endpoint /types/{type} - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/types/{type}) - - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - - Create Entity Selecting Content Type ${building_filename} ${first_entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} - Create Entity Selecting Content Type ${building_filename} ${second_entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} - - @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} - - Retrieve Entity Type type=Building context=${EMPTY} accept=${EMPTY} - - Check Response Status Code Set To 200 - Check Response Body Containing EntityTypeInfo element ${type_expectation} - - [Teardown] Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True - -044_02_07_endpoint /attributes/ - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/attributes/) - - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} - - Retrieve Attributes context=${EMPTY} accept=${EMPTY} - Check Response Status Code Set To 200 - Check Response Body Containing AttributeList element ${attributes_expectation} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_02_08_endpoint /attributes/{attrId} - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/attributes/{attrId}) - - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} - - Retrieve Attribute attribute_name=airQualityLevel context=${ngsild_test_suite_context} accept=${EMPTY} - Check Response Status Code Set To 200 - Check Response Body Containing Attribute element ${attribute_expectation} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_02_09_endpoint /csourceRegistrations/ +044_02_03_endpoint /csourceRegistrations/ [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceRegistrations/) ${registration_id}= Generate Random Entity Id ${registration_id_prefix} @@ -157,73 +62,23 @@ ${teatype}= Vehicle ${request} ${response}= Create Context Source Registration With Return ${updated_payload} Check Response Status Code 201 ${response['status']} - Query Context Source Registrations id=${registration_id} type=${registration_type} - Check Response Status Code Set To 200 - Check Response Body Containing One Registration element ${registration_expectation} ${response['body']} - - [Teardown] Delete Context Source Registration ${registration_id} - -044_02_10_endpoint /csourceRegistrations/{registrationId} - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceRegistrations/{registrationId}) - - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - ${payload}= Load Json From File ${EXECDIR}/data/${registration_filename} - ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} - ${request} ${response}= Create Context Source Registration With Return ${updated_payload} - Check Response Status Code 201 ${response['status']} - - Retrieve Context Source Registration ${registration_id} - Check Response Status Code Set To 200 + ${request} ${response}= Query Context Source Registrations With Return id=${registration_id} type=${registration_type} + Check Response Status Code 200 ${response['status']} Check Response Body Containing One Registration element ${registration_expectation} ${response['body']} + Check Request Containing Accept Header Set To ${request} application/json, */* [Teardown] Delete Context Source Registration ${registration_id} -044_02_11_endpoint /csourceSubscriptions/ - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceSubscriptions/) - - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} - Create Context Source Registration Subscription ${subscription_payload} - - Query Context Source Registration Subscriptions - Check Response Status Code Set To 200 - Check Response Body Containing Subscription element ${subscription_expectation} ${subscription_id} - - [Teardown] Delete Context Source Registration Subscription ${subscription_id} - -044_02_12_endpoint /csourceSubscriptions/{subscriptionId} - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceSubscriptions/{subscriptionId}) - - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} - Create Context Source Registration Subscription ${subscription_payload} - - Retrieve Context Source Registration Subscription ${subscription_id} - Check Response Status Code Set To 200 - Check Response Body Containing Subscription element ${subscription_expectation} ${subscription_id} - - [Teardown] Delete Context Source Registration Subscription ${subscription_id} - -044_02_13_endpoint /temporal/entities +044_02_04_endpoint /temporal/entities [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/temporal/entities) ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} Create Temporal Representation Of Entity ${tea_filename} ${temporal_entity_representation_id} - Query Temporal Representation Of Entities entity_types=${teatype} timerel=after timeAt=2020-08-01T12:05:00Z - Check Response Status Code Set To 200 - Check Response Body Containing EntityTemporal element ${tea_expectation} ${temporal_entity_representation_id} - - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} - -044_02_14_endpoint /temporal/entities/{entityId} - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/temporal/entities/{entityId}) - - ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} - Create Temporal Representation Of Entity ${tea_filename} ${temporal_entity_representation_id} - - Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} - Check Response Status Code Set To 200 + ${request} ${response}= Query Temporal Representation Of Entities With Return entity_types=${teatype} timerel=after timeAt=2020-08-01T12:05:00Z + Check Response Status Code 200 ${response['status']} + Set Test Variable ${response} Check Response Body Containing EntityTemporal element ${tea_expectation} ${temporal_entity_representation_id} + Check Request Containing Accept Header Set To ${request} application/json, */* - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_02b.robot b/TP/NGSI-LD/CommonBehaviours/044_02b.robot deleted file mode 100644 index 07b009a5..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_02b.robot +++ /dev/null @@ -1,84 +0,0 @@ -*** Settings *** -Documentation Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -*** Variable *** -${building_id_prefix}= urn:ngsi-ld:Building: -${building_filename}= building-simple-attributes-sample.jsonld -${building_expectation}= building-simple-attributes-sample-expectation.json -${entity_type}= https://ngsi-ld-test-suite/context#Building - -${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld -${subscription_expectation}= subscription-sample-expectation.json - -${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_filename}= csourceRegistrations/registration-with-expiration-sample.jsonld -${registration_expectation}= registration-with-expiration-expectation-sample.json -${registration_type}= Vehicle - -${tea_id_prefix}= urn:ngsi-ld:Vehicle: -${tea_filename}= vehicle-temporal-representation-sample.jsonld -${tea_expectation}= vehicle-temporal-representation-expectation.json -${teatype}= Vehicle - -*** Test Cases *** -044_02_01_endpoint /entities/{entityId} - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/entities/{entityId}) - ${id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${request} ${response}= Query Entity ${id} - Check Response Status Code 200 ${response['status']} - Check Response Body Containing Entity element ${building_expectation} ${id} ${response['body']} - Check Request Containing Accept Header Set To ${request} application/json, */* - - [Teardown] Delete Entity by Id Returning Response ${id} - - -044_02_02_endpoint /subscriptions/{subscriptionId} - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/subscriptions/{subscriptionId}) - - ${id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${request} ${response}= Retrieve Subscription ${id} - Check Response Status Code 200 ${response['status']} - Check Response Body Containing One Subscription element ${subscription_expectation} ${response['body']} - Check Request Containing Accept Header Set To ${request} application/json, */* - - [Teardown] Delete Subscription ${id} - -044_02_03_endpoint /csourceRegistrations/ - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceRegistrations/) - - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - ${payload}= Load Json From File ${EXECDIR}/data/${registration_filename} - ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} - ${request} ${response}= Create Context Source Registration With Return ${updated_payload} - Check Response Status Code 201 ${response['status']} - - ${request} ${response}= Query Context Source Registrations With Return id=${registration_id} type=${registration_type} - Check Response Status Code 200 ${response['status']} - Check Response Body Containing One Registration element ${registration_expectation} ${response['body']} - Check Request Containing Accept Header Set To ${request} application/json, */* - - [Teardown] Delete Context Source Registration ${registration_id} - -044_02_04_endpoint /temporal/entities - [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/temporal/entities) - - ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} - Create Temporal Representation Of Entity ${tea_filename} ${temporal_entity_representation_id} - - ${request} ${response}= Query Temporal Representation Of Entities With Return entity_types=${teatype} timerel=after timeAt=2020-08-01T12:05:00Z - Check Response Status Code 200 ${response['status']} - Set Test Variable ${response} - Check Response Body Containing EntityTemporal element ${tea_expectation} ${temporal_entity_representation_id} - Check Request Containing Accept Header Set To ${request} application/json, */* - - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_03.robot b/TP/NGSI-LD/CommonBehaviours/044_03.robot index 02bdff5f..bf43562b 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_03.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_03.robot @@ -6,43 +6,22 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${vehicle_filename}= vehicle-datasetid-attributes-sample.jsonld +${vehicle_filename}= vehicle-simple-attributes-sample.json ${vehicle_attribute}= speed -${vehicle_fragment}= vehicle-fragment-empty-datasetid-sample.jsonld +${vehicle_fragment}= vehicle-brandname-fragment.jsonld ${subscription_id_prefix}= urn:ngsi-ld:Subscription: ${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld ${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.jsonld -${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_filename}= csourceRegistrations/registration-sample.jsonld -${registration_fragment}= csourceRegistrations/registration-with-expiration-sample.jsonld - ${tea_id_prefix}= urn:ngsi-ld:Vehicle: ${tea_filename}= vehicle-temporal-representation-sample.jsonld -${tea_fragment}= vehicle-temporal-intanceid-update-sample.jsonld -${tea_attribute}= speed -${tea_first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld -${tea_second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld ${building_id_prefix}= urn:ngsi-ld:Building: ${building_filename}= building-simple-attributes-sample.jsonld -${entity_type}= https://ngsi-ld-test-suite/context#Building *** Test Cases *** -044_03_01_endpoint patch /entities/{entityId}/attrs/ - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /entities/{entityId}/attrs/) - - ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Update Entity Attributes ${entity_id} ${vehicle_fragment} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_03_02_endpoint patch /entities/{entityId}/attrs/{attrId} +044_03_01_endpoint patch /entities/{entityId}/attrs/{attrId} [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /entities/{entityId}/attrs/{attrId}) ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} @@ -54,7 +33,7 @@ ${entity_type}= https://ngsi-ld-test-suite/context#Building [Teardown] Delete Entity by Id Returning Response ${entity_id} -044_03_03_endpoint patch /subscriptions/{subscriptionId} +044_03_02_endpoint patch /subscriptions/{subscriptionId} [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /subscriptions/{subscriptionId}) ${id}= Generate Random Entity Id ${subscription_id_prefix} @@ -66,52 +45,7 @@ ${entity_type}= https://ngsi-ld-test-suite/context#Building [Teardown] Delete Subscription ${id} -044_03_04_endpoint patch /csourceRegistrations/{registrationId} - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /csourceRegistrations/{registrationId}) - - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - ${payload}= Load Json From File ${EXECDIR}/data/${registration_filename} - ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} - ${request} ${response}= Create Context Source Registration With Return ${updated_payload} - Check Response Status Code 201 ${response['status']} - - ${response}= Update Context Source Registration With Return ${registration_id} ${registration_fragment} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Context Source Registration ${registration_id} - -044_03_05_endpoint patch /csourceSubscriptions/{subscriptionId} - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /csourceSubscriptions/{subscriptionId}) - - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} - Create Context Source Registration Subscription ${subscription_payload} - - ${subscription_update_fragment}= Load Test Sample ${subscription_fragment} - ${response}= Update Context Source Registration Subscription By Selecting Content Type ${subscription_id} ${subscription_update_fragment} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Context Source Registration Subscription ${subscription_id} - - -044_03_06_endpoint patch /temporal/entities/{entityId}/attrs/{attrId}/{instanceId} - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /temporal/entities/{entityId}/attrs/{attrId}/{instanceId}) - - ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} - Set Suite Variable ${temporal_entity_representation_id} - ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} sysAttrs - ${instanceId}= Set Variable ${response['body']['https://ngsi-ld-test-suite/context#speed'][0]['instanceId']} - - ${response}= Partial Update Attribute From Temporal Entity ${temporal_entity_representation_id} ${tea_attribute} ${instanceId} ${tea_fragment} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} - - -044_03_07_endpoint post /entities/ +044_03_03_endpoint post /entities/ [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entities/) ${entity_id}= Generate Random Entity Id ${building_id_prefix} @@ -120,19 +54,7 @@ ${entity_type}= https://ngsi-ld-test-suite/context#Building [Teardown] Delete Entity by Id ${entity_id} -044_03_08_endpoint post /entities/{entityId}/attrs/ - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entities/{entityId}/attrs/) - - ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Append Entity Attributes ${entity_id} ${vehicle_fragment} ${EMPTY} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_03_09_endpoint post /subscriptions/ +044_03_04_endpoint post /subscriptions/ [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /subscriptions/) ${subscriptions_id}= Generate Random Entity Id ${subscription_id_prefix} @@ -141,29 +63,7 @@ ${entity_type}= https://ngsi-ld-test-suite/context#Building [Teardown] Delete Subscription ${subscriptions_id} -044_03_10_endpoint post /csourceRegistrations/ - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /csourceRegistrations/) - - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - - ${payload}= Load Json From File ${EXECDIR}/data/${registration_filename} - ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} - ${request} ${response}= Create Context Source Registration With Return ${updated_payload} content_type=${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Context Source Registration ${registration_id} - -044_03_11_endpoint post /csourceSubscriptions/ - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /csourceSubscriptions/) - - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} - ${request} ${response}= Create Context Source Registration Subscription With Return ${subscription_payload} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Context Source Registration Subscription ${subscription_id} - -044_03_12_endpoint post /entityOperations/create +044_03_05_endpoint post /entityOperations/create [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/create) @@ -180,90 +80,11 @@ ${entity_type}= https://ngsi-ld-test-suite/context#Building [Teardown] Batch Delete Entities @{expected_entities_ids} - -044_03_13_endpoint post /entityOperations/upsert - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/upsert) - - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${first_entity}= Load Entity ${building_filename} ${first_entity_id} - ${second_entity}= Load Entity ${building_filename} ${second_entity_id} - @{entities_to_be_upserted}= Create List ${first_entity} ${second_entity} - @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} - - Batch Upsert Entities By Selecting Content Type @{entities_to_be_upserted} ${EMPTY} - Check Response Status Code Set To 415 - - [Teardown] Batch Delete Entities @{expected_entities_ids} - -044_03_14_endpoint post /entityOperations/update - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/update) - - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity building-simple-attributes-sample.jsonld ${first_entity_id} - Create Entity building-simple-attributes-sample.jsonld ${second_entity_id} - - ${first_entity}= Load Entity ${building_filename} ${first_entity_id} - ${second_entity}= Load Entity ${building_filename} ${second_entity_id} - @{entities_to_be_updated}= Create List ${first_entity} ${second_entity} - @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} - - Batch Update Entities @{entities_to_be_updated} ${EMPTY} - Check Response Status Code Set To 415 - - [Teardown] Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True - - -044_03_15_endpoint post /entityOperations/delete - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/delete) - - ${first_entity_id}= Generate Random Entity Id ${id_prefix} - ${second_entity_id}= Generate Random Entity Id ${id_prefix} - Create Entity ${building_filename} ${first_entity_id} - Create Entity ${building_filename} ${second_entity_id} - - @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} - Batch Delete Entities By Selecting Content Type @{entities_ids_to_be_deleted} ${EMPTY} - Check Response Status Code Set To 415 - -044_03_16_endpoint post /entityOperations/query - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/query) - - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - Query Entity ${first_entity_id} ${CONTENT_TYPE_LD_JSON} - @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} - ${entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${first_entity_id} ${second_entity_id} - @{entity_types_to_be_retrieved}= Create List ${entity_type} - ${response}= Query Entities Via POST entity_ids=${entities_ids_to_be_retrieved} entity_types=${entity_types_to_be_retrieved} content_type=${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True - -044_03_17_endpoint post /temporal/entities/ +044_03_06_endpoint post /temporal/entities/ [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /temporal/entities/) ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${EMPTY} Check Response Status Code 415 ${response['status']} - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} - -044_03_18_endpoint post /temporal/entityOperations/query - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /temporal/entityOperations/query) - - ${first_temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} - ${second_temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} - Create Temporal Representation Of Entity ${tea_first_vehicle_payload_file} ${first_temporal_entity_representation_id} - Create Temporal Representation Of Entity ${tea_second_vehicle_payload_file} ${second_temporal_entity_representation_id} - @{temporal_entity_representation_ids}= Create List ${first_temporal_entity_representation_id} ${second_temporal_entity_representation_id} - - Query Temporal Representation Of Entities Via Post entity-operations-after-query.jsonld ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Several Temporal Representations Of Entities @{temporal_entity_representation_ids} \ No newline at end of file + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_03b.robot b/TP/NGSI-LD/CommonBehaviours/044_03b.robot deleted file mode 100644 index 79c9916e..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_03b.robot +++ /dev/null @@ -1,92 +0,0 @@ -*** Settings *** -Documentation Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -*** Variable *** -${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${vehicle_filename}= vehicle-datasetid-attributes-sample.jsonld -${vehicle_attribute}= speed -${vehicle_fragment}= vehicle-fragment-empty-datasetid-sample.jsonld - -${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld -${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.jsonld - -${tea_id_prefix}= urn:ngsi-ld:Vehicle: -${tea_filename}= vehicle-temporal-representation-sample.jsonld - -${building_id_prefix}= urn:ngsi-ld:Building: -${building_filename}= building-simple-attributes-sample.jsonld - - -*** Test Cases *** -044_03_01_endpoint patch /entities/{entityId}/attrs/{attrId} - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /entities/{entityId}/attrs/{attrId}) - - ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Partial Update Entity Attributes ${entity_id} ${vehicle_attribute} ${vehicle_fragment} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_03_02_endpoint patch /subscriptions/{subscriptionId} - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (patch /subscriptions/{subscriptionId}) - - ${id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Update Subscription ${id} ${subscription_fragment} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Subscription ${id} - - -044_03_03_endpoint post /entities/ - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entities/) - - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Entity by Id ${entity_id} - -044_03_04_endpoint post /subscriptions/ - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /subscriptions/) - - ${subscriptions_id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${subscriptions_id} ${subscription_filename} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Subscription ${subscriptions_id} - -044_03_05_endpoint post /entityOperations/create - - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /entityOperations/create) - - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${first_entity}= Load Entity ${building_filename} ${first_entity_id} - ${second_entity}= Load Entity ${building_filename} ${second_entity_id} - @{entities_to_be_created}= Create List ${first_entity} ${second_entity} - - Batch Create Entities @{entities_to_be_created} content_type=${EMPTY} - - @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} - Check Response Status Code Set To 415 - - [Teardown] Batch Delete Entities @{expected_entities_ids} - -044_03_06_endpoint post /temporal/entities/ - [Documentation] Verify throwing 415 HTTP status code (Unsupported Media Type) if "Content-Type" header is not "application/json" or "application/ld+json" (post /temporal/entities/) - - ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} - ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${EMPTY} - Check Response Status Code 415 ${response['status']} - - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_04.robot b/TP/NGSI-LD/CommonBehaviours/044_04.robot index b4239d0d..29d07ad6 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_04.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_04.robot @@ -10,42 +10,12 @@ ${status_code}= 406 ${building_id_prefix}= urn:ngsi-ld:Building: ${building_filename}= building-simple-attributes-sample.jsonld -${entity_type}= https://ngsi-ld-test-suite/context#Building ${subscription_id_prefix}= urn:ngsi-ld:Subscription: ${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld -${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_filename}= csourceRegistrations/registration-sample.jsonld - -${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${vehicle_filename}= vehicle-datasetid-attributes-sample.jsonld -${vehicle_attribute}= speed - -${tea_id_prefix}= urn:ngsi-ld:Vehicle: -${tea_filename}= vehicle-temporal-representation-sample.jsonld - *** Test Cases *** -044_04_01_endpoint get /entities/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /entities/) - - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} - ${entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${first_entity_id} ${second_entity_id} - @{entity_types_to_be_retrieved}= Create List ${entity_type} - ${response}= Query Entities entity_ids=${entities_ids_to_be_retrieved} entity_types=${entity_types_to_be_retrieved} accept=${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Batch Delete Entities @{entities_ids_to_be_deleted} teardown=True - - -044_04_02_endpoint get /entities/{entityId} +044_04_01_endpoint get /entities/{entityId} [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /entities/{entityId}) ${entity_id}= Generate Random Entity Id ${building_id_prefix} @@ -57,19 +27,7 @@ ${tea_filename}= vehicle-temporal-representation-sample.jsonld [Teardown] Delete Entity by Id Returning Response ${entity_id} -044_04_03_endpoint get /subscriptions/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /subscriptions/) - - ${id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Query Subscriptions accept=${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Subscription ${id} - -044_04_04_endpoint get /subscriptions/{subscriptionId} +044_04_02_endpoint get /subscriptions/{subscriptionId} [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /subscriptions/{subscriptionId}) ${id}= Generate Random Entity Id ${subscription_id_prefix} @@ -81,104 +39,20 @@ ${tea_filename}= vehicle-temporal-representation-sample.jsonld [Teardown] Delete Subscription ${id} -044_04_05_endpoint get /types/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /types/) - - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Retrieve Entity Types With Return ${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_04_06_endpoint get /types/{type} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /types/{type}) - - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${response}= Retrieve Entity Type With Return ${entity_type} ${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_04_07_endpoint get /attributes/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /attributes/) - - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - - ${response}= Retrieve Attributes With Return ${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_04_08_endpoint get /attributes/{attrId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /attributes/{attrId}) - - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - ${response}= Retrieve Attribute With Return airQualityLevel ${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_04_09_endpoint get /csourceRegistrations/ +044_04_03_endpoint get /csourceRegistrations/ [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceRegistrations/) Query Context Source Registrations type=Building accept=${accept} Check Response Status Code Set To ${status_code} - -044_04_10_endpoint get /csourceRegistrations/{registrationId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceRegistrations/{registrationId}) - - ${context_source_registration_id}= Generate Random Entity Id ${registration_id_prefix} - ${context_source_registration_payload}= Load Test Sample ${registration_filename} ${context_source_registration_id} - Create Context Source Registration ${context_source_registration_payload} - - - Retrieve Context Source Registration ${context_source_registration_id} accept=${accept} - Check Response Status Code Set To ${status_code} - - [Teardown] Delete Context Source Registration ${context_source_registration_id} - - -044_04_11_endpoint get /csourceSubscriptions/ +044_04_04_endpoint get /csourceSubscriptions/ [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceSubscriptions/) Query Context Source Registration Subscriptions accept=${accept} Check Response Status Code Set To ${status_code} -044_04_12_endpoint get /csourceSubscriptions/{subscriptionId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceSubscriptions/{subscriptionId}) - - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} - Create Context Source Registration Subscription ${subscription_payload} - - Retrieve Context Source Registration Subscription ${subscription_id} accept=${accept} - Check Response Status Code Set To ${status_code} - - [Teardown] Delete Context Source Registration Subscription ${subscription_id} - -044_04_13_endpoint get /temporal/entities +044_04_05_endpoint get /temporal/entities [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /temporal/entities) - - @{entity_types_to_be_retrieved}= Create List Vehicle + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle Query Temporal Representation Of Entities entity_types=${entity_types_to_be_retrieved} timerel=after timeAt=2020-08-01T12:05:00Z accept=${accept} - Check Response Status Code Set To ${status_code} - -044_04_14_endpoint get /temporal/entities/{entityId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /temporal/entities/{entityId}) - - ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} - Create Temporal Representation Of Entity ${tea_filename} ${temporal_entity_representation_id} - - Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} accept=${accept} - Check Response Status Code Set To ${status_code} - - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} \ No newline at end of file + Check Response Status Code Set To ${status_code} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_04b.robot b/TP/NGSI-LD/CommonBehaviours/044_04b.robot deleted file mode 100644 index a80de3b3..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_04b.robot +++ /dev/null @@ -1,61 +0,0 @@ -*** Settings *** -Documentation Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -*** Variable *** -${accept}= application/xml -${status_code}= 406 - -${building_id_prefix}= urn:ngsi-ld:Building: -${building_filename}= building-simple-attributes-sample.jsonld -${entity_type}= https://ngsi-ld-test-suite/context#Building - -${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld - -*** Test Cases *** -044_04_01_endpoint get /entities/{entityId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /entities/{entityId}) - - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${request} ${response}= Query Entity ${entity_id} accept=${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_04_02_endpoint get /subscriptions/{subscriptionId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /subscriptions/{subscriptionId}) - - ${id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - - ${request} ${response}= Retrieve Subscription ${id} accept=${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Subscription ${id} - -044_04_03_endpoint get /csourceRegistrations/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceRegistrations/) - - Query Context Source Registrations type=Building accept=${accept} - Check Response Status Code Set To ${status_code} - -044_04_04_endpoint get /csourceSubscriptions/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /csourceSubscriptions/) - - Query Context Source Registration Subscriptions accept=${accept} - Check Response Status Code Set To ${status_code} - -044_04_05_endpoint get /temporal/entities - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header does not imply "application/json" nor "application/ld+json" (get /temporal/entities) - - @{entity_types_to_be_retrieved}= Create List Vehicle - Query Temporal Representation Of Entities entity_types=${entity_types_to_be_retrieved} timerel=after timeAt=2020-08-01T12:05:00Z accept=${accept} - Check Response Status Code Set To ${status_code} - diff --git a/TP/NGSI-LD/CommonBehaviours/044_05.robot b/TP/NGSI-LD/CommonBehaviours/044_05.robot index de22aa7c..ff5b8b74 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_05.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_05.robot @@ -17,100 +17,91 @@ ${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld ${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.json ${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_filename}= registration-sample.jsonld -${registration_fragment}= registration-with-expiration-sample.jsonld +${registration_filename}= context-source-registration-with-expiration-sample.jsonld +${registration_fragment}= context-source-registration-with-expiration-expectation.json ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${vehicle_filename}= vehicle-datasetid-attributes-sample.jsonld -${vehicle_attribute}= speed +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${vehicle_attribute}= brandName +${vehicle_fragment}= vehicle-brandname-fragment.jsonld ${tea_id_prefix}= urn:ngsi-ld:Vehicle: ${tea_filename}= vehicle-temporal-representation-sample.jsonld -*** comment *** -044_05_01_endpoint /subscriptions/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/subscriptions/) +*** Test Cases *** +044_05_01_endpoint create /entities/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /entities/) - ${id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} accept=${accept} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} accept=${accept} Check Response Status Code ${status_code} ${response['status']} - [Teardown] Delete Subscription ${id} + [Teardown] Delete Entity by Id ${entity_id} -044_05_02_endpoint /subscriptions/{subscriptionId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/subscriptions/{subscriptionId}) +044_05_02_endpoint update /entities/{entityId}/attrs/{attrId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (update /entities/{entityId}/attrs/{attrId}) - ${id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} - - ${response}= Update Subscription ${id} ${subscription_fragment} ${CONTENT_TYPE_LD_JSON} accept=${accept} + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + Retrieve Entity by Id ${entity_id} + ${response}= Partial Update Entity Attributes ${entity_id} ${vehicle_attribute} ${vehicle_fragment} ${CONTENT_TYPE_LD_JSON} accept=${accept} Check Response Status Code ${status_code} ${response['status']} - [Teardown] Delete Subscription ${id} + [Teardown] Delete Entity by Id Returning Response ${entity_id} -#044_05_03_endpoint /types/ -# [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/types/) +044_05_03_endpoint create /subscriptions/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /subscriptions/) -#044_05_04_endpoint /types/{type} -# [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/types/{type}) - -#044_05_05_endpoint /attributes/ -# [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/attributes/) + ${subscriptions_id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${subscriptions_id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} accept=${accept} + Check Response Status Code ${status_code} ${response['status']} + [Teardown] Delete Subscription ${subscriptions_id} -#044_05_06_endpoint /attributes/{attrId} -# [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/attributes/{attrId}) +044_05_04_endpoint update /subscriptions/{subscriptionId} + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (update /subscriptions/{subscriptionId}) -044_05_07_endpoint /csourceRegistrations/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/csourceRegistrations/) + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_filename} - ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} - ${request} ${response}= Create Context Source Registration With Return ${updated_payload} accept=${accept} + ${response}= Update Subscription ${id} ${subscription_fragment} ${CONTENT_TYPE_LD_JSON} accept=${accept} Check Response Status Code ${status_code} ${response['status']} - [Teardown] Delete Context Source Registration ${registration_id} - - - -044_05_08_endpoint /csourceRegistrations/{registrationId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/csourceRegistrations/{registrationId}) + [Teardown] Delete Subscription ${id} - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_filename} - ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} - ${request} ${response}= Create Context Source Registration With Return ${updated_payload} - Check Response Status Code 201 ${response['status']} +044_05_05_endpoint create /temporal/entities/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /temporal/entities/) - ${fragment}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_fragment} - ${fragment_with_id}= Update Value To Json ${fragment} $..id ${registration_id} - ${response}= Update Context Source Registration With Return ${registration_id} ${fragment_with_id} ${CONTENT_TYPE_LD_JSON} accept=${accept} + ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${CONTENT_TYPE_LD_JSON} accept=${accept} Check Response Status Code ${status_code} ${response['status']} - [Teardown] Delete Context Source Registration ${registration_id} + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} +044_05_06_endpoint create /entityOperations/create + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /entityOperations/create) -044_05_09_endpoint /csourceSubscriptions/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/csourceSubscriptions/) + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity ${building_filename} ${first_entity_id} + ${second_entity}= Load Entity ${building_filename} ${second_entity_id} + @{entities_to_be_created}= Create List ${first_entity} ${second_entity} - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} - Create Context Source Registration Subscription ${subscription_payload} accept=${accept} - Check Response Status Code Set To ${status_code} + Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} accept=${accept} - [Teardown] Delete Context Source Registration Subscription ${subscription_id} + @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + Check Response Status Code Set To ${status_code} -*** Test Cases *** -044_05_10_endpoint /csourceSubscriptions/{subscriptionId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (/csourceSubscriptions/{subscriptionId}) + [Teardown] Batch Delete Entities @{expected_entities_ids} - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_filename} ${subscription_id} - Create Context Source Registration Subscription ${subscription_payload} +044_05_07_endpoint create /csourceRegistrations/ + [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /csourceRegistrations/) - ${subscription_update_fragment}= Load Test Sample ${subscription_fragment} - ${response}= Update Context Source Registration Subscription By Selecting Content Type ${subscription_id} ${subscription_update_fragment} ${CONTENT_TYPE_LD_JSON} #accept=${accept} + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration With Return ${updated_payload} accept=${accept} Check Response Status Code ${status_code} ${response['status']} - [Teardown] Delete Context Source Registration Subscription ${subscription_id} \ No newline at end of file + [Teardown] Delete Context Source Registration ${registration_id} \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/044_05b.robot b/TP/NGSI-LD/CommonBehaviours/044_05b.robot deleted file mode 100644 index f6d40827..00000000 --- a/TP/NGSI-LD/CommonBehaviours/044_05b.robot +++ /dev/null @@ -1,107 +0,0 @@ -*** Settings *** -Documentation Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" -Resource ${EXECDIR}/resources/ApiUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -*** Variable *** -${accept}= application/geo+json -${status_code}= 406 - -${building_id_prefix}= urn:ngsi-ld:Building: -${building_filename}= building-simple-attributes-sample.jsonld -${entity_type}= https://ngsi-ld-test-suite/context#Building - -${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld -${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.json - -${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_filename}= registration-sample.jsonld -${registration_fragment}= registration-with-expiration-sample.jsonld - -${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${vehicle_filename}= vehicle-simple-attributes-sample.jsonld -${vehicle_attribute}= brandName -${vehicle_fragment}= vehicle-fragment-brandname-sample.jsonld - -${tea_id_prefix}= urn:ngsi-ld:Vehicle: -${tea_filename}= vehicle-temporal-representation-sample.jsonld - -*** Test Cases *** -044_05_01_endpoint create /entities/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /entities/) - - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} accept=${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Entity by Id ${entity_id} - -044_05_02_endpoint update /entities/{entityId}/attrs/{attrId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (update /entities/{entityId}/attrs/{attrId}) - - ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} - ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${response['status']} - Retrieve Entity by Id ${entity_id} - ${response}= Partial Update Entity Attributes ${entity_id} ${vehicle_attribute} ${vehicle_fragment} ${CONTENT_TYPE_LD_JSON} accept=${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Entity by Id Returning Response ${entity_id} - -044_05_03_endpoint create /subscriptions/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /subscriptions/) - - ${subscriptions_id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${subscriptions_id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} accept=${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Subscription ${subscriptions_id} - -044_05_04_endpoint update /subscriptions/{subscriptionId} - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (update /subscriptions/{subscriptionId}) - - ${id}= Generate Random Entity Id ${subscription_id_prefix} - ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} - - ${response}= Update Subscription ${id} ${subscription_fragment} ${CONTENT_TYPE_LD_JSON} accept=${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Subscription ${id} - -044_05_05_endpoint create /temporal/entities/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /temporal/entities/) - - ${temporal_entity_representation_id}= Generate Random Entity Id ${tea_id_prefix} - ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${CONTENT_TYPE_LD_JSON} accept=${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} - -044_05_06_endpoint create /entityOperations/create - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /entityOperations/create) - - ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} - ${first_entity}= Load Entity ${building_filename} ${first_entity_id} - ${second_entity}= Load Entity ${building_filename} ${second_entity_id} - @{entities_to_be_created}= Create List ${first_entity} ${second_entity} - - Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} accept=${accept} - - @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} - Check Response Status Code Set To ${status_code} - - [Teardown] Batch Delete Entities @{expected_entities_ids} - -044_05_07_endpoint create /csourceRegistrations/ - [Documentation] Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the "Accept" header is "application/geo+json" for operations different than "Retrieve Entity" and "Query Entity" (create /csourceRegistrations/) - - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_filename} - ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} - ${request} ${response}= Create Context Source Registration With Return ${updated_payload} accept=${accept} - Check Response Status Code ${status_code} ${response['status']} - - [Teardown] Delete Context Source Registration ${registration_id} \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/registration-with-expiration-expectation-sample.json b/data/csourceRegistrations/expectations/context-source-registration-with-expiration-expectation.json similarity index 100% rename from data/csourceRegistrations/expectations/registration-with-expiration-expectation-sample.json rename to data/csourceRegistrations/expectations/context-source-registration-with-expiration-expectation.json diff --git a/data/entities/fragmentEntities/vehicle-fragment-brandname-sample.jsonld b/data/entities/fragmentEntities/vehicle-brandname-fragment.jsonld similarity index 100% rename from data/entities/fragmentEntities/vehicle-fragment-brandname-sample.jsonld rename to data/entities/fragmentEntities/vehicle-brandname-fragment.jsonld -- GitLab From 3186b1fb11eb73a74bad7e4c9f841dd44bd416ec Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Tue, 16 Mar 2021 16:48:29 +0000 Subject: [PATCH 7/7] fixed more merge conflicts --- .../ContextInformation/Consumption/Entity/018_01_02.robot | 5 ----- .../ContextInformation/Consumption/Entity/018_03_02.robot | 5 ----- .../ContextInformation/Consumption/Entity/019_01_02.robot | 4 ---- 3 files changed, 14 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_02.robot index 45cc30b0..d539dc71 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_01_02.robot @@ -20,13 +20,8 @@ ${attribute_subcategory}= https://ngsi-ld-test-suite/context#subCategory ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} -<<<<<<< HEAD - ${attributes_to_be_retrieved}= Create List ${attribute_airqualitylevel} ${attribute_subcategory} - ${request} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} -======= ${attributes_to_be_retrieved}= Catenate SEPARATOR=, ${attribute_airqualitylevel} ${attribute_subcategory} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} ->>>>>>> develop Check Response Status Code 200 ${response['status']} Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response['body']} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_02.robot index bf7c433d..df7d0e2b 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/018_03_02.robot @@ -18,13 +18,8 @@ Get an entity if an attribute is not known to the system ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} -<<<<<<< HEAD - ${attributes_to_be_retrieved}= Create List ${attribute_not_known} - ${request} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} -======= ${attributes_to_be_retrieved}= Catenate SEPARATOR=, ${attribute_not_known} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} ->>>>>>> develop Check Response Status Code 404 ${response['status']} Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_RESOURCE_NOT_FOUND} Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_02.robot index 2664ed4c..52cfd88a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_02.robot @@ -11,11 +11,7 @@ ${parking_id_prefix}= urn:ngsi-ld:OffStreetParking: ${building_filename}= building-minimal-sample.jsonld ${vehicle_filename}= vehicle-simple-attributes-sample.jsonld ${parking_filename}= parking-simple-attributes-sample.jsonld -<<<<<<< HEAD -${expectation_filename}= vehicle-parking-sample-expectation.json -======= ${expectation_filename}= two-types-vehicle-offstreetparking-expectation.jsonld ->>>>>>> develop ${building_entity_type}= https://ngsi-ld-test-suite/context#Building ${vehicle_entity_type}= https://ngsi-ld-test-suite/context#Vehicle ${parking_entity_type}= https://ngsi-ld-test-suite/context#OffStreetParking -- GitLab