diff --git a/TP/NGSI-LD/CommonBehaviours/043.robot b/TP/NGSI-LD/CommonBehaviours/043.robot index b372613b69742e39395a73a38908410d6cfdf9e7..2e7a10d47d36c00523c8c7a2033fed3ddc3602cd 100644 --- a/TP/NGSI-LD/CommonBehaviours/043.robot +++ b/TP/NGSI-LD/CommonBehaviours/043.robot @@ -8,16 +8,16 @@ Resource ${EXECDIR}/resources/JsonUtils.resource ${expected_status_code}= 503 ${building_id_prefix}= urn:ngsi-ld:Building: -${building_filename}= building-minimal-without-context-sample.jsonld +${building_filename}= building-unretrievable-context-sample.jsonld ${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_filename}= csourceSubscriptions/subscription-without-context-sample.jsonld +${subscription_filename}= subscriptions/subscription-unretrievable-context-sample.jsonld ${tea_id_prefix}= urn:ngsi-ld:Vehicle: -${tea_filename}= bus-temporal-representation-without-context-sample.jsonld +${tea_filename}= bus-temporal-representation-unretrievable-context-sample.jsonld ${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_filename}= csourceRegistrations/context-source-registration-without-context-sample.jsonld +${registration_filename}= csourceRegistrations/context-source-registration-unretrievable-context-sample.jsonld *** Test Cases *** 043_01 Create entity @@ -42,7 +42,6 @@ ${registration_filename}= csourceRegistrations/context-source-registration-with [Teardown] Delete Subscription ${subscription_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) diff --git a/TP/NGSI-LD/CommonBehaviours/044_01.robot b/TP/NGSI-LD/CommonBehaviours/044_01.robot index 76c1db84680a8d00c3affd97cf3d51da89b17e35..5aecce32feb29453c3c887511dcca3a2b2d1d57d 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_01.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_01.robot @@ -7,14 +7,14 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: ${vehicle_filename}= vehicle-simple-attributes-sample.jsonld -${vehicle_fragment}= vehicle-brandname-fragment.jsonld +${vehicle_fragment}= vehicle-brandname-fragment.json ${attribute_id}= brandName ${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld -${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sample.jsonld +${subscription_filename}= subscriptions/subscription-sample.jsonld +${subscription_fragment}= subscriptions/fragments/subscription-update-sample.json -*** Test Cases *** +*** Test Cases *** 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 @@ -22,11 +22,11 @@ ${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sa ${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} + ${response}= Partial Update Entity Attributes ${entity_id} ${attribute_id} ${vehicle_fragment} ${CONTENT_TYPE_MERGE_PATCH_JSON} context=${ngsild_test_suite_context} Check Response Status Code 204 ${response['status']} [Teardown] Delete Entity by Id ${entity_id} - + 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 @@ -34,7 +34,7 @@ ${subscription_fragment}= csourceSubscriptions/fragments/subscription-update-sa ${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} + ${response}= Update Subscription ${subscription_id} ${subscription_fragment} ${CONTENT_TYPE_MERGE_PATCH_JSON} context=${ngsild_test_suite_context} Check Response Status Code 204 ${response['status']} [Teardown] Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/CommonBehaviours/044_02.robot b/TP/NGSI-LD/CommonBehaviours/044_02.robot index df734374731bb8a787b29d8306ac7bfad9b75099..8b853cdba2ed7d6ce12c82286b516bfcba3ea7a7 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_02.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_02.robot @@ -11,7 +11,7 @@ ${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_filename}= subscriptions/subscription-sample.jsonld ${subscription_expectation}= subscription-sample-expectation.json ${registration_id_prefix}= urn:ngsi-ld:Registration: @@ -21,9 +21,11 @@ ${registration_type}= Vehicle ${tea_id_prefix}= urn:ngsi-ld:Vehicle: ${tea_filename}= vehicle-temporal-representation-sample.jsonld -${tea_expectation}= vehicle-temporal-representation-expectation.json +${tea_expectation}= vehicles-temporal-representation-044-02-04-expectation.json ${teatype}= Vehicle +${content_type}= application/json + *** 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}) @@ -31,14 +33,14 @@ ${teatype}= Vehicle ${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} + ${request} ${response}= Query Entity ${id} context=${ngsild_test_suite_context} 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, */* + Check Response Headers Containing Content-Type set to ${response} ${content_type} + Check Response Headers Link Not Empty ${response} [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}) @@ -49,7 +51,8 @@ ${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, */* + Check Response Headers Containing Content-Type set to ${response} ${content_type} + Check Response Headers Link Not Empty ${response} [Teardown] Delete Subscription ${id} @@ -62,10 +65,11 @@ ${teatype}= Vehicle ${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} + ${request} ${response}= Query Context Source Registrations With Return id=${registration_id} type=${registration_type} context=${ngsild_test_suite_context} 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, */* + Check Response Headers Containing Content-Type set to ${response} ${content_type} + Check Response Headers Link Not Empty ${response} [Teardown] Delete Context Source Registration ${registration_id} @@ -75,10 +79,11 @@ ${teatype}= Vehicle ${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 + ${request} ${response}= Query Temporal Representation Of Entities With Return entity_types=${teatype} timerel=after timeAt=2020-08-01T12:05:00Z context=${ngsild_test_suite_context} 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, */* + Check Response Headers Containing Content-Type set to ${response} ${content_type} + Check Response Headers Link Not Empty ${response} [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 bf43562bb5c5dcf00f586a3f89e652f3b538bbc4..814983fc2a81128f8317af0d93eb6954349445d9 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_03.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_03.robot @@ -6,7 +6,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: -${vehicle_filename}= vehicle-simple-attributes-sample.json +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld ${vehicle_attribute}= speed ${vehicle_fragment}= vehicle-brandname-fragment.jsonld @@ -20,6 +20,8 @@ ${tea_filename}= vehicle-temporal-representation-sample.jsonld ${building_id_prefix}= urn:ngsi-ld:Building: ${building_filename}= building-simple-attributes-sample.jsonld +${content_type}= application/xml + *** 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}) @@ -28,7 +30,7 @@ ${building_filename}= building-simple-attributes-sample.jsonld ${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} + ${response}= Partial Update Entity Attributes ${entity_id} ${vehicle_attribute} ${vehicle_fragment} ${content_type} Check Response Status Code 415 ${response['status']} [Teardown] Delete Entity by Id Returning Response ${entity_id} @@ -40,7 +42,7 @@ ${building_filename}= building-simple-attributes-sample.jsonld ${response}= Create Subscription ${id} ${subscription_filename} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Update Subscription ${id} ${subscription_fragment} ${EMPTY} + ${response}= Update Subscription ${id} ${subscription_fragment} ${content_type} Check Response Status Code 415 ${response['status']} [Teardown] Delete Subscription ${id} @@ -49,7 +51,7 @@ ${building_filename}= building-simple-attributes-sample.jsonld [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} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${entity_id} ${content_type} Check Response Status Code 415 ${response['status']} [Teardown] Delete Entity by Id ${entity_id} @@ -58,13 +60,12 @@ ${building_filename}= building-simple-attributes-sample.jsonld [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} + ${response}= Create Subscription ${subscriptions_id} ${subscription_filename} ${content_type} 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} @@ -73,7 +74,7 @@ ${building_filename}= building-simple-attributes-sample.jsonld ${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} + Batch Create Entities @{entities_to_be_created} content_type=${content_type} @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} Check Response Status Code Set To 415 @@ -84,7 +85,7 @@ ${building_filename}= building-simple-attributes-sample.jsonld [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} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${tea_filename} ${content_type} 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 29d07ad62cea661715c5b9b228763e407ea525b7..64e9643617b3b9f0be870d3bd0f08c6e5c62a836 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_04.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_04.robot @@ -42,8 +42,8 @@ ${subscription_filename}= csourceSubscriptions/subscription-sample.jsonld 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} + ${request} ${response}= Query Context Source Registrations With Return type=Building accept=${accept} + Check Response Status Code ${status_code} ${response['status']} 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/) diff --git a/TP/NGSI-LD/CommonBehaviours/044_05.robot b/TP/NGSI-LD/CommonBehaviours/044_05.robot index ff5b8b74ef9a3c8478585123d1f4034e63394b56..7b7662dbc4905851ab16df32b6a8f961a4ed3161 100644 --- a/TP/NGSI-LD/CommonBehaviours/044_05.robot +++ b/TP/NGSI-LD/CommonBehaviours/044_05.robot @@ -8,100 +8,30 @@ Resource ${EXECDIR}/resources/JsonUtils.resource ${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}= 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-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 *** 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}) - +044_05_01 Retrieve subscription by id + [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}= Update Subscription ${id} ${subscription_fragment} ${CONTENT_TYPE_LD_JSON} accept=${accept} + ${request} ${response}= Retrieve Subscription ${id} 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} +044_05_02 Query 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}= 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} - [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 +044_05_03 Query context source registration + [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) + ${request} ${response}= Query Context Source Registrations With Return type=Building accept=${accept} + Check Response Status Code ${status_code} ${response['status']} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_04.robot index 5d0d706a129d298e81b08f909d26f8c07a7da15e..fe88f51a53517a16ccaddaf4e1986a0b852fd113 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_04.robot @@ -8,9 +8,8 @@ Resource ${EXECDIR}/resources/JsonUtils.resource ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-minimal-sample.jsonld ${entity_type}= https://ngsi-ld-test-suite/context#Building -${invalid_attribute_one}= invalid_attribute_one -${invalid_attribute_two}= invalid_attribute_two - +${invalid_attribute_one}= invalid +${invalid_attribute_two}= invalid *** Test Cases *** Query several entities based on incorrect attribute names [Documentation] Check that you cannot query entities if the requested attribute names are incorrect diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_05.robot index 55dd7fd3283cb494caa4a6f6c8ee9890848b60dc..8f0612077dd1e17746707f8828da1ec095ab5629 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_05.robot @@ -6,9 +6,12 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -${filename}= building-minimal-sample.jsonld -${entity_type}= https://ngsi-ld-test-suite/context#Building -${invalid_geometry_property}= invalid_geometry_property +${filename}= building-location-attribute-sample.jsonld +${entity_type}= Building +${georel}= invalid +${geometry}= Point +${coordinates}= [-8.503,41.202] +${geoproperty}= location *** Test Cases *** Query entitites when the request has a wrong geometryProperty @@ -23,7 +26,8 @@ Query entitites when the request has a wrong geometryProperty Check Response Status Code 201 ${response['status']} ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} - ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} geoproperty=${invalid_geometry_property} + ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} geoproperty=${geoproperty} georel=${georel} geometry=${geometry} coordinates=${coordinates} context=${ngsild_test_suite_context} + Check Response Status Code 400 ${response['status']} Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_01.robot index 9f686e75f54a79bbf3505b588e7428ffbb3d7e02..a44a455f290e29c7ea82124178d9cf41eeb78ead 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_01.robot @@ -24,7 +24,8 @@ Create Temporal Entity Check Response Status Code 201 ${response['status']} ${created_temporal_entity}= Load Test Sample temporalEntities/${filename} ${temporal_entity_representation_id} - Set Test Variable ${response} - Check Created Resource Set To ${created_temporal_entity} + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} + ${ignored_attributes}= Create List instanceId @context + Check Created Resource Set To ${created_temporal_entity} ${ignored_attributes} [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-without-context-sample.jsonld b/data/csourceRegistrations/context-source-registration-unretrievable-context-sample.jsonld similarity index 71% rename from data/csourceRegistrations/context-source-registration-without-context-sample.jsonld rename to data/csourceRegistrations/context-source-registration-unretrievable-context-sample.jsonld index b4a6b06efb3f5a7e307eb5f2467e5b92afb248ac..41532009790862273c584c457c7a731160b03b86 100644 --- a/data/csourceRegistrations/context-source-registration-without-context-sample.jsonld +++ b/data/csourceRegistrations/context-source-registration-unretrievable-context-sample.jsonld @@ -10,5 +10,8 @@ ] } ], - "endpoint":"http://my.csource.org:1026" + "endpoint":"http://my.csource.org:1026", + "@context":[ + "unretrievableContext" + ] } \ No newline at end of file diff --git a/data/entities/building-unretrievable-context-sample.jsonld b/data/entities/building-unretrievable-context-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..908a6b09ee094b03b553a4647dd3fa40ae930f97 --- /dev/null +++ b/data/entities/building-unretrievable-context-sample.jsonld @@ -0,0 +1,7 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "@context": [ + "unretrievableContext" + ] +} \ 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 index df3301bfb68b6cd8f9d8d728427d2c7ad24f0348..436ba724d690eb224d61a62d7df7ac5aec7dc94a 100644 --- a/data/entities/expectations/building-simple-attributes-sample-expectation.json +++ b/data/entities/expectations/building-simple-attributes-sample-expectation.json @@ -1,22 +1,22 @@ { "id": "urn:ngsi-ld:Building:randomUUID", - "type": "https://ngsi-ld-test-suite/context#Building", - "https://ngsi-ld-test-suite/context#name": { - "type": "Property", - "value": "Eiffel Tower" - }, - "https://ngsi-ld-test-suite/context#airQualityLevel": { + "type": "Building", + "airQualityLevel": { "type": "Property", "value": 4, "observedAt": "2020-09-09T16:40:00.000Z", "unitCode": "C62" }, - "https://ngsi-ld-test-suite/context#almostFull": { + "almostFull": { "type": "Property", "value": false }, - "https://ngsi-ld-test-suite/context#subCategory": { + "subCategory": { "type": "Property", "value": "tourism" + }, + "name": { + "type": "Property", + "value": "Eiffel Tower" } } \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-brandname-fragment.json b/data/entities/fragmentEntities/vehicle-brandname-fragment.json new file mode 100644 index 0000000000000000000000000000000000000000..2675db210eaf45962be1423ab36779f2af770e60 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-brandname-fragment.json @@ -0,0 +1,6 @@ +{ + "https://ngsi-ld-test-suite/context#brandName": { + "type": "Property", + "value": "BMW" + } +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-brandname-fragment.jsonld b/data/entities/fragmentEntities/vehicle-brandname-fragment.jsonld index 14fcc171f62f02516a245497db45cbc41eb10d5e..8c229718a38962e381376027f85620741c5433ee 100644 --- a/data/entities/fragmentEntities/vehicle-brandname-fragment.jsonld +++ b/data/entities/fragmentEntities/vehicle-brandname-fragment.jsonld @@ -3,5 +3,5 @@ "type": "Property", "value": "BMW" }, - "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + "@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" } \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-without-context-sample.jsonld b/data/subscriptions/subscription-unretrievable-context-sample.jsonld similarity index 84% rename from data/csourceSubscriptions/subscription-without-context-sample.jsonld rename to data/subscriptions/subscription-unretrievable-context-sample.jsonld index 36860f5b4da5b44b3b8d439cf28f1861ce1a1c2d..f4a60a8120fd573f217e4decafbcb0ce44a6826e 100644 --- a/data/csourceSubscriptions/subscription-without-context-sample.jsonld +++ b/data/subscriptions/subscription-unretrievable-context-sample.jsonld @@ -12,5 +12,8 @@ "uri":"http://my.endpoint.org/notify", "accept":"application/json" } - } + }, + "@context":[ + "contextUnretrievable" + ] } \ No newline at end of file diff --git a/data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld b/data/temporalEntities/bus-temporal-representation-unretrievable-context-sample.jsonld similarity index 94% rename from data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld rename to data/temporalEntities/bus-temporal-representation-unretrievable-context-sample.jsonld index 9a70e2bd3f3b391d336763d9324aed2bb06454a6..c6f128254d71f64709b31dc616e435ff0ee8fbdf 100644 --- a/data/temporalEntities/bus-temporal-representation-without-context-sample.jsonld +++ b/data/temporalEntities/bus-temporal-representation-unretrievable-context-sample.jsonld @@ -40,5 +40,8 @@ "value":124, "observedAt":"2020-08-01T14:07:00Z" } + ], + "@context":[ + "unretrievableContext" ] } \ 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 deleted file mode 100644 index 7917df3cc19bec2f9b2925ac20860ebc862de024..0000000000000000000000000000000000000000 --- a/data/temporalEntities/expectations/vehicle-temporal-representation-expectation.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "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/expectations/vehicles-temporal-representation-044-02-04-expectation.json b/data/temporalEntities/expectations/vehicles-temporal-representation-044-02-04-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..6fb2bc953f72e4e30d6efc94fa40b15af3c327ed --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-044-02-04-expectation.json @@ -0,0 +1,76 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName":{ + "type":"Property", + "value":"Volvo" + }, + "fuelLevel":[ + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:07:00Z" + } + ] + }, + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName":{ + "type":"Property", + "value":"BMW" + }, + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-09-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-09-01T14:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-09-01T12:05:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2020-09-01T12:07:00Z" + } + ] + } +] \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index b6e4bb360a64c9a111eb0ace37deb89dcc62914c..da2b42aca22ba014f968dfb49a4a15ed88328dcd 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -68,7 +68,7 @@ Query Entity [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} + [Arguments] ${entity_ids}=${EMPTY} ${entity_types}=${EMPTY} ${accept}=${EMPTY} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${options}=${EMPTY} ${limit}=${EMPTY} ${entity_id_pattern}=${EMPTY} ${georel}=${EMPTY} ${coordinates}=${EMPTY} ${geometry}=${EMPTY} ${attrs_length} = Get Length ${attrs} ${accept_length} = Get Length ${accept} ${options_length} = Get Length ${options} @@ -85,6 +85,9 @@ Query Entities Run Keyword If ${entity_types_length}>0 Set To Dictionary ${params} type=${entity_types} Run Keyword If '${limit}'!='' Set To Dictionary ${params} limit=${limit} Run Keyword If '${entity_id_pattern}'!='' Set To Dictionary ${params} idPattern=${entity_id_pattern} + Run Keyword If '${georel}'!='' Set To Dictionary ${params} georel=${georel} + Run Keyword If '${coordinates}'!='' Set To Dictionary ${params} coordinates=${coordinates} + Run Keyword If '${geometry}'!='' Set To Dictionary ${params} geometry=${geometry} ${response}= GET ${ENTITIES_ENDPOINT_PATH} headers=${headers} query=${params} Output request @@ -190,9 +193,10 @@ Delete Entity Attributes [return] ${response} Partial Update Entity Attributes - [Arguments] ${entityId} ${attributeId} ${fragment_filename} ${content_type} ${accept}=${EMPTY} + [Arguments] ${entityId} ${attributeId} ${fragment_filename} ${content_type} ${accept}=${EMPTY} ${context}=${EMPTY} &{headers}= Create Dictionary 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" ${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 diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 54eac1a58dd73a898e76eacc84e7f95877771c9a..431c61d06d1ba876d77d908ac8f7a23ef4458dac 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -37,11 +37,13 @@ Check Response Body Content ${comparison_result}= Compare Dictionaries Ignoring Keys ${response_body} ${entity_payload} ${all_ignored_paths} Should Be True ${comparison_result} msg=Entity Comparison Failed -Check Request Containing Accept Header Set To - [Arguments] ${request} ${expected_accept_content} +Check Response Headers Containing Content-Type set to + [Arguments] ${response} ${expected_content_type_content} + Should Be Equal ${response['headers']['Content-Type']} ${expected_content_type_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 +Check Response Headers Link Not Empty + [Arguments] ${response} + Should Not Be Empty ${response['headers']['Link']} # Since Http headers names are case-insensitive (from Http specification) # We check both Location and location headers @@ -53,6 +55,7 @@ Check Response Headers Containing URI set to # Since Http headers names are case-insensitive (from Http specification) # We check both Location and location headers + Check Response Headers ID Not Empty [Arguments] ${response}