diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..679523a4da03945c84bd83be92c4c70bc88ed690 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot @@ -0,0 +1,26 @@ +*** Settings *** +Documentation Check that you cannot update a subcription: If the Subscription id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Update Subscription With Non present Or Invalid Id + +*** Test Cases *** id +NotPresentId ${EMPTY} +InvalidId InvalidUri + +*** Variable *** +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-update-sample.json + +*** Keywords *** +Update Subscription With Non present Or Invalid Id + [Arguments] ${id} + [Documentation] Check that you cannot update a subcription: If the Subscription id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised + [Tags] mandatory + + Update Subscription ${id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 400 + 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/Subscription/UpdateSubscription/029_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..3c64d3109eec03014c5768d07068609a7d26677e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot @@ -0,0 +1,19 @@ +*** Settings *** +Documentation Check that you cannot update a subscription: If the NGSI-LD System does not know about the target Subscription, because there is no existing Subscription whose id (URI) is equivalent, an error of type ResourceNotFound shall be raised +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-update-sample.json + +*** Test Case *** +Update Unknown Subscription + [Documentation] Check that you cannot update a subscription: If the NGSI-LD System does not know about the target Subscription, because there is no existing Subscription whose id (URI) is equivalent, an error of type ResourceNotFound shall be raised + [Tags] mandatory + + Update Subscription unknownSubscription ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 404 + 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/Subscription/UpdateSubscription/029_03.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..9a787102542ea3fb18092b5cf821c1627b880c6e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot @@ -0,0 +1,35 @@ +*** Settings *** +Documentation Check that you cannot update a subcription: If the data types and restriction are not met by the Subscription Fragment, then an error of type BadRequestData shall be raised +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-invalid-update-sample.json + +*** Test Case *** +Update Subscription With Invalid Fragment + [Documentation] Check that you cannot update a subcription: If the data types and restriction are not met by the Subscription Fragment, then an error of type BadRequestData shall be raised + [Tags] mandatory + + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 400 + 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} + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..e22a5f35c045c28f68d0aaa4fbe7d139cfac9205 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot @@ -0,0 +1,35 @@ +*** Settings *** +Documentation Check that you cannot update a subscription: Any attempt to remove (by setting them to null in the Fragment) mandatory properties of a Subscription (clause 5.2.12) shall result in an error of type BadRequestData +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-null-properties-update-sample.json + +*** Test Case *** +Update Subscription With Null Mandatory Properties + [Documentation] Check that you cannot update a subscription: Any attempt to remove (by setting them to null in the Fragment) mandatory properties of a Subscription (clause 5.2.12) shall result in an error of type BadRequestData + [Tags] mandatory + + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 400 + 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} + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..60aca577c7144f385aff2857ada780b8124fa2dd --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-vehicle-entities-sample.json +${expected_subscription_payload_file_path}= subscriptions/expected/subscription-vehicle-sample.jsonld +${expected_expanded_subscription_payload_file_path}= subscriptions/expected/subscription-vehicle-expanded-types-sample.jsonld + +*** Test Case *** +Update Subscription With Term to Uri Expansion + [Documentation] Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed + [Tags] mandatory + + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 204 + + Retrieve Subscription ${subscription_id} context=${ngsild_test_suite_context} + Check Response Body Containing Subscription element ${expected_subscription_payload_file_path} ${subscription_id} + + Retrieve Subscription ${subscription_id} + Check Response Body Containing Subscription element ${expected_expanded_subscription_payload_file_path} ${subscription_id} + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..606931b9938250a84f1011a02a5a6a473f7cf8a7 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Check that you can update a subcription: The implementation shall modify the target Subscription +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-update-sample.json + +*** Test Case *** +Update Subscription + [Documentation] Check that you can update a subcription: The implementation shall modify the target Subscription + [Tags] mandatory + + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 204 + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + ${subscription}= Upsert Element In Entity ${subscription_payload} ${subscription_update_fragment} + Retrieve Subscription ${subscription_id} accept=${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} + ${ignored_attributes}= Create List ${status_regex_expr} + Check Updated Resource Set To ${subscription} ${ignored_attributes} + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} + + Set Suite Variable ${subscription_id} + Set Suite Variable ${subscription_payload} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..bfbb5d6df36c28f1060bfb92231d48f72ddb5ddd --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you can update a subscription: If isActive is equal to true or null and expiresAt is not present, then status shall be updated to "active", if and only if, the previous value of status was different than "expired" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Activate Paused Subscription With isActive Member +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Test Cases *** SUBSCRIPTION_UPDATE_FRAGMENT_FILE_PATH +ActiveTrue subscriptions/fragments/subscription-isActive-update-sample.json +ActiveNull subscriptions/fragments/subscription-isActive-null-update-sample.json + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-inactive-sample.jsonld + +*** Keywords *** +Activate Paused Subscription With isActive Member + [Arguments] ${subscription_update_fragment_file_path} + [Documentation] Check that you can update a subscription: If isActive is equal to true or null and expiresAt is not present, then status shall be updated to "active", if and only if, the previous value of status was different than "expired" + [Tags] mandatory + + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 204 + Retrieve Subscription ${subscription_id} + Check Response Body Containing an Attribute set to status active + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..2472613f350892afdfaff0c5f52c81cb54ee0b2c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Check that you can update a subcription: If isActive is equal to true or null and expiresAt is null or corresponds to a DateTime in the future, then status shall be updated to "active" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Activate Paused Subscription With isActive And ExpiresAt Members +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Test Cases *** SUBSCRIPTION_UPDATE_FRAGMENT_FILE_PATH +ActiveTrueExpiresAtNull subscriptions/fragments/subscription-isActive-expiresAt-null-update-sample.json +ActiveTrueExpiresAt subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json +ActiveNullExpiresAtNull subscriptions/fragments/subscription-isActive-null-expiresAt-null-update-sample.json +ActiveNullExpiresAt subscriptions/fragments/subscription-isActive-null-expiresAt-update-sample.json + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-inactive-sample.jsonld + +*** Keywords *** +Activate Paused Subscription With isActive And ExpiresAt Members + [Arguments] ${subscription_update_fragment_file_path} + [Documentation] Check that you can update a subcription: If isActive is equal to true or null and expiresAt is null or corresponds to a DateTime in the future, then status shall be updated to "active" + [Tags] mandatory + + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 204 + Retrieve Subscription ${subscription_id} + Check Response Body Containing an Attribute set to status active + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot new file mode 100644 index 0000000000000000000000000000000000000000..b414200e68216e87b27ed51fe0bdd8be2cf77044 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot @@ -0,0 +1,35 @@ +*** Settings *** +Documentation Check that you can update a subscription: If isActive is equal to false and expiresAt is not present, then status shall be updated to "paused", if and only if, the previous value of status was different than "expired" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-isActive-update-sample.json + +*** Test Case *** +Update Subscription Status To Paused + [Documentation] Check that you can update a subscription: If isActive is equal to false and expiresAt is not present, then status shall be updated to "paused", if and only if, the previous value of status was different than "expired" + [Tags] mandatory + + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 204 + Retrieve Subscription ${subscription_id} + Check Response Body Containing an Attribute set to status paused + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot new file mode 100644 index 0000000000000000000000000000000000000000..6cdf122fc827143e6d28e46485b7c749de9ab3bd --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future or is null, then status shall be updated to "active", if and only if the previous value of status was "expired" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-inactive-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-expiresAt-future-update-sample.json + +*** Test Case *** +Activate Expired Subscription + [Documentation] Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future or is null, then status shall be updated to "active", if and only if the previous value of status was "expired" + [Tags] mandatory + + # Update subscription to expired + Update Subscription ${subscription_id} subscriptions/fragments/subscription-expiresAt-update-sample.json ${CONTENT_TYPE_JSON} + + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 204 + Retrieve Subscription ${subscription_id} + Check Response Body Containing an Attribute set to status active + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot new file mode 100644 index 0000000000000000000000000000000000000000..4c38313dc82bb2224f0396f7fd8c7bdff09ebd9d --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot @@ -0,0 +1,35 @@ +*** Settings *** +Documentation Check that you cannot update a subscription: If expiresAt is included but referring to a DateTime in the past, then a BadRequestData error shall be raised +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-expiresAt-update-sample.json + +*** Test Case *** +Update Subscription With ExpiresAt In The Past + [Documentation] Check that you cannot update a subscription: If expiresAt is included but referring to a DateTime in the past, then a BadRequestData error shall be raised + [Tags] mandatory + + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 400 + 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} + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/data/subscriptions/expected/subscription-vehicle-expanded-types-sample.jsonld b/data/subscriptions/expected/subscription-vehicle-expanded-types-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..5cb80bfeeb93d3c1c3c9709f0f0a50255f9bfa72 --- /dev/null +++ b/data/subscriptions/expected/subscription-vehicle-expanded-types-sample.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"https://ngsi-ld-test-suite/context#Vehicle" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@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/subscriptions/expected/subscription-vehicle-sample.jsonld b/data/subscriptions/expected/subscription-vehicle-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..ae7a20daf0da9215b65d70639335977172667a27 --- /dev/null +++ b/data/subscriptions/expected/subscription-vehicle-sample.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Vehicle" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@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/subscriptions/fragments/subscription-building-entities-sample.json b/data/subscriptions/fragments/subscription-building-entities-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..57564a2b0211c2f3602b84144246fa59665ab7e9 --- /dev/null +++ b/data/subscriptions/fragments/subscription-building-entities-sample.json @@ -0,0 +1,7 @@ +{ + "entities":[ + { + "type":"Building" + } + ] +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-expiresAt-future-update-sample.json b/data/subscriptions/fragments/subscription-expiresAt-future-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..e4f92ec31fa2721d6c537b4e3d32e350a3ce4e2b --- /dev/null +++ b/data/subscriptions/fragments/subscription-expiresAt-future-update-sample.json @@ -0,0 +1,3 @@ +{ + "expiresAt": "2030-08-01T22:07:00Z" +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-expiresAt-update-sample.json b/data/subscriptions/fragments/subscription-expiresAt-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..237d218065b6eea14c6b1c5117eb3baee3bcaf1d --- /dev/null +++ b/data/subscriptions/fragments/subscription-expiresAt-update-sample.json @@ -0,0 +1,3 @@ +{ + "expiresAt": "2020-08-01T22:07:00Z" +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-invalid-update-sample.json b/data/subscriptions/fragments/subscription-invalid-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..e82d4022eec36304d1ef730214af5bdb788e22e1 --- /dev/null +++ b/data/subscriptions/fragments/subscription-invalid-update-sample.json @@ -0,0 +1,5 @@ +{ + "notification":{ + "format":"keyValues" + } +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-expiresAt-null-update-sample.json b/data/subscriptions/fragments/subscription-isActive-expiresAt-null-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..5cc9b6ab5b90645dbfab5b6afd3e35b952d5aaca --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-expiresAt-null-update-sample.json @@ -0,0 +1,4 @@ +{ + "isActive": true, + "expiresAt": null +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json b/data/subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..f72957cda304308b97f22486a144e8f74c9a3098 --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json @@ -0,0 +1,4 @@ +{ + "isActive": true, + "expiresAt": "2030-08-01T22:07:00Z" +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-null-expiresAt-null-update-sample.json b/data/subscriptions/fragments/subscription-isActive-null-expiresAt-null-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..1ec15711cc16c5e9451abeb02d2c7087034e2f2d --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-null-expiresAt-null-update-sample.json @@ -0,0 +1,4 @@ +{ + "isActive": null, + "expiresAt": null +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-null-expiresAt-update-sample.json b/data/subscriptions/fragments/subscription-isActive-null-expiresAt-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..1780d37985078071870eebcabfdc834e760e076c --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-null-expiresAt-update-sample.json @@ -0,0 +1,4 @@ +{ + "isActive": null, + "expiresAt": "2030-08-01T22:07:00Z" +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-null-update-sample.json b/data/subscriptions/fragments/subscription-isActive-null-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..fe8bb4e26a68db90471070bb00f6da69809e3f88 --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-null-update-sample.json @@ -0,0 +1,3 @@ +{ + "isActive": null +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-update-sample.json b/data/subscriptions/fragments/subscription-isActive-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..b432cbaef9391ee3b78deea727e71149c635b5f1 --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-update-sample.json @@ -0,0 +1,3 @@ +{ + "isActive": false +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-null-properties-update-sample.json b/data/subscriptions/fragments/subscription-null-properties-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..f044a4da065564d4c9331dbfe46b07905669edf0 --- /dev/null +++ b/data/subscriptions/fragments/subscription-null-properties-update-sample.json @@ -0,0 +1,6 @@ +{ + "notification":{ + "format":"keyValues", + "endpoint":null + } +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-update-sample.json b/data/subscriptions/fragments/subscription-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..81f39078881addb707f6f2590cc853d609e0554d --- /dev/null +++ b/data/subscriptions/fragments/subscription-update-sample.json @@ -0,0 +1,9 @@ +{ + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.second.endpoint.org/notify", + "accept":"application/json" + } + } +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-vehicle-entities-sample.json b/data/subscriptions/fragments/subscription-vehicle-entities-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..ff01dca79e195f50eb1efc707d46582403216d29 --- /dev/null +++ b/data/subscriptions/fragments/subscription-vehicle-entities-sample.json @@ -0,0 +1,7 @@ +{ + "entities":[ + { + "type":"Vehicle" + } + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-inactive-sample.jsonld b/data/subscriptions/subscription-inactive-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..a00ea73665aa4270d7cd9a782285a22c0504ca27 --- /dev/null +++ b/data/subscriptions/subscription-inactive-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "isActive": false, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@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/subscriptions/subscription-sample.jsonld b/data/subscriptions/subscription-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..fd713519120a72b4acb3b3fcbce8e10c43fd7526 --- /dev/null +++ b/data/subscriptions/subscription-sample.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@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/resources/ApiUtils.resource b/resources/ApiUtils.resource index 28af5b772e1a75fdb92b2659f21e263a2a8eb4d3..c7156c82393da5b750ae66417e7ef168e5c1fa93 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -26,11 +26,11 @@ ${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 -${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 +${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/errors/BadRequestData +${ERROR_TYPE_INVALID_REQUEST} https://uri.etsi.org/ngsi-ld/errors/InvalidRequest +${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound +${ERROR_TYPE_ALREADY_EXISTS} https://uri.etsi.org/ngsi-ld/errors/AlreadyExists +${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} https://uri.etsi.org/ngsi-ld/errors/LDContextNotAvailable ${response} @@ -661,9 +661,10 @@ Update Context Source Registration Subscription From File Set Test Variable ${response} Create Subscription - [Arguments] ${subscription_id} ${filename_path} ${content_type} ${accept}=${EMPTY} + [Arguments] ${subscription_id} ${filename_path} ${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" ${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} @@ -672,13 +673,15 @@ Create Subscription [return] ${response} Update Subscription - [Arguments] ${subscription_id} ${fragment_filename} ${content_type} ${accept}=${EMPTY} + [Arguments] ${subscription_id} ${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" ${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 + Set Test Variable ${response} [return] ${response} Delete Subscription @@ -686,6 +689,7 @@ Delete Subscription ${response}= DELETE ${SUBSCRIPTION_ENDPOINT_PATH}${subscription_id} Output request Output response + Set Suite Variable ${response} [return] ${response} Query Subscriptions @@ -701,13 +705,16 @@ Query Subscriptions [return] ${response} Retrieve Subscription - [Arguments] ${id} ${accept}=${EMPTY} + [Arguments] ${id} ${accept}=${EMPTY} ${context}=${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 ${SUBSCRIPTION_ENDPOINT_PATH}${id} headers=${headers} ${request}= Output request Output response + Set Test Variable ${response} [return] ${request} ${response} Update Context Source Registration Subscription By Selecting Content Type @@ -842,4 +849,4 @@ Query Temporal Representation Of Entities With Return ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH} headers=${headers} query=${params} ${request}= Output request Output response - [return] ${request} ${response} \ No newline at end of file + [return] ${request} ${response} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 0fc84a3f4224d4af65e2f375abea009c5e876018..db22588fec5c7f30f53772efeb88b3fc8753da47 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -305,6 +305,7 @@ Check Response Body Containing One Registration element ${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 + Check Resource Set To [Arguments] ${resource} ${ignored_keys}=${None} ${error_message}=${EMPTY}