diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..b7ea0073fe40a57ce53969cc6f415c4171ecacc8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +resources/__pycache__ +results +*.pyc +*.http +.vscode/ +.venv diff --git a/.idea/runConfigurations/All_Unit_Tests.xml b/.idea/runConfigurations/All_Unit_Tests.xml new file mode 100644 index 0000000000000000000000000000000000000000..8392a2e346bac9746136f3e2510b10c2b8600d5e --- /dev/null +++ b/.idea/runConfigurations/All_Unit_Tests.xml @@ -0,0 +1,19 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/CheckTests_Unit_Tests.xml b/.idea/runConfigurations/CheckTests_Unit_Tests.xml new file mode 100644 index 0000000000000000000000000000000000000000..92efef3e23df7c754201a721b3ebd78a22345c01 --- /dev/null +++ b/.idea/runConfigurations/CheckTests_Unit_Tests.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Check_Format.xml b/.idea/runConfigurations/Check_Format.xml new file mode 100644 index 0000000000000000000000000000000000000000..dbdb34d8daf196e7ba0cad1efeeea6ec1718d3fd --- /dev/null +++ b/.idea/runConfigurations/Check_Format.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Check_Initial_Setup.xml b/.idea/runConfigurations/Check_Initial_Setup.xml new file mode 100644 index 0000000000000000000000000000000000000000..5ea679218eeb574a2da466e68505ee8f6f5d7ab5 --- /dev/null +++ b/.idea/runConfigurations/Check_Initial_Setup.xml @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/CommonBehaviours_Unit_Tests.xml b/.idea/runConfigurations/CommonBehaviours_Unit_Tests.xml new file mode 100644 index 0000000000000000000000000000000000000000..39ceab9ac051488783a17591b96bb5710bb848c0 --- /dev/null +++ b/.idea/runConfigurations/CommonBehaviours_Unit_Tests.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/ContextInformation_Consumption_Unit_Tests.xml b/.idea/runConfigurations/ContextInformation_Consumption_Unit_Tests.xml new file mode 100644 index 0000000000000000000000000000000000000000..64782d57805511ae96b24f2ecfd3794cb18d9ba7 --- /dev/null +++ b/.idea/runConfigurations/ContextInformation_Consumption_Unit_Tests.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/ContextInformation_Provision_Unit_Tests.xml b/.idea/runConfigurations/ContextInformation_Provision_Unit_Tests.xml new file mode 100644 index 0000000000000000000000000000000000000000..a414ee7543f5089dd513229820f70c51258a6887 --- /dev/null +++ b/.idea/runConfigurations/ContextInformation_Provision_Unit_Tests.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/ContextInformation_Subscription_Unit_Tests.xml b/.idea/runConfigurations/ContextInformation_Subscription_Unit_Tests.xml new file mode 100644 index 0000000000000000000000000000000000000000..964e7546101e0416c359b130eaa254b0a3e766e4 --- /dev/null +++ b/.idea/runConfigurations/ContextInformation_Subscription_Unit_Tests.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/ContextSource_Discovery_Unit_Tests.xml b/.idea/runConfigurations/ContextSource_Discovery_Unit_Tests.xml new file mode 100644 index 0000000000000000000000000000000000000000..eb3518ff38a09c24decc3a5fdd38d3d1105119ea --- /dev/null +++ b/.idea/runConfigurations/ContextSource_Discovery_Unit_Tests.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/ContextSource_RegistrationSubscription_Unit_Tests.xml b/.idea/runConfigurations/ContextSource_RegistrationSubscription_Unit_Tests.xml new file mode 100644 index 0000000000000000000000000000000000000000..e5d3135afb6e36e9282f963060f6fb6c5ef93b8a --- /dev/null +++ b/.idea/runConfigurations/ContextSource_RegistrationSubscription_Unit_Tests.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/ContextSource_Registration_Unit_Tests.xml b/.idea/runConfigurations/ContextSource_Registration_Unit_Tests.xml new file mode 100644 index 0000000000000000000000000000000000000000..fb32add137e1393afc3ae2b8a984afb28b3eea7a --- /dev/null +++ b/.idea/runConfigurations/ContextSource_Registration_Unit_Tests.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Format_Files.xml b/.idea/runConfigurations/Format_Files.xml new file mode 100644 index 0000000000000000000000000000000000000000..e5c737c29a87c0b93ba74906361ab82566eab6bc --- /dev/null +++ b/.idea/runConfigurations/Format_Files.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Generate_Documentation_Data.xml b/.idea/runConfigurations/Generate_Documentation_Data.xml new file mode 100644 index 0000000000000000000000000000000000000000..d4e60cbaf0cef416524b791a5bcd77ba543331df --- /dev/null +++ b/.idea/runConfigurations/Generate_Documentation_Data.xml @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Run_All_Test_Suites_with_Listener.xml b/.idea/runConfigurations/Run_All_Test_Suites_with_Listener.xml new file mode 100644 index 0000000000000000000000000000000000000000..b718676ec05cc7652234f29d9e32db796651f557 --- /dev/null +++ b/.idea/runConfigurations/Run_All_Test_Suites_with_Listener.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Run_Current_Test_Suite.xml b/.idea/runConfigurations/Run_Current_Test_Suite.xml new file mode 100644 index 0000000000000000000000000000000000000000..43a559bb40ba9e3ce13188ca72c3102ac24735ee --- /dev/null +++ b/.idea/runConfigurations/Run_Current_Test_Suite.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Run_Current_Test_Suite_with_Listener.xml b/.idea/runConfigurations/Run_Current_Test_Suite_with_Listener.xml new file mode 100644 index 0000000000000000000000000000000000000000..538e85bea1461f72dc1e536a5c9a097d0d498964 --- /dev/null +++ b/.idea/runConfigurations/Run_Current_Test_Suite_with_Listener.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Run_Selected_Text.xml b/.idea/runConfigurations/Run_Selected_Text.xml new file mode 100644 index 0000000000000000000000000000000000000000..ba07fcba51fc818e2ceceb4531c34c3d5558d628 --- /dev/null +++ b/.idea/runConfigurations/Run_Selected_Text.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Statistics_Documentation_Data.xml b/.idea/runConfigurations/Statistics_Documentation_Data.xml new file mode 100644 index 0000000000000000000000000000000000000000..7618ff677c35784eb0156b09ee31e0907080cdc7 --- /dev/null +++ b/.idea/runConfigurations/Statistics_Documentation_Data.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..54f26c88965d325bd01566ec7a4ef2d16de86169 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/MarketSquare/robotframework-tidy + id: robotidy + rev: 4.2.1 + hooks: + - id: robotidy diff --git a/LICENSE b/LICENSE index 6adf313a02738feebbd6e28b7f4ae31835bb816a..69a5f9d7abdb82edbcea13046e9abefe07b97d0d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ Copyright 2021 ETSI -Redistribution and use in source and binary forms, with or without +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. diff --git a/README.md b/README.md index 25b3d4e38460faa7a8fcdd479dea086aa7ce4663..c7d52cccfc782d72cc6a471119eebfc623b2a2ce 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,476 @@ -# NGSI-LD Test Suite +# ETSI NGSI-LD Test Suite +This repository contains the ETSI NGSI-LD Test Suite to test the compliance of the Context Brokers with the +specification of the ETSI NGSI-LD API. + +## Contents + +
+ +Details + +- [Install the Test Suite](#install-the-test-suite) +- [Configure the test suite](#configure-the-test-suite) +- [Execute the NGSI-LD Test Suite](#execute-the-ngsi-ld-test-suite) +- [Contribute to the Test Suite](#contribute-to-the-test-suite) + - [Install IDE (PyCharm)](#install-ide-pycharm) + - [Run configurations (PyCharm)](#run-configurations-pycharm) + - [Pre commit](#pre-commit) +- [Tooling](#tooling) +- [Frameworks and libraries used in the project](#frameworks-and-libraries-used-in-the-project) +- [Useful links](#useful-links) +- [LICENSE](#license) + +
+ + +## Install the Test Suite + +In order to install the ETSI NGSI-LD Test Suite, download the configuration script: + +- For MacOS and Ubuntu, download the following file: + +```$ curl https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/scripts/configure.sh > configure.sh``` + +- For Windows, using Powershell download the following file (curl is an alias for Invoke-WebRequest in Powershell): + +```> curl https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/scripts/configure.ps1 > configure.ps1``` + +- For MacOS and Ubuntu, be sure that you have the proper execution permissions of the file and the user is included +in the sudoers group, then execute the following script: + +```$ configure.sh``` + +- In Windows 11, using Powershell, make sure you can run the script: + +```> powershell -executionpolicy bypass configure.ps1``` + +These scripts develop a set of operations, the same in the different Operating System, which consist of: +- Installation of the corresponding software requirements: + - Python3.11 + - Git + - Virtualenv + - Pip +- Cloning the NGSI-LD Test Suite repository in the local folder and create the corresponding Python Virtual Environment +taking into account the content of `requirements.txt` file. Further details on each library can be found in +[PyPi](https://pypi.org/) and +[Robot Framework Standard Libraries](http://robotframework.org/robotframework/#standard-libraries). + + +## Configure the test suite + +In the `resources/variables.py` file, configure the following parameters: + +- `url` : It is the url of the context broker which is to be tested (including the `/ngsi-ld/v1` path, +e.g., http://localhost:8080/ngsi-ld/v1). +- `temporal_api_url` : This is the url of the GET temporal operation API, in case that a Context Broker splits +this portion of the API (e.g., http://localhost:8080/ngsi-ld/v1). +- `ngsild_test_suite_context` : This is the url of the default context used in the ETSI NGSI-LD requests +(e.g., 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'). +- `notification_server_host` and `notification_server_port` : This is the address and port used to create the local +server to listen to notifications (the address must be accessible by the context broker). +Default value: `0.0.0.0` and `8085`. +- `context_source_host` and `context_source_port` : The address and port used for the context source. +Default value: `0.0.0.0` and `8086`. + +When you execute locally the tests, you can leave the default values as they are. NGSI-LD Test Suite provides +a mockup services to provide the notification functionality and therefore the notification_server_host can be +assigned to '0.0.0.0'. In case that you deploy the Context Broker on a docker engine, you need to specify the +url of the Docker Host. In this case you have two options to specify the IP address of your host machine: + +- (Windows, MacOS) As of Docker v18.03+ you can use the `host.docker.internal` hostname to connect to your +Docker host. +- (Linux) Need to extract the IP of the `docker0` interface. Execute the following command: +``` ifconfig docker0 | grep inet | awk '{print $2}' ``` and that IP is the one that you need to use for +notification purposes. + +Optionally, there are some extra variables that can be used during the generation of execution results of the Test +Case with a specific Robot Listener class to automatically generate a GitHub Issue in the GitHub repository of the +Context Broker of a failed Test Case. In case that you cannot or do not want to use this functionality, delete those +variables from the file. + +As an explanation of the process, the GitHub Issue will be created if there is no other issue in the repository with +the same name or there is an issue with the same name, but it is not closed. + +In order to create these issues, the [GitHub REST API](https://docs.github.com/en/rest) is used. For this purpose, +the authentication process is using a personal access token. The needed variables are the following: +* `github_owner`: Your GitHub user account. +* `github_broker_repo` : The corresponding URL of the Context Broker repository. +* `github_token` : Your personal access token. Please take a look to the GitHub documentation if you want to generate +your own [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). + +## Execute the NGSI-LD Test Suite + +The first operation that you have to develop is the activation of the Python Virtual Environment through the +execution of the following command in MacOS or Ubuntu: + +```$ source .venv/bin/activate``` + +In case of Windows, you need to execute the following command: + +```> .\.venv\scripts\activate.bat ``` + +Now, you can launch the tests with the following command in MacOS or Linux: + +```$ robot --outputdir ./results .``` + +For Windows system, you can launch the tests with the following command: + +```> robot --outputdir .\results .\TP\NGSI-LD``` + +For more running instructions, please consult [scripts/run_tests.sh](./scripts/run_tests.sh) or [scripts/run_tests.ps1](./scripts/run_tests.ps1) + +To have the whole messages, it is necessary to modify the width of the test execution output with the option +--consolewidth (-W). The default width is 78 characters. + +```$ robot --consolewidth 150 .``` + +The messages in the console are clear and without noise, only the strictly necessary (request and response to the +Context Brokers and a nice message which shows the difference between two documents when they are). However, it can be +difficult to follow all the messages in the console when there is a lot of testing and a lot of Context Broker calls. +This is why a command to redirect the console output to a file can be used. You must add a chevron at the end of the +test launch command followed by the file name. + +```$ robot . > results.log``` + +> **Note:** if you want to deactivate the Python Virtual Environment just execute the command in +> MacOS and Ubuntu systems: +> +> ```console +> $ deactivate +> ``` +> And in Window system: +> +> ```console +> > .venv\scripts\deactivate.bat +> ``` + +## Test Suite Management (tsm) + +The `tsm` script is designed to facilitate the selection and execution of the Test Suite, especially if not all the +endpoints of the API have been implemented for a specific Context Broker. This script provides a set of commands +to enable or disable Test Cases, Robot Test Suites or Collections (Robot Test Suite Groups), visualize the current +status of the different Test Cases, execute the selected Test Cases and perform other related operations as described +below. + +The `tsm` script generates a pickle file named `tsm.pkl`, which stores the tuples list corresponding to each Test Case +with the following information: + + (switch, running status, Test Case long name) + +where the values and their meaning are the following: +* **switch**: + * `ON`: the Test Case is on, which means that it will be executed by the script. + * `OFF`: the Test Case is off, and therefore is not selected to be executed by the script. + * `MISSING`: the Test Case is not anymore in the Test Suite Structure. An update operation should be run to update + the `tsm.pkl` with the current set of available Test Cases in the filesystem. + * `NEW`: new Test Case discovered by the tsm after an update operation. +* **status**: + * `PASSED`: the robot framework executes the Test Case with result PASS. + * `FAILED`: the robot framework executes the Test Case with result FAIL. + * `PENDING`: the Test Case is pending to be executed by the robot framework. +* **test case long name**: the Test Case long name set by robot framework based on the Robot Test Suite number and +the Test Case name (e.g., NGSILD.032 02.032_02_01 Delete Unknown Subscription) + +### Installation +The `tsm` script is integrated with arguments auto-completion for bash, therefore it is needed the installation of +the argcomplete python package on your system: + + pip install argcomplete + +and to enable the completion after the installation executing the following command: + + activate-global-python-argcomplete + +and then + + eval "$(register-python-argcomplete tsm)" + +Now, it is possible to autocomplete the commands and show possible options executing the script. Also –help argument +is available to obtain more information about the options. + +### Execution + +The tsm cases update command updates the `tsm.pkl` file with all the Robot Test Suite under the local path. If the +pickle file does not exist, it is created. After the creation of this file, it is possible to execute the script +to maintain and run the selected Test Cases from the pickle file. The list of commands is the following: + +* **Test Cases (cases)** + * Switch ON Test Cases + + tsm cases on [test_cases] + + * Switch OFF Test Cases + + tsm cases off [test_cases] + tsm cases off "NGSILD.032 01.032_01_02 InvalidId" + + * List Test Cases based on the specific flag. + + tsm cases list [on, off, missing, new, passed, failed, pending, all] + tsm cases list ./TP/NGSI-LD/CommonBehaviours + + * Run Test Cases that are enabled + + tsm cases run [on, off, missing, new, passed, failed, pending, [test_cases]] + tsm cases run NGSILD.048\ 01.048_01_06\ Endpoint\ post\ /temporal/entities/ + tsm cases run pending + + * Update the pickle file with the current Test Cases + + tsm cases update + + * Clean Test Cases, remove the Test Cases that were marked as MISSING + + tsm cases clean + +* **Robot Test Suites (suites)** + * Switch ON Robot Test Suites + + tsm suites on [suites] + + * Switch OFF Robot Test Suites + + tsm suites off [suites] + +* **Test Collections (collections)** + * Switch ON Test Collections + + tsm collections on [collections] + tsm collections on ./TP/NGSI-LD/CommonBehaviours + + * Switch OFF Test Collections + + tsm collections off [collections] + +## Contribute to the Test Suite + +In order to contribute to the ETSI NGSI-LD Test Suite, it is recommended to install an IDE with the corresponding +Robot Framework. Our recommendations are: + +- PyCharm + + +### Install IDE (PyCharm) + +- Install [PyCharm](https://www.jetbrains.com/fr-fr/pycharm/download) + +- Install [Robot Framework Language Server](https://plugins.jetbrains.com/plugin/16086-robot-framework-language-server) + +- Define as variable the path of the working directory. In Settings > Languages & Frameworks > Robot Framework +(Project), insert the following: `{"EXECDIR": "{path}/ngsi-ld-test-suite"}`. + +### Develop a new Test Case + +In order to develop a new Test Case, some rules and conventions have to be followed. + +#### Test Case Template + +The following template shows the typical structure of a Test Case. It can be used as a template when creating a new +Test Case. + +``` +*** Settings *** +Documentation {Describe the behavior that is being checked by this Test Case} + +Resource ${EXECDIR}/resources/any/necessary/resource/file + +# For both setup and teardown steps, try as possible to use Keyword names already declared in doc/analysis/initial_setup.py +Suite Setup {An optional setup step to create data necessary for the Test Case} +Suite Teardown {An optional teardown step to delete data created in the setup step} +Test Template {If the Test Case uses permutations, the name of the Keyword that is called for each permutation} + + +*** Variables *** +${my_variable}= my_variable + + +*** Test Cases *** PARAM_1 PARAM_2 +XXX_YY_01 Purpose of the first permutation + [Tags] {resource_request_reference} {section_reference_1} {section_reference_2} + param_1_value param_2_value +XXX_YY_02 Purpose of the second permutation + [Tags] {resource_request_reference} {section_reference_1} {section_reference_2} + param_1_value param_2_value + + +*** Keywords *** +{Keyword name describing what the Test Case is doing} + [Documentation] {Not sure this documentation brings something?} + [Arguments] ${param_1} ${param_2} + + # Call operation that is being tested, passing any needed argument + + # Perform checks on the response that has been received from the operation + + # Optionally call another endpoint to do extra checks (e.g. check an entity has really been created) + +# Add there keywords for setup and teardown steps +# Setup step typically creates data necessary for the Test Case and set some variables that will be used by the Test Case +# using Set Suite Variable or Set Test Variable keywords +# Teardown step must delete any data that has been created in setup step +``` + +Where : + +- The possible values for `{resource_request_reference}` are defined in DGR/CIM-0015v211, section 6.1 +- The meaning of the `{section_reference_x}` tags is defined in DGR/CIM-0015v211, section 6.2. A Test Case can reference + more than one section in the specification (for instance, a Test Case whose goal is to check that scopes are correctly + created when an entity is created should reference sections 4.18 NGSI-LD Scopes and 5.6.1 Create Entity of the + RGS/CIM-009v131 document) + +#### Generate the documentation + +The Conformance Tests include an option to automatically generate the documentation of them. If new tests are developed +but include the Check and Request operations already defined, it is not needed to modify the automatic generation system. +Nevertheless, if there are new operations to check and/or new request operations to develop in the Conformance Tests, +it is needed to describe them so that the automatic documentation generated covers these new operations. + +Additionally, there is defined a Unit Test mechanism to identify if new Test Suites are included in the system +(See `doc/tests/test_CheckTests.py`) and if there were some changes in any Test Suite (See the `doc/tests/other test_*.py`). +In these cases, it is needed to provide the corresponding information in the Python code: + +- When a new Test Case is created, it has to be declared in the corresponding `doc/tests/test_{group}.py` Python file + (where `{group}` represents the group of operations and how they are defined in the ETSI RGS/CIM-0012v211 document). + Complementary to this, updates have to be done: + - In `doc/analysis/initial_setup.py` if it uses a new keyword to set up the initial state of the Test Case + - In `doc/analysis/requests.py` if it updates an endpoint operation, for instance by adding support for a new request + parameter (in `self.op` with the list and position of parameters, in the method that pretty prints the operation in + the automated generation of the documentation associated with the Test Cases. If the positions array is empty, it + means that all the parameters will be taken into consideration) + - Run the documentation generation script (`python doc/generateDocumentationData.py {new_tc_id}`) for the new Test + Case and copy the generated JSON file in the folder containing all files for the given group and subgroup + (`cp doc/results/{new_tc_id}.json doc/files/{group}/{subgroup}`) +- When a new global Keyword is created, it has to be declared in the corresponding Python files: + - In `doc/analysis/checks.py` if it is an assertion type keyword (in `self.checks` to reference the method that pretty + prints the operation and `self.args` to identify the position of the arguments) and the corresponding method to + provide the description of this new operation + - In `doc/analysis/requests.py` if it is an endpoint operation (in `self.op` with the list and position of parameters, + in `self.description` to reference the method that pretty print the operation, and add the method that pretty prints + the operation) +- When a new permutation is added in an existing Test Case, run the documentation generation script + (`python doc/generateDocumentationData.py {tc_id}`) for the Test Case and copy the generated JSON file in the + folder containing all files for the given group and subgroup (`cp doc/results/{tc_id}.json doc/files/{group}/{subgroup}`) +- When a new directory containing Test Cases is created, it has to be declared in `doc/generaterobotdata.py` along with + its acronym + +Finally, check that everything is OK by running the unit tests: + +```shell +python -m unittest discover -s ./doc/tests -t ./doc +``` + +### Run configurations (PyCharm) + +Two sample configurations have been created: + +- one to check if there are syntax or format changes to be done according to Robotidy (`Check Format`) +- one to make the syntax and format changes according to Robotidy (`Format Files`) + +To launch a run configuration, choose one of the two configurations from the Run menu and click on it to run it. + + +### Pre commit + +Before each commit, a formatting according to the rules of +[Robotidy](https://github.com/MarketSquare/robotframework-tidy) is done for files with the `.robot` or `.resource` +extension. If nothing has been modified, the commit is done normally. Otherwise, the commit displays an error message +with all the modifications made by Robotidy to format the file. Modified files can then be added to the commit. + +To use it, install `pre-commit` with the following commands (using pip): + +```$ pip install pre-commit``` + +Then install the Git hook scripts: + +```$ pre-commit install``` + +Now, it will run automatically on every commit. + +To manually launch the tool, the following command can be used: + +```$ python -m robotidy .``` + +Further details can be found on the [pre-commit](https://pre-commit.com) site. + +## Tooling + +### Find unused test data files + +The `find_unused_test_data.py` script in the `scripts` directory can be used to get a list of the test data files +that are not used by any Test Case: + +``` +$ python3 scripts/find_unused_test_data.py +``` + +### Find and run Test Cases using a given test data file + +The `find_tc_using_test_data.py` script in the `scripts` directory can be used to find the Test Cases that are using a +given test data file. It can optionally run all the matching Test Cases: + +``` +$ python3 scripts/find_tc_using_test_data.py +``` + +When launched, the script asks for a test date file name and if the matching Test Cases should be executed. + +### Find the list of defined Variables and Keywords in all resources files + +The `apiutils.py` script in the `scripts` directory can be used to find the Variables and Keywords that are defined +in all resources files defined in the folder `resources/ApiUtils`. + +``` +$ python3 scripts/apiutils.py +``` + +### Generate documentation content + +If you want to generate a documentation for the support keywords, for example for Context Information Consumption +resources: + +```$ python3 -m robot.libdoc resources/ApiUtils/ContextInformationConsumption.resource api_docs/ContextInformationConsumption.html``` + +And, if you want to generate a documentation for the Test Cases: + +```$ python3 -m robot.testdoc TP/NGSI-LD api_docs/TestCases.html``` + +## Generate output file details only for failed tests + +It is possible to generate a report only for the failed tests through the use of a specific listener in the execution +of the robot framework. For example, if you want to execute the test suite number 043 and generate the report, you can +execute the following command: + +```robot --listener libraries/ErrorListener.py --outputdir ./results ./TP/NGSI-LD/CommonBehaviours/043.robot``` + +It will generate a specific `errors.log` file into the `results` folder with the description of the different steps +developed and the mismatched observed on them. + +## Coding Style of Test Suites + +And if you want to tidy (code style) the Test Suites: + +```$ python3 -m robot.tidy --recursive TP/NGSI-LD``` + + +## Frameworks and libraries used in the project + +* [Robot Framework](https://github.com/robotframework/robotframework) +* [JSON Library](https://github.com/robotframework-thailand/robotframework-jsonlibrary) +* [Requests Library](https://github.com/MarketSquare/robotframework-requests) +* [Deep Diff](https://github.com/seperman/deepdiff) +* [HttpCtrl Library](https://github.com/annoviko/robotframework-httpctrl) +* [Robotidy Library ](https://github.com/MarketSquare/robotframework-tidy) + + +## Useful links + +* [Robot Framework User Guide](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#output-file) + + +## LICENSE + +Copyright 2021 ETSI + +The content of this repository and the files contained are released under the [ETSI Software License](LICENSE) a +(BSD-3-Clause LICENSE). \ No newline at end of file diff --git a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyGETWithoutAccept/045_01.robot b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyGETWithoutAccept/045_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..04e4af9f05f9bd2cfb8c5898c106395d884f81d4 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyGETWithoutAccept/045_01.robot @@ -0,0 +1,99 @@ +*** 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/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${building_filename}= building-simple-attributes-sample.jsonld +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= subscriptions/subscription-sample.jsonld +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_filename}= csourceRegistrations/context-source-registration-with-expiration-sample.jsonld +${registration_type}= Vehicle +${tea_id_prefix}= urn:ngsi-ld:Vehicle: +${tea_filename}= vehicle-temporal-representation-sample.jsonld +${teatype}= Vehicle +${content_type}= application/json + + +*** Test Cases *** +045_01_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}) + [Tags] e-query cb-get 6_3_4 + ${id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${building_filename} + ... ${id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${response}= Query Entity + ... id=${id} + ... context=${ngsild_test_suite_context} + ... accept=*/* + Check Response Status Code 200 ${response.status_code} + Check Response Headers Containing Content-Type set to ${content_type} ${response.headers} + Check Response Headers Link Not Empty ${response.headers} + [Teardown] Delete Entity by Id ${id} + +045_01_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}) + [Tags] sub-retrieve cb-get 6_3_4 + ${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_code} + ${response}= Retrieve Subscription + ... id=${id} + ... accept=*/* + Check Response Status Code 200 ${response.status_code} + Check Response Headers Containing Content-Type set to ${content_type} ${response.headers} + Check Response Headers Link Not Empty ${response.headers} + [Teardown] Delete Subscription ${id} + +045_01_03 Endpoint /csourceRegistrations/ + [Documentation] Verify that on a GET HTTP request if nothing is specified on the Accept header, "application/json" is assumed (/csourceRegistrations/) + [Tags] csr-query cb-get 6_3_4 + ${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} + ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response.status_code} + ${response}= Query Context Source Registrations With Return + ... id=${registration_id} + ... type=${registration_type} + ... context=${ngsild_test_suite_context} + ... accept=*/* + Check Response Status Code 200 ${response.status_code} + Check Response Headers Containing Content-Type set to ${content_type} ${response.headers} + Check Response Headers Link Not Empty ${response.headers} + [Teardown] Delete Context Source Registration ${registration_id} + +045_01_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) + [Tags] te-query cb-get 6_3_4 + ${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=${temporal_entity_representation_id} + ... filename=${tea_filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${response}= Query Temporal Representation Of Entities With Return + ... entity_types=${teatype} + ... timerel=after + ... timeAt=2020-08-01T12:05:00Z + ... context=${ngsild_test_suite_context} + ... accept=*/* + Check Response Status Code 200 ${response.status_code} + Set Test Variable ${response} + Check Response Headers Containing Content-Type set to ${content_type} ${response.headers} + Check Response Headers Link Not Empty ${response.headers} + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..44a8ff105f12187067e96ea084e89d4309260ca8 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot @@ -0,0 +1,92 @@ +*** Settings *** +Documentation Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${expected_status_code}= 503 +${building_id_prefix}= urn:ngsi-ld:Building: +${building_filename}= building-unretrievable-context-sample.jsonld +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= subscriptions/subscription-unretrievable-context-sample.jsonld +${tea_id_prefix}= urn:ngsi-ld:Vehicle: +${tea_filename}= bus-temporal-representation-unretrievable-context-sample.jsonld +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_filename}= csourceRegistrations/context-source-registration-unretrievable-context-sample.jsonld + + +*** Test Cases *** +043_01_01 Create entity + [Documentation] Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create entity) + [Tags] e-create cb-ldcontext 5_2_2 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${building_filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${expected_status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + [Teardown] Delete Entity by Id ${entity_id} + +043_01_02 Create subscription + [Documentation] Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create subscription) + [Tags] sub-create cb-ldcontext 5_2_2 + ${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_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + [Teardown] Delete Subscription ${subscription_id} + +043_01_03 Create Temporal Representation of Entities + [Documentation] Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create Temporal Representation of Entities) + [Tags] te-create cb-ldcontext 5_2_2 + ${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=${temporal_entity_representation_id} + ... filename=${tea_filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${expected_status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} + +043_01_04 Batch entity create + [Documentation] Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Batch entity create) + [Tags] be-create cb-ldcontext 5_2_2 + ${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} + @{entities_ids_to_be_created}= Create List ${first_entity_id} ${second_entity_id} + ${response}= Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${expected_status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + [Teardown] Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_created} + +043_01_05 Create context source registration + [Documentation] Verify receiving 503 – LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create context source registration) + [Tags] csr-create cb-ldcontext 5_2_2 + ${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} + ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code ${expected_status_code} ${response.status_code} + [Teardown] Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyMergePatchJson/044_01.robot b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyMergePatchJson/044_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..af2fbf781b7dd9a90dabdd0515a2a2297f77f6ef --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyMergePatchJson/044_01.robot @@ -0,0 +1,43 @@ +*** Settings *** +Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Initial Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${vehicle_fragment}= vehicle-brandname-fragment.json +${attribute_id}= brandName + + +*** 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] ea-partial-update cb-mergepatch 6_3_4 + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attribute_id} + ... fragment_filename=${vehicle_fragment} + ... content_type=${CONTENT_TYPE_MERGE_PATCH_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + +*** Keywords *** +Create Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${vehicle_filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + Set Test Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyMergePatchJson/044_02.robot b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyMergePatchJson/044_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..a228f94b80facdde3ade8ba78791e611645fc781 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyMergePatchJson/044_02.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Subscription +Test Teardown Delete Initial Subscription + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_filename}= subscriptions/subscription-sample.jsonld +${subscription_fragment}= subscriptions/fragments/subscription-update-sample.json + + +*** Test Cases *** +044_02_01 Endpoint /subscriptions/{subscriptionId} + [Documentation] Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type + [Tags] sub-update cb-mergepatch 6_3_4 + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_fragment} + ... ${CONTENT_TYPE_MERGE_PATCH_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + +*** Keywords *** +Create Initial Subscription + ${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_code} + Set Test Variable ${subscription_id} + +Delete Initial Subscription + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyNotAcceptableMediaType/049_01.robot b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyNotAcceptableMediaType/049_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..b835ad1c5209de29d663a3bb376efed9f34d228b --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyNotAcceptableMediaType/049_01.robot @@ -0,0 +1,63 @@ +*** 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/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${accept}= application/xml +${status_code}= 406 +${building_id_prefix}= urn:ngsi-ld:Building: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: + + +*** Test Cases *** +049_01_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}) + [Tags] e-query cb-noacceptable-medtype 6_3_4 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Query Entity + ... id=${entity_id} + ... accept=${accept} + Check Response Status Code ${status_code} ${response.status_code} + [Teardown] Delete Entity by Id ${entity_id} + +049_01_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}) + [Tags] sub-retrieve cb-noacceptable-medtype 6_3_4 + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Retrieve Subscription + ... id=${id} + ... accept=${accept} + Check Response Status Code ${status_code} ${response.status_code} + [Teardown] Delete Subscription ${id} + +049_01_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/) + [Tags] csr-query cb-noacceptable-medtype 6_3_4 + ${response}= Query Context Source Registrations With Return type=Building accept=${accept} + Check Response Status Code ${status_code} ${response.status_code} + +049_01_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/) + [Tags] csrsub-query cb-noacceptable-medtype 6_3_4 + ${response}= Query Context Source Registration Subscriptions accept=${accept} + Check Response Status Code ${status_code} ${response.status_code} + +049_01_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) + [Tags] te-query cb-noacceptable-medtype 6_3_4 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${response}= 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 ${status_code} ${response.status_code} diff --git a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyNotAcceptableMediaType/049_02.robot b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyNotAcceptableMediaType/049_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..75a726425014499e2e60454d298ab9f02029f2e7 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyNotAcceptableMediaType/049_02.robot @@ -0,0 +1,42 @@ +*** 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/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${accept}= application/geo+json +${status_code}= 406 +${subscription_id_prefix}= urn:ngsi-ld:Subscription: + + +*** Test Cases *** +049_02_01 Retrieve subscription by id + [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" (get /subscriptions/{subscriptionId}) + [Tags] sub-retrieve cb-noacceptable-medtype 6_3_4 + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Retrieve Subscription + ... id=${id} + ... accept=${accept} + Check Response Status Code ${status_code} ${response.status_code} + +049_02_02 Query 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" (get /temporal/entities) + [Tags] te-query cb-noacceptable-medtype 6_3_4 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${response}= 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 ${status_code} ${response.status_code} + +049_02_03 Query context source registration + [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" (get /csourceRegistrations) + [Tags] csr-query cb-noacceptable-medtype 6_3_4 + ${response}= Query Context Source Registrations With Return type=Building accept=${accept} + Check Response Status Code ${status_code} ${response.status_code} diff --git a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyUnsupportedMediaType/048_01.robot b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyUnsupportedMediaType/048_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..9b0dd21246fbbd5b0af99d9865334d620befa5e0 --- /dev/null +++ b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyUnsupportedMediaType/048_01.robot @@ -0,0 +1,88 @@ +*** 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/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${vehicle_attribute}= speed +${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 +${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 +${content_type}= application/xml + + +*** Test Cases *** +048_01_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}) + [Tags] ea-partial-update cb-unsupport-medtype 6_3_4 + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=${vehicle_attribute} + ... fragment_filename=${vehicle_fragment} + ... content_type=${content_type} + Check Response Status Code 415 ${response.status_code} + [Teardown] Delete Entity by Id ${entity_id} + +048_01_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}) + [Tags] sub-update cb-unsupport-medtype 6_3_4 + ${id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Update Subscription ${id} ${subscription_fragment} ${content_type} + Check Response Status Code 415 ${response.status_code} + [Teardown] Delete Subscription ${id} + +048_01_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/) + [Tags] e-create cb-unsupport-medtype 6_3_4 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${building_filename} + ... ${entity_id} + ... ${content_type} + Check Response Status Code 415 ${response.status_code} + [Teardown] Delete Entity by Id ${entity_id} + +048_01_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/) + [Tags] sub-create cb-unsupport-medtype 6_3_4 + ${subscriptions_id}= Generate Random Entity Id ${subscription_id_prefix} + ${response}= Create Subscription ${subscriptions_id} ${subscription_filename} ${content_type} + Check Response Status Code 415 ${response.status_code} + [Teardown] Delete Subscription ${subscriptions_id} + +048_01_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) + [Tags] be-create cb-unsupport-medtype 6_3_4 + ${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} + ${response}= 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 415 ${response.status_code} + [Teardown] Batch Delete Entities entities_ids_to_be_deleted=@{expected_entities_ids} + +048_01_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/) + [Tags] te-create cb-unsupport-medtype 6_3_4 + ${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=${temporal_entity_representation_id} + ... filename=${tea_filename} + ... content_type=${content_type} + Check Response Status Code 415 ${response.status_code} + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributeInformation/027_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributeInformation/027_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..49d35c1440f0461894368d230ba72e194f4be6f3 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributeInformation/027_01.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Check that you cannot retrieve a detailed representation of an unknown NGSI-LD attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entity +Suite Teardown Delete Initial Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.json + + +*** Test Cases *** +027_01_01 Retrieve Detailed Representation Of Available Attribute Without Context + [Documentation] Check that you cannot retrieve a detailed representation of an unknown NGSI-LD attribute + [Tags] ed-attr 5_7_10 + ${response}= Retrieve Attribute attribute_name=airQualityLevel + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Set Suite Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributeInformation/027_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributeInformation/027_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..14f30676b70c5d1441cc5632ffe7bf2410e7aaaa --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributeInformation/027_02.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you can retrieve a list with a detailed representation of NGSI-LD attributes + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entity +Suite Teardown Delete Initial Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.json +${expectation_file}= types/expectations/attribute-027-01-expectation.json + + +*** Test Cases *** +027_02_01 Retrieve Detailed Representation Of Available Attribute + [Documentation] Check that you can retrieve a list with a detailed representation of NGSI-LD attributes + [Tags] ed-attr 5_7_10 + ${response}= Retrieve Attribute attribute_name=airQualityLevel context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Attribute element ${expectation_file} ${response.json()} + + +*** Keywords *** +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Set Suite Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributes/025_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributes/025_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..efd3a03089bfeae9b9a7b14d0fe25ef4e47a89e4 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributes/025_01.robot @@ -0,0 +1,47 @@ +*** Settings *** +Documentation Check that you can retrieve a list of NGSI-LD attributes + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Retrieve Available Attributes + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.json + + +*** Test Cases *** CONTEXT EXPECTATION_FILE +025_01_01 WithoutJsonLdContext + [Tags] ed-attrs 5_7_8 + ${EMPTY} types/expectations/attribute-list-025-01-01-expectation.json +025_01_02 WithJsonLdContext + [Tags] ed-attrs 5_7_8 + ${ngsild_test_suite_context} types/expectations/attribute-list-025-01-02-expectation.json + + +*** Keywords *** +Retrieve Available Attributes + [Documentation] Check that you can retrieve a list of NGSI-LD attributes + [Arguments] ${context} ${expectation_file} + ${response}= Retrieve Attributes + ... context=${context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing AttributeList element ${expectation_file} ${response.json()} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Set Test Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypeInformation/024_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypeInformation/024_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..6fc21b311e4a9b57926e952d624a17be9cece803 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypeInformation/024_01.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that you cannot retrieve a detailed representation of an unknown NGSI-LD entity type + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.json + + +*** Test Cases *** +024_01_01 Retrieve Detailed Representation Of Available Entity Type Without Context + [Documentation] Check that you cannot retrieve a detailed representation of an unknown NGSI-LD entity type + [Tags] ed-type 5_7_7 + ${response}= Retrieve Entity Type type=Building + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Setup Initial Entities + ${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 + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Set Suite Variable ${first_entity_id} + Set Suite Variable ${second_entity_id} + +Delete Initial Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypeInformation/024_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypeInformation/024_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..f7414eec07121714443f27c2d3bb768aa7fc6d42 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypeInformation/024_02.robot @@ -0,0 +1,47 @@ +*** Settings *** +Documentation Check that you can retrieve a detailed representation of a specified NGSI-LD entity type + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.json +${expectation_file}= types/expectations/entity-type-info-024-01-expectation.json + + +*** Test Cases *** +024_02_01 Retrieve Detailed Representation Of Available Entity Type + [Documentation] Check that you can retrieve a detailed representation of a specified NGSI-LD entity type + [Tags] ed-type 5_7_7 + ${response}= Retrieve Entity Type type=Building context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing EntityTypeInfo element ${expectation_file} ${response.json()} + + +*** Keywords *** +Setup Initial Entities + ${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 + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Set Suite Variable ${first_entity_id} + Set Suite Variable ${second_entity_id} + +Delete Initial Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypes/022_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypes/022_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..c97a6e3e4cea8f67afa75c7c39c14801d834b3d3 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypes/022_01.robot @@ -0,0 +1,57 @@ +*** Settings *** +Documentation Check that you can retrieve a list of NGSI-LD entity types + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entities +Test Teardown Delete Initial Entities +Test Template Retrieve Available Entity Types + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${first_filename}= building-simple-attributes-sample.json +${second_filename}= vehicle-simple-attributes-sample.json + + +*** Test Cases *** CONTEXT EXPECTATION_FILE +022_01_01 WithoutJsonLdContext + [Tags] ed-types 5_7_5 + ${EMPTY} types/expectations/entity-type-list-022-01-01-expectation.json +022_01_02 WithJsonLdContext + [Tags] ed-types 5_7_5 + ${ngsild_test_suite_context} types/expectations/entity-type-list-022-01-02-expectation.json + + +*** Keywords *** +Retrieve Available Entity Types + [Documentation] Check that you can retrieve a list of NGSI-LD entity types + [Arguments] ${context} ${expectation_file} + ${response}= Retrieve Entity Types + ... context=${context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing EntityTypeList element ${expectation_file} ${response.json()} + +Setup Initial Entities + ${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 + ... ${first_filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Create Entity Selecting Content Type + ... ${second_filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Set Test Variable ${first_entity_id} + Set Test Variable ${second_entity_id} + +Delete Initial Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveDetailsOfAvailableAttributes/026_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveDetailsOfAvailableAttributes/026_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..e7c1ef5e383add5436814f6aa3cf856571d85f30 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveDetailsOfAvailableAttributes/026_01.robot @@ -0,0 +1,48 @@ +*** Settings *** +Documentation Check that you can retrieve a list with a detailed representation of NGSI-LD attributes + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Retrieve Details Of Available Attributes + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.json + + +*** Test Cases *** CONTEXT EXPECTATION_FILE +026_01_01 WithoutJsonLdContext + [Tags] ed-attrs-details 5_7_9 + ${EMPTY} types/expectations/attribute-026-01-01-expectation.json +026_01_02 WithJsonLdContext + [Tags] ed-attrs-details 5_7_9 + ${ngsild_test_suite_context} types/expectations/attribute-026-01-02-expectation.json + + +*** Keywords *** +Retrieve Details Of Available Attributes + [Documentation] Check that you can retrieve a list with a detailed representation of NGSI-LD attributes + [Arguments] ${context} ${expectation_file} + ${response}= Retrieve Attributes + ... context=${context} + ... details=true + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Attribute element ${expectation_file} ${response.json()} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Set Test Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveDetailsOfAvailableEntityTypes/023_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveDetailsOfAvailableEntityTypes/023_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..36ca2ee23cb6490803afc7febd1442ff626dd16e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveDetailsOfAvailableEntityTypes/023_01.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Check that you can retrieve a list with a detailed representation of NGSI-LD entity types + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entities +Test Teardown Delete Initial Entities +Test Template Retrieve Details Of Available Entity Types + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${first_filename}= building-simple-attributes-sample.json +${second_filename}= vehicle-simple-attributes-sample.json + + +*** Test Cases *** CONTEXT EXPECTATION_FILE +023_01_01 WithoutJsonLdContext + [Tags] ed-types-details 5_7_6 + ${EMPTY} types/expectations/entity-type-023-01-01-expectation.json +023_01_02 WithJsonLdContext + [Tags] ed-types-details 5_7_6 + ${ngsild_test_suite_context} types/expectations/entity-type-023-01-02-expectation.json + + +*** Keywords *** +Retrieve Details Of Available Entity Types + [Documentation] Check that you can retrieve a list with a detailed representation of NGSI-LD entity types + [Arguments] ${context} ${expectation_file} + ${response}= Retrieve Entity Types + ... context=${context} + ... details=true + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing EntityType element ${expectation_file} ${response.json()} + +Setup Initial Entities + ${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 + ... ${first_filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Create Entity Selecting Content Type + ... ${second_filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Set Test Variable ${first_entity_id} + Set Test Variable ${second_entity_id} + +Delete Initial Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..20aaf6e6eb5914008e30a3bad3a4ebca36a144f2 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_01.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation Check that you can query several entities based on ids + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-expectation.json +${entity_type}= https://ngsi-ld-test-suite/context#Building + + +*** Test Cases *** +019_01_01 Query several entities based on ids + [Documentation] Check that you can query several entities based on ids + [Tags] e-query 5_7_2 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${third_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${third_entity_id} + ${create_response3}= Create Entity Selecting Content Type + ... ${filename} + ... ${third_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response3.status_code} + @{entities_ids_to_be_compared}= 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}= Catenate SEPARATOR=, ${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_code} + Check Response Body Containing List Containing Entity Elements + ... ${expectation_filename} + ... ${entities_ids_to_be_compared} + ... ${response.json()} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} + Delete Entity by Id ${third_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..762c8762024b6ec794d129ea1a88f3f1361f1cd9 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_02.robot @@ -0,0 +1,65 @@ +*** Settings *** +Documentation Check that you can query several entities based on the entities types + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${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}= two-types-vehicle-offstreetparking-expectation.jsonld +${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 + + +*** Test Cases *** +019_01_02 Query several entities based on the entities types + [Documentation] Check that you can query several entities based on the entities types + [Tags] e-query 5_7_2 + ${building_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${building_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${building_filename} + ... ${building_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${vehicle_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${vehicle_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${vehicle_filename} + ... ${vehicle_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${parking_entity_id}= Generate Random Entity Id ${parking_id_prefix} + Set Suite Variable ${parking_entity_id} + ${create_response3}= Create Entity Selecting Content Type + ... ${parking_filename} + ... ${parking_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response3.status_code} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${vehicle_entity_type} ${parking_entity_type} + ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} accept=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 200 ${response.status_code} + @{entities_ids_to_be_compared}= Create List ${vehicle_entity_id} ${parking_entity_id} + Check Response Body Containing List Containing Entity Elements With Different Types + ... filename=${expectation_filename} + ... entities_representation_ids=${entities_ids_to_be_compared} + ... response_body=${response.json()} + ... ignore_core_context_version=${True} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${building_entity_id} + Delete Entity by Id ${vehicle_entity_id} + Delete Entity by Id ${parking_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..d2ddcb4586cf0ad55314a6277b0cd5b487c40db8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_03.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that you can query several entities based on the given id pattern + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-expectation.json +${entity_type}= https://ngsi-ld-test-suite/context#Building +${entity_id_pattern}= urn:ngsi-ld:Building:.* + + +*** Test Cases *** +019_01_03 Query several entities based on the given id pattern + [Documentation] Check that you can query several entities based on the given id pattern + [Tags] e-query 5_7_2 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} + @{entities_ids_to_be_compared}= Create List ${second_entity_id} ${first_entity_id} + ${response}= Query Entities + ... entity_id_pattern=${entity_id_pattern} + ... entity_types=${entity_types_to_be_retrieved} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Entity Elements + ... expectation_filename=${expectation_filename} + ... entities_ids=${entities_ids_to_be_compared} + ... response_body=${response.json()} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..b151d9523f2c250326fbae79496ad0e68e3ed42b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_04.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Check that you can query several entities based on attribute names + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${filename2}= building-minimal-sample.jsonld +${expectation_filename}= building-attributes-query-expectation.json +${entity_type}= https://ngsi-ld-test-suite/context#Building +${attribute_airqualitylevel}= https://ngsi-ld-test-suite/context#airQualityLevel +${attribute_subcategory}= https://ngsi-ld-test-suite/context#subCategory + + +*** Test Cases *** +019_01_04 Query several entities based on attribute names + [Documentation] Check that you can query several entities based on attribute names + [Tags] e-query 5_7_2 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${filename2} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${attributes_to_be_retrieved}= Catenate + ... SEPARATOR=, + ... ${attribute_airqualitylevel} + ... ${attribute_subcategory} + @{entities_ids_to_be_compared}= Create List ${first_entity_id} + ${response}= Query Entities attrs=${attributes_to_be_retrieved} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Entity Elements + ... ${expectation_filename} + ... ${entities_ids_to_be_compared} + ... ${response.json()} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..7191633102cc7b46e6203becea8de9dc9caff86d --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_05.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that you can query entities based on a geoquery + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-location-attribute-sample.jsonld +${expectation_filename}= building-geoproperty-query-expectation.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building +${georal}= equals +${geometry}= Point +${coordinates}= [13.3986, 52.5547] + + +*** Test Cases *** +019_01_05 Query several entities based on a geoquery + [Documentation] Check that you can query entities based on a geoquery + [Tags] e-query 5_7_2 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + @{entities_ids_to_be_compared}= 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}= Catenate SEPARATOR=, ${entity_type} + ${response}= Query Entities + ... entity_types=${entity_types_to_be_retrieved} + ... accept=${CONTENT_TYPE_LD_JSON} + ... georel=${georal} + ... geometry=${geometry} + ... coordinates=${coordinates} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Entity Elements + ... ${expectation_filename} + ... ${entities_ids_to_be_compared} + ... ${response.json()} + ... ${True} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..18635a72eab39479da396e8dce66f2604e0f9a3a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_01.robot @@ -0,0 +1,62 @@ +*** Settings *** +Documentation Check that you can query one entity via POST Interaction based on id + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Entities +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-expectation.json +${entity_type}= https://ngsi-ld-test-suite/context#Building + + +*** Test Cases *** +019_02_01 Query one entity via POST Interaction based on id + [Documentation] Check that you can query one entity via POST Interaction based on id + [Tags] e-query 5_7_2 + @{entities_ids_to_be_compared}= Create List ${first_entity_id} + ${response}= Query Entities Via POST + ... entity_id=${first_entity_id} + ... entity_type=${entity_type} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Entity Elements + ... ${expectation_filename} + ... ${entities_ids_to_be_compared} + ... ${response.json()} + + +*** Keywords *** +Create Entities + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${third_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${third_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${third_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} + Delete Entity by Id ${third_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..f262652e6b544dbc138e12ea82a85f96210c6ed3 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_02.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that you can query several entities via POST Interaction based on the entity type + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Entities +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${building_filename}= building-minimal-sample.jsonld +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${expectation_filename}= two-vehicles-expectation.jsonld +${building_entity_type}= https://ngsi-ld-test-suite/context#Building +${vehicle_entity_type}= https://ngsi-ld-test-suite/context#Vehicle + + +*** Test Cases *** +019_02_02 Query several entities via POST Interaction based on the entities types + [Documentation] Check that you can query several entities via POST Interaction based on the entity type + [Tags] e-query 5_7_2 + ${entities_ids_to_be_compared}= Create List ${first_vehicle_entity_id} ${second_vehicle_entity_id} + ${response}= Query Entities Via POST + ... entity_type=${vehicle_entity_type} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Entity Elements With Different Types + ... filename=${expectation_filename} + ... entities_representation_ids=${entities_ids_to_be_compared} + ... response_body=${response.json()} + ... ignore_core_context_version=True + + +*** Keywords *** +Create Entities + ${building_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${building_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${building_filename} + ... ${building_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${first_vehicle_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${first_vehicle_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${vehicle_filename} + ... ${first_vehicle_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${second_vehicle_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${second_vehicle_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${vehicle_filename} + ... ${second_vehicle_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Entities + Delete Entity by Id ${building_entity_id} + Delete Entity by Id ${first_vehicle_entity_id} + Delete Entity by Id ${second_vehicle_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..12f338967aa7f0974b253638f171c3480fcc0699 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_03.robot @@ -0,0 +1,55 @@ +*** Settings *** +Documentation Check that you can query several entities via POST Interaction based on the given id pattern + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Entities +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-expectation.json +${entity_type}= https://ngsi-ld-test-suite/context#Building +${entity_id_pattern}= urn:ngsi-ld:Building:.* + + +*** Test Cases *** +019_02_03 Query several entities via POST Interaction based on the given id pattern + [Documentation] Check that you can query several entities via POST Interaction based on the given id pattern + [Tags] e-query 5_7_2 + @{entities_ids_to_be_compared}= Create List ${first_entity_id} ${second_entity_id} + ${response}= Query Entities Via POST + ... entity_id_pattern=${entity_id_pattern} + ... entity_type=${entity_type} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Entity Elements + ... ${expectation_filename} + ... ${entities_ids_to_be_compared} + ... ${response.json()} + + +*** Keywords *** +Create Entities + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..913660a2cf8974727a9a0c2e7e930a1c8d5fc3a0 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_04.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Check that you can query several entities via POST Interaction based on attribute names + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Entities +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${building_filename}= building-minimal-sample.jsonld +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${expectation_filename}= vehicle-simple-attributes-core-context-expectation.json +${attribute_brandname}= https://ngsi-ld-test-suite/context#brandName +${attribute_isparked}= https://uri.etsi.org/ngsi-ld/default-context/isParked + + +*** Test Cases *** +019_02_04 Query several entities via POST Interaction based on attribute names + [Documentation] Check that you can query several entities via POST Interaction based on attribute names + [Tags] e-query 5_7_2 + @{attributes_to_be_retrieved}= Create List ${attribute_brandname} ${attribute_isparked} + @{entities_ids_to_be_retrieved}= Create List ${vehicle_entity_id} + ${response}= Query Entities Via POST attrs=${attributes_to_be_retrieved} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Entity Elements + ... ${expectation_filename} + ... ${entities_ids_to_be_retrieved} + ... ${response.json()} + + +*** Keywords *** +Create Entities + ${building_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${building_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${building_filename} + ... ${building_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${vehicle_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${vehicle_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${vehicle_filename} + ... ${vehicle_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Entities + Delete Entity by Id ${building_entity_id} + Delete Entity by Id ${vehicle_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..50e2dbc63bd067355aadc2553eacb127b225452d --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot @@ -0,0 +1,57 @@ +*** Settings *** +Documentation Check that you can query entitites via POST Interaction asking for a GeoJSON representation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Entities +Suite Teardown Delete Entities + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${parking_id_prefix}= urn:ngsi-ld:OffStreetParking: +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${parking_filename}= parking-simple-attributes-sample.jsonld +${expectation_filename}= vehicle-parking-simple-expectation.geojson +${vehicle_entity_type}= https://ngsi-ld-test-suite/context#Vehicle +${parking_entity_type}= https://ngsi-ld-test-suite/context#OffStreetParking + + +*** Test Cases *** +019_02_05 Query several entities via POST Interaction asking for a GeoJSON representation + [Documentation] Check that you can query entities via POST Interaction asking for a GeoJSON representation + [Tags] e-query 5_7_2 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${vehicle_entity_type} ${parking_entity_type} + ${response}= Query Entities Via POST + ... entity_type=${entity_types_to_be_retrieved} + ... accept=${CONTENT_TYPE_GEOJSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Content + ... expectation_filename=${expectation_filename} + ... response_body=${response.json()} + + +*** Keywords *** +Create Entities + ${vehicle_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${vehicle_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${vehicle_filename} + ... ${vehicle_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${parking_entity_id}= Generate Random Entity Id ${parking_id_prefix} + Set Suite Variable ${parking_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${parking_filename} + ... ${parking_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Entities + Delete Entity by Id ${vehicle_entity_id} + Delete Entity by Id ${parking_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..66e256598af0f54e12a279eb54ce89731069985c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_01.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that you cannot query entities if the requested ids are incorrect + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building +${entity_invalid_id_one}= thisisaninvaliduri1 +${entity_invalid_id_two}= thisisaninvaliduri2 + + +*** Test Cases *** +019_03_01 Query entities based on incorrect ids + [Documentation] Check that you cannot query entities if the requested ids are incorrect + [Tags] e-query 5_7_2 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${entity_invalid_id_one} ${entity_invalid_id_two} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} + ${response}= Query Entities + ... entity_ids=${entities_ids_to_be_retrieved} + ... entity_types=${entity_types_to_be_retrieved} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..563b5c0cfffa957e6e8e105eac617a554dc814cb --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_02.robot @@ -0,0 +1,54 @@ +*** Settings *** +Documentation Check that you cannot query entities if the requested entity types are incorrect + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${building_filename}= building-minimal-sample.jsonld +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${invalid_entity_type_one}= type +${invalid_entity_type_two}= invalid_entity_type_two + + +*** Test Cases *** +019_03_02 Query entities based on incorrect entity types + [Documentation] Check that you cannot query entities if the requested entity types are incorrect + [Tags] e-query 5_7_2 + ${building_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${building_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${building_filename} + ... ${building_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${vehicle_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${vehicle_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${vehicle_filename} + ... ${vehicle_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${entity_types_to_be_retrieved}= Catenate + ... SEPARATOR=, + ... ${invalid_entity_type_one} + ... ${invalid_entity_type_two} + ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${building_entity_id} + Delete Entity by Id ${vehicle_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..1d0857cb2097cc0f9818db2be0393b4abcdfad34 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check that you cannot query entities if the requested id pattern is incorrect + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building +${invalid_entity_id_pattern}= invalid_entity_id_pattern** + + +*** Test Cases *** +019_03_03 Query several entities based on incorrect id pattern + [Documentation] Check that you cannot query entities if the requested id pattern is incorrect + [Tags] e-query 5_7_2 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} + ${response}= Query Entities + ... entity_id_pattern=${invalid_entity_id_pattern} + ... entity_types=${entity_types_to_be_retrieved} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} 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 new file mode 100644 index 0000000000000000000000000000000000000000..7db8d213ddc4a2ca80858261d2611b6a69aa9120 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_04.robot @@ -0,0 +1,50 @@ +*** Settings *** +Documentation Check that you cannot query entities if the requested attribute names are incorrect + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building +${invalid_attribute_one}= id +${invalid_attribute_two}= type + + +*** Test Cases *** +019_03_04 Query several entities based on incorrect attribute names + [Documentation] Check that you cannot query entities if the requested attribute names are incorrect + [Tags] e-query 5_7_2 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${attributes_to_be_retrieved}= Catenate SEPARATOR=, ${invalid_attribute_one} ${invalid_attribute_two} + ${response}= Query Entities attrs=${attributes_to_be_retrieved} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} 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 new file mode 100644 index 0000000000000000000000000000000000000000..d89932a408643dc4e2032ed5802491aae94fa2b4 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_05.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Check that you cannot query entities if the request has a wrong geometryProperty + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-location-attribute-sample.jsonld +${entity_type}= Building +${georel}= invalid +${geometry}= Point +${coordinates}= [-8.503,41.202] +${geoproperty}= location + + +*** Test Cases *** +019_03_05 Query entities when the request has a wrong geometryProperty + [Documentation] Check that you cannot query entities if the request has a wrong geometryProperty + [Tags] e-query 5_7_2 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} + ${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_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..b729cb9588d5cf7017e1a1a999f4c9d3e79b484f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_04.robot @@ -0,0 +1,63 @@ +*** Settings *** +Documentation Check that the queried entities by Id can be returned in a simplified representation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${expectation_filename}= building-simple-attributes-simplified-expectation.json +${options_parameter}= keyValues +${entity_type}= https://ngsi-ld-test-suite/context#Building + + +*** Test Cases *** +019_04_01 Query entities in a simplified representation + [Documentation] Check that the queried entities by Id can be returned in a simplified representation + [Tags] e-query 6_3_7 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${third_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${third_entity_id} + ${create_response3}= Create Entity Selecting Content Type + ... ${filename} + ... ${third_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response3.status_code} + @{entities_ids_to_be_compared}= 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}= Catenate SEPARATOR=, ${entity_type} + ${response}= Query Entities + ... entity_ids=${entities_ids_to_be_retrieved} + ... entity_types=${entity_types_to_be_retrieved} + ... options=${options_parameter} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Entity Elements + ... ${expectation_filename} + ... ${entities_ids_to_be_compared} + ... ${response.json()} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} + Delete Entity by Id ${third_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..a963fa843776b3739704ba89b8532a078d43c62d --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_05.robot @@ -0,0 +1,54 @@ +*** Settings *** +Documentation Check that the queried entities by id can be returned in GeoJSON format + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Initial Entities +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-location-attribute-sample.jsonld +${expectation_filename}= two-buildings-location-attribute-normalized.geojson +${entity_type}= https://ngsi-ld-test-suite/context#Building + + +*** Test Cases *** +019_05_01 Get an entity by id that can be returned in GeoJSON format + [Documentation] Check that the queried entities by id can be returned in GeoJSON format + [Tags] e-query 6_3_7 + ${entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${first_entity_id} ${second_entity_id} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} + ${response}= Query Entities + ... entity_ids=${entities_ids_to_be_retrieved} + ... entity_types=${entity_types_to_be_retrieved} + ... accept=${CONTENT_TYPE_GEOJSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Content + ... expectation_filename=${expectation_filename} + ... response_body=${response.json()} + + +*** Keywords *** +Create Initial Entities + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..9b7dc7ec121e440883cfde0f17407da9937a30c3 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_06.robot @@ -0,0 +1,63 @@ +*** Settings *** +Documentation Check that you can query entities specifying a maximum number of results + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building +${limit}= 2 + + +*** Test Cases *** +019_06_01 Query entities specifying a maximum number of results + [Documentation] Check that you can query entities specifying a maximum number of results + [Tags] e-query 6_3_10 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + ${third_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${third_entity_id} + ${create_response3}= Create Entity Selecting Content Type + ... ${filename} + ... ${third_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response3.status_code} + ${entities_ids_to_be_retrieved}= Catenate + ... SEPARATOR=, + ... ${first_entity_id} + ... ${second_entity_id} + ... ${third_entity_id} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} + ${response}= Query Entities + ... entity_ids=${entities_ids_to_be_retrieved} + ... entity_types=${entity_types_to_be_retrieved} + ... limit=${limit} + Check Response Status Code 200 ${response.status_code} + @{entities_ids_to_be_compared}= Create List ${first_entity_id} ${second_entity_id} + Check Response Body Containing Number Of Entities ${entity_type} ${2} ${response.json()} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} + Delete Entity by Id ${third_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..73484e24301bec660e34cb129e241048c3d8838c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results. + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities +Test Template Query Entities With Count + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${first_entity_filename}= building-simple-attributes-sample.jsonld +${second_entity_filename}= building-simple-attributes-second-sample.jsonld +${entity_type}= Building +${airQualityLevel}= airQualityLevel==6 + + +*** Test Cases *** Q_PARAMETER EXPECTED_STATUS EXPECTED_COUNT +019_07_01 Check that the total number of matching results is returned if the count parameter is set to true and only the entity type is provided + ${EMPTY} 200 2 +019_07_02 Check that the total number of matching results is returned if the count parameter is set to true and a q parameter is provided + ${airQualityLevel} 200 1 + + +*** Keywords *** +Query Entities With Count + [Documentation] If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results. + [Tags] e-query 5_7_2 6_3_13 + [Arguments] ${q} ${expected_status_code} ${expected_count} + ${response}= Query Entities + ... entity_types=${entity_type} + ... q=${q} + ... count=${True} + ... context=${ngsild_test_suite_context} + + Check Response Status Code ${expected_status_code} ${response.status_code} + Check Response Headers Containing NGSILD-Results-Count Equals To ${expected_count} ${response.headers} + +Setup Initial Entities + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${first_entity_filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${second_entity_filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + +Delete Initial Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..66970dfa1e148bbbdaf6fe64a2de7a87a59581ea --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_01.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Check that you can get an entity by id + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${expectation_filename}= building-simple-attributes-expectation.jsonld + + +*** Test Cases *** +018_01_01 Get an entity by id + [Documentation] Check that you can get an entity by id + [Tags] e-retrieve 5_7_1 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${create_response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + ${response}= Query Entity + ... id=${entity_id} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Entity element + ... ${expectation_filename} + ... ${entity_id} + ... ${response.json()} + ... ${True} + + +*** Keywords *** +Delete Created Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..c5c418be5894214c6896866fb0621e2f1aec71f7 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_02.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that you can query some attributes from an entity + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${expectation_filename}= building-simple-attributes-query-expectation.jsonld +${attribute_airqualitylevel}= https://ngsi-ld-test-suite/context#airQualityLevel +${attribute_subcategory}= https://ngsi-ld-test-suite/context#subCategory + + +*** Test Cases *** +018_01_02 Query some attributes from an entity + [Documentation] Check that you can query some attributes from an entity + [Tags] e-retrieve 5_7_1 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${create_response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + ${attributes_to_be_retrieved}= Catenate + ... SEPARATOR=, + ... ${attribute_airqualitylevel} + ... ${attribute_subcategory} + ${response}= Query Entity + ... id=${entity_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... attrs=${attributes_to_be_retrieved} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Entity element + ... ${expectation_filename} + ... ${entity_id} + ... ${response.json()} + ... ${True} + + +*** Keywords *** +Delete Created Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..2ec9c63d170a01291463b55e91873dbb35f108cb --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_03.robot @@ -0,0 +1,44 @@ +*** Settings *** +Documentation Check that you can query the geometry property from an entity + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-location-attribute-sample.jsonld +${expectation_filename}= building-geoproperty-query-expectation.jsonld +${geometry_property}= location + + +*** Test Cases *** +018_01_03 Query the geometry property from an entity + [Documentation] Check that you can query the geometry property from an entity + [Tags] e-retrieve 5_7_1 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${create_response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + ${response}= Query Entity + ... id=${entity_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... geoproperty=${geometry_property} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Entity element + ... ${expectation_filename} + ... ${entity_id} + ... ${response.json()} + ... ${True} + + +*** Keywords *** +Delete Created Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..13067279be170c677086cc4b2aa7277516858ae0 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_02.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that you cannot get an entity with invalid id + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Get Entity With Invalid Id + + +*** Test Cases *** ENTITY_ID EXPECTED_STATUS_CODE PROBLEM_TYPE +018_02_01 Get an entity if the Entity Id is not a valid URI + thisisaninvaliduri 400 ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Get Entity With Invalid Id + [Documentation] Check that you cannot get an entity with invalid/missing id + [Tags] e-retrieve 5_7_1 + [Arguments] ${entity_id} ${expected_status_code} ${problem_type} + ${response}= Query Entity + ... id=${entity_id} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${expected_status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_03_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_03_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..c83b8661de9e42cc129bd1650ccd1a0f1689cbad --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_03_01.robot @@ -0,0 +1,25 @@ +*** Settings *** +Documentation Check that you cannot get an entity if the entity id is not known to the system + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +018_03_01 Get an entity if the Entity Id is not known to the system + [Documentation] Check that you cannot get an entity if the entity id or attributes are not known to the system + [Tags] e-retrieve 5_7_1 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Query Entity + ... id=${entity_id} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_03_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_03_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..a456aa68c619ee31b95099c16ad29f504e6cf04c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_03_02.robot @@ -0,0 +1,43 @@ +*** Settings *** +Documentation Check that you cannot get an entity if an attribute is not known to the system + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${attribute_not_known}= property_not_found + + +*** Test Cases *** +018_03_02 Get an entity if an attribute is not known to the system + [Documentation] Check that you cannot get an entity if an attribute is not known to the system + [Tags] e-retrieve 5_7_1 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${create_response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + ${attributes_to_be_retrieved}= Catenate SEPARATOR=, ${attribute_not_known} + ${response}= Query Entity + ... id=${entity_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... attrs=${attributes_to_be_retrieved} + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Delete Created Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..370df415521b3f68716738bea1f82faed50dc473 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_04.robot @@ -0,0 +1,44 @@ +*** Settings *** +Documentation Check that the queried entity by Id can be returned in a simplified representation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Created Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${expectation_filename}= building-simple-attributes-simplified-expectation.jsonld +${options_parameter}= keyValues + + +*** Test Cases *** +018_04_01 Get an entity in a simplified representation + [Documentation] Check that the queried entity by Id can be returned in a simplified representation + [Tags] e-retrieve 6_3_7 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${entity_id} + ${create_response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + ${response}= Query Entity + ... id=${entity_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... options=${options_parameter} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Entity element + ... ${expectation_filename} + ... ${entity_id} + ... ${response.json()} + ... ${True} + + +*** Keywords *** +Delete Created Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..a06f8909dfc038ec7ff28d43e9fd78f351888145 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_05.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that the queried entity by id can be returned in a GeoJSON format + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Initial Entity +Suite Teardown Delete Created Entity +Test Template Retrieve Entity In GeoJSON Representation + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-location-attribute-sample.jsonld + + +*** Test Cases *** OPTIONS EXPECTATION_FILENAME +018_05_01 Simplified + [Tags] e-retrieve 6_3_7 + keyValues building-location-attribute-simplified.geojson +018_05_02 Normalized + [Tags] e-retrieve 6_3_7 + ${EMPTY} building-location-attribute-normalized.geojson + + +*** Keywords *** +Retrieve Entity In GeoJSON Representation + [Documentation] Check that the queried entity by id can be returned in a GeoJSON format + [Arguments] ${options} ${expectation_filename} + ${response}= Query Entity + ... id=${entity_id} + ... accept=${CONTENT_TYPE_GEOJSON} + ... options=${options} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response.json()} + +Create Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + +Delete Created Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..ffff142dd9643751738fd89fd337b692d3dcf77c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_06.robot @@ -0,0 +1,51 @@ +*** Settings *** +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 + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Created Entity +Test Template Review JSON-LD Resolution When retrieving an entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.json +${empty_jsonld_expectation_filename}= building-simple-attributes-sample-expanded-expectation.json +${creation_jsonld_expectation_filename}= building-simple-attributes-sample-compacted-expectation.json + + +*** Test Cases *** CONTEXT EXPECTED_PAYLOAD +018_06_01 EmptyJsonLdContext + [Tags] e-retrieve 6_3_5 + ${EMPTY} ${empty_jsonld_expectation_filename} +018_06_02 CreationTimeJsonLdContext + [Tags] e-retrieve 6_3_5 + ${ngsild_test_suite_context} ${creation_jsonld_expectation_filename} + + +*** Keywords *** +Review 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 + [Arguments] ${context} ${expected_payload} + ${response}= Query Entity + ... id=${entity_id} + ... accept=${CONTENT_TYPE_JSON} + ... context=${context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Entity element ${expected_payload} ${entity_id} ${response.json()} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Set Test Variable ${entity_id} + +Delete Created Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..e7e0f174cf6fffbfdf5dfd4c4ff6599349256e20 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_01.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entities +Test Teardown Delete Initial Entities +Test Template Query the temporal evolution of entities + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${bus_id_prefix}= urn:ngsi-ld:Bus: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld +${bus_payload_file}= 2020-08-bus-temporal-representation-sample.jsonld + + +*** Test Cases *** TIMEREL TIMEAT EXPECTATION_FILE +021_01_01 After + [Tags] te-query 5_7_4 + after 2020-08-01T12:04:00Z vehicles-temporal-representation-021-01-01-expectation.jsonld +021_01_02 Before + [Tags] te-query 5_7_4 + before 2020-09-01T13:06:00Z vehicles-temporal-representation-021-01-02-expectation.jsonld + + +*** Keywords *** +Query the temporal evolution of entities + [Documentation] Check that you can query the temporal evolution of entities + [Arguments] ${timerel} ${timeat} ${expectation_file} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... timerel=${timerel} + ... timeAt=${timeat} + ... context=${ngsild_test_suite_context} + @{temporal_entities_representation_ids}= Create List + ... ${first_temporal_entity_representation_id} + ... ${second_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + +Setup Initial Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${third_temporal_entity_representation_id}= Generate Random Entity Id ${bus_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Create Temporal Representation Of Entity ${bus_payload_file} ${third_temporal_entity_representation_id} + Set Test Variable ${first_temporal_entity_representation_id} + Set Test Variable ${second_temporal_entity_representation_id} + Set Test Variable ${third_temporal_entity_representation_id} + +Delete Initial Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${third_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..2ede1332dca4701f3296556c5efe7ad00644aeee --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_02.robot @@ -0,0 +1,57 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of certain attributes of entities + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Temporal Entities +Suite Teardown Delete Initial Temporal Entities + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld +${expectation_file}= vehicles-temporal-representation-021-02-expectation.jsonld + + +*** Test Cases *** +021_02_01 Query the temporal evolution of certain attributes of entities + [Documentation] Check that you can query the temporal evolution of certain attributes of entities + [Tags] te-query 5_7_4 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${temporal_attributes_to_be_retrieved}= Catenate SEPARATOR=, speed + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... attrs=${temporal_attributes_to_be_retrieved} + ... context=${ngsild_test_suite_context} + @{temporal_entities_representation_ids}= Create List + ... ${first_temporal_entity_representation_id} + ... ${second_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Temporal Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Set Suite Variable ${first_temporal_entity_representation_id} + Set Suite Variable ${second_temporal_entity_representation_id} + +Delete Initial Temporal Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..003a65943a8f24fa2b3a53310f64adcdc8fd10e9 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_03.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of the last N instances of entities attributes + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Temporal Entities +Suite Teardown Delete Initial Temporal Entities + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-multiple-instances-sample.jsonld +${second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld +${expectation_file}= vehicles-temporal-representation-021-03-expectation.jsonld + + +*** Test Cases *** +021_03_01 Query the temporal evolution of the last N instances of entities attributes + [Documentation] Check that you can query the temporal evolution of the last N instances of entities attributes + [Tags] te-query 5_7_4 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... lastN=${14} + ... context=${ngsild_test_suite_context} + @{temporal_entities_representation_ids}= Create List + ... ${first_temporal_entity_representation_id} + ... ${second_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Temporal Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Set Suite Variable ${first_temporal_entity_representation_id} + Set Suite Variable ${second_temporal_entity_representation_id} + +Delete Initial Temporal Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..4ddd9113b75feb57802c3958fc012e90a987d259 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_04.robot @@ -0,0 +1,55 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities using a context + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Temporal Entities +Suite Teardown Delete Initial Temporal Entities + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld +${expectation_file}= vehicles-temporal-representation-021-04-expectation.jsonld + + +*** Test Cases *** +021_04_01 Query the temporal evolution of entities using a context + [Documentation] Check that you can query the temporal evolution of entities using a context + [Tags] te-query 5_7_4 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... context=${ngsild_test_suite_context} + @{temporal_entities_representation_ids}= Create List + ... ${first_temporal_entity_representation_id} + ... ${second_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Temporal Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Set Suite Variable ${first_temporal_entity_representation_id} + Set Suite Variable ${second_temporal_entity_representation_id} + +Delete Initial Temporal Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..8ecc5c8326a6a487d59edf4998e0ee34e858cde5 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_05.robot @@ -0,0 +1,50 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities matching the given type(s) + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Temporal Entities +Suite Teardown Delete Initial Temporal Entities + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${bus_id_prefix}= urn:ngsi-ld:Bus: +${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${bus_payload_file}= 2020-08-bus-temporal-representation-sample.jsonld +${expectation_file}= vehicles-temporal-representation-021-05-expectation.jsonld + + +*** Test Cases *** +021_05_01 Query the temporal evolution of entities matching the given type(s) + [Documentation] Check that you can query the temporal evolution of entities matching the given type(s) + [Tags] te-query 5_7_4 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Bus + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... context=${ngsild_test_suite_context} + @{temporal_entities_representation_ids}= Create List ${second_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Temporal Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${bus_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity ${bus_payload_file} ${second_temporal_entity_representation_id} + Set Suite Variable ${first_temporal_entity_representation_id} + Set Suite Variable ${second_temporal_entity_representation_id} + +Delete Initial Temporal Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..90d282ed17b95fa48d2ed14ebb3d6f37c3e400c7 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_06.robot @@ -0,0 +1,55 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities matching the given identifier(s) + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Temporal Entities +Suite Teardown Delete Initial Temporal Entities + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld +${expectation_file}= vehicles-temporal-representation-021-06-expectation.jsonld + + +*** Test Cases *** +021_06_01 Query the temporal evolution of entities matching the given identifier(s) + [Documentation] Check that you can query the temporal evolution of entities matching the given identifier(s) + [Tags] te-query 5_7_4 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${entity_ids_to_be_retrieved}= Catenate SEPARATOR=, ${first_temporal_entity_representation_id} + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... entity_ids=${entity_ids_to_be_retrieved} + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... context=${ngsild_test_suite_context} + @{temporal_entities_representation_ids}= Create List ${first_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Temporal Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Set Suite Variable ${first_temporal_entity_representation_id} + Set Suite Variable ${second_temporal_entity_representation_id} + +Delete Initial Temporal Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..77e54de96a44275de4069e8a85a517f925d9e908 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_07.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities matching the given id pattern + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Temporal Entities +Suite Teardown Delete Initial Temporal Entities + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld +${expectation_file}= vehicles-temporal-representation-021-07-expectation.jsonld + + +*** Test Cases *** +021_07_01 Query the temporal evolution of entities matching the given id pattern + [Documentation] Check that you can query the temporal evolution of entities matching the given id pattern + [Tags] te-query 5_7_4 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... entity_id_pattern=urn:ngsi-ld:Vehicle:.* + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... context=${ngsild_test_suite_context} + @{temporal_entities_representation_ids}= Create List + ... ${first_temporal_entity_representation_id} + ... ${second_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Temporal Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Set Suite Variable ${first_temporal_entity_representation_id} + Set Suite Variable ${second_temporal_entity_representation_id} + +Delete Initial Temporal Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_08.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..4e97c76f657f34dc72329e748c03f78207d41bed --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_08.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities matching the given NGSI-LD query + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Temporal Entities +Suite Teardown Delete Initial Temporal Entities + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld +${expectation_file}= vehicles-temporal-representation-021-08-expectation.jsonld + + +*** Test Cases *** +021_08_01 Query the temporal evolution of entities matching the given NGSI-LD query + [Documentation] Check that you can query the temporal evolution of entities matching the given NGSI-LD query + [Tags] te-query 5_7_4 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... ngsild_query=speed>90 + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... context=${ngsild_test_suite_context} + @{temporal_entities_representation_ids}= Create List + ... ${first_temporal_entity_representation_id} + ... ${second_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Temporal Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Set Suite Variable ${first_temporal_entity_representation_id} + Set Suite Variable ${second_temporal_entity_representation_id} + +Delete Initial Temporal Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_09.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_09.robot new file mode 100644 index 0000000000000000000000000000000000000000..64d4b253ea71a7e7d82da38dd775d6af7943c058 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_09.robot @@ -0,0 +1,65 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities matching the given NGSI-LD geo-query + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Temporal Entities +Test Teardown Delete Initial Temporal Entities +Test Template Query the temporal evolution of entities matching the given NGSI-LD geo-query + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${second_vehicle_payload_file}= 2020-10-vehicule-temporal-representation-with-location-sample.jsonld +${expectation_file}= vehicles-temporal-representation-021-09-expectation.jsonld + + +*** Test Cases *** GEOREL GEOMETRY COORDINATES GEOPROPERTY EXPECTATION_FILE +021_09_01 Near Point + [Tags] te-query 5_7_4 + near;maxDistance==2000 Point [-8.503,41.202] ${EMPTY} vehicles-temporal-representation-021-09-01-expectation.jsonld +021_09_02 Within Polygon + [Tags] te-query 5_7_4 + contains Polygon [[[-13.503,47.202],[6.541, 52.961],[20.37,44.653],[9.46,32.57],[-13.503,32.57],[-13.503,47.202]]] location vehicles-temporal-representation-021-09-02-expectation.jsonld + + +*** Keywords *** +Query the temporal evolution of entities matching the given NGSI-LD geo-query + [Documentation] Check that you can query the temporal evolution of entities matching the given NGSI-LD geo-query + [Arguments] ${georel} ${geometry} ${coordinates} ${geoproperty} ${expectation_file} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... georel=${georel} + ... geometry=${geometry} + ... coordinates=${coordinates} + ... geoproperty=${geoproperty} + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... context=${ngsild_test_suite_context} + @{temporal_entities_representation_ids}= Create List ${second_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + +Setup Initial Temporal Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Set Test Variable ${first_temporal_entity_representation_id} + Set Test Variable ${second_temporal_entity_representation_id} + +Delete Initial Temporal Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_10.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_10.robot new file mode 100644 index 0000000000000000000000000000000000000000..a9431ab7edfabca2d22b8efb59a28c1c31715906 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_10.robot @@ -0,0 +1,47 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities matching the given NGSI-LD Context Source filter + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Create Initial Context Source Registration and Mock Server +Test Teardown Delete Initial Context Source Registration and Mock Server + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-observationInterval-sample.jsonld +${context_source_url}= http://${context_source_host}:${context_source_port} + + +*** Test Cases *** +021_10_01 Query the temporal evolution of entities matching the given NGSI-LD context source filter + [Documentation] Check that you can query the temporal evolution of entities matching the given NGSI-LD Context Source filter + [Tags] te-query 5_7_4 + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Building + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... csf=endpoint=="${context_source_url}" + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... context=${ngsild_test_suite_context} + Wait for redirected request + Check Response Status Code 200 ${response.status_code} + + +*** Keywords *** +Create Initial Context Source Registration and Mock Server + Start Context Source Mock Server + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Context Source Registration Sample With Reachable Context Source + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Create Context Source Registration ${context_source_registration_payload} + Set Suite Variable ${context_source_registration_id} + +Delete Initial Context Source Registration and Mock Server + Stop Context Source Mock Server + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_11.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_11.robot new file mode 100644 index 0000000000000000000000000000000000000000..1d35165e4fe91b79393bc843cdf94b087c2fb521 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_11.robot @@ -0,0 +1,63 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities with a limit to the number of entities to be retrieved + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Temporal Entities +Test Teardown Delete Initial Temporal Entities +Test Template Query the temporal evolution of entities with a limit to the number of entities to be retrieved + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld + + +*** Test Cases *** LIMIT +021_11_01 Query Some entities + [Tags] te-query 5_7_4 + ${2} +021_11_02 Query All entities + [Tags] te-query 5_7_4 + ${3} + + +*** Keywords *** +Query the temporal evolution of entities with a limit to the number of entities to be retrieved + [Documentation] Check that you can query the temporal evolution of entities with a limit to the number of entities to be retrieved + [Arguments] ${limit} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Bus,Vehicle + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... limit=${limit} + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Number Of Entities Vehicle ${limit} ${response.json()} + +Setup Initial Temporal Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${third_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${third_temporal_entity_representation_id} + Set Test Variable ${first_temporal_entity_representation_id} + Set Test Variable ${second_temporal_entity_representation_id} + Set Test Variable ${third_temporal_entity_representation_id} + +Delete Initial Temporal Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${third_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_12.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_12.robot new file mode 100644 index 0000000000000000000000000000000000000000..ed4e91481981d23e132ba65c86840284e26c6421 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_12.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Check that you cannot query the temporal evolution of entities with an invalid request or invalid request content + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Temporal Entity +Suite Teardown Delete Initial Temporal Entity + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld + + +*** Test Cases *** +021_12_01 Query the temporal evolution of entities with an invalid request + [Documentation] Check that you cannot query the temporal evolution of entities with an invalid request + [Tags] te-query 5_7_4 + ${response}= Query Temporal Representation Of Entities + ... timerel=after + ... timeAt=2020-07-01T12:05:00Z + ... context=${ngsild_test_suite_context} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_13.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_13.robot new file mode 100644 index 0000000000000000000000000000000000000000..b90c2fc6a8d0865f308cb4aeb2e5ad20c3f385e0 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_13.robot @@ -0,0 +1,59 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities using the entityOperations method + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Temporal Entities +Test Teardown Delete Initial Temporal Entities +Test Template Query the temporal evolution of entities using the entityOperations method + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld + + +*** Test Cases *** PAYLOAD_FILE EXPECTATION_FILE +021_13_01 After + [Tags] te-query 5_7_4 + entity-operations-after-query.jsonld vehicles-temporal-representation-021-13-01-expectation.jsonld +021_13_02 Before + [Tags] te-query 5_7_4 + entity-operations-before-query.jsonld vehicles-temporal-representation-021-13-02-expectation.jsonld + + +*** Keywords *** +Query the temporal evolution of entities using the entityOperations method + [Documentation] Check that you can query the temporal evolution of entities using the entityOperations method + [Arguments] ${payload_file} ${expectation_file} + ${response}= Query Temporal Representation Of Entities Via Post + ... query_file_name=${payload_file} + ... context=${ngsild_test_suite_context} + @{temporal_entities_representation_ids}= Create List + ... ${first_temporal_entity_representation_id} + ... ${second_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + +Setup Initial Temporal Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Set Test Variable ${first_temporal_entity_representation_id} + Set Test Variable ${second_temporal_entity_representation_id} + +Delete Initial Temporal Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_14.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_14.robot new file mode 100644 index 0000000000000000000000000000000000000000..d18dd087a3dca0d387c1f0ed165c9d89d291cc0a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_14.robot @@ -0,0 +1,71 @@ +*** Settings *** +Documentation Check that you can query the temporal evolution of entities with the simplified representation + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entities +Test Teardown Delete Initial Entities +Test Template Query the temporal evolution of entities + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${bus_id_prefix}= urn:ngsi-ld:Bus: +${first_vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${second_vehicle_payload_file}= 2020-09-vehicule-temporal-representation-sample.jsonld +${bus_payload_file}= 2020-08-bus-temporal-representation-sample.jsonld + + +*** Test Cases *** TIMEREL TIMEAT EXPECTATION_FILE +021_14_01 After + [Tags] te-query 5_7_4 + after 2020-08-01T12:04:00Z vehicles-temporal-representation-021-14-01-expectation.json +021_14_02 Before + [Tags] te-query 5_7_4 + before 2020-09-01T13:06:00Z vehicles-temporal-representation-021-14-02-expectation.json + + +*** Keywords *** +Query the temporal evolution of entities + [Documentation] Check that you can query the temporal evolution of entities with the simplified representation + [Arguments] ${timerel} ${timeat} ${expectation_file} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, Vehicle + ${response}= Query Temporal Representation Of Entities + ... entity_types=${entity_types_to_be_retrieved} + ... timerel=${timerel} + ... timeAt=${timeat} + ... context=${ngsild_test_suite_context} + ... options=temporalValues + @{temporal_entities_representation_ids}= Create List + ... ${first_temporal_entity_representation_id} + ... ${second_temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing EntityTemporal elements + ... ${expectation_file} + ... ${temporal_entities_representation_ids} + ... ${response.json()} + +Setup Initial Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${second_temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + ${third_temporal_entity_representation_id}= Generate Random Entity Id ${bus_id_prefix} + Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${second_vehicle_payload_file} + ... ${second_temporal_entity_representation_id} + Create Temporal Representation Of Entity + ... ${bus_payload_file} + ... ${third_temporal_entity_representation_id} + Set Test Variable ${first_temporal_entity_representation_id} + Set Test Variable ${second_temporal_entity_representation_id} + Set Test Variable ${third_temporal_entity_representation_id} + +Delete Initial Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${second_temporal_entity_representation_id} + Delete Temporal Representation Of Entity ${third_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..4fc7fb120868fc1b8f679becd58bada264f5e6e7 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of an entity + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Temporal Entity +Suite Teardown Delete Initial Temporal Entity + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${vehicle_expectation_file}= vehicle-temporal-representation-020-01-expectation.jsonld + + +*** Test Cases *** +020_01_01 Retrieve the temporal evolution of an entity + [Documentation] Check that you can retrieve the temporal evolution of an entity + [Tags] te-retrieve 5_7_3 + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing EntityTemporal element + ... ${vehicle_expectation_file} + ... ${temporal_entity_representation_id} + ... ${response.json()} + + +*** Keywords *** +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..359e26e05614034149298682ff7fc1f6782e10ab --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of an entity using a context + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Temporal Entity +Suite Teardown Delete Initial Temporal Entity + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${vehicle_expectation_file}= vehicle-temporal-representation-020-02-expectation.jsonld + + +*** Test Cases *** +020_02_01 Retrieve the temporal evolution of an entity using a context + [Documentation] Check that you can retrieve the temporal evolution of an entity using a context + [Tags] te-retrieve 5_7_3 + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing EntityTemporal element + ... ${vehicle_expectation_file} + ... ${temporal_entity_representation_id} + ... ${response.json()} + + +*** Keywords *** +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..74f48620c9fec779cbb20d842b7f3f98a02d969f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of certain attributes of an entity + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Temporal Entity +Test Teardown Delete Initial Temporal Entity + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${vehicle_expectation_file}= vehicle-temporal-representation-020-03-expectation.jsonld + + +*** Test Cases *** +020_03_01 Retrieve the temporal evolution of certain attributes of an entity + [Documentation] Check that you can retrieve the temporal evolution of certain attributes of an entity + [Tags] te-retrieve 5_7_3 + @{temporal_attributes_to_be_retrieved}= Create List fuelLevel + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... attrs=${temporal_attributes_to_be_retrieved} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing EntityTemporal element + ... ${vehicle_expectation_file} + ... ${temporal_entity_representation_id} + ... ${response.json()} + + +*** Keywords *** +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..4b7be9bb42b4e3af122ccedffeab3cddb27f88ee --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Temporal Entity +Test Teardown Delete Initial Temporal Entity +Test Template Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld + + +*** Test Cases *** TIMEREL TIMEAT ENDTIMEAT VEHICLE_EXPECTATION_FILE +020_04_01 After + [Tags] te-retrieve 5_7_3 + after 2020-08-01T13:03:00Z ${EMPTY} vehicle-temporal-representation-020-04-01-expectation.jsonld +020_04_02 Before + [Tags] te-retrieve 5_7_3 + before 2020-08-01T12:05:00Z ${EMPTY} vehicle-temporal-representation-020-04-02-expectation.jsonld +020_04_03 Between + [Tags] te-retrieve 5_7_3 + between 2020-08-01T12:00:00Z 2020-08-01T13:00:00Z vehicle-temporal-representation-020-04-03-expectation.jsonld + + +*** Keywords *** +Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query + [Documentation] Check that you can retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query + [Arguments] ${timerel} ${timeat} ${endtimeat} ${vehicle_expectation_file} + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... timerel=${timerel} + ... timeAt=${timeat} + ... endTimeAt=${endtimeat} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing EntityTemporal element + ... ${vehicle_expectation_file} + ... ${temporal_entity_representation_id} + ... ${response.json()} + +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Test Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..6e18ef8247c40603d41f3fb39d73a3d761de2c10 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot @@ -0,0 +1,48 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of the last N instances of entity attributes + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Temporal Entity +Test Teardown Delete Initial Temporal Entity +Test Template Retrieve the temporal evolution of the last N instances of entity attributes + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-multiple-instances-sample.jsonld + + +*** Test Cases *** LASTN VEHICLE_EXPECTATION_FILE +020_05_01 Retrieve Some Instances + [Tags] te-retrieve 5_7_3 + ${10} vehicle-temporal-representation-020-05-01-expectation.jsonld +020_05_02 Retrieve All Instances + [Tags] te-retrieve 5_7_3 + ${20} vehicle-temporal-representation-020-05-02-expectation.jsonld + + +*** Keywords *** +Retrieve the temporal evolution of the last N instances of entity attributes + [Documentation] Check that you can retrieve the temporal evolution of the last N instances of entity attributes + [Arguments] ${lastn} ${vehicle_expectation_file} + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... lastN=${lastn} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing EntityTemporal element + ... ${vehicle_expectation_file} + ... ${temporal_entity_representation_id} + ... ${response.json()} + +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Test Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..1bf372e62a33a468ec9262a90c85fa9ed208ebd1 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot @@ -0,0 +1,19 @@ +*** Settings *** +Documentation Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI) + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Test Cases *** +020_06_01 Retrieve the temporal evolution of an entity with an invalid id + [Documentation] Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI) + [Tags] te-retrieve 5_7_3 + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=invalidUri + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..7983fff02d3347f60c47a2489fdb36155cffc079 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot @@ -0,0 +1,19 @@ +*** Settings *** +Documentation Check that you cannot retrieve the temporal evolution of a non-existing entity + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Test Cases *** +020_07_01 Retrieve the temporal evolution of a non-existing entity + [Documentation] Check that you cannot retrieve the temporal evolution of a non-existing entity + [Tags] te-retrieve 5_7_3 + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=urn:ngsi-ld:Vehicle:unknowEntity + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..411ea56bf3040ea64a7a7ff6804793d4193c53e9 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Check that you cannot retrieve the temporal evolution of non-existing entity attributes + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Temporal Entity +Suite Teardown Delete Initial Temporal Entity + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld + + +*** Test Cases *** +020_08_01 Retrieve the temporal evolution of non-existing entity attributes + [Documentation] Check that you cannot retrieve the temporal evolution of non-existing entity attributes + [Tags] te-retrieve 5_7_3 + @{temporal_attributes_to_be_retrieved}= Create List unknownAttribute + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... attrs=${temporal_attributes_to_be_retrieved} + ... context=${ngsild_test_suite_context} + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot new file mode 100644 index 0000000000000000000000000000000000000000..466b418158083bff789203468534c3ff481dc192 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Check that you cannot retrieve the temporal evolution of an entity with an invalid request content + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Temporal Entity +Test Teardown Delete Initial Temporal Entity +Test Template Retrieve the temporal evolution of an entity with an invalid request content + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld + + +*** Test Cases *** TIMEREL TIMEAT ENDTIMEAT +020_09_01 After + [Tags] te-retrieve 5_7_3 + after ${EMPTY} ${EMPTY} +020_09_02 Before + [Tags] te-retrieve 5_7_3 + before ${EMPTY} ${EMPTY} +020_09_03 Between + [Tags] te-retrieve 5_7_3 + between 2020-08-01T12:00:00Z ${EMPTY} + + +*** Keywords *** +Retrieve the temporal evolution of an entity with an invalid request content + [Documentation] Check that you cannot retrieve the temporal evolution of an entity with an invalid request content + [Arguments] ${timerel} ${timeat} ${endtimeat} + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... timerel=${timerel} + ... timeAt=${timeat} + ... endTimeAt=${endtimeat} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Test Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot new file mode 100644 index 0000000000000000000000000000000000000000..17298e7035bbf1f5c5fc14abd278074b0b4c9942 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of an entity with the simplified temporal representation + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Create Temporal Entity +Suite Teardown Delete Initial Temporal Entity + + +*** Variables *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= 2020-08-vehicule-temporal-representation-sample.jsonld +${vehicle_expectation_file}= vehicle-temporal-representation-020-10-expectation.jsonld + + +*** Test Cases *** +020_10_01 Retrieve the temporal evolution of an entity with the simplified temporal representation + [Documentation] Check that you can retrieve the temporal evolution of an entity with the simplified temporal representation + [Tags] te-retrieve 5_7_3 + @{options}= Create List temporalValues + ${response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... options=${options} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing EntityTemporal element + ... ${vehicle_expectation_file} + ... ${temporal_entity_representation_id} + ... ${response.json()} + + +*** Keywords *** +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..477e7f9012c761912604c1bf184825e083e50ebf --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that you can create a batch of entities + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entities +Test Template Batch Create Entity Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** FILENAME +003_01_01 MinimalEntity + [Tags] be-create 5_6_7 + building-minimal-sample.jsonld +003_01_02 EntityWithSimpleProperties + [Tags] be-create 5_6_7 + building-simple-attributes-sample.jsonld +003_01_03 EntityWithSimpleRelationships + [Tags] be-create 5_6_7 + building-relationship-sample.jsonld +003_01_04 EntityWithRelationshipsProperties + [Tags] be-create 5_6_7 + building-relationship-of-property-sample.jsonld + + +*** Keywords *** +Batch Create Entity Scenarios + [Documentation] Check that you can create a batch of entities + [Arguments] ${filename} + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity ${filename} ${first_entity_id} + ${second_entity}= Load Entity ${filename} ${second_entity_id} + @{entities_to_be_created}= Create List ${first_entity} ${second_entity} + ${response}= Batch Create Entities + ... @{entities_to_be_created} + + @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + Set Test Variable @{expected_entities_ids} + ${entities_to_be_queried}= Catenate SEPARATOR=, ${first_entity_id} ${second_entity_id} + Check Response Status Code 201 ${response.status_code} + Check Response Body Containing Array Of URIs set to ${expected_entities_ids} ${response.json()} + + ${response1}= Query Entities + ... entity_ids=${entities_to_be_queried} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Created Resources Set To + ... expected_resources=${entities_to_be_created} + ... response_body=${response1.json()} + +Delete Initial Entities + Batch Delete Entities entities_ids_to_be_deleted=@{expected_entities_ids} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_02.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..5a23e2ecae9d4dc8abd979d46d51763aabf6d209 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_02.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Check that you can create a batch of entities where some will succeed and others will fail + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entity +Suite Teardown Delete Initial Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +003_02_01 Create a batch of two valid entities and one invalid entity + [Documentation] Check that you can create a batch of two valid entities and one invalid entity + [Tags] be-create 5_6_7 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + # TODO: Use Load Test Sample keyword instead + ${first_entity}= Load Entity building-minimal-sample.jsonld ${first_entity_id} + ${second_entity}= Load Entity building-minimal-sample.jsonld ${second_entity_id} + ${already_existing_entity}= Load Entity building-minimal-sample.jsonld ${existing_entity_id} + @{entities_to_be_created}= Create List ${first_entity} ${second_entity} ${already_existing_entity} + ${response}= Batch Create Entities @{entities_to_be_created} + @{expected_successful_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + @{expected_failed_entities_ids}= Create List ${existing_entity_id} + &{expected_batch_operation_result}= Create Batch Operation Result + ... ${expected_successful_entities_ids} + ... ${expected_failed_entities_ids} + Check Response Status Code 207 ${response.status_code} + Check Response Body Containing Batch Operation Result ${expected_batch_operation_result} ${response.json()} + ${expected_entities_ids}= Catenate SEPARATOR=, @{expected_successful_entities_ids} + ${response1}= Query Entities + ... entity_ids=${expected_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + @{created_entities}= Create List ${first_entity} ${second_entity} + Check Created Resources Set To ${created_entities} ${response1.json()} + + +*** Keywords *** +Setup Initial Entity + ${existing_entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity building-minimal-sample.jsonld ${existing_entity_id} + Set Suite Variable ${existing_entity_id} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} ${existing_entity_id} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..97507d6f6e1ac7f170670510113ac8c4de5047c5 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that you cannot create a batch of entities with an invalid request + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Create Batch Entity With Invalid Request Scenarios + + +*** Test Cases *** FILENAME PROBLEM_TYPE +003_03_01 InvalidJson + [Tags] be-create 5_6_7 + batch/invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +003_03_02 EmptyJson + [Tags] be-create 5_6_7 + batch/empty-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Create Batch Entity With Invalid Request Scenarios + [Documentation] Check that you cannot create a batch of entities with an invalid request + [Arguments] ${filename} ${problem_type} + ${response}= Batch Request Entities From File create filename=${filename} + Check Response Status Code 400 ${response.status_code} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..b7551d9fcc58cc0116f4364d98916ec0c46990f7 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot @@ -0,0 +1,64 @@ +*** Settings *** +Documentation Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +003_04_01 Create a batch of one entity using a provided Link header with JSON content type and retrieve the entity with context detail + [Documentation] Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" + [Tags] be-create 6_3_5 + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.json ${entity_id} + @{entities_to_be_created}= Create List ${entity} + ${response}= Batch Create Entities + ... @{entities_to_be_created} + ... content_type=${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 201 ${response.status_code} + + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + # Attribute should be compacted as we used the same context as provided when creating the entity + Check Response Body Containing an Attribute set to + ... expected_attribute_name=almostFull + ... response_body=${response1.json()} + +003_04_02 Create a batch of one entity using a provided Link header with JSON content type and retrieve the entity without context detail + [Documentation] Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" + [Tags] be-create 6_3_5 + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.json ${entity_id} + @{entities_to_be_created}= Create List ${entity} + ${response}= Batch Create Entities + ... @{entities_to_be_created} + ... content_type=${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 201 ${response.status_code} + + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + # Attribute should not be compacted as we did not provide a context containing this attribute + Check Response Body Containing an Attribute set to + ... expected_attribute_name=https://ngsi-ld-test-suite/context#almostFull + ... response_body=${response1.json()} + + +*** Keywords *** +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${entity_id} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..b1d934a73d399494fd3f9d238e6eeb1e8f33ef90 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot @@ -0,0 +1,55 @@ +*** Settings *** +Documentation Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +003_05_01 Create a batch of one entity using the default context with JSON content type + [Documentation] Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context and retrieve the entity without context + [Tags] be-create 6_3_5 + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.json ${entity_id} + @{entities_to_be_created}= Create List ${entity} + ${response}= Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_JSON} + Check Response Status Code 201 ${response.status_code} + + ${response1}= Retrieve Entity by Id id=${entity_id} + # Attribute should be compacted as we used the same default context as provided when creating the entity + Check Response Body Containing an Attribute set to + ... expected_attribute_name=almostFull + ... response_body=${response1.json()} + +003_05_02 Create a batch of one entity using the default context with JSON content type + [Documentation] Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context and retrieve the entity with context + [Tags] be-create 6_3_5 + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.json ${entity_id} + @{entities_to_be_created}= Create List ${entity} + ${response}= Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_JSON} + Check Response Status Code 201 ${response.status_code} + + ${response1}= Retrieve Entity by Id id=${entity_id} context=${ngsild_test_suite_context} + # Attribute should not be compacted as we did not provide a context containing this term + Check Response Body Containing an Attribute set to + ... expected_attribute_name=ngsi-ld:default-context/almostFull + ... response_body=${response1.json()} + + +*** Keywords *** +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${entity_id} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..ca78572caad8a25bff8c7abb148a75e1ad2cf237 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot @@ -0,0 +1,25 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/json" and the request payload body (as JSON) contains a "@context" term + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +003_06_01 Create a batch of one entity containing a JSON-LD @context with a JSON content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/json" and the request payload body (as JSON) contains a "@context" term + [Tags] be-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${entity}= Load Entity building-simple-attributes-sample.jsonld ${entity_id} + @{entities_to_be_created}= Create List ${entity} + ${response}= Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..d48a743724f5868344457c30a6b76ee50723788b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot @@ -0,0 +1,55 @@ +*** Settings *** +Documentation Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +003_07_01 Create a batch of one entity using a JSON-LD @context obtained from the request payload + [Documentation] Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" and the response attribute should be compacted as we used the same context as provided when creating the entity + [Tags] be-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.jsonld ${entity_id} + @{entities_to_be_created}= Create List ${entity} + ${response}= Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + # Attribute should be compacted as we used the same context as provided when creating the entity + Check Response Body Containing an Attribute set to + ... expected_attribute_name=almostFull + ... response_body=${response1.json()} + +003_07_02 Create a batch of one entity using a JSON-LD @context obtained from the request payload + [Documentation] Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" and response attribute should not be compacted as we did not provide a context containing this term + [Tags] be-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.jsonld ${entity_id} + @{entities_to_be_created}= Create List ${entity} + ${response}= Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + # Attribute should not be compacted as we did not provide a context containing this term + Check Response Body Containing an Attribute set to + ... expected_attribute_name=https://ngsi-ld-test-suite/context#almostFull + ... response_body=${response1.json()} + + +*** Keywords *** +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${entity_id} + ${response}= Batch Delete Entities + ... entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..b2ed544785150e10524737db5c8e3d84faf88286 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot @@ -0,0 +1,25 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and the request payload body does not contain a @context term + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +003_08_01 Create a batch of one entity not containing a JSON-LD @context with a JSON-LD content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and the request payload body does not contain a @context term + [Tags] be-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${entity}= Load Entity building-simple-attributes-sample.json ${entity_id} + @{entities_to_be_created}= Create List ${entity} + ${response}= Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot new file mode 100644 index 0000000000000000000000000000000000000000..18e4929671887c80ed3f067f2056865e01850831 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and a JSON-LD Link header is present in the incoming HTTP request + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +003_09_01 Create a batch of one entity with a Link header and a JSON-LD content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and a JSON-LD Link header is present in the incoming HTTP request + [Tags] be-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${entity}= Load Entity building-simple-attributes-sample.jsonld ${entity_id} + @{entities_to_be_created}= Create List ${entity} + ${response}= Batch Create Entities + ... @{entities_to_be_created} + ... content_type=${CONTENT_TYPE_LD_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_01.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..fa8104d981c5ca59243b28baded128fe81afee50 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_01.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Check that you can delete a batch of entities + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +006_01_01 Delete a batch of entities + [Documentation] Check that you can delete a batch of entities + [Tags] be-delete 5_6_10 + ${response}= Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} + Check Response Status Code 204 ${response.status_code} + + ${expected_entities_ids}= Catenate SEPARATOR=, @{entities_ids_to_be_deleted} + ${response1}= Query Entities + ... entity_ids=${expected_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + Check SUT Not Containing Resources ${response1.json()} + + +*** Keywords *** +Setup Initial Entities + ${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} + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + Set Test Variable ${entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_02.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..c532ce2a6dd7aefdc82f62cc682382da40a60877 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_02.robot @@ -0,0 +1,46 @@ +*** Settings *** +Documentation Check that you can delete a batch of entities where some will succeed and others will fail + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +006_02_01 Delete a batch of non-existing and existing entities + [Documentation] Check that you can delete a batch of non-existing and existing entities + [Tags] be-delete 5_6_10 + ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} + @{entities_ids_to_be_deleted}= Create List ${existing_entity_id} ${new_entity_id} + + ${response}= Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} + @{expected_successful_entities_ids}= Create List ${existing_entity_id} + @{expected_failed_entities_ids}= Create List ${new_entity_id} + Set Test Variable ${expected_successful_entities_ids} + + &{response1}= Create Batch Operation Result + ... ${expected_successful_entities_ids} + ... ${expected_failed_entities_ids} + Check Response Status Code 207 ${response.status_code} + Check Response Body Containing Batch Operation Result ${response1} ${response.json()} + + ${expected_entities_ids}= Catenate SEPARATOR=, @{expected_successful_entities_ids} + ${response2}= Query Entities + ... entity_ids=${expected_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + Check SUT Not Containing Resources ${response2.json()} + + +*** Keywords *** +Setup Initial Entity + ${existing_entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity building-simple-attributes-sample.jsonld ${existing_entity_id} + Set Test Variable ${existing_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..9b9d913adc09e5ad8242a9d90f0279fb637ba313 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that you cannot delete a batch of entities with an invalid request + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Batch Delete Entity With Invalid Request Scenarios + + +*** Test Cases *** FILENAME PROBLEM_TYPE +006_03_01 InvalidJson + [Tags] be-delete 5_6_10 + batch/invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +006_03_02 EmptyJson + [Tags] be-delete 5_6_10 + batch/empty-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Batch Delete Entity With Invalid Request Scenarios + [Documentation] Check that you cannot delete a batch of entities with an invalid request + [Arguments] ${filename} ${problem_type} + ${response}= Batch Request Entities From File delete filename=${filename} + Check Response Status Code 400 ${response.status_code} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..01350e4aab3f1d92a55af6cc77cbc25847d7110d --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot @@ -0,0 +1,65 @@ +*** Settings *** +Documentation Check that you can update a batch of entities + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entities +Test Teardown Delete Initial Entities +Test Template Batch Update Entity Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_payload_filename}= building-simple-attributes-sample.jsonld + + +*** Test Cases *** FILENAME UPDATE_FRAGMENT_FILENAME +005_01_01 EntityWithSimpleProperties + [Tags] be-update 5_6_9 + building-simple-attributes-sample.jsonld fragmentEntities/empty-fragment.json +005_01_02 EntityWithSimpleRelationships + [Tags] be-update 5_6_9 + building-relationship-sample.jsonld fragmentEntities/locatedAt-fragment.json +005_01_03 EntityWithRelationshipsProperties + [Tags] be-update 5_6_9 + building-relationship-of-property-sample.jsonld fragmentEntities/airQualityLevel-with-relationship-fragment.json + + +*** Keywords *** +Batch Update Entity Scenarios + [Documentation] Check that you can update a batch of entities + [Arguments] ${filename} ${update_fragment_filename} + ${first_entity}= Load Entity ${filename} ${first_entity_id} + ${second_entity}= Load Entity ${filename} ${second_entity_id} + @{entities_ids_to_be_updated}= Create List ${first_entity_id} ${second_entity_id} + @{entities_to_be_updated}= Create List ${first_entity} ${second_entity} + ${response}= Batch Update Entities @{entities_to_be_updated} + Check Response Status Code 204 ${response.status_code} + ${first_created_entity}= Load Test Sample entities/${entity_payload_filename} ${first_entity_id} + ${second_created_entity}= Load Test Sample entities/${entity_payload_filename} ${second_entity_id} + ${update_fragment}= Load Test Sample entities/${update_fragment_filename} + ${first_updated_entity}= Upsert Element In Entity ${first_created_entity} ${update_fragment} + ${second_updated_entity}= Upsert Element In Entity ${second_created_entity} ${update_fragment} + @{updated_entities}= Create List ${first_updated_entity} ${second_updated_entity} + ${expected_entities_ids}= Catenate SEPARATOR=, @{entities_ids_to_be_updated} + ${response1}= Query Entities + ... entity_ids=${expected_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resources Set To ${updated_entities} ${response1.json()} + +Setup Initial Entities + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_payload_filename} ${first_entity_id} + Create Entity ${entity_payload_filename} ${second_entity_id} + Set Test Variable ${first_entity_id} + Set Test Variable ${second_entity_id} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_02.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..20d9603ee26899e3f40fe06723d9099fbdadd37a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_02.robot @@ -0,0 +1,65 @@ +*** Settings *** +Documentation Check that you can update a batch of entities with noOverwrite option + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entities +Test Teardown Delete Initial Entities +Test Template Batch Update Entity With NoOverwrite Option Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_payload_filename}= building-simple-attributes-sample.jsonld + + +*** Test Cases *** FILENAME UPDATE_FRAGMENT_FILENAME EXPECTED_STATUS +005_02_01 EntityWithExistingAttributes + [Tags] be-update 5_6_9 + building-simple-attributes-sample.jsonld fragmentEntities/empty-fragment.json 204 +005_02_02 EntityWithNewAttribute + [Tags] be-update 5_6_9 + building-relationship-sample.jsonld fragmentEntities/locatedAt-fragment.json 204 +005_02_03 EntityWithNewAndExistingAttribute + [Tags] be-update 5_6_9 + building-location-attribute-sample.jsonld fragmentEntities/location-fragment.json 204 + + +*** Keywords *** +Batch Update Entity With NoOverwrite Option Scenarios + [Documentation] Check that you can update a batch of entities with noOverwrite option + [Arguments] ${filename} ${update_fragment_filename} ${expected_status} + ${first_entity}= Load Entity ${filename} ${first_entity_id} + ${second_entity}= Load Entity ${filename} ${second_entity_id} + @{entities_to_be_updated}= Create List ${first_entity} ${second_entity} + @{entities_ids_to_be_updated}= Create List ${first_entity_id} ${second_entity_id} + ${response}= Batch Update Entities @{entities_to_be_updated} overwrite_option=noOverwrite + Check Response Status Code ${expected_status} ${response.status_code} + ${first_created_entity}= Load Test Sample entities/${entity_payload_filename} ${first_entity_id} + ${second_created_entity}= Load Test Sample entities/${entity_payload_filename} ${second_entity_id} + ${update_fragment}= Load Test Sample entities/${update_fragment_filename} + ${first_updated_entity}= Upsert Element In Entity ${first_created_entity} ${update_fragment} + ${second_updated_entity}= Upsert Element In Entity ${second_created_entity} ${update_fragment} + @{updated_entities}= Create List ${first_updated_entity} ${second_updated_entity} + ${expected_entities_ids}= Catenate SEPARATOR=, @{entities_ids_to_be_updated} + ${response1}= Query Entities + ... entity_ids=${expected_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resources Set To ${updated_entities} ${response1.json()} + +Setup Initial Entities + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_payload_filename} ${first_entity_id} + Create Entity ${entity_payload_filename} ${second_entity_id} + Set Test Variable ${first_entity_id} + Set Test Variable ${second_entity_id} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_03.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..3e22a340ad9ad3e907673a4446400264771ad7d1 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_03.robot @@ -0,0 +1,71 @@ +*** Settings *** +Documentation Check that you can update a batch of entities where some will succeed and others will fail + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_payload_filename}= building-simple-attributes-sample.jsonld +${update_fragment_filename}= fragmentEntities/simple-attributes-relationship-of-property-fragment.json + + +*** Test Cases *** +005_03_01 Update a batch of non-existing and existing entities + [Documentation] Check that you can update a batch of non-existing and existing entities + [Tags] be-update 5_6_9 + ${first_existing_entity}= Load Entity + ... building-relationship-of-property-sample.jsonld + ... ${first_existing_entity_id} + ${second_existing_entity}= Load Entity + ... building-relationship-of-property-sample.jsonld + ... ${second_existing_entity_id} + ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${new_entity}= Load Entity building-relationship-of-property-sample.jsonld ${new_entity_id} + @{entities_to_be_updated}= Create List ${first_existing_entity} ${second_existing_entity} ${new_entity} + + ${response}= Batch Update Entities @{entities_to_be_updated} + @{expected_successful_entities_ids}= Create List ${first_existing_entity_id} ${second_existing_entity_id} + Set Suite Variable @{expected_successful_entities_ids} + @{expected_failed_entities_ids}= Create List ${new_entity_id} + &{expected_batch_operation_result}= Create Batch Operation Result + ... ${expected_successful_entities_ids} + ... ${expected_failed_entities_ids} + Check Response Status Code 207 ${response.status_code} + Check Response Body Containing Batch Operation Result ${expected_batch_operation_result} ${response.json()} + + ${first_created_entity}= Load Test Sample entities/${entity_payload_filename} ${first_existing_entity_id} + ${second_created_entity}= Load Test Sample + ... entities/${entity_payload_filename} + ... ${second_existing_entity_id} + ${update_fragment}= Load Test Sample entities/${update_fragment_filename} + ${first_updated_entity}= Upsert Element In Entity ${first_created_entity} ${update_fragment} + ${second_updated_entity}= Upsert Element In Entity ${second_created_entity} ${update_fragment} + @{updated_entities}= Create List ${first_updated_entity} ${second_updated_entity} + ${expected_entities_ids}= Catenate SEPARATOR=, @{expected_successful_entities_ids} + + ${response1}= Query Entities + ... entity_ids=${expected_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resources Set To ${updated_entities} ${response1.json()} + + +*** Keywords *** +Setup Initial Entities + ${first_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_payload_filename} ${first_existing_entity_id} + Create Entity ${entity_payload_filename} ${second_existing_entity_id} + Set Suite Variable ${first_existing_entity_id} + Set Suite Variable ${second_existing_entity_id} + +Delete Initial Entities + Batch Delete Entities entities_ids_to_be_deleted=@{expected_successful_entities_ids} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..cd78f72beaa9b1c43c1b0db5484a793a8310900a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that you cannot update a batch of entities with an invalid request + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Batch Update Entity With Invalid Request Scenarios + + +*** Test Cases *** FILENAME PROBLEM_TYPE +005_04_01 InvalidJson + [Tags] be-update 5_6_9 + batch/invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +005_04_02 InvalidJsonLd + [Tags] be-update 5_6_9 + batch/invalid-json-ld-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Batch Update Entity With Invalid Request Scenarios + [Documentation] Check that you cannot update a batch of entities with an invalid request + [Arguments] ${filename} ${problem_type} + ${response}= Batch Request Entities From File update filename=${filename} + Check Response Status Code 400 ${response.status_code} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..575f1c52b2525969de97660d369e8e22992f2db5 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Check that you can upsert a batch of non-existing entities and they will be created + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entities +Test Template Batch Upsert Entity Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** FILENAME +004_01_01 EntityWithSimpleProperties + [Tags] be-upsert 5_6_8 + building-simple-attributes-sample.jsonld +004_01_02 EntityWithSimpleRelationships + [Tags] be-upsert 5_6_8 + building-relationship-sample.jsonld +004_01_03 EntityWithRelationshipsProperties + [Tags] be-upsert 5_6_8 + building-relationship-of-property-sample.jsonld + + +*** Keywords *** +Batch Upsert Entity Scenarios + [Documentation] Check that you can upsert a batch of non-existing entities + [Arguments] ${filename} + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity ${filename} ${first_entity_id} + ${second_entity}= Load Entity ${filename} ${second_entity_id} + @{entities_to_be_upserted}= Create List ${first_entity} ${second_entity} + ${response}= Batch Upsert Entities @{entities_to_be_upserted} + @{expected_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + Set Test Variable @{expected_entities_ids} + Check Response Status Code 201 ${response.status_code} + Check Response Body Containing Array Of URIs set to ${expected_entities_ids} ${response.json()} + ${expected_updated_entities_ids}= Catenate SEPARATOR=, @{expected_entities_ids} + ${response1}= Query Entities + ... entity_ids=${expected_updated_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resources Set To ${entities_to_be_upserted} ${response1.json()} + +Delete Initial Entities + Batch Delete Entities entities_ids_to_be_deleted=@{expected_entities_ids} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..c0f99081f494820b1076787c1177808ec9b2298f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot @@ -0,0 +1,74 @@ +*** Settings *** +Documentation Check that you can upsert a batch of non-existing and existing entities where non-existing will be created and existing will be replaced + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entities +Test Template Batch Upsert Non-existing And Existing Entities Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** FILENAME +004_02_01 EntityWithSimpleProperties + [Tags] be-upsert 5_6_8 + building-simple-attributes-sample.jsonld +004_02_02 EntityWithSimpleRelationships + [Tags] be-upsert 5_6_8 + building-relationship-sample.jsonld +004_02_03 EntityWithRelationshipsProperties + [Tags] be-upsert 5_6_8 + building-relationship-of-property-sample.jsonld + + +*** Keywords *** +Batch Upsert Non-existing And Existing Entities Scenarios + [Documentation] Check that you can upsert a batch of non-existing and existing entities + [Arguments] ${filename} + Setup Initial Entities ${filename} + ${response}= Batch Upsert Entities @{entities_to_be_upserted} + @{expected_entities_ids}= Create List ${new_entity_id} + Check Response Status Code 201 ${response.status_code} + Check Response Body Containing Array Of URIs set to ${expected_entities_ids} ${response.json()} + @{upserted_entities_ids}= Create List + ... ${new_entity_id} + ... ${first_existing_entity_id} + ... ${second_existing_entity_id} + ${expected_updated_entities_ids}= Catenate SEPARATOR=, @{upserted_entities_ids} + ${response1}= Query Entities + ... entity_ids=${expected_updated_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resources Set To ${entities_to_be_upserted} ${response1.json()} + +Setup Initial Entities + [Arguments] ${filename} + ${first_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity building-minimal-sample.jsonld ${first_existing_entity_id} + Create Entity building-minimal-sample.jsonld ${second_existing_entity_id} + Set Test Variable ${first_existing_entity_id} + Set Test Variable ${second_existing_entity_id} + ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${new_entity_id} + ${new_entity}= Load Entity ${filename} ${new_entity_id} + ${first_existing_entity}= Load Entity ${filename} ${first_existing_entity_id} + ${second_existing_entity}= Load Entity ${filename} ${second_existing_entity_id} + @{entities_to_be_upserted}= Create List + ... ${new_entity} + ... ${first_existing_entity} + ... ${second_existing_entity} + Set Test Variable ${entities_to_be_upserted} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List + ... ${first_existing_entity_id} + ... ${second_existing_entity_id} + ... ${new_entity_id} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_03.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..cd69a975d7c60bb9e8ff5754f9d938155d631b02 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_03.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Check that you can upsert a batch of existing entities and they will be replaced + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entities +Test Teardown Delete Initial Entities +Test Template Batch Upsert Existing Entities Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** FILENAME +004_03_01 EntityWithSimpleProperties + [Tags] be-upsert 5_6_8 + building-simple-attributes-sample.jsonld +004_03_02 EntityWithSimpleRelationships + [Tags] be-upsert 5_6_8 + building-relationship-sample.jsonld +004_03_03 EntityWithRelationshipsProperties + [Tags] be-upsert 5_6_8 + building-relationship-of-property-sample.jsonld + + +*** Keywords *** +Batch Upsert Existing Entities Scenarios + [Documentation] Check that you can upsert a batch of existing entities + [Arguments] ${filename} + ${first_existing_entity}= Load Entity ${filename} ${first_existing_entity_id} + ${second_existing_entity}= Load Entity ${filename} ${second_existing_entity_id} + @{entities_to_be_upserted}= Create List ${first_existing_entity} ${second_existing_entity} + ${response}= Batch Upsert Entities @{entities_to_be_upserted} + Check Response Status Code 204 ${response.status_code} + @{upserted_entities_ids}= Create List ${first_existing_entity_id} ${second_existing_entity_id} + ${expected_updated_entities_ids}= Catenate SEPARATOR=, @{upserted_entities_ids} + ${response1}= Query Entities + ... entity_ids=${expected_updated_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resources Set To ${entities_to_be_upserted} ${response1.json()} + +Setup Initial Entities + ${first_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity building-minimal-sample.jsonld ${first_existing_entity_id} + Create Entity building-minimal-sample.jsonld ${second_existing_entity_id} + Set Test Variable ${first_existing_entity_id} + Set Test Variable ${second_existing_entity_id} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${first_existing_entity_id} ${second_existing_entity_id} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_04.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..373c711cdfe0d75120fe69d29103a8666c85d157 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_04.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that you can upsert a batch of entities with update option + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entities +Test Template Batch Upsert Entities With Update Option Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${existing_entity_payload_filename}= building-minimal-sample.jsonld + + +*** Test Cases *** FILENAME UPDATE_FRAGMENT_FILENAME +004_04_01 EntityWithSimpleProperties + [Tags] be-upsert 5_6_8 + building-simple-attributes-sample.jsonld fragmentEntities/simple-attributes-fragment.json +004_04_02 EntityWithSimpleRelationships + [Tags] be-upsert 5_6_8 + building-relationship-sample.jsonld fragmentEntities/locatedAt-fragment.json +004_04_03 EntityWithRelationshipsProperties + [Tags] be-upsert 5_6_8 + building-relationship-of-property-sample.jsonld fragmentEntities/simple-attributes-relationship-of-property-fragment.json + + +*** Keywords *** +Batch Upsert Entities With Update Option Scenarios + [Documentation] Check that you can upsert a batch of entities with update option + [Arguments] ${filename} ${update_fragment_filename} + ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${new_entity_id} + ${new_entity}= Load Entity ${filename} ${new_entity_id} + ${existing_entity}= Load Entity ${filename} ${existing_entity_id} + @{entities_to_be_upserted}= Create List ${new_entity} ${existing_entity} + @{entities_ids_to_be_upserted}= Create List ${existing_entity_id} ${new_entity_id} + ${response}= Batch Upsert Entities @{entities_to_be_upserted} update_option=update + @{expected_entities_ids}= Create List ${new_entity_id} + Check Response Status Code 201 ${response.status_code} + Check Response Body Containing Array Of URIs set to ${expected_entities_ids} ${response.json()} + ${old_entity}= Load Test Sample entities/${existing_entity_payload_filename} ${existing_entity_id} + ${update_fragment}= Load Test Sample entities/${update_fragment_filename} + ${old_updated_entity}= Upsert Element In Entity ${old_entity} ${update_fragment} + @{updated_entities}= Create List ${new_entity} ${old_updated_entity} + ${expected_updated_entities_ids}= Catenate SEPARATOR=, @{entities_ids_to_be_upserted} + ${response1}= Query Entities + ... entity_ids=${expected_updated_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resources Set To ${updated_entities} ${response1.json()} + +Setup Initial Entity + ${existing_entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${existing_entity_payload_filename} ${existing_entity_id} + Set Test Variable ${existing_entity_id} + +Delete Initial Entities + @{entities_ids_to_be_deleted}= Create List ${existing_entity_id} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} + @{entities_ids_to_be_deleted}= Create List ${new_entity_id} + Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_05.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..d3261d04704aae9c1f1ef030f3f81ae900a69a08 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_05.robot @@ -0,0 +1,50 @@ +*** Settings *** +Documentation Check that you can upsert a batch of entities where some will succeed and others will fail + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +004_05_01 Upsert a batch of two valid entities and one invalid entity + [Documentation] Check that you can upsert a batch of two valid entities and one invalid entity + [Tags] be-upsert 5_6_8 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${third_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity building-minimal-sample.jsonld ${first_entity_id} + ${second_entity}= Load Entity building-minimal-sample.jsonld ${second_entity_id} + ${third_entity}= Load Entity building-minimal-sample.jsonld ${third_entity_id} + ${invalid_entity}= Remove Entity Type ${third_entity} + @{entities_to_be_upserted}= Create List ${first_entity} ${second_entity} ${invalid_entity} + ${response}= Batch Upsert Entities @{entities_to_be_upserted} + @{expected_successful_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + Set Test Variable ${expected_successful_entities_ids} + @{expected_failed_entities_ids}= Create List ${third_entity_id} + &{expected_batch_operation_result}= Create Batch Operation Result + ... success=${expected_successful_entities_ids} + ... errors=${expected_failed_entities_ids} + Check Response Status Code 207 ${response.status_code} + Check Response Body Containing Batch Operation Result ${expected_batch_operation_result} ${response.json()} + ${expected_updated_entities_ids}= Catenate SEPARATOR=, @{expected_successful_entities_ids} + ${response1}= Query Entities + ... entity_ids=${expected_updated_entities_ids} + ... entity_types=Building + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + @{upserted_entities}= Create List ${first_entity} ${second_entity} + Check Updated Resources Set To ${upserted_entities} ${response1.json()} + + +*** Keywords *** +Delete Entities + ${response}= Batch Delete Entities + ... entities_ids_to_be_deleted=@{expected_successful_entities_ids} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..94aa31b9386cff2fe473c0da1d9c9a3feb4eaf71 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that you cannot upsert a batch of entities with an invalid request + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Batch Upsert Entity With Invalid Request Scenarios + + +*** Test Cases *** FILENAME PROBLEM_TYPE +004_06_01 InvalidJson + [Tags] be-upsert 5_6_8 + batch/invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +004_06_02 InvalidJsonLd + [Tags] be-upsert 5_6_8 + batch/invalid-json-ld-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Batch Upsert Entity With Invalid Request Scenarios + [Documentation] Check that you cannot upsert a batch of entities with an invalid request + [Arguments] ${filename} ${problem_type} + ${response}= Batch Request Entities From File upsert filename=${filename} + Check Response Status Code 400 ${response.status_code} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${problem_type} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_01.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..140e388790114a47e8f616d019f50eb13c5faf4a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_01.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation Check that you can create an entity + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entity +Test Template Create Entity Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** FILENAME CONTENT_TYPE +001_01_01 MinimalEntity + [Tags] e-create 5_6_1 + building-minimal-without-context-sample.jsonld application/json +001_01_02 EntityWithSimpleProperties + [Tags] e-create 5_6_1 + building-simple-attributes-sample.jsonld application/ld+json +001_01_03 EntityWithRelationshipsProperties + [Tags] e-create 5_6_1 + building-relationship-of-property-sample.jsonld application/ld+json +001_01_04 EntityWithLocationAttribute + [Tags] e-create 5_6_1 + building-location-attribute-sample.jsonld application/ld+json + + +*** Keywords *** +Create Entity Scenarios + [Documentation] Check that you can create an entity + [Arguments] ${filename} ${content_type} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${content_type} + Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${entity_id} ${response.headers} + ${created_entity}= Load Test Sample entities/${filename} ${entity_id} + IF '${content_type}' == 'application/json' + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... accept=${content_type} + END + IF '${content_type}' == 'application/ld+json' + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... accept=${content_type} + ... context=${ngsild_test_suite_context} + END + Check Created Resource Set To + ... created_resource=${created_entity} + ... response_body=${response1.json()} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..dda6b86a1a71d675484dcb7708fa536a80876f87 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot @@ -0,0 +1,31 @@ +*** Settings *** +Documentation Check that you cannot create an entity with an invalid request + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Create Entity With Invalid Request Scenarios + + +*** Test Cases *** FILENAME ERROR_TYPE +001_02_01 InvalidJson + [Tags] e-create 5_6_1 + invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +001_02_02 EmptyJson + [Tags] e-create 5_6_1 + empty-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +001_02_03 EntityWithNoContext + [Tags] e-create 5_6_1 + building-minimal-without-context-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Create Entity With Invalid Request Scenarios + [Documentation] Check that you cannot create an entity with an invalid request + [Arguments] ${filename} ${error_type} + ${response}= Create Entity From File ${filename} + Check Response Status Code 400 ${response.status_code} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${error_type} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_03.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..c1481b6130455039748caf28a01e3d7ef222c08a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_03.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Check that you cannot create an entity with an existing id + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Initial Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${content_type}= application/ld+json + + +*** Test Cases *** +001_03_01 Create one valid entity and one invalid entity + [Documentation] Check that you cannot create an entity with an existing id + [Tags] e-create 5_6_1 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${content_type} + Check Response Status Code 201 ${response.status_code} + ${response1}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${content_type} + Check Response Status Code 409 ${response1.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response1.json()} + ... ${ERROR_TYPE_ALREADY_EXISTS} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response1.json()} + + +*** Keywords *** +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_04.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..d212101b49470cd560ccb29a4367fa173ab1f5b9 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_04.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.json + + +*** Test Cases *** +001_04_01 Create one entity using a provided Link header with JSON content type and NGSILD context + [Documentation] Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" + [Tags] e-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + ${response1}= Retrieve Entity by Id id=${entity_id} context=${ngsild_test_suite_context} + # Attribute should be compacted as we used the same context as provided when creating the entity + Check Response Body Containing an Attribute set to + ... expected_attribute_name=almostFull + ... response_body=${response1.json()} + +001_04_02 Create one entity using a provided Link header with JSON content type and no context + [Documentation] Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" + [Tags] e-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + ${response1}= Retrieve Entity by Id id=${entity_id} + # Attribute should not be compacted as we did not provide a context containing this term + Check Response Body Containing an Attribute set to + ... expected_attribute_name=https://ngsi-ld-test-suite/context#almostFull + ... response_body=${response1.json()} + + +*** Keywords *** +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_05.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..6105b77a101a73525af9a2b3110b01289ef75538 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_05.robot @@ -0,0 +1,48 @@ +*** Settings *** +Documentation Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.json + + +*** Test Cases *** +001_05_01 Create one entity using the default context with JSON content type and request without context + [Documentation] Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context, requesting without context + [Tags] e-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_JSON} + ${response1}= Retrieve Entity by Id id=${entity_id} + # Attribute should be compacted as we used the same default context as provided when creating the entity + Check Response Body Containing an Attribute set to + ... expected_attribute_name=almostFull + ... response_body=${response1.json()} + +001_05_02 Create one entity using the default context with JSON content type and request with context + [Documentation] Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context, requesting with context + [Tags] e-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_JSON} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... accept=${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + # Attribute should not be compacted as we did not provide a context containing this term + Check Response Body Containing an Attribute set to + ... expected_attribute_name=ngsi-ld:default-context/almostFull + ... response_body=${response1.json()} + + +*** Keywords *** +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_06.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..0a6cc0288a2527a1bfe26e0589a2aff62555c521 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_06.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/json" and the request payload body (as JSON) contains a "@context" term + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld + + +*** Test Cases *** +001_06_01 Create one entity containing a JSON-LD @context with a JSON content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/json" and the request payload body (as JSON) contains a "@context" term + [Tags] e-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_07.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..09805dcefb86586c519d5d06a60b9fd0c15a166a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_07.robot @@ -0,0 +1,45 @@ +*** Settings *** +Documentation Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld + + +*** Test Cases *** +001_07_01 Create one entity using a JSON-LD @context obtained from the request payload with ld context + [Documentation] Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" and retrieve with ld context + [Tags] e-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${response1}= Retrieve Entity by Id id=${entity_id} context=${ngsild_test_suite_context} + # Attribute should be compacted as we used the same context as provided when creating the entity + Check Response Body Containing an Attribute set to + ... expected_attribute_name=almostFull + ... response_body=${response1.json()} + +001_07_02 Create one entity using a JSON-LD @context obtained from the request payload without context + [Documentation] Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" and retrieve without context + [Tags] e-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${response1}= Retrieve Entity by Id id=${entity_id} + # Attribute should not be compacted as we did not provide a context containing this term + Check Response Body Containing an Attribute set to + ... expected_attribute_name=https://ngsi-ld-test-suite/context#almostFull + ... response_body=${response1.json()} + + +*** Keywords *** +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_08.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..6ec9f5e5e8e0825e39c364898f4c4d9b7f2a5e9a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_08.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and the request payload body does not contain a @context term + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.json + + +*** Test Cases *** +001_08_01 Create one entity not containing a JSON-LD @context with a JSON-LD content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and the request payload body does not contain a @context term + [Tags] e-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_09.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_09.robot new file mode 100644 index 0000000000000000000000000000000000000000..13e06ecba7f961780aa31729106cd3fe667a18b2 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_09.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and a JSON-LD Link header is present in the incoming HTTP request + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld + + +*** Test Cases *** +001_09_01 Create one entity with a Link header and a JSON-LD content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and a JSON-LD Link header is present in the incoming HTTP request + [Tags] e-create 6_3_5 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_01.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..0746a6a2efe6ed3c7c6da4604e2abdd996d1cb8e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_01.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that you can delete an entity by id + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +002_01_01 Delete an entity + [Documentation] Check that you can delete an entity by id + [Tags] e-delete 5_6_6 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Create Entity Selecting Content Type + ... building-simple-attributes-sample.jsonld + ... ${entity_id} + ... application/ld+json + Check Response Status Code 201 ${response.status_code} + ${response1}= Delete Entity by Id ${entity_id} + Check Response Status Code 204 ${response1.status_code} + ${response2}= Retrieve Entity by Id id=${entity_id} context=${ngsild_test_suite_context} + Check SUT Not Containing Resource ${response2.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..7822ceae3003f0f9f9cde1f1b4397405ad38001a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_02.robot @@ -0,0 +1,31 @@ +*** Settings *** +Documentation Check that you cannot delete an entity with invalid/missing id + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Delete Entity Scenarios + + +*** Test Cases *** ENTITY_ID EXPECTED_STATUS_CODE PROBLEM_TYPE +002_02_01 Delete an entity if the Entity Id is not present + [Tags] e-delete 5_6_6 + ${EMPTY} 405 ${EMPTY} +002_02_02 Delete an entity if the Entity Id is not a valid URI + [Tags] e-delete 5_6_6 + thisisaninvaliduri 400 ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Delete Entity Scenarios + [Documentation] Check that you cannot delete an entity with invalid/missing id + [Arguments] ${entity_id} ${expected_status_code} ${problem_type} + ${response}= Delete Entity by Id ${entity_id} + Check Response Status Code ${expected_status_code} ${response.status_code} + IF "${problem_type}"!="${EMPTY}" + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + END diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_03.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..e057e68e7bcbb38b466b53c3652deffd5d6cdfd1 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_03.robot @@ -0,0 +1,24 @@ +*** Settings *** +Documentation Check that you cannot delete an entity if the entity id is not known to the system + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${expected_status_code}= 404 + + +*** Test Cases *** +002_03_01 Delete an entity with an id not known to the system + [Documentation] Check that you cannot delete an entity if the entity id is not known to the system + [Tags] e-delete 5_6_6 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Delete Entity by Id ${entity_id} + Check Response Status Code ${expected_status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_01.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..c419292697d3747029ada8cb4b6bc78373c013eb --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_01.robot @@ -0,0 +1,50 @@ +*** Settings *** +Documentation Check that you can append entity attributes + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Initial Entity +Test Template Append Attributes Without Params + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-speed-two-datasetid-sample.jsonld + + +*** Test Cases *** STATUS_CODE FRAGMENT_FILENAME EXPECTATION_FILENAME +010_01_01 Append entity attributes + 204 vehicle-new-attribute-fragment.jsonld vehicle-speed-appended-expectation.jsonld +010_01_02 Append entity attributes with different datasetid + 204 vehicle-speed-different-datasetid-fragment.jsonld vehicle-speed-different-datasetid-expectation.jsonld + + +*** Keywords *** +Append Attributes Without Params + [Documentation] Check that you can append entity attributes + [Tags] ea-append 5_6_3 + [Arguments] ${status_code} ${fragment_filename} ${expectation_filename} + ${response}= Append Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resource Set To ${entity_expectation_payload} ${response1.json()} + +Create Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + Set Suite Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_02.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..dc002913dd23d9d6cc8b5376740ddcd9caedf60f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_02.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check that you cannot append entity attributes with invalid/missing id or invalid request body + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Initial Entity +Test Template Append Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-speed-two-datasetid-sample.jsonld +${fragment_filename}= vehicle-attribute-to-add-fragment.jsonld +${status_code}= 400 +${invalid_fragment_filename}= invalid-fragment.jsonld + + +*** Test Cases *** ENTITY_INVALID_ID +010_02_01 Append entity attributes if the entity Id is not present + ${EMPTY} +010_02_02 Append entity attributes if the Entity Id is not a valid URI + thisisaninvaliduri + + +*** Keywords *** +Append Attributes + [Documentation] Check that you cannot append entity attributes with invalid/missing id or invalid request body + [Tags] ea-append 5_6_3 + [Arguments] ${entity_invalid_id} + ${response}= Append Entity Attributes ${entity_invalid_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + [Teardown] Delete Entity by Id ${entity_id} + +Create Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + Set Test Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_03.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..72ba2e556e6708f46a4dbcc3ed32c3eaf3388f53 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_03.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Check that you cannot append entity attributes if the entity id is not known to the system + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Initial Entities + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${fragment_filename}= vehicle-attribute-to-add-fragment.jsonld + + +*** Test Cases *** +010_03_01 Append entity attributes when the entity id is not known to the system + [Documentation] Check that you cannot append entity attributes if the entity id is not known to the system + [Tags] ea-append 5_6_3 + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${entity_id} + ${response}= Append Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Delete Initial Entities + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_04.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..80ebd7095096add71c13add952811a82b8aa9aa4 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_04.robot @@ -0,0 +1,62 @@ +*** Settings *** +Documentation Check that you can append entity attributes + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Initial Entity +Test Template Append Attributes With Params + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-speed-two-datasetid-sample.jsonld + + +*** Test Cases *** STATUS_CODE FRAGMENT_FILENAME EXPECTATION_RESPONSE_BODY EXPECTATION_FILENAME +010_04_01 Append entity attributes and ignore existing multi-attribute instance + 204 vehicle-attribute-to-add-fragment.jsonld ${EMPTY} vehicle-speed-appended-expectation.jsonld +010_04_02 Append entity attributes with a new multi-attribute instance + 204 vehicle-speed-different-datasetid-fragment.jsonld ${EMPTY} vehicle-speed-different-datasetid-expectation.jsonld + + +*** Keywords *** +Append Attributes With Params + [Documentation] Check that you can append entity attributes + [Tags] ea-append 5_6_3 + [Arguments] ${status_code} ${fragment_filename} ${expectation_response_body} ${expectation_filename} + ${response}= Append Entity Attributes With Parameters + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + ... noOverwrite + Check Response Status Code ${status_code} ${response.status_code} + # ignore the reason for the not updated attribute as this detail is up to each context broker implementation + IF "${expectation_response_body}"!="${EMPTY}" + Check Response Body Content + ... expectation_filename=${expectation_response_body} + ... response_body=${response.json()} + ... additional_ignored_path=root\\['notUpdated'\\]\\[0\\]\\['reason'\\] + END + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List @context + Check Updated Resource Set To ${entity_expectation_payload} ${response1.json()} ${ignored_attributes} + +Create Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + Set Global Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_05.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..81f4950f51e8fbb4ef8b35f13412dcec50b8044f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_05.robot @@ -0,0 +1,44 @@ +*** Settings *** +Documentation Check that you cannot append entity attributes with invalid/missing id or invalid request body + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Initial Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-speed-two-datasetid-sample.jsonld +${fragment_filename}= vehicle-attribute-to-add-fragment.jsonld +${status_code}= 400 +${invalid_fragment_filename}= invalid-fragment.jsonld + + +*** Test Cases *** +010_05_01 Append entity attributes with invalid entity fragments + [Documentation] Check that you cannot append entity attributes with invalid entity fragments + [Tags] ea-append 5_6_3 + ${response}= Append Entity Attributes + ... ${entity_id} + ... ${invalid_fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + Check Response Body Type When Using Session Request ${response.json()} ${ERROR_TYPE_INVALID_REQUEST} + Check Response Body Title When Using Session Request ${response.json()} + + +*** Keywords *** +Create Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + Set Test Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_01.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..65211d518a2ccfbcc225ad77bc569a1c5acc8135 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_01.robot @@ -0,0 +1,57 @@ +*** Settings *** +Documentation Check that you can delete an attribute from an entity + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entities +Test Template Delete Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${status_code}= 204 +${filename}= vehicle-two-datasetid-attributes-sample.jsonld +${attribute_id}= speed + + +*** Test Cases *** DATASETID DELETEALL EXPECTATION_FILENAME +013_01_01 Delete an attribute with the default instance + ${EMPTY} false vehicle-delete-default-speed-expectation.jsonld +013_01_02 Delete an attribute with the datasetId + urn:ngsi-ld:Property:gpsBxyz123-speed false vehicle-delete-datasetid-speed-expectation.jsonld +013_01_03 Delete all target attribute instances + ${EMPTY} true vehicle-delete-deleteall-speed-expectation.jsonld + + +*** Keywords *** +Delete Attributes + [Documentation] Check that you can delete an attribute from an entity + [Tags] ea-delete 5_6_5 + [Arguments] ${datasetId} ${deleteAll} ${expectation_filename} + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${create_response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attribute_id} + ... datasetId=${datasetId} + ... deleteAll=${deleteAll} + ... context=${ngsild_test_suite_context} + Check Response Status Code ${status_code} ${response.status_code} + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response2}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List @context + Check Updated Resource Set To ${entity_expectation_payload} ${response2.json()} ${ignored_attributes} + +Delete Initial Entities + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_02.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..e32113286837dcd5bf6af9328d6b7a1c2d634da9 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_02.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that you cannot delete an attribute from an entity with invalid/missing ids + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Initial Entity +Test Template Delete Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-two-datasetid-attributes-sample.jsonld + + +*** Test Cases *** ENTITY_ID ATTRIBUTE_ID EXPECTED_STATUS_CODE +013_02_01 Delete an attribute if the Entity Id is not present + ${EMPTY} speed 400 +013_02_02 Delete an attribute if the Entity Id is not a valid URI + thisIsAnInvalidURI speed 400 +013_02_03 Delete an attribute if the Attribute Name is not present + ${valid_entity_id} ${EMPTY} 405 + + +*** Keywords *** +Delete Attributes + [Documentation] Check that you cannot delete an attribute from an entity with invalid/missing ids + [Tags] ea-delete 5_6_5 + [Arguments] ${entity_id} ${attribute_id} ${expected_status_code} + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attribute_id} + ... datasetId=${EMPTY} + ... deleteAll=false + Check Response Status Code ${expected_status_code} ${response.status_code} + +Create Initial Entity + ${valid_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${valid_entity_id} + ${create_response}= Create Entity Selecting Content Type + ... ${filename} + ... ${valid_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + +Delete Initial Entity + Delete Entity by Id ${valid_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_03.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..222757546543a3ffa4a92ef04da2898d8226953b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_03.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Check that you cannot delete an attribute from an entity with invalid/missing ids + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Delete Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${status_code}= 404 +${filename}= vehicle-two-datasetid-attributes-sample.jsonld + + +*** Test Cases *** ENTITY_ID ATTRIBUTE_ID DATASETID +013_03_01 Delete an attribute when the Entity Id is not known to the system + ${not_found_entity_id} speed urn:ngsi-ld:Property:gpsBxyz123-speed +013_03_02 Delete an attribute when the Entity does not contain the target attribute id + ${valid_entity_id} notFound ${EMPTY} +013_03_03 Delete an attribute when the Entity does not contain the target attribute with same datasetId + ${valid_entity_id} speed urn:ngsi-ld:Property:notFound + + +*** Keywords *** +Delete Attributes + [Documentation] Check that you cannot delete an attribute from an entity with invalid/missing ids + [Tags] ea-delete 5_6_5 + [Arguments] ${entity_id} ${attribute_id} ${datasetId} + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attribute_id} + ... datasetId=${datasetId} + ... deleteAll=false + Check Response Status Code ${status_code} ${response.status_code} + +Setup Initial Entity + ${valid_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${valid_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${valid_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${not_found_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${not_found_entity_id} + +Delete Initial Entity + Delete Entity by Id ${valid_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_01.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..5ac36e31817523095b444826c093ba6edd01067d --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_01.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Check that you can perform a partial update on an entity attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Initiate Test Case +Test Teardown Delete Initial Entities +Test Template Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-speed-two-datasetid-sample.jsonld +${status_code}= 204 + + +*** Test Cases *** FRAGMENT_FILENAME ATTRIBUTE_ID EXPECTATION_FILENAME +012_01_01 Check that you can partially update an attribute + vehicle-isparked-fragment.jsonld isParked vehicle-isparked-update-expectation.jsonld +012_01_02 Check that you can partially update an attribute by specifying the datasetId + vehicle-speed-equal-datasetid-fragment.jsonld speed vehicle-update-speed-expectation.jsonld + + +*** Keywords *** +Update Attributes + [Documentation] Check that you can perform a partial update on an entity attribute + [Tags] ea-partial-update 5_6_4 + [Arguments] ${fragment_filename} ${attribute_id} ${expectation_filename} + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attribute_id} + ... fragment_filename=${fragment_filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List @context + Check Updated Resource Set To ${entity_expectation_payload} ${response1.json()} ${ignored_attributes} + +Initiate Test Case + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Entities + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_02.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..299a2f7b92629f03223439cb5830b35de705abec --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_02.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Check that you cannot perform a partial update on an entity attribute with invalid/missing ids + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-two-datasetid-attributes-sample.jsonld +${status_code}= 400 + + +*** Test Cases *** ENTITY_ID ATTRIBUTE_ID FRAGMENT_FILENAME +012_02_01 Make a partial attribute update if the Entity Id is not present + ${EMPTY} speed vehicle-speed-equal-datasetid-fragment.jsonld +012_02_02 Make a partial attribute update if the Entity Id is not a valid URI + thisisaninvaliduri speed vehicle-speed-equal-datasetid-fragment.jsonld +012_02_03 Make a partial attribute update if the Attribute type does not match + ${valid_entity_id} speed vehicle-speed-equal-datasetid-different-type-fragment.jsonld +012_02_04 Make a partial attribute update if the entity fragment is empty + ${valid_entity_id} speed empty-fragment.json + + +*** Keywords *** +Update Attributes + [Documentation] Check that you cannot perform a partial update on an entity attribute with invalid/missing ids + [Tags] ea-partial-update 5_6_4 + [Arguments] ${entity_id} ${attribute_id} ${fragment_filename} + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attribute_id} + ... fragment_filename=${fragment_filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + +Setup Initial Entity + ${valid_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${valid_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${valid_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Entity + Delete Entity by Id ${valid_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_03.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..411c751a6dc208e2691880ea5855c3cb760408d7 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_03.robot @@ -0,0 +1,59 @@ +*** Settings *** +Documentation Check that you cannot perform a partial update on an entity attribute if the entity id or attribute is not known to the system + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Initial Entity +Test Template Partial Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-speed-two-datasetid-sample.jsonld +${status_code}= 404 +${default_attr_id}= speed + + +*** Test Cases *** ENTITY_ID ATTR_ID FRAGMENT_FILENAME +012_03_01 Partial update when the Entity Id is not known to the system + ${not_found_entity_id} ${default_attr_id} vehicle-isparked-fragment.jsonld +012_03_02 Partial update when no default instance and no datasetId specified + ${valid_entity_id} ${default_attr_id} vehicle-speed-no-datasetid-fragment.jsonld +012_03_03 Partial update when no instance with the datasetId specified + ${valid_entity_id} ${default_attr_id} vehicle-speed-unknown-datasetid-fragment.jsonld +012_03_04 Partial update when the Attribute Name does not exist in the entity + ${valid_entity_id} isParked2 vehicle-isparked-fragment.jsonld + + +*** Keywords *** +Partial Update Attributes + [Documentation] Check that you cannot perform a partial update on an entity attribute if the entity id or attribute is not known to the system + [Tags] ea-partial-update 5_6_4 + [Arguments] ${entity_id} ${attr_id} ${fragment_filename} + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attr_id} + ... fragment_filename=${fragment_filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + +Create Initial Entity + ${valid_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${valid_entity_id} + ${not_found_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${not_found_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${valid_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Entity + Delete Entity by Id ${valid_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_01.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..8fbac35714e18d3f67f13a2fa892c875d8bfb0c8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_01.robot @@ -0,0 +1,65 @@ +*** Settings *** +Documentation Check that you can update entity attributes + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Initialize Test +Test Teardown Delete Initial Entities +Test Template Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-two-datasetid-attributes-sample.jsonld + + +*** Test Cases *** STATUS_CODE FRAGMENT_FILENAME EXPECTATION_RESPONSE_FILENAME EXPECTATION_FILENAME +011_01_01 Check that you can update existing attributes with no datasetId + 204 vehicle-speed-two-datasetid-01-fragment.jsonld ${EMPTY} expectations/vehicle-update-attributes-expectation.jsonld +011_01_02 Check that you can update existing attributes with the datasetId + 204 vehicle-speed-two-datasetid-02-fragment.jsonld ${EMPTY} expectations/vehicle-update-datasetid-attributes-expectation.jsonld +011_01_03 Check that you can update only some attributes while unknown are ignored + 204 vehicle-speed-two-datasetid-03-fragment.jsonld ${EMPTY} expectations/vehicle-multi-attributes-expectation.jsonld + + +*** Keywords *** +Update Attributes + [Documentation] Check that you can update entity attributes + [Tags] ea-update 5_6_2 + [Arguments] + ... ${status_code} + ... ${fragment_filename} + ... ${expectation_resp_filename} + ... ${expectation_filename} + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + IF "${expectation_resp_filename}"!="${EMPTY}" + Check Response Body Content + ... expectation_filename=${expectation_resp_filename} + ... response_body=${response.json()} + END + ${entity_expectation_payload}= Load Test Sample entities/${expectation_filename} ${entity_id} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List @context + Check Updated Resource Set To ${entity_expectation_payload} ${response1.json()} ${ignored_attributes} + +Delete Initial Entities + Delete Entity by Id ${entity_id} + +Initialize Test + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_02.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..6cbe3811cd320e2d0ed10e26f097ca66927d0130 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_02.robot @@ -0,0 +1,46 @@ +*** Settings *** +Documentation Check that you cannot update entity attributes with invalid/missing id or invalid request body + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Initialize Environment +Test Teardown Delete Entity +Test Template Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: + + +*** Test Cases *** ENTITY_INVALID_ID FRAGMENT_FILENAME +011_02_01 Update an attribute if the Entity Id is not present + ${EMPTY} vehicle-speed-two-datasetid-01-fragment.jsonld +011_02_02 Update an attribute if the Entity Id is not a valid URI + thisisaninvaliduri vehicle-speed-two-datasetid-01-fragment.jsonld + + +*** Keywords *** +Update Attributes + [Documentation] Check that you cannot update entity attributes with invalid/missing id or invalid request body + [Tags] ea-update 5_6_2 + [Arguments] ${entity_invalid_id} ${fragment_filename} + ${response}= Update Entity Attributes ${entity_invalid_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + +Initialize Environment + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... vehicle-two-datasetid-attributes-sample.jsonld + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_03.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..936cce7df0f885a08cdd426c3fd558971bba84a4 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_03.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Check that you cannot update entity attributes if the entity id or attributes are not known to the system + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Initial Entities + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${fragment_filename}= vehicle-speed-two-datasetid-01-fragment.jsonld + + +*** Test Cases *** +011_03_01 Update entity attributes when the entity id is not known to the system + [Documentation] Check that you cannot update entity attributes if the entity id or attributes are not known to the system + [Tags] ea-update 5_6_2 + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${entity_id} + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Delete Initial Entities + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_04.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..241a0712006201bf8cf794e367d06f7ec368cdfc --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_04.robot @@ -0,0 +1,44 @@ +*** Settings *** +Documentation Check that you cannot update entity attributes with invalid request body + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Initialize Environment ${filename} +Test Template Update entity attributes with invalid entity fragments + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-speed-two-datasetid-sample.jsonld + + +*** Test Cases *** +011_04_01 Update entity attributes with invalid entity fragments + vehicle-speed-two-datasetid-sample.jsonld invalid-fragment.jsonld + + +*** Keywords *** +Update entity attributes with invalid entity fragments + [Documentation] Check that you cannot update an attribute if the entity fragment is invalid + [Tags] ea-update 5_6_2 + [Arguments] ${filename} ${fragment_filename} + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Type When Using Session Request ${response.json()} ${ERROR_TYPE_INVALID_REQUEST} + Check Response Body Title When Using Session Request ${response.json()} + [Teardown] Delete Entity by Id ${entity_id} + +Initialize Environment + [Arguments] ${filename} + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..591c0d5ab014c513ae1ba04f097f21f385a59e8b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_01.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Check that you can create a temporal representation of an entity + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Temporal Entity +Test Template Create Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: + + +*** Test Cases *** FILENAME EXPECTATION_FILENAME CONTENT_TYPE +007_01_01 Create a temporal representation of an entity + vehicle-create-temporal-representation-sample.jsonld vehicle-temporal-representation-create-expectation.jsonld application/ld+json +007_01_02 Create a temporal entity with no context + vehicle-create-temporal-representation-without-context-sample.jsonld vehicle-temporal-representation-create-with-no-context-expectation.jsonld application/json + + +*** Keywords *** +Create Temporal Entity + [Documentation] Check that you can create a temporal representation of an entity + [Tags] te-create 5_6_11 + [Arguments] ${filename} ${expectation_filename} ${content_type} + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${content_type} + Check Response Status Code 201 ${response.status_code} + ${created_temporal_entity}= Load Test Sample + ... temporalEntities/${filename} + ... ${temporal_entity_representation_id} + IF '${content_type}'=='application/json' + ${response1}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + END + IF '${content_type}'=='application/ld+json' + ${response1}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... context=${ngsild_test_suite_context} + END + ${ignored_attributes}= Create List instanceId @context + ${temporal_entity_expectation_payload}= Load Test Sample + ... temporalEntities/expectations/${expectation_filename} + ... ${temporal_entity_representation_id} + Check Created Resource Set To + ... ${temporal_entity_expectation_payload} + ... ${response1.json()} + ... ${ignored_attributes} + +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_02.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..d9ced397244b3a973726b269730d975500463cde --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_02.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Check that you cannot create a temporal entity with an empty/invalid json/id + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Create Temporal Entity From File + + +*** Variables *** +${status_code}= 400 + + +*** Test Cases *** FILENAME +007_02_01 Create a temporal entity with an invalid json + vehicle-temporal-representation-invalid-json-sample.jsonld +007_02_02 Create a temporal entity with an empty json + vehicle-temporal-representation-empty-json-sample.jsonld + + +*** Keywords *** +Create Temporal Entity From File + [Documentation] Check that you cannot create a temporal entity with an empty/invalid json/id + [Tags] te-create 5_6_11 + [Arguments] ${filename} + ${response}= Create Temporal Representation Of Entity Selecting Content Type + ... ${filename} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Type When Using Session Request ${response.json()} ${ERROR_TYPE_INVALID_REQUEST} + Check Response Body Title When Using Session Request ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_03.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..a2104f090df14f9bf39a90ad1674a6a92102a8f9 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_03.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Check that you cannot create a temporal entity with an empty/invalid json/id + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Create Temporal Entity + + +*** Variables *** +${status_code}= 400 + + +*** Test Cases *** ENTITY_ID FILENAME +007_03_01 Create a temporal entity with missing id + ${EMPTY} vehicle-temporal-representation-without-id-sample.jsonld +007_03_02 Create a temporal invalid URI + invalidId vehicle-temporal-representation-sample.jsonld + + +*** Keywords *** +Create Temporal Entity + [Documentation] Check that you cannot create a temporal entity with an invalid @context + [Tags] te-create 5_6_11 + [Arguments] ${entity_id} ${filename} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${entity_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + [Teardown] Delete Temporal Representation Of Entity ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..924ee1d346538ad9229841efacd9d7a2bd06d3f8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_01.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Check that you can delete a temporal representation of an entity with simple temporal properties + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld + + +*** Test Cases *** +009_01_01 Delete a temporal representation of an entity with simple temporal properties + [Documentation] Check that you can delete a temporal representation of an entity with simple temporal properties + [Tags] te-delete 5_6_16 + ${response}= Delete Temporal Representation Of Entity With Returning Response + ... ${temporal_entity_representation_id} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... context=${ngsild_test_suite_context} + Check SUT Not Containing Resource ${response1.status_code} + + +*** Keywords *** +Create Initial Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_02.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..8e3a2cd61c2043b5949f3080130f447b7269ed60 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_02.robot @@ -0,0 +1,34 @@ +*** Settings *** +Documentation Check that an error is raised if you delete a temporal entity with an empty/invalid EntityId + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Delete Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: + + +*** Test Cases *** ID EXPECTED_STATUS_CODE PROBLEM_TYPE +009_02_01 Delete a temporal representation of an entity with an empty entity id + ${EMPTY} 405 ${EMPTY} +009_02_02 Delete a temporal representation of an entity with an invalid entity id + invalidId 400 ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Delete Temporal Entity + [Documentation] Check that an error is raised if you delete a temporal entity with an empty/invalid EntityId + [Tags] te-delete 5_6_16 + [Arguments] ${id} ${expected_status_code} ${problem_type} + ${response}= Delete Temporal Representation Of Entity With Returning Response ${id} + Check Response Status Code ${expected_status_code} ${response.status_code} + IF "${problem_type}"!="${EMPTY}" + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + END diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_03.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..4ead807e188fa8a81ecb0091ee407308ed2c4a55 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_03.robot @@ -0,0 +1,24 @@ +*** Settings *** +Documentation Check that an error is raised if you delete a temporal entity with a non-existing/invalid EntityId + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${status_code}= 404 + + +*** Test Cases *** +009_03_01 Delete a temporal representation of an entity with an unknown entity id + [Documentation] Check that an error is raised if you delete a temporal entity with a non-existing entity id + [Tags] te-delete 5_6_16 + ${temporal_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Delete Temporal Representation Of Entity With Returning Response ${temporal_entity_id} + Check Response Status Code ${status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/UpdateTemporalRepresentationOfEntity/008_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/UpdateTemporalRepresentationOfEntity/008_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..ae5cf6be47766bbce200d431e2e61f078dae1802 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/UpdateTemporalRepresentationOfEntity/008_01.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check that you can update a temporal representation of an entity with simple temporal properties + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-create-temporal-representation-sample.jsonld +${update_filename}= vehicle-temporal-representation-update-sample.jsonld +${expectation_filename}= vehicle-temporal-representation-update-expectation.jsonld + + +*** Test Cases *** +008_01_01 Update a temporal representation of an entity with simple temporal properties + [Documentation] Check that you can update a temporal representation of an entity with simple temporal properties + [Tags] te-update 5_6_11 + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${response1}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${update_filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response1.status_code} + ${temporal_entity_expectation_payload}= Load Test Sample + ... temporalEntities/expectations/${expectation_filename} + ... ${temporal_entity_representation_id} + ${response2}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List instanceId @context + Check Updated Resource Set To + ... ${temporal_entity_expectation_payload} + ... ${response2.json()} + ... ${ignored_attributes} + + +*** Keywords *** +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..1fdb1f2c1c3aca798ef6346a94c76cbe52e9a99f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_01.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check that you can add a simple temporal attribute to a temporal representation of an entity + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${fragment_filename}= vehicle-temporal-representation-fragment.jsonld +${expectation_filename}= vehicle-temporal-representation-added-attribute-expectation.jsonld + + +*** Test Cases *** +014_01_01 Add an attribute to a temporal entity with simple temporal properties + [Documentation] Check that you can add a simple temporal attribute to a temporal representation of an entity + [Tags] tea-append 5_6_12 + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${temporal_entity_representation_id} + ${create_response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + ${response}= Append Attribute To Temporal Entity + ... ${temporal_entity_representation_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + ${temporal_entity_expectation_payload}= Load Test Sample + ... temporalEntities/expectations/${expectation_filename} + ... ${temporal_entity_representation_id} + ${response1}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List instanceId @context + Check Updated Resource Set To + ... ${temporal_entity_expectation_payload} + ... ${response1.json()} + ... ${ignored_attributes} + + +*** Keywords *** +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_02.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..70f62e5086e3784c6385fc67644401b7ba98085a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_02.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Check that an error is raised if you add an attribute to a temporal entity with invalid content + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Add Attribute To Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${fragment_filename}= vehicle-temporal-representation-fragment.jsonld +${status_code}= 400 + + +*** Test Cases *** ID +014_02_01 Add an attribute to a temporal representation of an entity with an empty entity id + ${EMPTY} +014_02_02 Add an attribute to a temporal representation of an entity with an invalid entity id + thisIsAninvalidId + + +*** Keywords *** +Add Attribute To Temporal Entity + [Documentation] Check that an error is raised if you add a temporal entity attribute with a non-existing/invalid EntityId + [Tags] tea-append 5_6_12 + [Arguments] ${id} + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${create_response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + ${response}= Append Attribute To Temporal Entity ${id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_03.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..c20cae2a59409d2296a633056b92040035cccfd7 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_03.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that an error is raised if you add an attribute to a non-existent entity + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${fragment_filename}= vehicle-temporal-representation-fragment.jsonld +${status_code}= 404 + + +*** Test Cases *** +014_03_01 Add Attribute To Temporal Entity + [Documentation] Check that an error is raised if you add an attribute to a non-existent entity + [Tags] tea-append 5_6_12 + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${temporal_entity_representation_id} + ${create_response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + ${not_found_temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Append Attribute To Temporal Entity + ... ${not_found_temporal_entity_representation_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + + +*** Keywords *** +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_04.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..ab6d9fcd5e77ff94e1fae7664ccb79d94927a131 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_04.robot @@ -0,0 +1,47 @@ +*** Settings *** +Documentation Check that an error is raised if you add a temporal entity attribute with empty/invalid content + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Initialize Test Case +Test Template Add an Attribute To a Temporal Entity From File + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${fragment_filename}= vehicle-temporal-representation-fragment.jsonld +${status_code}= 400 + + +*** Test Cases *** UPDATE_FILENAME +014_04_01 Add an attribute to a temporal representation of an entity with invalid content + vehicle-temporal-representation-invalid-json-fragment.jsonld +014_04_02 Add an attribute to a temporal representation of an entity with empty content + vehicle-temporal-representation-empty-json-fragment.jsonld + + +*** Keywords *** +Add an Attribute To a Temporal Entity From File + [Documentation] Check that an error is raised if you add a temporal entity attribute with empty/invalid content + [Tags] tea-append 5_6_12 + [Arguments] ${update_filename} + ${response}= Append Attribute To Temporal Entity + ... ${temporal_entity_representation_id} + ... ${update_filename} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response.status_code} + Check Response Body Type When Using Session Request ${response.json()} ${ERROR_TYPE_INVALID_REQUEST} + Check Response Body Title When Using Session Request ${response.json()} + [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} + +Initialize Test Case + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..f854ab85953db99428ca837cca489eda548b38b4 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_01.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that you can delete an attribute of a temporal representation of an entity with simple temporal properties + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Initialize Setup +Test Teardown Delete Temporal Entity +Test Template Delete Attribute From A Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${status_code}= 204 +${attribute_id}= fuelLevel + + +*** Test Cases *** DELETE_ALL DATASET_ID EXPECTATION_FILE +015_01_01 Delete an attribute from a temporal representation of an entity without deleteAll/datasetId + false ${EMPTY} vehicle-temporal-representation-delete-fuelLevel-expectation.jsonld +015_01_02 Delete an attribute from a temporal representation of an entity with datasetId + false urn:ngsi-ld:Vehicle:12345-fuel vehicle-temporal-representation-delete-fuelLevel-datasetid-expectation.jsonld +015_01_03 Delete an attribute from a temporal representation of an entity with deleteAll + true ${EMPTY} vehicle-temporal-representation-deleteall-fuelLevel-expectation.jsonld + + +*** Keywords *** +Delete Attribute From A Temporal Entity + [Documentation] Check that you can delete an attribute of a temporal representation of an entity with simple temporal properties + [Tags] tea-delete 5_6_13 + [Arguments] ${delete_all} ${dataset_id} ${expectation_filename} + ${response}= Delete Attribute From Temporal Entity + ... entityId=${temporal_entity_representation_id} + ... attributeId=${attribute_id} + ... content_type=${CONTENT_TYPE_JSON} + ... datasetId=${datasetid} + ... deleteAll=${deleteall} + ... context=${ngsild_test_suite_context} + Check Response Status Code ${status_code} ${response.status_code} + ${temporal_entity_expectation_payload}= Load Test Sample + ... temporalEntities/expectations/${expectation_filename} + ... ${temporal_entity_representation_id} + ${response1}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List instanceId @context + Check Updated Resource Set To + ... ${temporal_entity_expectation_payload} + ... ${response1.json()} + ... ${ignored_attributes} + +Initialize Setup + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_02.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..4fdefef439f1cb135938127cc74a5d93c130d7c2 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_02.robot @@ -0,0 +1,55 @@ +*** Settings *** +Documentation Check that an error is raised if you delete an attribute to temporal entity with an unknown/invalid Entity/Attribute Id + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Temporal Entity +Test Teardown Delete Temporal Entity +Test Template Delete attribute from temporal entity with unknow entity/attribute id + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${status_code}= 400 +${filename}= vehicle-temporal-representation-sample.jsonld + + +*** Test Cases *** ENTITY_ID ATTRIBUTE_ID +015_02_01 Delete an attribute to a temporal representation of an entity with a missing entity id + ${EMPTY} speed +015_02_02 Delete an attribute to a temporal representation of an entity with an invalid entity id + invalidId speed +015_02_03 Delete an attribute to a temporal representation of an entity with an invalid attribute id + ${valid_temporal_entity_id} invalid(Name + + +*** Keywords *** +Delete attribute from temporal entity with unknow entity/attribute id + [Documentation] Check that an error is raised if you delete an attribute to temporal entity with an unknown/invalid Entity/Attribute Id + [Tags] tea-delete 5_6_13 + [Arguments] ${entity_id} ${attribute_id} + ${response}= Delete Attribute From Temporal Entity + ... entityId=${entity_id} + ... attributeId=${attribute_id} + ... content_type=${CONTENT_TYPE_JSON} + ... datasetId=${EMPTY} + ... deleteAll=false + Check Response Status Code ${status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + +Create Temporal Entity + ${valid_temporal_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${valid_temporal_entity_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + Set Test Variable ${valid_temporal_entity_id} + +Delete Temporal Entity + Delete Temporal Representation Of Entity ${valid_temporal_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_03.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..cd7bc1b3ff7a1bac4d5d4221b589641df8d6d9b8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_03.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Check that an error is raised if you delete a temporal entity with an unknown EntityId/Attribute Id + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Id +Test Teardown Delete Temporal Entity +Test Template Delete An Attribute + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${status_code}= 404 + + +*** Test Cases *** ENTITY_ID ATTRIBUTE_ID +015_03_01 Delete an attribute to a temporal entity if the entity id does not exist + ${unknown_temporal_entity_id} fuelLevel +015_03_02 Delete an attribute to a temporal entity if the entity does not contain the target attribute + ${valid_temporal_entity_id} notExistingAttribute + + +*** Keywords *** +Delete An Attribute + [Documentation] Check that an error is raised if you delete a temporal entity with an unknown EntityId/Attribute Id + [Tags] tea-delete 5_6_13 + [Arguments] ${entity_id} ${attribute_id} + ${response}= Delete Attribute From Temporal Entity + ... entityId=${entity_id} + ... attributeId=${attribute_id} + ... content_type=${CONTENT_TYPE_JSON} + ... datasetId=${EMPTY} + ... deleteAll=false + ... context=${ngsild_test_suite_context} + Check Response Status Code ${status_code} ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + +Create Id + ${valid_temporal_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${unknown_temporal_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${valid_temporal_entity_id} + Set Test Variable ${unknown_temporal_entity_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${valid_temporal_entity_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Temporal Entity + Delete Temporal Representation Of Entity ${valid_temporal_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..072e7cb8e85292d977ac462804d4236210efd3ea --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_01.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Check that you can delete an attribute instance in temporal representation of an entity + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${attributeId}= speed +${expectation_filename}= vehicle-temporal-representation-delete-speed-instanceid-sample.jsonld + + +*** Test Cases *** +017_01_01 Delete an attribute instance in temporal representation of an entity + [Documentation] Check that you can delete an attribute instance in temporal representation of an entity + [Tags] tea-instance-delete 5_6_15 + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${temporal_entity_representation_id} + ${create_response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response.status_code} + ${retrieve_response}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${instanceId}= Set Variable ${retrieve_response.json()['speed'][0]['instanceId']} + ${response}= Delete Attribute Instance From Temporal Entity + ... ${temporal_entity_representation_id} + ... ${attributeId} + ... ${instanceId} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + ${temporal_entity_expectation_payload}= Load Test Sample + ... temporalEntities/expectations/${expectation_filename} + ... ${temporal_entity_representation_id} + ${response1}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List instanceId @context + Check Updated Resource Set To + ... ${temporal_entity_expectation_payload} + ... ${response1.json()} + ... ${ignored_attributes} + + +*** Keywords *** +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_02.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..a62015a700760e028c7027256deb2937c36a56a4 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_02.robot @@ -0,0 +1,63 @@ +*** Settings *** +Documentation Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Temporal Entity +Test Teardown Delete Temporal Entity +Test Template Delete attribute instance + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${status_code}= 400 + + +*** Test Cases *** TEMPORAL_ENTITY_ID ATTRIBUTE_ID INSTANCE_ID +017_02_01 Delete an attribute instance in temporal representation of an entity if the entity id is not valid + invalidId speed ${valid_instanceId} +017_02_02 Delete an attribute instance in temporal representation of an entity if the entity id is not present + ${EMPTY} speed ${valid_instanceId} +017_02_03 Delete an attribute instance in temporal representation of an entity if the instance id is not valid + ${temporal_entity_representation_id} speed invalidId +017_02_04 Delete an attribute instance in temporal representation of an entity if the attribute name is not a valid name + ${temporal_entity_representation_id} invalid(Name ${valid_instanceId} +017_02_05 Delete an attribute instance in temporal representation of an entity if the attribute name is not present + ${temporal_entity_representation_id} ${EMPTY} ${valid_instanceId} + + +*** Keywords *** +Delete attribute instance + [Documentation] Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right + [Tags] tea-instance-delete 5_6_15 + [Arguments] ${temporal_entity_id} ${attributeId} ${instanceId} + ${response}= Delete Attribute Instance From Temporal Entity + ... ${temporal_entity_id} + ... ${attributeId} + ... ${instanceId} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code ${status_code} ${response.status_code} + +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${response}= Retrieve Temporal Representation Of Entity + ... ${temporal_entity_representation_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... options=sysAttrs + ... context=${ngsild_test_suite_context} + ${valid_instanceId}= Set Variable ${response.json()['speed'][0]['instanceId']} + Set Test Variable ${valid_instanceId} + +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..bfe466ea3881660adb00a8850b4e6e45488dc380 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Id +Test Teardown Delete Initial Temporal Representation Of Entity +Test Template Delete An Attribute Instance + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${status_code}= 404 + + +*** Test Cases *** TEMPORAL_ENTITY_ID ATTRIBUTE_ID INSTANCE_ID +017_03_01 Delete an attribute instance in temporal representation of an entity if the entity with given id is not found + ${unknown_temporal_entity_id} speed ${valid_instanceId} +017_03_02 Delete an attribute instance in temporal representation of an entity if the target attribute is not found + ${temporal_entity_representation_id} speed2 ${valid_instanceId} +017_03_03 Delete an attribute instance in temporal representation of an entity if the target attribute instance is not found + ${temporal_entity_representation_id} speed urn:ngsi-ld:01234567890123456789 + + +*** Keywords *** +Delete An Attribute Instance + [Documentation] Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not found + [Tags] tea-instance-delete 5_6_15 + [Arguments] ${temporal_entity_id} ${attributeId} ${instanceId} + ${response}= Delete Attribute Instance From Temporal Entity + ... ${temporal_entity_id} + ... ${attributeId} + ... ${instanceId} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code ${status_code} ${response.status_code} + +Create Id + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${unknown_temporal_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${unknown_temporal_entity_id} + ${response}= Retrieve Temporal Representation Of Entity + ... ${temporal_entity_representation_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... options=sysAttrs + ... context=${ngsild_test_suite_context} + ${valid_instanceId}= Set Variable ${response.json()['speed'][0]['instanceId']} + Set Test Variable ${valid_instanceId} + +Delete Initial Temporal Representation Of Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..3d7eebc55a5b3a445ca686748a698b42afc8e458 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot @@ -0,0 +1,71 @@ +*** Settings *** +Documentation Check that you can modify an attribute instance in temporal representation of an entity + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Intitial Temporal Representation Of Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${fragment_filename}= vehicle-temporal-modify-attribute-instance-fragment.jsonld +${expectation_filename}= vehicle-temporal-representation-modify-attribute-instance-expectation.jsonld +${attributeId}= speed + + +*** Test Cases *** +016_01_01 Modify attribute instance in temporal representation of an entity + [Documentation] Check that you can partially update an attribute instance of a temporal representation of an entity + [Tags] tea-partial-update 5_6_14 + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${temporal_entity_representation_id} + + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + + ${response1}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${instanceId_before_update}= Set Variable ${response1.json()['speed'][0]['instanceId']} + + ${response2}= Modify Attribute Instance From Temporal Entity + ... ${temporal_entity_representation_id} + ... ${attributeId} + ... ${instanceId_before_update} + ... ${fragment_filename} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code 204 ${response2.status_code} + + ${temporal_entity_expectation_payload}= Load Test Sample + ... temporalEntities/expectations/${expectation_filename} + ... ${temporal_entity_representation_id} + ${response3}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${instanceId_after_update}= Set Variable ${response3.json()['speed'][0]['instanceId']} + + Should Be Equal As Strings ${instanceId_before_update} ${instanceId_after_update} + + ${temporal_entity_expectation_payload}= Load Test Sample + ... temporalEntities/expectations/${expectation_filename} + ... ${temporal_entity_representation_id} + ${ignored_attributes}= Create List instanceId @context modifiedAt + Check Updated Resource Set To + ... ${temporal_entity_expectation_payload} + ... ${response3.json()} + ... ${ignored_attributes} + + +*** Keywords *** +Delete Intitial Temporal Representation Of Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_02.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..26cabf40245e9b406d0a0e869678af69c02cfb16 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_02.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that you cannot modify an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Id +Test Teardown Delete Temporal Entity +Test Template Modify Attribute Instance Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${fragment_filename}= vehicle-temporal-modify-attribute-instance-fragment.jsonld + + +*** Test Cases *** TEMPORAL_ENTITY_ID ATTRIBUTE_ID INSTANCE_ID EXPECTED_STATUS_CODE +016_02_01 Modify attribute instance in temporal representation of an entity if the entity id is not valid + invalidId speed ${valid_instanceId} 400 +016_02_02 Modify attribute instance in temporal representation of an entity if the entity id is not present + ${EMPTY} speed ${valid_instanceId} 400 +016_02_03 Modify attribute instance in temporal representation of an entity if the instance id is not valid + ${temporal_entity_representation_id} speed invalidId 400 +016_02_04 Modify attribute instance in temporal representation of an entity if the instance id is not present + ${temporal_entity_representation_id} speed ${EMPTY} 405 +016_02_05 Modify attribute instance in temporal representation of an entity if the attribute name is not a valid name + ${temporal_entity_representation_id} invalid(Id ${valid_instanceId} 400 +016_02_06 Modify attribute instance in temporal representation of an entity if the attribute name is not present + ${temporal_entity_representation_id} ${EMPTY} ${valid_instanceId} 405 + + +*** Keywords *** +Modify Attribute Instance Temporal Entity + [Documentation] Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right + [Tags] tea-partial-update 5_6_14 + [Arguments] ${temporal_entity_id} ${attributeId} ${instanceId} ${expected_status_code} + ${response}= Modify Attribute Instance From Temporal Entity + ... ${temporal_entity_id} + ... ${attributeId} + ... ${instanceId} + ... ${fragment_filename} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code ${expected_status_code} ${response.status_code} + +Create Id + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${response}= Retrieve Temporal Representation Of Entity + ... ${temporal_entity_representation_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... options=sysAttrs + ... context=${ngsild_test_suite_context} + ${valid_instanceId}= Set Variable ${response.json()['speed'][0]['instanceId']} + Set Test Variable ${valid_instanceId} + +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_03.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..cde5c1e5913703b515221a28aa5932959e5754c5 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_03.robot @@ -0,0 +1,63 @@ +*** Settings *** +Documentation Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not found + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Id +Test Teardown Delete Temporal Entity +Test Template Modify Attribute Instance Temporal Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= vehicle-temporal-representation-sample.jsonld +${fragment_filename}= vehicle-temporal-modify-attribute-instance-fragment.jsonld +${status_code}= 404 + + +*** Test Cases *** TEMPORAL_ENTITY_ID ATTRIBUTE_ID INSTANCE_ID +016_03_01 Modify attribute instance in temporal representation of an entity if the entity with given id is not found + ${unknown_temporal_entity_id} speed ${valid_instanceId} +016_03_02 Modify attribute instance in temporal representation of an entity if the target attribute is not found + ${temporal_entity_representation_id} speed2 ${valid_instanceId} +016_03_03 Modify attribute instance in temporal representation of an entity if the target attribute instance is not found + ${temporal_entity_representation_id} speed urn:ngsi-ld:01234567890123456789 + + +*** Keywords *** +Modify Attribute Instance Temporal Entity + [Documentation] Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not found + [Tags] tea-partial-update 5_6_14 + [Arguments] ${temporal_entity_id} ${attributeId} ${instanceId} + ${response}= Modify Attribute Instance From Temporal Entity + ... ${temporal_entity_id} + ... ${attributeId} + ... ${instanceId} + ... ${fragment_filename} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code ${status_code} ${response.status_code} + +Create Id + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Suite Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${unknown_temporal_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${unknown_temporal_entity_id} + ${response}= Retrieve Temporal Representation Of Entity + ... ${temporal_entity_representation_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... options=sysAttrs + ... context=${ngsild_test_suite_context} + ${valid_instanceId}= Set Variable ${response.json()['speed'][0]['instanceId']} + Set Test Variable ${valid_instanceId} + +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..07a8f00e5df26347dfae9316ef3390db818c40e5 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_01.robot @@ -0,0 +1,37 @@ +*** Settings *** +Documentation Check that you can create a subscription + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${subscription_expectation_file_path}= subscriptions/expectations/subscription-028-01-expectation.jsonld + + +*** Test Cases *** +028_01_01 Create Subscription + [Documentation] Check that you can create a subscription + [Tags] sub-create 5_8_1 + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${subscription_id} + ${response}= Create Subscription + ... ${subscription_id} + ... ${subscription_payload_file_path} + ... ${CONTENT_TYPE_LD_JSON} + ${expected_subscription}= Load Test Sample ${subscription_expectation_file_path} ${subscription_id} + ${response1}= Retrieve Subscription + ... id=${subscription_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... context=${ngsild_test_suite_context} + Check Created Resource Set To ${expected_subscription} ${response1.json()} + + +*** Keywords *** +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..23a0c5217430cec655dad6fe3a90679232dc5271 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_02.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that you cannot create a subscription with an invalid request + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Create Subscription With Invalid Request + + +*** Test Cases *** FILENAME EXPECTED_STATUS +028_02_01 InvalidJson + subscription-invalid-json-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} +028_02_02 EmptyJson + subscription-empty-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Create Subscription With Invalid Request + [Documentation] Check that you cannot create a subscription with an invalid request + [Tags] sub-create 5_8_1 + [Arguments] ${filename} ${expected_status} + ${response}= Create Subscription From File ${filename} + Check Response Status Code 400 ${response.status_code} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${expected_status} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_03.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..34c28ec73cbdea385f3a85c1d4558fe91a964163 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_03.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Check that you cannot create a subscription with an invalid/empty id + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Initial Subscriptions +Test Template Create Subscription With Invalid/Empty Id + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld + + +*** Test Cases *** ID +028_03_01 InvalidId + invalidId +028_03_02 EmptyId + ${EMPTY} + + +*** Keywords *** +Create Subscription With Invalid/Empty Id + [Documentation] Check that you cannot create a subscription with an invalid/empty id + [Tags] sub-create 5_8_1 + [Arguments] ${subscription_id} + Set Suite Variable ${subscription_id} + ${response}= Create Subscription + ... ${subscription_id} + ... ${subscription_payload_file_path} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_04.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..a819183f2597e6fc576a7ee43a67f73462d82ed6 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_04.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you cannot create a subscription with an existing id + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld + + +*** Test Cases *** +028_04_01 Create a subscription with an id known to the system + [Documentation] Check that you cannot create a subscription with an existing id + [Tags] sub-create 5_8_1 + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${subscription_id} + ${initial_response}= Create Subscription + ... ${subscription_id} + ... ${subscription_payload_file_path} + ... ${CONTENT_TYPE_LD_JSON} + ${response}= Create Subscription + ... ${subscription_id} + ... ${subscription_payload_file_path} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 409 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_ALREADY_EXISTS} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..9602eff7d2a1364df2395fc7b11ef9995763a2ff --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that you cannot create a subscription with invalid throttling + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Create Subscription With Invalid Throttling + + +*** Test Cases *** FILENAME EXPECTED_STATUS +028_05_01 ThrottlingAndTimeIntervalConjunction + subscription-invalid-throttling-timeInterval-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} +028_05_02 NegativeThrottling + subscription-invalid-negative-throttling-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Create Subscription With Invalid Throttling + [Documentation] Check that you cannot create a subscription with invalid throttling + [Tags] sub-create 5_8_1 + [Arguments] ${filename} ${expected_status} + ${response}= Create Subscription From File ${filename} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${expected_status} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..d91dc8e1bdcf2efcfe092bbaa8c832aa68c21c61 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_01.robot @@ -0,0 +1,30 @@ +*** Settings *** +Documentation Check that you cannot delete a subscription: If the subscription Id is not present or it is not a valid URI, then an error shall be raised + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Delete Subscription With Non present Or Invalid Id + + +*** Test Cases *** ID EXPECTED_STATUS_CODE PROBLEM_TYPE +032_01_01 NotPresentId + [Tags] sub-delete 5_8_5 + ${EMPTY} 405 ${EMPTY} +032_01_02 InvalidId + [Tags] sub-delete 5_8_5 + InvalidUri 400 ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Delete Subscription With Non present Or Invalid Id + [Documentation] Check that you cannot delete a subscription: If the subscription Id is not present or it is not a valid URI, then an error shall be raised + [Arguments] ${id} ${expected_status_code} ${problem_type} + ${response}= Delete Subscription ${id} + Check Response Status Code ${expected_status_code} ${response.status_code} + IF "${problem_type}"!="${EMPTY}" + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + END diff --git a/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..bf8a42681e1eeab008832957dd89cbb84fbb485f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_02.robot @@ -0,0 +1,17 @@ +*** Settings *** +Documentation Check that you cannot delete a subscription: If the subscription id provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + + +*** Test Cases *** +032_02_01 Delete Unknown Subscription + [Documentation] Check that you cannot delete a subscription: If the subscription id provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised + [Tags] sub-delete 5_8_5 + ${response}= Delete Subscription urn:ngsi-ld:Subscription:unknowSubscription + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_03.robot b/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..e87684fe33ff0803734f8e5474854d0e181dd99a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_03.robot @@ -0,0 +1,31 @@ +*** Settings *** +Documentation Check that you can delete a subscription + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld + + +*** Test Cases *** +032_03_01 Delete Subscription + [Documentation] Check that you can delete a subscription + [Tags] sub-delete 5_8_5 + ${response}= Delete Subscription ${subscription_id} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Subscription + ... id=${subscription_id} + Check SUT Not Containing Resource ${response1.status_code} + + +*** 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} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..3a4f0f8486d60aa200ad03205d6e4d6a0a5da2f3 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_01.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that you can query a list of subscriptions + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${first_subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${second_subscription_payload_file_path}= subscriptions/subscription-watchedAttributes-sample.jsonld +${third_subscription_payload_file_path}= subscriptions/subscription-inactive-sample.jsonld +${expectation_file_path}= subscriptions/expectations/subscriptions-031-01-expectation.json + + +*** Test Cases *** +031_01_01 Query Subscriptions + [Documentation] Check that you can query a list of subscriptions + [Tags] sub-query 5_8_4 + ${response}= Query Subscriptions context=${ngsild_test_suite_context} + @{subscription_ids}= Create List + ... ${first_subscription_id} + ... ${second_subscription_id} + ... ${third_subscription_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Subscription elements + ... ${expectation_file_path} + ... ${subscription_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Subscriptions + ${first_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${second_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${third_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Create Subscription + ... ${first_subscription_id} + ... ${first_subscription_payload_file_path} + ... ${CONTENT_TYPE_LD_JSON} + Create Subscription + ... ${second_subscription_id} + ... ${second_subscription_payload_file_path} + ... ${CONTENT_TYPE_LD_JSON} + Create Subscription + ... ${third_subscription_id} + ... ${third_subscription_payload_file_path} + ... ${CONTENT_TYPE_LD_JSON} + Set Suite Variable ${first_subscription_id} + Set Suite Variable ${second_subscription_id} + Set Suite Variable ${third_subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${first_subscription_id} + Delete Subscription ${second_subscription_id} + Delete Subscription ${third_subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..6b3f827eed113cc79c40b19178020736277d217f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_02.robot @@ -0,0 +1,71 @@ +*** Settings *** +Documentation Check that you can query a list of subscriptions: Pagination logic shall be in place + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Subscriptions +Test Teardown Delete Initial Subscriptions +Test Template Query Subscriptions With Limit And Page Parameters + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${first_subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${second_subscription_payload_file_path}= subscriptions/subscription-watchedAttributes-sample.jsonld +${third_subscription_payload_file_path}= subscriptions/subscription-inactive-sample.jsonld + + +*** Test Cases *** LIMIT OFFSET EXPECTED_SUBSCRIPTION_NUMBER PREV_LINK NEXT_LINK +031_02_01 Query Second Subscription + [Tags] sub-query 5_8_4 + ${1} ${1} ${1} ;rel="prev";type="application/ld+json" ;rel="next";type="application/ld+json" +031_02_02 Query Last Subscription + [Tags] sub-query 5_8_4 + ${1} ${2} ${1} ;rel="prev";type="application/ld+json" ${EMPTY} +031_02_03 Query All Subscriptions + [Tags] sub-query 5_8_4 + ${15} ${0} ${3} ${EMPTY} ${EMPTY} + + +*** Keywords *** +Query Subscriptions With Limit And Page Parameters + [Documentation] Check that you can query a list of subscriptions: Pagination logic shall be in place + [Arguments] ${limit} ${offset} ${expectation_subscription_number} ${prev_link} ${next_link} + ${response}= Query Subscriptions + ... context=${ngsild_test_suite_context} + ... limit=${limit} + ... offset=${offset} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Number Of Entities + ... Subscription + ... ${expectation_subscription_number} + ... ${response.json()} + Check Pagination Prev And Next Headers ${prev_link} ${next_link} ${response.headers} + +Setup Initial Subscriptions + ${first_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${second_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${third_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Create Subscription + ... ${first_subscription_id} + ... ${first_subscription_payload_file_path} + ... ${CONTENT_TYPE_LD_JSON} + Create Subscription + ... ${second_subscription_id} + ... ${second_subscription_payload_file_path} + ... ${CONTENT_TYPE_LD_JSON} + Create Subscription + ... ${third_subscription_id} + ... ${third_subscription_payload_file_path} + ... ${CONTENT_TYPE_LD_JSON} + Set Test Variable ${first_subscription_id} + Set Test Variable ${second_subscription_id} + Set Test Variable ${third_subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${first_subscription_id} + Delete Subscription ${second_subscription_id} + Delete Subscription ${third_subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..626eeb79ebbe0dc1e6dbc3c3e743581dbd8e4319 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_01.robot @@ -0,0 +1,26 @@ +*** Settings *** +Documentation Check that you cannot retrieve a subscription if the subscription Id is not a valid URI, then an error of type BadRequestData shall be raised + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Retrieve Subscription With Invalid Id + + +*** Test Cases *** ID +030_01_01 InvalidId + [Tags] sub-retrieve 5_8_3 + InvalidUri + + +*** Keywords *** +Retrieve Subscription With Invalid Id + [Documentation] Check that you cannot retrieve a subscription: If the subscription Id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised + [Arguments] ${id} + ${response}= Retrieve Subscription + ... id=${id} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..2b7a201b6346036bb85ccdcb5217ef4ff817a6ec --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_02.robot @@ -0,0 +1,18 @@ +*** Settings *** +Documentation Check that you cannot retrieve a subscription: If the identifier provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + + +*** Test Cases *** +030_02_01 Retrieve Unknown Subscription + [Documentation] Check that you cannot retrieve a subscription: If the identifier provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised + [Tags] sub-retrieve 5_8_3 + ${response}= Retrieve Subscription + ... id=urn:ngsi-ld:Subscription:unknowSubscription + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_03.robot b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..25166491cf5543f3f359a6040abacebd5e9ebfdf --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_03.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you can retrieve a subscription + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${expectation_file_path}= subscriptions/expectations/subscriptions-030-03-expectation.json + + +*** Test Cases *** +030_03_01 Retrieve Subscription + [Documentation] Check that you can retrieve a subscription + [Tags] sub-retrieve 5_8_3 + ${response}= Retrieve Subscription + ... id=${subscription_id} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Subscription element + ... ${expectation_file_path} + ... ${subscription_id} + ... ${response.json()} + + +*** 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/SubscriptionNotificationBehaviour/046_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..aebf283097ac0dfb438a6b189d0f100071b0d4c7 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_01.robot @@ -0,0 +1,69 @@ +*** Settings *** +Documentation Check that a notification is only sent if and only if the status is active + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-building-entities-active.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify + + +*** Test Cases *** +046_01_01 Check that a notification is only sent if status is active + [Documentation] Check that a notification is only sent if and only if the status is active + [Tags] sub-notification 5_8_6 + + Add Initial Entity + Sleep 1s + Setup Initial Subscriptions + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Should be Equal ${entity_id} ${notification}[data][0][id] + Should be Equal ${5} ${notification}[data][0][airQualityLevel][value] + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Add Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_building_filepath} ${entity_id} + Set Suite Variable ${entity_id} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Set Suite Variable ${subscription_id} + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..9fb9e494660a117b7cd6d30cd0004c56ce52b5b8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_02.robot @@ -0,0 +1,70 @@ +*** Settings *** +Documentation If a Subscription defines a timeInterval member, a Notification shall be sent periodically, when the time interval (in seconds) specified in such value field is reached, regardless of Attribute changes. + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-timeInterval-sample.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath}= building-simple-attributes-sample.jsonld + + +*** Test Cases *** +046_02_01 Check that a notification is sent on the timeInterval + [Documentation] If a Subscription defines a timeInterval member, a Notification shall be sent periodically, when the time interval (in seconds) specified in such value field is reached, regardless of Attribute changes. + [Tags] sub-notification 5_8_6 + ${response}= Setup Initial Subscriptions + + ${notification} ${headers}= Wait for notification timeout=${15} + + ${notification} ${headers}= Wait for notification timeout=${15} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Dictionary Should Contain Key ${notification} data + Should Not Be Empty ${notification}[data] Notification data should not be empty + Should be Equal ${entity_id} ${notification}[data][0][id] + Should be True + ... '${notification}[data][0][airQualityLevel][value]'=='4.0' or '${notification}[data][0][airQualityLevel][value]'=='4' + Should be Equal Eiffel Tower ${notification}[data][0][name][value] + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Suite Variable ${entity_id} + Set Suite Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_03.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..b8cb874b07fe001f38def9bcfaf15f11aaba2bd8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_03.robot @@ -0,0 +1,75 @@ +*** Settings *** +Documentation A notification with all subscribed Entities will be included if query or geoquery are not defined. + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-building-entities-default.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld + + +*** Test Cases *** +046_03_01 Check that a notification is sent with all entities + [Documentation] A notification with all subscribed Entities will be included if query or geoquery are not defined. + [Tags] sub-notification 5_8_6 + ${response}= Setup Initial Subscriptions + + Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification ${5} + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Dictionary Should Contain Key ${notification} data + Should Not Be Empty ${notification}[data] Notification data should not be empty + Should be Equal ${entity_id} ${notification}[data][0][id] + Should be True + ... '${notification}[data][0][airQualityLevel][value]'=='5.0' or '${notification}[data][0][airQualityLevel][value]'=='5' + Should be Equal Eiffel Tower ${notification}[data][0][name][value] + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Suite Variable ${entity_id} + Set Suite Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Add Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_building_filepath} ${entity_id} + Set Suite Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_04.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..3e487cafebd90b13387854e99968dbb68700c1d8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_04.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation If a Subscription does not define a timeInterval member, the notification shall be sent whenever there is a change in the watched Attributes. The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-building-entities-active-watchedAttributes.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld + + +*** Test Cases *** +046_04_01 Check that a notification is sent with all entities + [Documentation] The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions + [Tags] sub-notification 5_8_6 + ${response}= Setup Initial Subscriptions + + ${response1}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification ${5} + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Dictionary Should Contain Key ${notification} data + Should Not Be Empty ${notification}[data] Notification data should not be empty + Should be Equal ${entity_id} ${notification}[data][0][id] + Should be Equal ${5} ${notification}[data][0][airQualityLevel][value] + Should be Equal Eiffel Tower ${notification}[data][0][name][value] + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + Set Suite Variable ${entity_id} + Set Suite Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..b698a8c25f1d6a374d4f37bdc95f4e7eb931bd81 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_05.robot @@ -0,0 +1,70 @@ +*** Settings *** +Documentation If a Subscription does not define a timeInterval member, the notification shall be sent whenever there is a change in the watched Attributes and the entity matches the q parameter. The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-building-entities-active-watchedAttributes-query.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld + + +*** Test Cases *** +046_05_01 Check that a notification is sent with all entities + [Documentation] The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions + [Tags] sub-notification 5_8_6 + Setup Initial Subscriptions + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification ${5} + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Dictionary Should Contain Key ${notification} data + Should Not Be Empty ${notification}[data] Notification data should not be empty + Should be Equal ${entity_id} ${notification}[data][0][id] + Should be True + ... '${notification}[data][0][airQualityLevel][value]'=='5.0' or '${notification}[data][0][airQualityLevel][value]'=='5' + Should be Equal Eiffel Tower ${notification}[data][0][name][value] + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Suite Variable ${entity_id} + Set Suite Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_06.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..021d8432be0ec71a271ffc6314fd04c03d70a54c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_06.robot @@ -0,0 +1,55 @@ +*** Settings *** +Documentation If a Subscription does not define a timeInterval member, the notification shall be sent whenever an entity matches the query defined in the subscription. The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Setup Server And Subscriptions +Suite Teardown Delete Server And Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-building-entities-active-query.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${building_filename}= building-location-attribute.jsonld +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify + + +*** Test Cases *** +046_06_01 Check that a notification is sent with all matching entities + [Documentation] only the subscribed Entities matching the query and watched attributes shall be included. + [Tags] sub-notification 5_8_6 + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_id} + + ${response}= Create Entity Selecting Content Type + ... ${building_filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${10} + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Should be Equal ${entity_id} ${notification}[data][0][id] + + +*** Keywords *** +Setup Server And Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + Set Suite Variable ${subscription_id} + Start Local Server ${notification_server_host} ${notification_server_port} + + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +Delete Server And Subscriptions + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_07.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..cbba2962734a6f85029e5c383ce1de115af987d3 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_07.robot @@ -0,0 +1,98 @@ +*** Settings *** +Documentation Check that a notification is only sent if and only if the status is active + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Suite +Suite Teardown After Suite +Test Teardown After Test + + +*** Variables *** +${subscription_id_prefix} urn:ngsi-ld:Subscription: +${subscription_payload_file_path} subscriptions/subscription-building-entities-active.jsonld +${subscription_payload_file_path_notificationAttributes} subscriptions/subscription-building-entities-active-notificationAttributes.jsonld +${subscription_payload_file_path_default_context} subscriptions/subscription-building-entities-active-default-context.jsonld +${building_id_prefix} urn:ngsi-ld:Building: +${notification_server_send_url} http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath} building-simple-attributes-sample.jsonld +${fragment_filename} airQualityLevel-fragment.jsonld +${date_format} %Y-%m-%dT%H:%M:%SZ +${date_format_with_millis} %Y-%m-%dT%H:%M:%S.%fZ + + +*** Test Cases *** +046_07_01 Check notification structure + [Documentation] The structure of the notification message shall be as mandated by clause 5.3. Valid notification with attributes as stated above + [Tags] sub-notification 5_8_6 + [Setup] Setup Initial Subscriptions ${subscription_payload_file_path} + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification + Should Be Equal ${notification}[type] Notification + Should Be Equal ${notification}[subscriptionId] ${subscription_id} + ${notified_at_date}= Parse Ngsild Date ${notification}[notifiedAt] + Should Not Be Equal ${notified_at_date} ${None} + +046_07_02 Check correct attributes are included + [Documentation] The structure of the notification message shall be as mandated by clause 5.3. The Entity Attributes included (Properties or Relationships) shall be those specified by the notification.attributes member in the Subscription data type (clause 5.2.12). + [Tags] sub-notification 5_8_6 + [Setup] Setup Initial Subscriptions ${subscription_payload_file_path_notificationAttributes} + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification + Should Be Equal ${notification}[type] Notification + Should Be Equal ${notification}[subscriptionId] ${subscription_id} + ${notified_at_date}= Parse Ngsild Date ${notification}[notifiedAt] + Should Not Be Equal ${notified_at_date} ${None} + Dictionary Should Not Contain Key ${notification}[data][0] name + Dictionary Should Contain Key ${notification}[data][0] airQualityLevel + +046_07_03 Check URI expansion is observed + [Documentation] The structure of the notification message shall be as mandated by clause 5.3. URI expansion shall be observed (clause 5.5.7). + [Tags] sub-notification 5_8_6 + [Setup] Setup Initial Subscriptions ${subscription_payload_file_path_default_context} + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification + Should Be Equal ${notification}[type] Notification + Should Be Equal ${notification}[subscriptionId] ${subscription_id} + ${notified_at_date}= Parse Ngsild Date ${notification}[notifiedAt] + Should Not Be Equal ${notified_at_date} ${None} + Dictionary Should Contain Key ${notification}[data][0] https://ngsi-ld-test-suite/context#airQualityLevel + + +*** Keywords *** +Before Suite + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + [Arguments] ${subscription_payload_path} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Test Variable ${entity_id} + Set Test Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + +After Suite + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_08.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..3e685e6224da6de7b58b963c3cb171717ec36d18 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_08.robot @@ -0,0 +1,94 @@ +*** Settings *** +Documentation Check that a notification is only sent if and only if the status is active + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Library ${EXECDIR}/libraries/logUtils.py + +Suite Setup Before Suite +Suite Teardown After Suite +Test Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-building-entities-active.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld + + +*** Test Cases *** +046_08_01 Check that a notification is sent with all attributes + [Documentation] The structure of the notification message shall be as mandated by clause 5.3.1. The absence of the notification.attributes member of a Subscription means that all Entity Attributes shall be included. All attributes are included + [Tags] sub-notification 5_8_6 + [Setup] Setup Initial Subscriptions ${False} + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification ${5} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Dictionary Should Contain Key ${notification} data + Should Not Be Empty ${notification}[data] Notification data should not be empty + Should be Equal ${entity_id} ${notification}[data][0][id] + Should be Equal Eiffel Tower ${notification}[data][0][name][value] + Dictionary Should Contain Key ${notification}[data][0] almostFull + Dictionary Should Contain Key ${notification}[data][0] airQualityLevel + Dictionary Should Contain Key ${notification}[data][0] subCategory + +046_08_02 Check that a notification is sent with all attributes in simplified format + [Documentation] The structure of the notification message shall be as mandated by clause 5.3.1. The absence of the notification.attributes member of a Subscription means that all Entity Attributes shall be included If the notification.format member value is "keyValues" then a simplified representation of the entities (as mandated by clause 4.5.3) shall be provided + [Tags] sub-notification 5_8_6 + [Setup] Setup Initial Subscriptions ${True} + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification ${5} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Dictionary Should Contain Key ${notification} data + Should Not Be Empty ${notification}[data] Notification data should not be empty + Should be Equal ${entity_id} ${notification}[data][0][id] + Should be Equal Eiffel Tower ${notification}[data][0][name] + + +*** Keywords *** +Before Suite + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + [Arguments] ${change_json} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + + IF "${change_json}" == "${True}" + ${subscription_payload}= Update Value To JSON + ... ${subscription_payload} + ... $..notification['format'] + ... keyValues + END + + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Test Variable ${entity_id} + Set Test Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + +After Suite + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_09.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_09.robot new file mode 100644 index 0000000000000000000000000000000000000000..359b126ccd57effa546b16a4433b2ed8765e315b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_09.robot @@ -0,0 +1,65 @@ +*** Settings *** +Documentation A Notification shall be sent (as mandated by each concrete binding and including any optional endpoint.receiverInfo defined by clause 5.2.22) to the endpoint specified by the endpoint.uri member of the notification structure defined by clause 5.2.14 + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix} urn:ngsi-ld:Subscription: +${subscription_payload_file_path} subscriptions/subscription-building-entities-active-endpoint-info.jsonld +${building_id_prefix} urn:ngsi-ld:Building: +${entity_building_filepath} building-simple-attributes-sample.jsonld +${fragment_filename} airQualityLevel-fragment.jsonld +${notification_server_send_url} http://${notification_server_host}:${notification_server_port}/notify + + +*** Test Cases *** +046_09_01 Check that a notification is sent to the endpoint + [Documentation] A Notification shall be sent (as mandated by each concrete binding and including any optional endpoint.receiverInfo defined by clause 5.2.22) to the endpoint specified by the endpoint.uri member of the notification structure defined by clause 5.2.1 + [Tags] sub-notification 5_8_6 + + Setup Initial Subscriptions + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${10} + Dictionary Should Contain Key ${headers} X-Additional-Key + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Suite Variable ${entity_id} + Set Suite Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_10.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_10.robot new file mode 100644 index 0000000000000000000000000000000000000000..31866d310216a7371be5c2d468611bb4ca233f65 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_10.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation The Notification content shall be JSON by default. + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix} urn:ngsi-ld:Subscription: +${subscription_payload_file_path} subscriptions/subscription-building-entities-default.jsonld +${building_id_prefix} urn:ngsi-ld:Building: +${entity_building_filepath} building-simple-attributes-sample.jsonld +${fragment_filename} airQualityLevel-fragment.jsonld +${notification_server_send_url} http://${notification_server_host}:${notification_server_port}/notify +${expected_header_links} <${ngsild_test_suite_context}>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json" + + +*** Test Cases *** +046_10_01 Check that the notification is sent as JSON + [Documentation] The Notification shall be sent as JSON + [Tags] sub-notification 5_8_6 + + Setup Initial Subscriptions + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Dictionary Should Contain Item ${headers} Link ${expected_header_links} + Dictionary Should Not Contain Key ${notification}[data][0] @context + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Suite Variable ${subscription_id} + Set Suite Variable ${entity_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_11.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_11.robot new file mode 100644 index 0000000000000000000000000000000000000000..f8b2d391902549cf325d1570566255e6bd9d0c1e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_11.robot @@ -0,0 +1,75 @@ +*** Settings *** +Documentation A Notification shall be sent (as mandated by each concrete binding and including any optional endpoint.info defined by clause 5.2.22) to the endpoint specified by the endpoint.uri member of the notification structure defined by clause 5.2.14 + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-building-entities-active.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${date_format}= %Y-%m-%dT%H:%M:%SZ +${date_format_with_millis}= %Y-%m-%dT%H:%M:%S.%fZ + + +*** Test Cases *** +046_11_01 Check that timesSent is increased by one + [Documentation] The notification.timesSent member shall be incremented by one. + [Tags] sub-notification 5_8_6 + + Add Initial Entity + Sleep 1s + Setup Initial Subscriptions + + Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + Wait for notification timeout=${10} + + ${response}= Retrieve Subscription + ... id=${subscription_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... context=${ngsild_test_suite_context} + + Dictionary Should Contain Key ${response.json()}[notification] timesSent + Should be Equal ${1} ${response.json()}[notification][timesSent] + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Set Suite Variable ${subscription_id} + +Add Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_building_filepath} ${entity_id} + Set Suite Variable ${entity_id} + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_12.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_12.robot new file mode 100644 index 0000000000000000000000000000000000000000..bacdb570e68d875e42531193233b8ae241bd435a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_12.robot @@ -0,0 +1,83 @@ +*** Settings *** +Documentation A Notification shall be sent (as mandated by each concrete binding and including any optional endpoint.info defined by clause 5.2.22) to the endpoint specified by the endpoint.uri member of the notification structure defined by clause 5.2.14 + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-building-entities-active.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify + + +*** Test Cases *** +046_12_01 Check that lastNotification is updated + [Documentation] The status, lastNotification and lastSuccess members shall be updated with expected value and dates. This test will check these formats. + [Tags] sub-notification 5_8_6 + + Add Initial Entity + Sleep 1s + Setup Initial Subscriptions + + Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + Wait for notification timeout=${10} + + ${response}= Retrieve Subscription + ... id=${subscription_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... context=${ngsild_test_suite_context} + + ${notification_info}= Get Value From Json ${response.json()} $.notification + + Dictionary Should Contain Key ${notification_info}[0] status + Should be Equal ok ${notification_info}[0][status] + + Dictionary Should Contain Key ${notification_info}[0] lastNotification + ${last_notification_date}= Parse Ngsild Date ${notification_info}[0][lastNotification] + Should Not Be Equal ${last_notification_date} ${None} + + Dictionary Should Contain Key ${notification_info}[0] lastSuccess + ${last_success_date}= Parse Ngsild Date ${notification_info}[0][lastSuccess] + Should Not Be Equal ${last_success_date} ${None} + + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Add Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_building_filepath} ${entity_id} + Set Suite Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_13.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_13.robot new file mode 100644 index 0000000000000000000000000000000000000000..ccc6ef86c8fa3e6d72a3ff884b5bca2f98bc3c06 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_13.robot @@ -0,0 +1,71 @@ +*** Settings *** +Documentation If the response to the notification request is different than 200 OK then implementations shall: Update notification.lastFailure with a timestamp representing the current date and time, update notification.status to "failed" + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-building-entities-active.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld + + +*** Test Cases *** +046_13_01 Check that lastFailure and status are updated if a notification could not be sent + [Documentation] If the response to the notification request is different than 200 OK then implementations shall: Update notification.lastFailure with a timestamp representing the current date and time, update notification.status to "failed" + [Tags] sub-notification 5_8_6 + + @{expected_notification_data_entities}= Create List Building + Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + Sleep 10s + + ${response}= Retrieve Subscription + ... id=${subscription_id} + ... accept=${CONTENT_TYPE_LD_JSON} + ... context=${ngsild_test_suite_context} + + ${notification_info}= Get Value From Json ${response.json()} $.notification + + Dictionary Should Contain Key ${notification_info}[0] status + Should be Equal failed ${notification_info}[0][status] + + Dictionary Should Contain Key ${notification_info}[0] lastFailure + ${last_failure_date}= Parse Ngsild Date ${notification_info}[0][lastFailure] + Should Not Be Equal ${last_failure_date} ${None} + + +*** Keywords *** +Setup Initial Subscription + ${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 Subscription + Delete Subscription ${subscription_id} + +Add Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_building_filepath} ${entity_id} + Set Suite Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} + +Before Test + Setup Initial Subscription + Add Initial Entity + +After Test + Delete Initial Subscription + Delete Initial Entity diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_14.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_14.robot new file mode 100644 index 0000000000000000000000000000000000000000..b5258eb652207f473d502666afb99e8d4ba0bd98 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_14.robot @@ -0,0 +1,76 @@ +*** Settings *** +Documentation The Notification content shall be JSON-LD when endpoint.accept is set to JSON-LD + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix} urn:ngsi-ld:Subscription: +${subscription_payload_file_path} subscriptions/subscription-building-entities-accept-jsonld.jsonld +${building_id_prefix} urn:ngsi-ld:Building: +${entity_building_filepath} building-simple-attributes-sample.jsonld +${fragment_filename} airQualityLevel-fragment.jsonld +${notification_server_send_url} http://${notification_server_host}:${notification_server_port}/notify + + +*** Test Cases *** +046_14_01 Check that a notification is sent as JSON-LD + [Documentation] The Notification content shall be JSON-LD when endpoint.accept is set to 'application/ld+json' + [Tags] sub-notification 5_8_6 + + Add Initial Entity + Sleep 1s + Setup Initial Subscriptions + Sleep 1s + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait For Notification timeout=${10} + Reply By 200 + + ${notification_headers}= Get Request Headers + ${notification_headers_dict}= Convert To Dictionary ${notification_headers} + Dictionary Should Not Contain Key ${notification_headers_dict} Link + + ${notification_payload}= Get Request Body + # json.loads parses the payload as json. It fails if the payload is malformed + ${notification}= Evaluate json.loads('''${notification_payload}''') json + Dictionary Should Contain Key ${notification}[data][0] @context + + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Add Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_building_filepath} ${entity_id} + Set Suite Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot new file mode 100644 index 0000000000000000000000000000000000000000..c1661f987e76cf97b4fcfd281836db793e96faee --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot @@ -0,0 +1,67 @@ +*** Settings *** +Documentation If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-valid-throttling-sample.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld + + +*** Test Cases *** +046_15_01 Check that a notification is not sent if the throttling has not elapsed yet + [Documentation] If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. + [Tags] sub-notification 5_8_6 + Setup Initial Subscriptions + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${10} + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + Wait for no notification + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Suite Variable ${entity_id} + Set Suite Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} 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..13dab30b609843c4d8ba26aabb2e419dd7de1a02 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot @@ -0,0 +1,35 @@ +*** Settings *** +Documentation Check that you cannot update a subscription: 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/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Update Subscription With Non present Or Invalid Id + + +*** Variables *** +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-update-sample.json + + +*** Test Cases *** ID EXPECTED_STATUS_CODE PROBLEM_TYPE +029_01_01 NotPresentId + [Tags] sub-update 5_8_2 + ${EMPTY} 405 ${EMPTY} +029_01_02 InvalidId + [Tags] sub-update 5_8_2 + InvalidUri 400 ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Update Subscription With Non present Or Invalid Id + [Documentation] Check that you cannot update a subscription: If the Subscription id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised + [Arguments] ${id} ${expected_status_code} ${problem_type} + ${response}= Update Subscription ${id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + Check Response Status Code ${expected_status_code} ${response.status_code} + IF "${problem_type}"!="${EMPTY}" + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + END 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..551020eb9db494d04206fe03ff2c70dbe984c8d7 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot @@ -0,0 +1,25 @@ +*** 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/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-update-sample.json + + +*** Test Cases *** +029_02_01 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] sub-update 5_8_2 + ${response}= Update Subscription + ... urn:ngsi-ld:Subscription:unknowSubscription + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} 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..557cf6d463c4ba3f89937a2ab29ad8aa0480c0f4 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Check that you cannot update a subscription: 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/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${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 Cases *** +029_03_01 Update Subscription With Invalid Fragment + [Documentation] Check that you cannot update a subscription: If the data types and restriction are not met by the Subscription Fragment, then an error of type BadRequestData shall be raised + [Tags] sub-update 5_8_2 + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** 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..f77a9d5552f1a6aa71ee57d5376e3cffe2cef112 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot @@ -0,0 +1,40 @@ +*** 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/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${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 Cases *** +029_04_01 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] sub-update 5_8_2 + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** 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..f99ebf8a8cec2fab89f9564e05fa1db8b594bd66 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot @@ -0,0 +1,62 @@ +*** Settings *** +Documentation Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${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/expectations/subscription-vehicle-sample.jsonld +${expected_expanded_subscription_payload_file_path}= subscriptions/expectations/subscription-vehicle-expanded-types-sample.jsonld + + +*** Test Cases *** +029_05_01 Update Subscription With Term to Uri Expansion with Context + [Documentation] Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed + [Tags] sub-update 5_8_2 + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Subscription + ... id=${subscription_id} + ... context=${ngsild_test_suite_context} + Check Response Body Containing Subscription element + ... ${expected_subscription_payload_file_path} + ... ${subscription_id} + ... ${response1.json()} + +029_05_02 Update Subscription With Term to Uri Expansion without Context + [Documentation] Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed + [Tags] sub-update 5_8_2 + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Subscription + ... id=${subscription_id} + Check Response Body Containing Subscription element + ... ${expected_expanded_subscription_payload_file_path} + ... ${subscription_id} + ... ${response1.json()} + + +*** 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..0ea7eef0b329c5199450a2cf50fd8d9079232790 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot @@ -0,0 +1,47 @@ +*** Settings *** +Documentation Check that you can update a subscription: The implementation shall modify the target Subscription + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${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 Cases *** +029_06_01 Update Subscription + [Documentation] Check that you can update a subscription: The implementation shall modify the target Subscription + [Tags] sub-update 5_8_2 + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + ${subscription}= Upsert Element In Entity ${subscription_payload} ${subscription_update_fragment} + ${response1}= Retrieve Subscription + ... id=${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} ${response1.json()} ${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..6a8c6f2842b084d2a2ec029cfc372943c851cdc6 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot @@ -0,0 +1,46 @@ +*** Settings *** +Documentation Check that you can update a subscription: If isActive is equal to true 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/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions +Test Template Activate Paused Subscription With isActive Member + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-inactive-sample.jsonld + + +*** Test Cases *** SUBSCRIPTION_UPDATE_FRAGMENT_FILE_PATH +029_07_01 ActiveTrue + [Tags] sub-update 5_8_2 + subscriptions/fragments/subscription-isActive-true-update-sample.json + + +*** Keywords *** +Activate Paused Subscription With isActive Member + [Documentation] Check that you can update a subscription: If isActive is equal to true 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" + [Arguments] ${subscription_update_fragment_file_path} + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Subscription + ... id=${subscription_id} + Check Response Body Containing an Attribute set to + ... expected_attribute_name=status + ... response_body=${response1.json()} + ... expected_attribute_value=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..18585700311272fdd283de01d1c5748696f6643f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot @@ -0,0 +1,46 @@ +*** Settings *** +Documentation Check that you can update a subscription: If isActive is equal to true and expiresAt corresponds to a DateTime in the future, then status shall be updated to "active" + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions +Test Template Activate Paused Subscription With isActive And ExpiresAt Members + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-inactive-sample.jsonld + + +*** Test Cases *** SUBSCRIPTION_UPDATE_FRAGMENT_FILE_PATH +029_08_01 ActiveTrueExpiresAt + [Tags] sub-update 5_8_2 + subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json + + +*** Keywords *** +Activate Paused Subscription With isActive And ExpiresAt Members + [Documentation] Check that you can update a subscription: If isActive is equal to true and expiresAt corresponds to a DateTime in the future, then status shall be updated to "active" + [Arguments] ${subscription_update_fragment_file_path} + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Subscription + ... id=${subscription_id} + Check Response Body Containing an Attribute set to + ... expected_attribute_name=status + ... response_body=${response1.json()} + ... expected_attribute_value=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..0330b7d5fb11b4926699d1c686204ee4e0bc9582 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot @@ -0,0 +1,42 @@ +*** 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/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-isActive-false-update-sample.json + + +*** Test Cases *** +029_09_01 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] sub-update 5_8_2 + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Subscription + ... id=${subscription_id} + Check Response Body Containing an Attribute set to + ... expected_attribute_name=status + ... response_body=${response1.json()} + ... expected_attribute_value=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..3b70a8c3dd7321a5f76e2a9273e3ede9a1fe7087 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future, then status shall be updated to "active", if and only if the previous value of status was "expired" + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${subscription_id_prefix} urn:ngsi-ld:Subscription: +${subscription_payload_file_path} subscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path} subscriptions/fragments/subscription-expiresAt-future-update-sample.json + + +*** Test Cases *** +029_10_01 Activate Expired Subscription + [Documentation] Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future, then status shall be updated to "active", if and only if the previous value of status was "expired" + [Tags] sub-update 5_8_2 + # Update subscription to expire in 5 seconds + ${now}= Get Current Date time_zone=UTC + ${in_5_seconds}= Add Time To Date ${now} 5s result_format=%Y-%m-%dT%H:%M:%SZ + ${update_template_fragment}= Load JSON From File + ... ${EXECDIR}/data/subscriptions/fragments/subscription-expiresAt-update-sample.json + ${update_fragment}= Update Value To JSON ${update_template_fragment} $..expiresAt ${in_5_seconds} + ${update_response}= Update Subscription With Payload + ... ${subscription_id} + ... ${update_fragment} + ... ${CONTENT_TYPE_JSON} + Sleep 10s + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Subscription + ... id=${subscription_id} + Check Response Body Containing an Attribute set to + ... expected_attribute_name=status + ... response_body=${response1.json()} + ... expected_attribute_value=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..794e10480f9812fb6f18df6a64f45d248075fdd8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot @@ -0,0 +1,40 @@ +*** 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/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + + +*** Variables *** +${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 Cases *** +029_11_01 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] sub-update 5_8_2 + ${response}= Update Subscription + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** 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/ContextSource/Discovery/QueryContextSourceRegistrations/037_01.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..2bc317bbd8a6a2bcec6ed701a838812592c45cbe --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_01.robot @@ -0,0 +1,62 @@ +*** Settings *** +Documentation Check that you can query context source registrations if at least one of list of Entity Types or list of Attribute names is present + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registrations +Test Teardown Delete Created Context Source Registrations +Test Template Query A Context Source Registration + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${first_context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${second_context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-detailed-information-sample.jsonld + + +*** Test Cases *** QUERY_PARAM_NAME QUERY_PARAM_VALUE EXPECTATION_FILE_PATH EXPECTED_CONTEXT_SOURCE_REGISTRATION_IDS +037_01_01 With list of entity types + [Tags] csr-query 5_10_2 + type Building csourceRegistrations/expectations/context-source-registrations-037-01-expectation.json ${second_context_source_registration_id} +037_01_02 With list of attribute names + [Tags] csr-query 5_10_2 + attrs name csourceRegistrations/expectations/context-source-registrations-037-01-expectation.json ${second_context_source_registration_id} + + +*** Keywords *** +Query A Context Source Registration + [Documentation] Check that you can query context source registrations if at least one of list of Entity Types or list of Attribute names is present + [Arguments] + ... ${query_param_name} + ... ${query_param_value} + ... ${expectation_file_path} + ... @{expected_context_source_registration_ids} + ${response}= Query Context Source Registrations + ... context=${ngsild_test_suite_context} + ... ${query_param_name}=${query_param_value} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Context Source Registrations elements + ... ${expectation_file_path} + ... ${expected_context_source_registration_ids} + ... ${response.json()} + +Setup Initial Context Source Registrations + ${first_context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${second_context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${first_context_source_registration_payload}= Load Test Sample + ... ${first_context_source_registration_payload_file_path} + ... ${first_context_source_registration_id} + ${second_context_source_registration_payload}= Load Test Sample + ... ${second_context_source_registration_payload_file_path} + ... ${second_context_source_registration_id} + Create Context Source Registration ${first_context_source_registration_payload} + Create Context Source Registration ${second_context_source_registration_payload} + Set Test Variable ${first_context_source_registration_id} + Set Test Variable ${second_context_source_registration_id} + +Delete Created Context Source Registrations + Delete Context Source Registration ${first_context_source_registration_id} + Delete Context Source Registration ${second_context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_02.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..6c0c788ec7fa9cf0acc5e956ee078f655eb39632 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_02.robot @@ -0,0 +1,18 @@ +*** Settings *** +Documentation Check that you cannot query context source registrations, if neither Entity types nor Attribute names are provided, an error of type 400 shall be raised. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Test Cases *** +037_02_01 Query Context Source Registrations Without Entity Types and Attribute Names + [Documentation] Check that you cannot query context source registrations, if neither Entity types nor Attribute names are provided, an error of type 400 shall be raised. + [Tags] csr-query 5_10_2 + ${response}= Query Context Source Registrations context=${ngsild_test_suite_context} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_03.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..0740c46bcffd679b0067cd35c32725674b1276aa --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_03.robot @@ -0,0 +1,37 @@ +*** Settings *** +Documentation Check that you cannot query context source registrations, if the list of Entity identifiers includes a URI which it is not valid, or the query, geo-query or temporal query are not syntactically valid + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Query Context Source Registration With Invalid Query Param + + +*** Test Cases *** QUERY_PARAM_NAME QUERY_PARAM_VALUE +037_03_01 Invalid URI + [Tags] csr-query 5_10_2 + id invalidUri +037_03_02 Invalid Query + [Tags] csr-query 5_10_2 + q (invalidQuery +037_03_03 Invalid GeoQuery + [Tags] csr-query 5_10_2 + georel within +037_03_04 Invalid Temporal Query + [Tags] csr-query 5_10_2 + timerel before + + +*** Keywords *** +Query Context Source Registration With Invalid Query Param + [Documentation] Check that you cannot query context source registrations, if the list of Entity identifiers includes a URI which it is not valid, or the query, geo-query or temporal query are not syntactically valid + [Arguments] ${query_param_name} ${query_param_value} + ${response}= Query Context Source Registrations + ... context=${ngsild_test_suite_context} + ... ${query_param_name}=${query_param_value} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..c2cbb462df2b77cd01a4e0b12e01ca45df3c0d3f --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot @@ -0,0 +1,43 @@ +*** Settings *** +Documentation Check that you can query context source registrations. If a JSON-LD context is not provided, then all the query terms shall be resolved against the default JSON-LD @context + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Context Source Registration +Suite Teardown Delete Created Context Source Registration + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-detailed-information-sample.jsonld +${expectation_file_path}= csourceRegistrations/expectations/context-source-registrations-037-04-expectation.json +${entity_type}= https://ngsi-ld-test-suite/context#Building + + +*** Test Cases *** +037_04_01 Query Context Source Registrations Without Context + [Documentation] Check that you can query context source registrations. If a JSON-LD context is not provided, then all the query terms shall be resolved against the default JSON-LD @context + [Tags] csr-query 5_10_2 + ${response}= Query Context Source Registrations id=${context_source_registration_id} type=${entity_type} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Context Source Registrations elements + ... ${expectation_file_path} + ... ${expected_context_source_registration_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Context Source Registration + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Create Context Source Registration ${context_source_registration_payload} + Set Suite Variable ${context_source_registration_id} + +Delete Created Context Source Registration + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_05.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..7856534fa6746497bac4413d742dd319e431ab9f --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_05.robot @@ -0,0 +1,48 @@ +*** Settings *** +Documentation Check that you can query context source registrations matching EntityInfo of RegistrationInfo + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Created Context Source Registration +Test Template Query Context Source Registration Matching EntityInfo of RegistrationInfo + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: + + +*** Test Cases *** REGISTRATION_FILE_PATH EXPECTATION_FILE_PATH +037_05_01 Registration With EntityInfo Matching The Query + [Tags] csr-query 5_10_2 + csourceRegistrations/context-source-registration-sample.jsonld csourceRegistrations/expectations/context-source-registrations-037-05-01-expectation.json +037_05_02 Registration Without EntityInfo + [Tags] csr-query 5_10_2 + csourceRegistrations/context-source-registration-with-only-properties-information-sample.jsonld csourceRegistrations/expectations/context-source-registrations-037-05-02-expectation.json + + +*** Keywords *** +Query Context Source Registration Matching EntityInfo of RegistrationInfo + [Documentation] Check that you can query context source registrations matching EntityInfo of RegistrationInfo + [Arguments] ${registration_file_path} ${expectation_file_path} + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${registration_file_path} + ... ${context_source_registration_id} + ${create_response}= Create Context Source Registration ${context_source_registration_payload} + Set Suite Variable ${context_source_registration_id} + ${response}= Query Context Source Registrations + ... context=${ngsild_test_suite_context} + ... type=OffStreetParking + ... idPattern=.*downtown$ + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Context Source Registrations elements + ... ${expectation_file_path} + ... ${expected_context_source_registration_ids} + ... ${response.json()} + +Delete Created Context Source Registration + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_06.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..4c25d9f666ab67ce16cd0e941d4f21156344489d --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_06.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Check that you can query context source registrations matching property and relationship names of RegistrationInfo + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration +Test Teardown Delete Created Context Source Registration +Test Template Query Context Source Registration Matching Properties And Relationships Of RegistrationInfo + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-detailed-information-sample.jsonld + + +*** Test Cases *** ATTRS_VALUE EXPECTATION_FILE_PATH +037_06_01 Query With Matching Properties And Relationships + [Tags] csr-query 5_10_2 + name,locatedAt csourceRegistrations/expectations/context-source-registrations-037-06-expectation.json +037_06_02 Query Without Properties And Relationships + [Tags] csr-query 5_10_2 + ${EMPTY} csourceRegistrations/expectations/context-source-registrations-037-06-expectation.json + + +*** Keywords *** +Query Context Source Registration Matching Properties And Relationships Of RegistrationInfo + [Documentation] Check that you can query context source registrations matching property and relationship names of RegistrationInfo + [Arguments] ${attrs_value} ${expectation_file_path} + ${response}= Query Context Source Registrations + ... context=${ngsild_test_suite_context} + ... type=Building + ... attrs=${attrs_value} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Context Source Registrations elements + ... ${expectation_file_path} + ... ${expected_context_source_registration_ids} + ... ${response.json()} + +Setup Initial Context Source Registration + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Create Context Source Registration ${context_source_registration_payload} + Set Test Variable ${context_source_registration_id} + +Delete Created Context Source Registration + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_07.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..9c1aaf8d1a04a6cad05811cb978f3dbdd4a5f4a8 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_07.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Check that you can query context source registrations. If present, the geoquery is matched against the GeoProperty programmatic parameter identified in the geoquery + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration +Test Teardown Delete Created Context Source Registration +Test Template Query Context Source Registration Matching Geoquery + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-location-sample.jsonld +${expectation_file_path}= csourceRegistrations/expectations/context-source-registrations-037-07-expectation.json + + +*** Test Cases *** GEOREL GEOMETRY COORDINATES GEOPROPERTY EXPECTATION_FILE_PATH +037_07_01 Near Point + [Tags] csr-query 5_10_2 + near;maxDistance==2000 Point [-8.503,41.202] ${EMPTY} ${expectation_file_path} +037_07_02 Within Polygon + [Tags] csr-query 5_10_2 + within Polygon [[-13.503,47.202],[6.541, 52.961],[20.37,44.653],[9.46,32.57],[-15.23,21.37]] location ${expectation_file_path} + + +*** Keywords *** +Query Context Source Registration Matching Geoquery + [Documentation] Check that you can query context source registrations. If present, the geoquery is matched against the GeoProperty programmatic parameter identified in the geoquery + [Arguments] ${georel} ${geometry} ${coordinates} ${geoproperty} ${expectation_file_path} + ${response}= Query Context Source Registrations + ... context=${ngsild_test_suite_context} + ... type=Building + ... georel=${georel} + ... geometry=${geometry} + ... coordinates=${coordinates} + ... geoproperty=${geoproperty} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Context Source Registrations elements + ... ${expectation_file_path} + ... ${expected_context_source_registration_ids} + ... ${response.json()} + +Setup Initial Context Source Registration + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Create Context Source Registration ${context_source_registration_payload} + Set Test Variable ${context_source_registration_id} + +Delete Created Context Source Registration + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_08.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..580aa1fcc8fa77914da1f59195a3f145203541f7 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_08.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Check that you can query context source registrations. If no temporal query is present, only Context Source Registrations for Context Sources providing latest information are considered + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Context Source Registration +Suite Teardown Delete Created Context Source Registration + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${expectation_file_path}= csourceRegistrations/expectations/context-source-registrations-037-08-expectation.json + + +*** Test Cases *** +037_08_01 Query Context Source Registration Without Temporal Query + [Documentation] Check that you can query context source registrations. If no temporal query is present, only Context Source Registrations for Context Sources providing latest information are considered + [Tags] csr-query 5_10_2 + ${response}= Query Context Source Registrations context=${ngsild_test_suite_context} type=Vehicle + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Context Source Registrations elements + ... ${expectation_file_path} + ... ${expected_context_source_registration_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Context Source Registration + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Create Context Source Registration ${context_source_registration_payload} + Set Suite Variable ${context_source_registration_id} + +Delete Created Context Source Registration + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_09.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_09.robot new file mode 100644 index 0000000000000000000000000000000000000000..be3044f4b168d115592b5d9998dece4d11a43d8a --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_09.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that you can query context source registrations. If present, the temporal query is matched against the observationInterval or the managementInterval + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Created Context Source Registrations +Test Template Query Context Source Registration Matching Temporal Query + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${context_source_registration_observation_interval_payload_file_path}= csourceRegistrations/context-source-registration-observationInterval-sample.jsonld +${context_source_registration_management_interval_payload_file_path}= csourceRegistrations/context-source-registration-managementInterval-sample.jsonld +${observation_interval_expectation_file_path}= csourceRegistrations/expectations/context-source-registrations-037-09-01-expectation.json +${management_interval_expectation_file_path}= csourceRegistrations/expectations/context-source-registrations-037-09-02-expectation.json + + +*** Test Cases *** PAYLOAD_FILE_PATH TIMEPROPERTY EXPECTATION_FILE_PATH +037_09_01 Observation Interval With observedAt + [Tags] csr-query 5_10_2 + ${context_source_registration_observation_interval_payload_file_path} observedAt ${observation_interval_expectation_file_path} +037_09_02 Observation Interval Without timeproperty + [Tags] csr-query 5_10_2 + ${context_source_registration_observation_interval_payload_file_path} ${EMPTY} ${observation_interval_expectation_file_path} +037_09_03 Management Interval With createdAt + [Tags] csr-query 5_10_2 + ${context_source_registration_management_interval_payload_file_path} createdAt ${management_interval_expectation_file_path} +037_09_04 Management Interval With modifiedAt + [Tags] csr-query 5_10_2 + ${context_source_registration_management_interval_payload_file_path} modifiedAt ${management_interval_expectation_file_path} + + +*** Keywords *** +Query Context Source Registration Matching Temporal Query + [Documentation] Check that you can query context source registrations. If present, the temporal query is matched against the observationInterval or the managementInterval + [Arguments] ${payload_file_path} ${timeproperty} ${expectation_file_path} + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${payload_file_path} + ... ${context_source_registration_id} + ${create_response}= Create Context Source Registration ${context_source_registration_payload} + Set Suite Variable ${context_source_registration_id} + ${response}= Query Context Source Registrations + ... context=${ngsild_test_suite_context} + ... type=Building + ... timeproperty=${timeproperty} + ... timerel=before + ... timeAt=2021-08-01T22:00:00Z + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Context Source Registrations elements + ... ${expectation_file_path} + ... ${expected_context_source_registration_ids} + ... ${response.json()} + +Delete Created Context Source Registrations + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_10.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_10.robot new file mode 100644 index 0000000000000000000000000000000000000000..cf87f23264aa588aa99f7a7b4a60b3142f7e9e08 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_10.robot @@ -0,0 +1,70 @@ +*** Settings *** +Documentation Check that you can query context source registrations. If present, the conditions specified by the context source query match the respective Context Source Properties + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registrations +Test Teardown Delete Created Context Source Registrations +Test Template Query Context Source Registration With Query Params + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${first_context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${second_context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-detailed-information-sample.jsonld +${third_context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-csourceProperty-sample.jsonld + + +*** Test Cases *** QUERY_PARAM_NAME QUERY_PARAM_VALUE EXPECTATION_FILE_PATH EXPECTED_CONTEXT_SOURCE_REGISTRATION_IDS +037_10_01 With list of Entity Ids + [Tags] csr-query 5_10_2 + id ${first_context_source_registration_id},${third_context_source_registration_id} csourceRegistrations/expectations/context-source-registrations-037-10-01-expectation.json ${first_context_source_registration_id},${third_context_source_registration_id} +037_10_02 With NGSI-LD Query + [Tags] csr-query 5_10_2 + q csourceProperty1=="aValue" csourceRegistrations/expectations/context-source-registrations-037-10-02-expectation.json ${third_context_source_registration_id} + + +*** Keywords *** +Query Context Source Registration With Query Params + [Documentation] Check that you can query context source registrations. If present, the conditions specified by the context source query match the respective Context Source Properties + [Arguments] + ... ${query_param_name} + ... ${query_param_value} + ... ${expectation_file_path} + ... @{expected_context_source_registration_ids} + ${response}= Query Context Source Registrations + ... context=${ngsild_test_suite_context} + ... ${query_param_name}=${query_param_value} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Context Source Registrations elements + ... ${expectation_file_path} + ... ${expected_context_source_registration_ids} + ... ${response.json()} + +Setup Initial Context Source Registrations + ${first_context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${second_context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${third_context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${first_context_source_registration_payload}= Load Test Sample + ... ${first_context_source_registration_payload_file_path} + ... ${first_context_source_registration_id} + ${second_context_source_registration_payload}= Load Test Sample + ... ${second_context_source_registration_payload_file_path} + ... ${second_context_source_registration_id} + ${third_context_source_registration_payload}= Load Test Sample + ... ${third_context_source_registration_payload_file_path} + ... ${third_context_source_registration_id} + Create Context Source Registration ${first_context_source_registration_payload} + Create Context Source Registration ${second_context_source_registration_payload} + Create Context Source Registration ${third_context_source_registration_payload} + Set Test Variable ${first_context_source_registration_id} + Set Test Variable ${second_context_source_registration_id} + Set Test Variable ${third_context_source_registration_id} + +Delete Created Context Source Registrations + Delete Context Source Registration ${first_context_source_registration_id} + Delete Context Source Registration ${second_context_source_registration_id} + Delete Context Source Registration ${third_context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_11.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_11.robot new file mode 100644 index 0000000000000000000000000000000000000000..42da3269d92a9b68fe320c640f66b2a9e5a3d843 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_11.robot @@ -0,0 +1,72 @@ +*** Settings *** +Documentation Check that you can query context source registrations with providing page and limit parameters, pagination logic shall be in place as mandated by clause 5.5.9. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registrations +Test Teardown Delete Created Context Source Registrations +Test Template Query Context Source Registration With Limit And Offset Parameters + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${first_context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${second_context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-location-sample.jsonld +${third_context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-detailed-information-sample.jsonld + + +*** Test Cases *** LIMIT OFFSET EXPECTED_NUMBER PREV_LINK NEXT_LINK +037_11_01 Query Second Subscription + [Tags] csr-query 5_10_2 + ${1} ${2} ${1} ;rel="prev";type="application/ld+json" ;rel="next";type="application/ld+json" +037_11_02 Query Last Subscription + [Tags] csr-query 5_10_2 + ${2} ${2} ${1} ;rel="prev";type="application/ld+json" ${EMPTY} +037_11_03 Query All Subscriptions + [Tags] csr-query 5_10_2 + ${15} ${0} ${2} ${EMPTY} ${EMPTY} + + +*** Keywords *** +Query Context Source Registration With Limit And Offset Parameters + [Documentation] Check that you can query context source registrations with providing page and limit parameters, pagination logic shall be in place as mandated by clause 5.5.9. + [Arguments] ${limit} ${offset} ${expected_number} ${prev_link} ${next_link} + ${response}= Query Context Source Registrations + ... context=${ngsild_test_suite_context} + ... type=Building + ... limit=${limit} + ... offset=${offset} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Number Of Entities + ... ContextSourceRegistration + ... ${expected_number} + ... ${response.json()} + Check Pagination Prev And Next Headers ${prev_link} ${next_link} ${response.json()} + +Setup Initial Context Source Registrations + ${first_context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${second_context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${third_context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${first_context_source_registration_payload}= Load Test Sample + ... ${first_context_source_registration_payload_file_path} + ... ${first_context_source_registration_id} + ${second_context_source_registration_payload}= Load Test Sample + ... ${second_context_source_registration_payload_file_path} + ... ${second_context_source_registration_id} + ${third_context_source_registration_payload}= Load Test Sample + ... ${third_context_source_registration_payload_file_path} + ... ${third_context_source_registration_id} + Create Context Source Registration ${first_context_source_registration_payload} + Create Context Source Registration ${second_context_source_registration_payload} + Create Context Source Registration ${third_context_source_registration_payload} + Set Test Variable ${first_context_source_registration_id} + Set Test Variable ${second_context_source_registration_id} + Set Test Variable ${third_context_source_registration_id} + +Delete Created Context Source Registrations + Delete Context Source Registration ${first_context_source_registration_id} + Delete Context Source Registration ${second_context_source_registration_id} + Delete Context Source Registration ${third_context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_01.robot b/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..b0a321ae10e57ea9dcc3ce8fa36aad57947b6384 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_01.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that you cannot retrieve a Context Source Registration, if the context source registration id is not a valid URI + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Retrieve Context Source Registration With An Invalid Id + + +*** Test Cases *** ID +036_01_01 Invalid Id + [Tags] csr-retrieve 5_10_1 + invalidUri + + +*** Keywords *** +Retrieve Context Source Registration With An Invalid Id + [Documentation] Check that you cannot retrieve a Context Source Registration, if the context source registration id is not a valid URI + [Arguments] ${id} + ${response}= Retrieve Context Source Registration + ... context_source_registration_id=${id} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_02.robot b/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..0a0f6a85e32499f0ce1cf1294200364788a6d4ba --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_02.robot @@ -0,0 +1,19 @@ +*** Settings *** +Documentation Check that you cannot retrieve a Context Source Registration, if the NGSI-LD endpoint does not know about the target context source registration, because there is no existing context source registration whose id (URI) is equivalent + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Test Cases *** +036_02_01 Retrieve Unknown Context Source Registration + [Documentation] Check that you cannot retrieve a Context Source Registration, if the NGSI-LD endpoint does not know about the target context source registration, because there is no existing context source registration whose id (URI) is equivalent + [Tags] csr-retrieve 5_10_1 + ${response}= Retrieve Context Source Registration + ... context_source_registration_id=urn:ngsi-ld:ContextSourceRegistration:unknowRegistration + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_03.robot b/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..2e708d16fca654422fd59cb8089f7d578a797140 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_03.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Check that you can retrieve a Context Source Registration. Term to URI expansion of Attribute names shall be observed. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Context Source Registration +Suite Teardown Delete Created Context Source Registration + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${expectation_file_path}= csourceRegistrations/expectations/context-source-registration-expanded-format.json + + +*** Test Cases *** +036_03_01 Retrieve Context Source Registration With Default Core Context + [Documentation] Check that you can retrieve a Context Source Registration. Term to URI expansion of Attribute names shall be observed. + [Tags] csr-retrieve 5_10_1 + ${response}= Retrieve Context Source Registration + ... context_source_registration_id=${context_source_registration_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Context Source Registration element + ... ${expectation_file_path} + ... ${context_source_registration_id} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Context Source Registration + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Create Context Source Registration ${context_source_registration_payload} + Set Suite Variable ${context_source_registration_id} + +Delete Created Context Source Registration + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_04.robot b/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..eeb98d89c4e543f4711a151db0654deae3dc7fe9 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_04.robot @@ -0,0 +1,43 @@ +*** Settings *** +Documentation Check that you can retrieve a Context Source Registration + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Context Source Registration +Suite Teardown Delete Created Context Source Registration + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${expectation_file_path}= csourceRegistrations/expectations/context-source-registration.json + + +*** Test Cases *** +036_04_01 Retrieve Context Source Registration + [Documentation] Check that you can retrieve a Context Source Registration + [Tags] csr-retrieve 5_10_1 + ${response}= Retrieve Context Source Registration + ... context_source_registration_id=${context_source_registration_id} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Context Source Registration element + ... ${expectation_file_path} + ... ${context_source_registration_id} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Context Source Registration + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Create Context Source Registration ${context_source_registration_payload} + Set Suite Variable ${context_source_registration_id} + +Delete Created Context Source Registration + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_05.robot b/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..4a0d3d3ffb4ccf589d7c6973f99671fa49c82bd6 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_05.robot @@ -0,0 +1,52 @@ +*** Settings *** +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 + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration +Test Teardown Delete Created Context Source Registration +Test Template Review JSON-LD resolution when retrieving a context source registration + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${expectation_file_path_compacted}= csourceRegistrations/expectations/context-source-registration.json +${expectation_file_path_expanded}= csourceRegistrations/expectations/context-source-registration-expanded-format.json + + +*** Test Cases *** CONTEXT EXPECTED_PAYLOAD +036_05_01 EmptyJsonLdContext + [Tags] csr-retrieve 6_3_5 + ${EMPTY} ${expectation_file_path_expanded} +036_05_02 CreationTimeJsonLdContext + [Tags] csr-retrieve 6_3_5 + ${ngsild_test_suite_context} ${expectation_file_path_compacted} + + +*** Keywords *** +Review JSON-LD resolution when retrieving a context source registration + [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 + [Arguments] ${context} ${expected_payload} + ${response}= Retrieve Context Source Registration + ... context_source_registration_id=${context_source_registration_id} + ... context=${context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Context Source Registration element + ... ${expected_payload} + ... ${context_source_registration_id} + ... ${response.json()} + +Setup Initial Context Source Registration + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Create Context Source Registration ${context_source_registration_payload} + Set Test Variable ${context_source_registration_id} + +Delete Created Context Source Registration + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..42f6ec072aa5dda7c6ee0ea74b2b2f4117f9d961 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot @@ -0,0 +1,29 @@ +*** Settings *** +Documentation Check that you can delete a context source registration by id + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= context-source-registration-sample.jsonld + + +*** Test Cases *** +035_01_01 Delete a context source registration by id + [Documentation] Check that you can delete a context source registration by id + [Tags] csr-delete 5_9_4 + ${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} + ${create_response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${create_response.status_code} + ${response}= Delete Context Source Registration With Return ${registration_id} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + ... context=${ngsild_test_suite_context} + Check SUT Not Containing Resource ${response1.status_code} diff --git a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_02.robot b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..6ec5936d178d0b49e2a2742a0e1903bfda27de76 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_02.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that you cannot delete a context source registration under some conditions + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Context Source Registration +Test Teardown Delete Created Context Source Registrations +Test Template Delete A Context Source + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${filename}= context-source-registration-sample.jsonld + + +*** Test Cases *** INVALID_REGISTRATION_ID EXPECTED_STATUS_CODE PROBLEM_TYPE +035_02_01 Delete a Context Source Registration if the Id is not present + [Tags] csr-delete 5_9_4 + ${EMPTY} 405 ${EMPTY} +035_02_02 Delete a Context Source Registration if the Id is not a valid URI + [Tags] csr-delete 5_9_4 + invalidURI 400 ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Delete A Context Source + [Documentation] Check that you cannot delete a context source registration under some conditions + [Arguments] ${invalid_registration_id} ${expected_status_code} ${problem_type} + ${response}= Delete Context Source Registration With Return ${invalid_registration_id} + Check Response Status Code ${expected_status_code} ${response.status_code} + IF "${problem_type}"!="${EMPTY}" + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + END + +Delete Created Context Source Registrations + Delete Context Source Registration ${registration_id} + +Create Initial Context Source Registration + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Test Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/csourceRegistrations/${filename} + ${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_03.robot b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..57ea1288be3e08c13478ef134bcb7bfb69938120 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_03.robot @@ -0,0 +1,21 @@ +*** Settings *** +Documentation Check that you cannot delete a context source registration by id if the id is not known to the system + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= context-source-registration-simple-sample.jsonld + + +*** Test Cases *** +035_03_01 Delete a context source registration by id + [Documentation] Check that you cannot delete a context source registration by id if the id is not known to the system + [Tags] csr-delete 5_9_4 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${response}= Delete Context Source Registration With Return ${registration_id} + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..4937159967700ce8f2b733a87519ab717e06a421 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot @@ -0,0 +1,37 @@ +*** Settings *** +Documentation Check that you can create a context source registration with specific ID and expiration date + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Context Source Registrations + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= csourceRegistrations/context-source-registration-with-expiration-sample.jsonld + + +*** Test Cases *** +033_01_01 Create Context Source Registration With Specific Date Expiration Date + [Documentation] Check that you can create a context source registration with specific ID and expiration date + [Tags] csr-create 5_9_2 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List ${status_regex_expr} + Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} + + +*** Keywords *** +Delete Created Context Source Registrations + Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..969d976439364bd202b0ef751c28de25d4d9871b --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Check that you can create a context source registration that never expires + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Context Source Registrations + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld + + +*** Test Cases *** +033_01_02 Create Context Source Registration That Never Expires + [Documentation] Check that you can create a context source registration that never expires + [Tags] csr-create 5_9_2 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${registration_id} ${response.headers} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List ${status_regex_expr} + Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} + + +*** Keywords *** +Delete Created Context Source Registrations + Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..bba76343bba3d32e8eb6876357be7cfb70bdefda --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Check that you can create a context source registration without specifying an ID + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Context Source Registrations + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= csourceRegistrations/context-source-registration-no-id-sample.jsonld + + +*** Test Cases *** +033_01_03 Create Context Source Registration Without Specifying an ID + [Documentation] Check that you can create a context source registration without specifying an ID + [Tags] csr-create 5_9_2 + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${response}= Create Context Source Registration With Return ${payload} + Check Response Status Code 201 ${response.status_code} + ${registration_id}= Check Response Headers ID Not Empty ${response.headers} + Set Suite Variable ${registration_id} + ${id_dict}= Create Dictionary id=${registration_id} + ${registration_payload}= Add Object To Json ${payload} $ ${id_dict} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List ${status_regex_expr} + Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} + + +*** Keywords *** +Delete Created Context Source Registrations + Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..ab4f1485cd3c82f046d13c217755ba6a33ff5444 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot @@ -0,0 +1,24 @@ +*** Settings *** +Documentation Check that you cannot create a context source with invalid content + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Library OperatingSystem + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= csourceRegistrations/context-source-registration-invalid-sample.jsonld + + +*** Test Cases *** +033_02_01 Create a context source registration with invalid JSON file + [Documentation] Create a context source registration with invalid JSON file + [Tags] csr-create 5_9_2 + ${subscription_payload}= Get File ${EXECDIR}/data/${registration_payload_file_path} + ${response}= Create Context Source Registration + ... ${subscription_payload} + Check Response Status Code 400 ${response.status_code} + Check Response Body Type When Using Session Request ${response.json()} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Title When Using Session Request ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_03.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..1af3676f1ff6c84e2f19fb5a53ac716dc7c997ea --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_03.robot @@ -0,0 +1,37 @@ +*** Settings *** +Documentation Check that you cannot create a context source registration that already exists + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create New Context Source Registration +Test Teardown Delete Created Context Source Registrations + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${filename}= csourceRegistrations/context-source-registration-sample.jsonld + + +*** Test Cases *** +033_03_01 Create a context source registration that already exists + [Documentation] Check that you cannot create a context source registration that already exists + [Tags] csr-create 5_9_2 + ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 409 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} + + +*** Keywords *** +Delete Created Context Source Registrations + Delete Context Source Registration ${registration_id} + +Create New Context Source Registration + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Test Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/${filename} + ${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response.status_code} + Set Test Variable ${updated_payload} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_04.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..9a4bb29d18d226d955044ce98e8b22c246743e8a --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_04.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Context Source Registrations + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.json + + +*** Test Cases *** +033_04_01 Create one context source registration using a provided Link header with JSON content type with Context + [Documentation] Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" + [Tags] csr-create 6_3_5 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return + ... ${updated_payload} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code 201 ${response.status_code} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + ... context=${ngsild_test_suite_context} + Check JSON Value In Response Body + ... ['information'][0]['entities'][0]['type'] + ... Building + ... ${response1.json()} + +033_04_02 Create one context source registration using a provided Link header with JSON content type without Context + [Documentation] Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" + [Tags] csr-create 6_3_5 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return + ... ${updated_payload} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code 201 ${response.status_code} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + Check JSON Value In Response Body + ... ['information'][0]['entities'][0]['type'] + ... https://ngsi-ld-test-suite/context#Building + ... ${response1.json()} + + +*** Keywords *** +Delete Created Context Source Registrations + Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_05.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..31efe47e817300777335ff759eaafbaf451e0dd9 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_05.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Context Source Registrations + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.json + + +*** Test Cases *** +033_05_01 Create one context source registration using the default context with JSON content type with Context + [Documentation] Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context and retrieve the information with ngsild context + [Tags] csr-create 6_3_5 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return + ... ${updated_payload} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 201 ${response.status_code} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + ... context=${ngsild_test_suite_context} + Check JSON Value In Response Body + ... ['information'][0]['entities'][0]['type'] + ... ngsi-ld:default-context/Building + ... ${response1.json()} + +033_05_02 Create one context source registration using the default context with JSON content type without Context + [Documentation] Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context and retrieve the information without ngsild context + [Tags] csr-create 6_3_5 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return + ... ${updated_payload} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 201 ${response.status_code} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + Check JSON Value In Response Body + ... ['information'][0]['entities'][0]['type'] + ... Building + ... ${response1.json()} + + +*** Keywords *** +Delete Created Context Source Registrations + Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_06.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..8247cb993a73295bf0e00ce435d0092afa11ea83 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_06.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/json" and the request payload body (as JSON) contains a "@context" term + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld + + +*** Test Cases *** +033_06_01 Create one context source registration containing a JSON-LD @context with a JSON content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/json" and the request payload body (as JSON) contains a "@context" term + [Tags] csr-create 6_3_5 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return + ... ${updated_payload} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_07.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..3010951f0801a0b2c34a8d32c16a06fcfb702f52 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_07.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Context Source Registrations + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld + + +*** Test Cases *** +033_07_01 Create one context source registration using a JSON-LD @context obtained from the request payload with Context + [Documentation] Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" and retrieve the information with ngsild context + [Tags] csr-create 6_3_5 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${updated_payload}= Update Value To JSON ${payload} $.id ${registration_id} + ${response}= Create Context Source Registration With Return + ... ${updated_payload} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + ... context=${ngsild_test_suite_context} + Check JSON Value In Response Body + ... ['information'][0]['entities'][0]['type'] + ... Vehicle + ... ${response1.json()} + +033_07_02 Create one context source registration using a JSON-LD @context obtained from the request payload without Context + [Documentation] Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" and retrieve the information without ngsild context + [Tags] csr-create 6_3_5 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${updated_payload}= Update Value To JSON ${payload} $.id ${registration_id} + ${response}= Create Context Source Registration With Return + ... ${updated_payload} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + Check JSON Value In Response Body + ... ['information'][0]['entities'][0]['type'] + ... https://ngsi-ld-test-suite/context#Vehicle + ... ${response1.json()} + + +*** Keywords *** +Delete Created Context Source Registrations + Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_08.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..bcd080707a20e13b89644b903c68a7b4245995c2 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_08.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and the request payload body does not contain a @context term + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.json + + +*** Test Cases *** +033_08_01 Create one context source registration not containing a JSON-LD @context with a JSON-LD content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and the request payload body does not contain a @context term + [Tags] csr-create 6_3_5 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return + ... ${updated_payload} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_09.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_09.robot new file mode 100644 index 0000000000000000000000000000000000000000..cc17f1d982645163b5aa394c090cb2b89be27f54 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_09.robot @@ -0,0 +1,29 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and a JSON-LD Link header is present in the incoming HTTP request + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld + + +*** Test Cases *** +033_09_01 Create one context source registration with a Link header and a JSON-LD content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and a JSON-LD Link header is present in the incoming HTTP request + [Tags] csr-create 6_3_5 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return + ... ${updated_payload} + ... ${CONTENT_TYPE_LD_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_10.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_10.robot new file mode 100644 index 0000000000000000000000000000000000000000..80d52d135964076747a314a1fb2cc05745525195 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_10.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Check that you cannot create a context source with invalid content + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Create Context Source With Invalid Content + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: + + +*** Test Cases *** +033_10_01 Create a context source registration with a different data structure than CSourceRegistration data type + csourceRegistrations/context-source-registration-invalid-structure-sample.jsonld +033_10_02 Create a context source registration with a date in the past + csourceRegistrations/context-source-registration-past-expiration-sample.jsonld + + +*** Keywords *** +Create Context Source With Invalid Content + [Documentation] Check that you cannot create a context source with invalid content + [Tags] csr-create 6_3_5 + [Arguments] ${filename} + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load JSON From File ${EXECDIR}/data/${filename} + ${updated_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 400 ${response.status_code} + Check Response Headers Containing URI set to ${registration_id} ${response.headers} diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_01.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..28d67a239951076caf5b22edcda85c6b32be55f9 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_01.robot @@ -0,0 +1,54 @@ +*** Settings *** +Documentation Check that you can update a context source registration by id + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Initialize the Test Case +Test Teardown Delete Updated Context Source Registration +Test Template Update A Context Source + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: + + +*** Test Cases *** FILENAME UPDATE_FILENAME +034_01_01 Update a context source registration by id + [Tags] csr-update 5_9_3 + context-source-registration-sample.jsonld context-source-registration-update-sample.json + + +*** Keywords *** +Update A Context Source + [Documentation] Check that you can update a context source registration by id + [Arguments] ${filename} ${update_filename} + Set Test Variable ${filename} + ${fragment}= Load JSON From File ${EXECDIR}/data/csourceRegistrations/fragments/${update_filename} + ${registration_update_fragment}= Update Value To JSON ${fragment} $.id ${registration_id} + ${response}= Update Context Source Registration With Return + ... ${registration_id} + ... ${registration_update_fragment} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + Check JSON Value In Response Body + ... ['endpoint'] + ... http://my.new.csource.org:1026 + ... ${response1.json()} + +Delete Updated Context Source Registration + Delete Context Source Registration ${registration_id} + +Initialize the Test Case + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Test Variable ${registration_id} + ${payload}= Load JSON From File + ... ${EXECDIR}/data/csourceRegistrations/context-source-registration-sample.jsonld + ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} + Set Test Variable ${registration_payload} + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..ec408e9cbb037e0370fa122e7886ae009e897b44 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that you cannot update a context source registration under some conditions + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Context Source Registration +Test Teardown Delete Initial Context Source Registration +Test Template Update A Context Source + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${filename}= context-source-registration-sample.jsonld +${registration_payload_file_path}= context-source-registration-invalid-sample.jsonld +${reason_400}= Bad Request + + +*** Test Cases *** REGISTRATION_ID FRAGMENT_FILENAME EXPECTED_STATUS_CODE PROBLEM_TYPE +034_02_01 Update a context source registration by id if the Id is not a valid URI + invalidURI fragments/context-source-registration-different-type-sample.jsonld 400 ${ERROR_TYPE_BAD_REQUEST_DATA} +034_02_02 Update a context source registration if the request body is not of the same data type + ${valid_registration_id} fragments/context-source-registration-different-type-sample.jsonld 400 ${ERROR_TYPE_BAD_REQUEST_DATA} +034_02_03 Update a context source registration if you attempt to remove a mandatory property + ${valid_registration_id} context-source-registration-invalid-sample.jsonld 400 ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Update A Context Source + [Documentation] Check that you cannot update a context source registration under some conditions + [Tags] csr-update 5_9_3 + [Arguments] ${registration_id} ${fragment_filename} ${expected_status_code} ${problem_type} + ${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} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${expected_status_code} ${response.status_code} + Check Response Reason set to ${response.reason} ${reason_400} + Check Response Body Containing ProblemDetails Element ${response.json()} ${problem_type} + +Create Initial Context Source Registration + ${valid_registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${valid_registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/csourceRegistrations/${filename} + ${updated_payload}= Update Value To JSON ${payload} $.id ${valid_registration_id} + ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Context Source Registration + Delete Context Source Registration ${valid_registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_03.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..b27e8dd6e53f652fd57af757436b0b252715fca2 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_03.robot @@ -0,0 +1,29 @@ +*** Settings *** +Documentation Check that you cannot update a context source registration by id if the id is not known to the system + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${filename}= context-source-registration-sample.jsonld +${reason_404}= Not Found + + +*** Test Cases *** +034_03_01 Update a context source registration by id if the id is not known to the system + [Documentation] Check that you cannot update a context source registration by id if the id is not known to the system + [Tags] csr-update 5_9_3 + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${registration_id} + ${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} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 404 ${response.status_code} + Check Response Reason set to ${response.reason} ${reason_404} + Check Response Body Containing ProblemDetails Element ${response.json()} ${ERROR_TYPE_RESOURCE_NOT_FOUND} diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_04.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..faef017ac06b9a1f443d85b3e7ddf14af28e0d70 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_04.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Check that you cannot update a context source registration under some conditions + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Context Source Registration +Test Teardown Delete Initial Context Source Registration + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${filename}= context-source-registration-sample.jsonld +${registration_payload_file_path}= context-source-registration-invalid-json-sample.json + + +*** Test Cases *** +034_04_01 Update a context source registration if the request body is invalid + [Documentation] Check that you cannot update a context source registration if the request body is invalid + [Tags] csr-update 5_9_3 + ${response}= Update Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + Check Response Status Code 400 ${response.status_code} + Check Response Body Type When Using Session Request ${response.json()} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Title When Using Session Request ${response.json()} + + +*** Keywords *** +Create Initial Context Source Registration + ${valid_registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Test Variable ${valid_registration_id} + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Test Variable ${registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/csourceRegistrations/${filename} + ${updated_payload}= Update Value To JSON ${payload} $.id ${registration_id} + ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Context Source Registration + Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_05.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..4b04131f0d8872a5545ddd70d0e21a90ece6837c --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_05.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that you can update a context source registration by id + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Initialize the Test Case +Test Teardown Delete Updated Context Source Registration +Test Template Update A Context Source + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: + + +*** Test Cases *** FILENAME UPDATE_FILENAME +034_05_01 Update a context source registration to never expire + [Tags] csr-update 5_9_3 + context-source-registration-with-expiration-sample.jsonld context-source-registration-null-expiresAt.json + + +*** Keywords *** +Update A Context Source + [Documentation] Check that you can update a context source registration by id + [Arguments] ${filename} ${update_filename} + Set Test Variable ${filename} + ${fragment}= Load JSON From File ${EXECDIR}/data/csourceRegistrations/fragments/${update_filename} + ${registration_update_fragment}= Update Value To JSON ${fragment} $.id ${registration_id} + ${response}= Update Context Source Registration With Return + ... ${registration_id} + ... ${registration_update_fragment} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + Check JSON Value Not In Response Body + ... $.expiresAt + ... ${response1.json()} + +Delete Updated Context Source Registration + Delete Context Source Registration ${registration_id} + +Initialize the Test Case + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Test Variable ${registration_id} + ${payload}= Load JSON From File + ... ${EXECDIR}/data/csourceRegistrations/context-source-registration-sample.jsonld + ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} + Set Test Variable ${registration_payload} + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_06.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..e4ceac334789b2510745641b01219bc91229aa42 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_06.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that you cannot update a context source registration if the Id is not present + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Context Source Registration +Test Teardown Delete Initial Context Source Registration +Test Template Update A Context Source + + +*** Variables *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${filename}= context-source-registration-sample.jsonld +${registration_payload_file_path}= context-source-registration-invalid-sample.jsonld +${reason_405}= Method Not Allowed + + +*** Test Cases *** FRAGMENT_FILENAME EXPECTED_STATUS_CODE REASON +034_06_01 Update a context source registration by id if the Id is not present + fragments/context-source-registration-different-type-sample.jsonld 405 ${reason_405} + + +*** Keywords *** +Update A Context Source + [Documentation] Check that you cannot update a context source registration under some conditions + [Tags] csr-update 5_9_3 + [Arguments] ${fragment_filename} ${expected_status_code} ${reason} + ${fragment}= Load JSON From File ${EXECDIR}/data/csourceRegistrations/${fragment_filename} + ${fragment_with_id}= Update Value To JSON ${fragment} $.id ${EMPTY} + ${response}= Update Context Source Registration With Return + ... ${EMPTY} + ... ${fragment_with_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${expected_status_code} ${response.status_code} + Check Response Reason set to ${response.reason} ${reason} + Check Response Does Not Contain Body ${response} + +Create Initial Context Source Registration + ${valid_registration_id}= Generate Random Entity Id ${registration_id_prefix} + Set Suite Variable ${valid_registration_id} + ${payload}= Load JSON From File ${EXECDIR}/data/csourceRegistrations/${filename} + ${updated_payload}= Update Value To JSON ${payload} $.id ${valid_registration_id} + ${response}= Create Context Source Registration With Return ${updated_payload} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Context Source Registration + Delete Context Source Registration ${valid_registration_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_01.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..2162618cff2b2ebcdea9602bce2456f6ab000cfc --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_01.robot @@ -0,0 +1,48 @@ +*** Settings *** +Documentation Check that if the created context source registration subscription defines a timeInterval member, a cSourceNotification will be sent periodically, initially on subscription and when the time interval is reached + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Setup Initial Context Source Registration +Suite Teardown Delete Created Context Source Registration And Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-timeInterval-sample.jsonld + + +*** Test Cases *** +047_01_01 Receive cSourceNotification Periodically And Initially On Subscription + [Documentation] Check that if the created context source registration subscription defines a timeInterval member, a cSourceNotification will be sent periodically, initially on subscription and when the time interval is reached + [Tags] csrsub-notification 5_11_7 + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Set Suite Variable ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + # Wait for 15 seconds to check if another notification was sent + Wait for notification timeout=${15} + + +*** Keywords *** +Setup Initial Context Source Registration + Start Local Server + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Create Context Source Registration ${context_source_registration_payload} + Set Suite Variable ${context_source_registration_id} + +Delete Created Context Source Registration And Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_02.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..0c53e8595ed828a78cb3cbbb9ee9b0d259387528 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_02.robot @@ -0,0 +1,63 @@ +*** Settings *** +Documentation Check that if the created context source registration subscription does not define a timeInterval member, a cSourceNotification, with the appropriate trigger reason in the "triggerReason" member, will be sent initially on subscription and whenever there is a change of a matching Context Source Registration + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Create Initial Context Source Registration and Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Context Source Registration Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${update_fragment_file_path}= csourceRegistrations/fragments/context-source-registration-update-sample.json + + +*** Test Cases *** +047_02_01 Receive cSourceNotification Initially On Subscription And Whenever There Is A Change Of A Matching Context Source Registration + [Documentation] Check that if the created context source registration subscription does not define a timeInterval member, a cSourceNotification, with the appropriate trigger reason in the "triggerReason" member, will be sent initially on subscription and whenever there is a change of a matching Context Source Registration + [Tags] csrsub-notification 5_11_7 + ${update_fragment}= Load Test Sample ${update_fragment_file_path} + ${response}= Update Context Source Registration ${context_source_registration_id} ${update_fragment} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=updated + + +*** Keywords *** +Create Initial Context Source Registration and Context Source Registration Subscription + Start Local Server + + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${context_source_registration_id} + Set Suite Variable ${subscription_id} + + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + + Create Context Source Registration ${context_source_registration_payload} + + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Set Suite Variable ${expected_context_source_registration_ids} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=newlyMatching + +Delete Created Context Source Registration And Context Source Registration Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_03.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..0b16106de8dfd05ca58b4f0207a50d1b110abe9a --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_03.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that instead of providing the original context source registration, implementations should return context source registration information relevant for the subscription, in particular only matching RegistrationInfo elements + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-building-and-bus-entities-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** +047_03_01 Receive cSourceNotification With Relevant Information + [Documentation] Check that instead of providing the original context source registration, implementations should return context source registration information relevant for the subscription, in particular only matching RegistrationInfo elements + [Tags] csrsub-notification 5_11_7 + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Set Suite Variable ${context_source_registration_id} + ${response}= Create Context Source Registration ${context_source_registration_payload} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + @{expected_notification_data_entities}= Create List Building + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=newlyMatching + ... expected_notification_data_entities=${expected_notification_data_entities} + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + Start Local Server + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_04.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..6584958c4562d4f9eacf20e0994e960cfdbd8cc5 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_04.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation The structure of the csource notification message shall be as mandated by clause 5.3.2 + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** +047_04_01 Receive cSourceNotification With Compliant Structure + [Documentation] The structure of the csource notification message shall be as mandated by clause 5.3.2 + [Tags] csrsub-notification 5_11_7 + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Set Suite Variable ${context_source_registration_id} + ${response}= Create Context Source Registration ${context_source_registration_payload} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=newlyMatching + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + Start Local Server + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_05.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..dd559ba87eaef0ddec615e59ca793c4c61fe367f --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_05.robot @@ -0,0 +1,55 @@ +*** Settings *** +Documentation Check that if a cSourceNotification is sent successfully to the "endpoint" member, the "notification.timesSent" member shall be incremented by one and the "notification.lastSuccess" and "notification.lastNotification" members shall be updated with the current timestamp and the status of the context source registration subscription shall be updated to "ok" + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${notification_expectation_file_path}= notifications/expectations/1-timesSent-ok.json + + +*** Test Cases *** +047_05_01 If A cSourceNotification Is Successfully Sent The Notification Member Shall Be Updated + [Documentation] Check that if a cSourceNotification is sent successfully to the "endpoint" member, the "notification.timesSent" member shall be incremented by one and the "notification.lastSuccess" and "notification.lastNotification" members shall be updated with the current timestamp and the status of the context source registration subscription shall be updated to "ok" + [Tags] csrsub-notification 5_11_7 + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Set Suite Variable ${context_source_registration_id} + ${create_response}= Create Context Source Registration ${context_source_registration_payload} + Wait for notification + ${response}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + @{expected_notification_additional_members}= Create List lastNotification lastSuccess + Check NotificationParams + ... ${notification_expectation_file_path} + ... ${expected_notification_additional_members} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + Start Local Server + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_06.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..36875da4ecc033dd797ee0c63844cb9b579fbdbc --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_06.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that if a cSourceNotification is not sent successfully, the "notification.timesSent" member shall be incremented by one and the notification.lastFailure" and "notification.lastNotification" members shall be updated with the current timestamp and the status of the context source registration subscription shall be updated to "failed" + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-unreachable-endpoint-sample.jsonld +${notification_expectation_file_path}= notifications/expectations/1-timesSent-failed.json + + +*** Test Cases *** +047_06_01 If A cSourceNotification Is Not Successfully Sent The Notification Member Shall Be Updated + [Documentation] Check that if a cSourceNotification is not sent successfully, the "notification.timesSent" member shall be incremented by one and the notification.lastFailure" and "notification.lastNotification" members shall be updated with the current timestamp and the status of the context source registration subscription shall be updated to "failed" + [Tags] csrsub-notification 5_11_7 + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Set Suite Variable ${context_source_registration_id} + ${create_response}= Create Context Source Registration ${context_source_registration_payload} + Wait for no notification + ${response}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + @{expected_notification_additional_members}= Create List lastNotification lastFailure + Check NotificationParams + ... ${notification_expectation_file_path} + ... ${expected_notification_additional_members} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + Start Local Server + ${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} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_07.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..7f51c7287e8404045ae4e7997c751932c7df7d63 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_07.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that a cSourceNotification shall only be sent if and only if the status of the corresponding subscription is active, neither paused or expired + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Subscription +Test Template Do Not Receive cSourceNotification If Subscription Status Is Not Active + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** FILEPATH +047_07_01 PausedSubscription + [Tags] csrsub-notification 5_11_7 + csourceSubscriptions/fragments/subscription-isActive-update-sample.json +047_07_02 ExpiredSubscription + [Tags] csrsub-notification 5_11_7 + csourceSubscriptions/fragments/subscription-expiresAt-update-sample.json + + +*** Keywords *** +Do Not Receive cSourceNotification If Subscription Status Is Not Active + [Documentation] Check that a cSourceNotification shall only be sent if and only if the status of the corresponding subscription is active, neither paused or expired + [Arguments] ${filepath} + ${subscription_update_fragment}= Load Test Sample ${filepath} + ${response}= Update Context Source Registration Subscription + ... ${subscription_id} + ... ${subscription_update_fragment} + + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Set Suite Variable ${context_source_registration_id} + ${response1}= Create Context Source Registration ${context_source_registration_payload} + Wait for no notification + +Setup Initial Context Source Registration Subscription + Start Local Server + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Subscription + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_08.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..bddc4ffa27632757f22f2ca39d1d5e71fde076b6 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_08.robot @@ -0,0 +1,54 @@ +*** Settings *** +Documentation Check if a context source registration subscription does not define a temporalQ member, a CsourceNotification will be triggered from matching context source registrations for context sources providing latest information + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Create Initial Context Source Registration and Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Context Source Registration Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${update_fragment_file_path}= csourceRegistrations/fragments/context-source-registration-update-sample.json + + +*** Test Cases *** +047_08_01 Receive cSourceNotification For Matching Context Source Registrations Providing Latest Information + [Documentation] Check if a context source registration subscription does not define a temporalQ member, a CsourceNotification will be triggered from matching context source registrations for context sources providing latest information + [Tags] csrsub-notification 5_11_7 + ${update_fragment}= Load Test Sample ${update_fragment_file_path} + ${response}= Update Context Source Registration ${context_source_registration_id} ${update_fragment} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=updated + + +*** Keywords *** +Create Initial Context Source Registration and Context Source Registration Subscription + Start Local Server + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration ${context_source_registration_payload} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${context_source_registration_id} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Context Source Registration Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_09.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_09.robot new file mode 100644 index 0000000000000000000000000000000000000000..30de1c0b9c00a7b1857c50ab1197ae8b74b0846a --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_09.robot @@ -0,0 +1,54 @@ +*** Settings *** +Documentation Check if a context source registration subscription defines an "entities" member, a CsourceNotification will be triggered from context source registrations with information member matching the described "entities" + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Create Initial Context Source Registration And Context Source Registration Subscription +Suite Teardown Delete Created Context Source Registration And Context Source Registration Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${update_fragment_file_path}= csourceRegistrations/fragments/context-source-registration-update-information-sample.json + + +*** Test Cases *** +047_09_01 Receive cSourceNotification For No Longer Matching Context Source Registrations Providing Latest Information + [Documentation] Check if a context source registration subscription defines an "entities" member, a CsourceNotification will be triggered from context source registrations with information member matching the described "entities" + [Tags] csrsub-notification 5_11_7 + ${update_fragment}= Load Test Sample ${update_fragment_file_path} + ${response}= Update Context Source Registration ${context_source_registration_id} ${update_fragment} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=noLongerMatching + + +*** Keywords *** +Create Initial Context Source Registration And Context Source Registration Subscription + Start Local Server + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration ${context_source_registration_payload} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${context_source_registration_id} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Context Source Registration Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_10.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_10.robot new file mode 100644 index 0000000000000000000000000000000000000000..edb70308503d5b85431b784eb439f11e9bb28dfd --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_10.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check if a context source registration subscription defines temporalQ member with timeproperty observedAt, the temporal query is matched against the observationInterval of matching context source registrations + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-observationInterval-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-temporalQ-observedAt-sample.jsonld + + +*** Test Cases *** +047_10_01 Receive cSourceNotification For Matching Context Source Registrations On Observation Interval + [Documentation] Check if a context source registration subscription defines temporalQ member with timeproperty observedAt, the temporal query is matched against the observationInterval of matching context source registrations + [Tags] csrsub-notification 5_11_7 + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Set Suite Variable ${context_source_registration_id} + ${response}= Create Context Source Registration ${context_source_registration_payload} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=newlyMatching + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + Start Local Server + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_11.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_11.robot new file mode 100644 index 0000000000000000000000000000000000000000..52cbf11f25e09a4a72c7fa11427e6d1b0724f484 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_11.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check if a context source registration subscription defines temporalQ member with timeproperty createdAt or modifiedAt, the temporal query is matched against the managementInterval of matching context source registrations + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Start Local Server +Suite Teardown Stop Local Server +Test Teardown Delete Created Context Source Registrations +Test Template Receive cSourceNotification For Matching Context Source Registrations On Management Interval + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-managementInterval-sample.jsonld + + +*** Test Cases *** FILEPATH +047_11_01 CreatedAt [Tags] csrsub-notification 5_11_7 + csourceSubscriptions/subscription-temporalQ-createdAt-sample.jsonld +047_11_02 ModifiedAt [Tags] csrsub-notification 5_11_7 + csourceSubscriptions/subscription-temporalQ-modifiedAt-sample.jsonld + + +*** Keywords *** +Receive cSourceNotification For Matching Context Source Registrations On Management Interval + [Documentation] Check if a context source registration subscription defines temporalQ member with timeproperty createdAt or modifiedAt, the temporal query is matched against the managementInterval of matching context source registrations + [Arguments] ${filepath} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${subscription_id} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint ${filepath} ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + Set Suite Variable ${context_source_registration_id} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + ${response1}= Create Context Source Registration ${context_source_registration_payload} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=newlyMatching + +Delete Created Context Source Registrations + Delete Context Source Registration Subscription ${subscription_id} + Delete Context Source Registration ${context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_12.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_12.robot new file mode 100644 index 0000000000000000000000000000000000000000..59d620a2693814fba033a39a18bde17da6e637ca --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_12.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check if a context source registrations subscription defines entities member and watchedAttributes member, a CsourceNotification will be triggered from context source registrations with information member matching the described "entities" and "attributes" + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-detailed-information-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-watchedAttributes-sample.jsonld + + +*** Test Cases *** +047_12_01 Receive cSourceNotification For Matching Context Source Registrations On Watched Attributes + [Documentation] Check if a context source registrations subscription defines entities member and watchedAttributes member, a CsourceNotification will be triggered from context source registrations with information member matching the described "entities" and "attributes" + [Tags] csrsub-notification 5_11_7 + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Set Suite Variable ${context_source_registration_id} + ${response}= Create Context Source Registration ${context_source_registration_payload} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=newlyMatching + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + Start Local Server + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_13.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_13.robot new file mode 100644 index 0000000000000000000000000000000000000000..5a24fab77af87802aecc2056afa1e2d9bd86bcfb --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_13.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check if a context source registrations subscription does not define watchedAttributes member, a CsourceNotification will be triggered from context source registrations with information member matching all attributes of the described entities + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-detailed-information-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** +047_13_01 Receive cSourceNotification For Matching Context Source Registrations On Any watchedAttribute + [Documentation] Check if a context source registrations subscription does not define watchedAttributes member, a CsourceNotification will be triggered from context source registrations with information member matching all attributes of the described entities + [Tags] csrsub-notification 5_11_7 + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Set Suite Variable ${context_source_registration_id} + ${response}= Create Context Source Registration ${context_source_registration_payload} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=newlyMatching + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + Start Local Server + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_14.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_14.robot new file mode 100644 index 0000000000000000000000000000000000000000..3ab8c25894b46291ba1e50cab007997e021a10c7 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_14.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check if a context source registrations subscription defines a geoQ member, a CsourceNotification will be triggered from matching context source registrations with a matching location member + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-location-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-geoQ-sample.jsonld + + +*** Test Cases *** +047_14_01 Receive cSourceNotification For Matching Context Source Registrations On Location + [Documentation] Check if a context source registrations subscription defines a geoQ member, a CsourceNotification will be triggered from matching context source registrations with a matching location member + [Tags] csrsub-notification 5_11_7 + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Set Suite Variable ${context_source_registration_id} + ${response}= Create Context Source Registration ${context_source_registration_payload} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=newlyMatching + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + Start Local Server + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_15.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_15.robot new file mode 100644 index 0000000000000000000000000000000000000000..792bc9cdd18d6490c3ffed683d34e042230b1f3b --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_15.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check if a context source registrations subscription does not define a geoproperty in the geoQ member, a CsourceNotification will be triggered from matching context source registrations with a matching location member + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration And Subscription + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-location-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-geoQ-without-geoproperty-sample.jsonld + + +*** Test Cases *** +047_15_01 Receive cSourceNotification For Matching Context Source Registrations On Location As Default + [Documentation] Check if a context source registrations subscription does not define a geoproperty in the geoQ member, a CsourceNotification will be triggered from matching context source registrations with a matching location member + [Tags] csrsub-notification 5_11_7 + ${context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_payload_file_path} + ... ${context_source_registration_id} + Set Suite Variable ${context_source_registration_id} + ${response}= Create Context Source Registration ${context_source_registration_payload} + @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${expected_context_source_registration_ids} + ... expected_trigger_reason=newlyMatching + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + Start Local Server + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + Create Context Source Registration Subscription ${subscription_payload} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration And Subscription + Stop Local Server + Delete Context Source Registration ${context_source_registration_id} + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_16.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_16.robot new file mode 100644 index 0000000000000000000000000000000000000000..9f140f2a24840975675693fc9176582f084ce99a --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_16.robot @@ -0,0 +1,73 @@ +*** Settings *** +Documentation Check if you update a context source registration subscription, a CsourceNotification will be sent with all currently matching context source registrations + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Test Setup Create Initial Context Source Registrations And Context Source Registration Subscription +Test Teardown Delete Created Context Source Registrations And Context Source Registration Subscription +Test Template Receive cSourceNotification For Newly Matching Context Source Registrations + + +*** Variables *** +${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${first_context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-vehicle-entities-sample.jsonld +${second_context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-bus-entities-sample.jsonld +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** FILEPATH NOTIFICATION_CSR_IDS +047_16_01 MatchFirstContextSourceRegistration + [Tags] csrsub-notification 5_11_7 + csourceSubscriptions/fragments/subscription-vehicle-entities-sample.json ${first_context_source_registration_id} +047_16_02 MatchSecondContextSourceRegistration + [Tags] csrsub-notification 5_11_7 + csourceSubscriptions/fragments/subscription-bus-entities-sample.json ${second_context_source_registration_id} +047_16_03 MatchBothContextSourceRegistrations + [Tags] csrsub-notification 5_11_7 + csourceSubscriptions/fragments/subscription-vehicle-and-bus-entities-sample.json ${first_context_source_registration_id} ${second_context_source_registration_id} + + +*** Keywords *** +Receive cSourceNotification For Newly Matching Context Source Registrations + [Documentation] Check if you update a context source registration subscription, a CsourceNotification will be sent with all currently matching context source registrations + [Arguments] ${filepath} @{notification_csr_ids} + ${subscription_update_fragment}= Load Test Sample ${filepath} + ${response}= Update Context Source Registration Subscription + ... ${subscription_id} + ... ${subscription_update_fragment} + Wait for notification and validate it + ... expected_subscription_id=${subscription_id} + ... expected_context_source_registration_ids=${notification_csr_ids} + ... expected_trigger_reason=newlyMatching + +Create Initial Context Source Registrations And Context Source Registration Subscription + Start Local Server + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${first_context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${second_context_source_registration_id}= Generate Random Entity Id ${context_source_registration_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ${first_context_source_registration_payload}= Load Test Sample + ... ${first_context_source_registration_payload_file_path} + ... ${first_context_source_registration_id} + ${second_context_source_registration_payload}= Load Test Sample + ... ${second_context_source_registration_payload_file_path} + ... ${second_context_source_registration_id} + Create Context Source Registration Subscription ${subscription_payload} + Create Context Source Registration ${first_context_source_registration_payload} + Create Context Source Registration ${second_context_source_registration_payload} + Set Test Variable ${subscription_id} + Set Test Variable ${first_context_source_registration_id} + Set Test Variable ${second_context_source_registration_id} + +Delete Created Context Source Registrations And Context Source Registration Subscription + Stop Local Server + Delete Context Source Registration Subscription ${subscription_id} + Delete Context Source Registration ${first_context_source_registration_id} + Delete Context Source Registration ${second_context_source_registration_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_01.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..db34b844b935b57325a256379deaac0516f8a96a --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_01.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that you can create a minimal context source registration subscription + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Generate Random Ids For Context Source Registration Subscriptions +Suite Teardown Delete Created Context Source Registration Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** +038_01_01 Create Context Source Registration Subscription + [Documentation] Check that you can create a minimal context source registration subscription + [Tags] csrsub-create 5_11_2 + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${subscription_id} ${response.headers} + ${response1}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + + # We need to ignore the Additional Members ('lastFailure', 'lastNotification', 'timesFailed', 'timesSent') + ${ignored_attributes}= Create List + ... ${status_regex_expr} + ... ${lastfailure_regex_expr} + ... ${lastNotification_regex_expr} + ... ${timesFailed_regex_expr} + ... ${timesSent_regex_expr} + + Check Created Resource Set To ${subscription_payload} ${response1.json()} ${ignored_attributes} + + Check Dictionary Might Contain Additional Members of the NotificationParams ${response1.json()} lastNotification + Check Dictionary Might Contain Additional Members of the NotificationParams ${response1.json()} lastFailure + Check Dictionary Might Contain Additional Members of the NotificationParams ${response1.json()} lastSuccess + Check Dictionary Might Contain Additional Members of the NotificationParams ${response1.json()} timesSent + + +*** Keywords *** +Generate Random Ids For Context Source Registration Subscriptions + # TODO: Refactor Generate Random Entity Id to Generate Random Test Sample Id + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_02.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..fe198aac608ade0998f1d94ce482abab56957ebe --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_02.robot @@ -0,0 +1,44 @@ +*** Settings *** +Documentation Check that you can create a context source registration subscription without providing an id and it will be automatically generated + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Created Context Source Registration Subscriptions + + +*** Variables *** +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${subscription_id}= ${EMPTY} + + +*** Test Cases *** +038_02_01 Create Context Source Registration Subscription Without An Id + [Documentation] Check that you can create a context source registration subscription without providing an id and it will be automatically generated + [Tags] csrsub-create 5_11_2 + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} + Remove From Dictionary ${subscription_payload} id + ${response}= Create Context Source Registration Subscription ${subscription_payload} + + Dictionary Should Contain Key ${response.headers} Location msg=HTTP Headers do not contain key 'Location' + ${subscription_id}= Get From Dictionary ${response.headers} Location + Set Suite Variable ${subscription_id} + + Check Response Status Code 201 ${response.status_code} + + ${response1}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + ${ignored_attributes}= Create List ${id_regex_expr} ${status_regex_expr} + Check Created Resource Set To ${subscription_payload} ${response1.json()} ${ignored_attributes} + + +*** Keywords *** +Delete Created Context Source Registration Subscriptions + IF "${subscription_id}" != "${EMPTY}" + Delete Context Source Registration Subscription ${subscription_id} + ELSE + Log To Console \nThere was no Context Source Registration Subscription to delete\n + END diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_03.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..69208861e08fd82f6cbf13723a03fee2851a3c9d --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_03.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you can create a context source registration subscription without providing isActive member and will be active by default + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Generate Random Ids For Context Source Registration Subscriptions +Suite Teardown Delete Created Context Source Registration Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** +038_03_01 Create Context Source Registration Subscription Without isActive Member + [Documentation] Check that you can create a context source registration subscription without providing isActive member and will be active by default + [Tags] csrsub-create 5_11_2 + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${subscription_id} ${response.headers} + ${response1}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + Check Response Body Containing an Attribute set to + ... expected_attribute_name=status + ... response_body=${response1.json()} + ... expected_attribute_value=active + + +*** Keywords *** +Generate Random Ids For Context Source Registration Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_04.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..e2fb5b4ffcca430be7c168dfcce229c57ec37099 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_04.robot @@ -0,0 +1,46 @@ +*** Settings *** +Documentation Check that you can create a context source registration subscription with isActive member set to false and it's initial status will be set to "paused" + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Generate Random Ids For Context Source Registration Subscriptions +Suite Teardown Delete Created Context Source Registration Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-inactive-sample.jsonld + + +*** Test Cases *** +038_04_01 Create Inactive Context Source Registration Subscription + [Documentation] Check that you can create a context source registration subscription with isActive member set to false and it's initial status will be set to "paused" + [Tags] csrsub-create 5_11_2 + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${subscription_id} ${response.headers} + ${response1}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + + # The conversion of a boolean data to json for a python object transform false -> False and true -> True + Check Response Body Containing a Boolean Attribute set to + ... expected_attribute_name=isActive + ... response_body=${response1.json()} + ... expected_attribute_value=False + + Check Response Body Containing an Attribute set to + ... expected_attribute_name=status + ... response_body=${response1.json()} + ... expected_attribute_value=paused + + +*** Keywords *** +Generate Random Ids For Context Source Registration Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_05.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..18ed598f84c9ff588a6a6e637e6295dfa45c26ea --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_05.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that you can create a context source registration subscription with an expiresAt member and when it is due the status of the subscription changes to "expired" + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Generate Random Ids For Context Source Registration Subscriptions +Suite Teardown Delete Created Context Source Registration Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-expiresAt-sample.jsonld + + +*** Test Cases *** +038_05_01 Create Context Source Registration Subscription With expiresAt Member + [Documentation] Check that you can create a context source registration subscription with an expiresAt member and when it is due the status of the subscription changes to "expired" + [Tags] csrsub-create 5_11_2 + ${subscription_payload_sample}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + ${current_date}= Get Current Date time_zone=UTC result_format=${date_format} + ${expiresAt}= Add Time To Date ${current_date} 10 seconds result_format=${date_format} + ${subscription_payload}= Update Value To JSON ${subscription_payload_sample} $..expiresAt ${expiresAt} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${subscription_id} ${response.headers} + Sleep 15s + + ${response1}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + + Check Response Body Contains DateTime Value + ... dictionary=${response1.json()} + ... key=expiresAt + ... expected value=${expiresAt} + + Check Response Body Containing an Attribute set to + ... expected_attribute_name=status + ... response_body=${response1.json()} + ... expected_attribute_value=expired + +*** Keywords *** +Generate Random Ids For Context Source Registration Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_06.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_06.robot new file mode 100644 index 0000000000000000000000000000000000000000..9ef56fc3a0585edb21fc5e586938167bf8829e07 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_06.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Check that you can create a context source registration subscription without an expiresAt member and it will be considered as perpetual + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Generate Random Ids For Context Source Registration Subscriptions +Suite Teardown Delete Created Context Source Registration Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** +038_06_01 Create Context Source Registration Subscription Without expiresAt Member + [Documentation] Check that you can create a context source registration subscription without an expiresAt member and it will be considered as perpetual + [Tags] csrsub-create 5_11_2 + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${subscription_id} ${response.headers} + # Let's say if the subscription stills active after 10s it will be considered as perpetual, but this is not enough + Sleep 10s + ${response1}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + Check Response Body Containing an Attribute set to + ... expected_attribute_name=status + ... response_body=${response1.json()} + ... expected_attribute_value=active + + +*** Keywords *** +Generate Random Ids For Context Source Registration Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_07.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..e9cb913c2b2aa80e96c31aab9c8f2b6c425c2e0b --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_07.robot @@ -0,0 +1,37 @@ +*** Settings *** +Documentation Check that you cannot create a context source registration subscription where another context source registration subscription whose id is equivalent exists + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Initial Context Source Registration Subscription + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** +038_07_01 Create Existing Context Source Registration Subscription + [Documentation] Check that you cannot create a context source registration subscription where another context source registration subscription whose id is equivalent exists + [Tags] csrsub-create 5_11_2 + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + Check Response Status Code 409 ${response.status_code} + Check Response Body Containing ProblemDetails Element + ... response_body=${response.json()} + ... problem_type=${ERROR_TYPE_ALREADY_EXISTS} + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + ${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} + Set Suite Variable ${subscription_id} + +Delete Initial Context Source Registration Subscription + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_08.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_08.robot new file mode 100644 index 0000000000000000000000000000000000000000..05e2da3120c9f7e1b5652bfca6efdbdefc224368 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_08.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Check that you cannot create a context source registration subscription If the data types, cardinalities and restrictions expressed by clause 5.2.12 are not met + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Create Invalid Context Source Registration Subscription + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= ${EMPTY} + + +*** Test Cases *** FILEPATH +038_08_01 WithoutNotification + [Tags] csrsub-create 5_11_2 + csourceSubscriptions/subscription-without-notification-sample.jsonld +038_08_02 InvalidType + [Tags] csrsub-create 5_11_2 + csourceSubscriptions/subscription-invalid-type-sample.jsonld +038_08_03 InvalidQuery + [Tags] csrsub-create 5_11_2 + csourceSubscriptions/subscription-invalid-query-sample.jsonld +038_08_04 EmptyWatchedAttributes + [Tags] csrsub-create 5_11_2 + csourceSubscriptions/subscription-empty-watchedAttributes-sample.jsonld + + +*** Keywords *** +Create Invalid Context Source Registration Subscription + [Documentation] Check that you cannot create a context source registration subscription If the data types, cardinalities and restrictions expressed by clause 5.2.12 are not met + [Arguments] ${filepath} + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${filepath} ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element + ... response_body=${response.json()} + ... problem_type=${ERROR_TYPE_BAD_REQUEST_DATA} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_09.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_09.robot new file mode 100644 index 0000000000000000000000000000000000000000..420689f22590a764667981b4c56acb3d5c81b7b4 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_09.robot @@ -0,0 +1,24 @@ +*** Settings *** +Documentation Check that you cannot create a context source registration subscription with an expiration timestamp representing a moment before the current date and time + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-expired-sample.jsonld + + +*** Test Cases *** +038_09_01 Create Expired Context Source Registration Subscription + [Documentation] Check that you cannot create a context source registration subscription with an expiration timestamp representing a moment before the current date and time + [Tags] csrsub-create 5_11_2 + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element + ... response_body=${response.json()} + ... problem_type=${ERROR_TYPE_BAD_REQUEST_DATA} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_01.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..39108b3e46297879f516778b58b067eebd223124 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_01.robot @@ -0,0 +1,33 @@ +*** Settings *** +Documentation Check that you can delete a context source registration subscription + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** +042_01_01 Delete Context Source Registration Subscription + [Documentation] Check that you can delete a context source registration subscription + [Tags] csrsub-delete 5_11_6 + ${response}= Delete Context Source Registration Subscription ${subscription_id} + Check Response Status Code 204 ${response.status_code} + ${response1}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + ... context=${ngsild_test_suite_context} + Check SUT Not Containing Resource ${response1.status_code} + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + ${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} + Set Suite Variable ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_02.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..aaf347e0c1e93625523e51e555f4efc43bfec0fd --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_02.robot @@ -0,0 +1,18 @@ +*** Settings *** +Documentation Check that you cannot delete a context source registration subscription with an invalid URI + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Test Cases *** +042_02_01 Delete Context Source Registration Subscription With Invalid Uri + [Documentation] Check that you cannot delete a context source registration subscription with an invalid URI + [Tags] csrsub-delete 5_11_6 + ${response}= Delete Context Source Registration Subscription invalidUri + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_03.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..483035cc8007ad80a8a92239b5634f02c32be779 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_03.robot @@ -0,0 +1,18 @@ +*** Settings *** +Documentation Check that you cannot delete an unknown context source registration subscription + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Test Cases *** +042_03_01 Delete Unknown Context Source Registration Subscription With Invalid Uri + [Documentation] Check that you cannot delete an unknown context source registration subscription + [Tags] csrsub-delete 5_11_6 + ${response}= Delete Context Source Registration Subscription urn:ngsi-ld:Subscription:unknowSubscription + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_01.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..72bfb91d67897c965af29dc141c4cae38b2550e4 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_01.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that you can query context source registration subscriptions + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration Subscriptions +Test Teardown Delete Created Context Source Registration Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${first_subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${second_subscription_payload_file_path}= csourceSubscriptions/subscription-watchedAttributes-sample.jsonld +${expectation_file_path}= csourceSubscriptions/expectations/subscriptions-035-01-expectation.json + + +*** Test Cases *** +041_01_01 Query Context Source Registration Subscriptions + [Documentation] Check that you can query context source registration subscriptions + [Tags] csrsub-query 5_11_5 + ${response}= Query Context Source Registration Subscriptions context=${ngsild_test_suite_context} + @{subscription_ids}= Create List ${first_subscription_id} ${second_subscription_id} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing List Containing Subscription elements + ... ${expectation_file_path} + ... ${subscription_ids} + ... ${response.json()} + + +*** Keywords *** +Setup Initial Context Source Registration Subscriptions + ${first_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${second_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${first_subscription_payload}= Load Test Sample + ... ${first_subscription_payload_file_path} + ... ${first_subscription_id} + ${second_subscription_payload}= Load Test Sample + ... ${second_subscription_payload_file_path} + ... ${second_subscription_id} + Create Context Source Registration Subscription ${first_subscription_payload} + Create Context Source Registration Subscription ${second_subscription_payload} + Set Suite Variable ${first_subscription_id} + Set Suite Variable ${second_subscription_id} + +Delete Created Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${first_subscription_id} + Delete Context Source Registration Subscription ${second_subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_02.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..b1f013ca8bf4e368e3fd48f52de6e86c051e45ce --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_02.robot @@ -0,0 +1,69 @@ +*** Settings *** +Documentation Check that you can query context source registration subscriptions with a limit parameter and it will be the maximum number of subscriptions to be retrieved + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration Subscriptions +Test Teardown Delete Created Context Source Registration Subscriptions +Test Template Query Context Source Registration Subscriptions With Limit Parameter + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${first_subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${second_subscription_payload_file_path}= csourceSubscriptions/subscription-watchedAttributes-sample.jsonld +${third_subscription_payload_file_path}= csourceSubscriptions/subscription-geoQ-sample.jsonld +${expectation_file_path}= csourceSubscriptions/expectations/subscriptions-035-01-expectation.json + + +*** Test Cases *** LIMIT EXPECTED_SUBSCRIPTION_NUMBER +041_02_01 Query One Subscription + [Tags] csrsub-query 5_11_5 + ${1} ${1} +041_02_02 Query Two Subscription + [Tags] csrsub-query 5_11_5 + ${2} ${2} +041_02_03 Query All Subscriptions + [Tags] csrsub-query 5_11_5 + ${15} ${3} + + +*** Keywords *** +Query Context Source Registration Subscriptions With Limit Parameter + [Documentation] Check that you can query context source registration subscriptions with a limit parameter and it will be the maximum number of subscriptions to be retrieved + [Arguments] ${limit} ${expected_subscription_number} + ${response}= Query Context Source Registration Subscriptions + ... context=${ngsild_test_suite_context} + ... limit=${limit} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Number Of Entities + ... Subscription + ... ${expected_subscription_number} + ... ${response.json()} + +Setup Initial Context Source Registration Subscriptions + ${first_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${second_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${third_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${first_subscription_payload}= Load Test Sample + ... ${first_subscription_payload_file_path} + ... ${first_subscription_id} + ${second_subscription_payload}= Load Test Sample + ... ${second_subscription_payload_file_path} + ... ${second_subscription_id} + ${third_subscription_payload}= Load Test Sample + ... ${third_subscription_payload_file_path} + ... ${third_subscription_id} + Create Context Source Registration Subscription ${first_subscription_payload} + Create Context Source Registration Subscription ${second_subscription_payload} + Create Context Source Registration Subscription ${third_subscription_payload} + Set Suite Variable ${first_subscription_id} + Set Suite Variable ${second_subscription_id} + Set Test Variable ${third_subscription_id} + +Delete Created Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${first_subscription_id} + Delete Context Source Registration Subscription ${second_subscription_id} + Delete Context Source Registration Subscription ${third_subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_03.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..dd52a0c7be27c767a8339ec9ee66ac8770d2b7d0 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_03.robot @@ -0,0 +1,70 @@ +*** Settings *** +Documentation Check that you can query context source registration subscriptions with providing page and limit parameters for pagination + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration Subscriptions +Test Teardown Delete Created Context Source Registration Subscriptions +Test Template Query Context Source Registration Subscriptions With Limit And Page Parameters + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${first_subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${second_subscription_payload_file_path}= csourceSubscriptions/subscription-watchedAttributes-sample.jsonld +${third_subscription_payload_file_path}= csourceSubscriptions/subscription-geoQ-sample.jsonld + + +*** Test Cases *** LIMIT PAGE EXPECTED_SUBSCRIPTION_NUMBER PREV_LINK NEXT_LINK +041_03_01 Query Second Subscription + [Tags] csrsub-query 5_11_5 + ${1} ${2} ${1} ;rel="prev";type="application/ld+json" ;rel="next";type="application/ld+json" +041_03_02 Query Last Subscription + [Tags] csrsub-query 5_11_5 + ${2} ${2} ${1} ;rel="prev";type="application/ld+json" ${EMPTY} +041_03_03 Query All Subscriptions + [Tags] csrsub-query 5_11_5 + ${15} ${1} ${3} ${EMPTY} ${EMPTY} + + +*** Keywords *** +Query Context Source Registration Subscriptions With Limit And Page Parameters + [Documentation] Check that you can query context source registration subscriptions with providing page and limit parameters for pagination + [Arguments] ${limit} ${page} ${expected_subscription_number} ${prev_link} ${next_link} + ${response}= Query Context Source Registration Subscriptions + ... context=${ngsild_test_suite_context} + ... limit=${limit} + ... page=${page} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Number Of Entities + ... Subscription + ... ${expected_subscription_number} + ... ${response.json()} + Check Pagination Prev And Next Headers ${prev_link} ${next_link} ${response.headers} + +Setup Initial Context Source Registration Subscriptions + ${first_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${second_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${third_subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${first_subscription_payload}= Load Test Sample + ... ${first_subscription_payload_file_path} + ... ${first_subscription_id} + ${second_subscription_payload}= Load Test Sample + ... ${second_subscription_payload_file_path} + ... ${second_subscription_id} + ${third_subscription_payload}= Load Test Sample + ... ${third_subscription_payload_file_path} + ... ${third_subscription_id} + Create Context Source Registration Subscription ${first_subscription_payload} + Create Context Source Registration Subscription ${second_subscription_payload} + Create Context Source Registration Subscription ${third_subscription_payload} + Set Suite Variable ${first_subscription_id} + Set Suite Variable ${second_subscription_id} + Set Suite Variable ${third_subscription_id} + +Delete Created Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${first_subscription_id} + Delete Context Source Registration Subscription ${second_subscription_id} + Delete Context Source Registration Subscription ${third_subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_04.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..4847fb557bc0d84ab3e7f6f03f37130f1c9d496b --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_04.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Check that you cannot query context source registration subscriptions with invalid page and limit parameters + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Query Context Source Registration Subscriptions With Invalid Limit And Page Parameters + + +*** Test Cases *** LIMIT PAGE +041_04_01 Invalid Limit + [Tags] csrsub-query 5_11_5 + ${-5} ${2} +041_04_02 Invalid Page + [Tags] csrsub-query 5_11_5 + ${2} ${-3} +041_04_03 Invalid Limit And Page + [Tags] csrsub-query 5_11_5 + ${0} ${0} + + +*** Keywords *** +Query Context Source Registration Subscriptions With Invalid Limit And Page Parameters + [Documentation] Check that you cannot query context source registration subscriptions with invalid page and limit parameters + [Arguments] ${limit} ${page} + ${response}= Query Context Source Registration Subscriptions limit=${limit} page=${page} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_01.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..73d765937a7f426b389c5b68a404be26d6c1510a --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_01.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation Check that you can retrieve a context source registration subscription + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration Subscription +Test Teardown Delete Created Context Source Registration Subscription + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${expectation_file_path}= csourceSubscriptions/expectations/subscriptions-040-01-expectation.json + + +*** Test Cases *** +040_01_01 Retrieve Context Source Registration Subscription + [Documentation] Check that you can retrieve a context source registration subscription + [Tags] csrsub-retrieve 5_11_4 + ${response}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + ... context=${ngsild_test_suite_context} + + ${expected_link_header}= CATENATE + ... SEPARATOR= + ... < + ... ${ngsild_test_suite_context} + ... >; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json" + + Check Response Status Code 200 ${response.status_code} + Check Response Reason set to ${response.reason} OK + Check Response Headers Link set to + ... response_headers=${response.headers} + ... expected_link_header=${expected link header} + + ${expectation_payload}= Load Test Sample ${expectation_file_path} ${subscription_id} + + # We need to ignore the Additional Members ('lastFailure', 'lastNotification', 'timesFailed', 'timesSent', 'isActive') + ${ignored_attributes}= Create List + ... ${status_regex_expr} + ... ${lastfailure_regex_expr} + ... ${lastNotification_regex_expr} + ... ${timesFailed_regex_expr} + ... ${timesSent_regex_expr} + ... ${is_active_expr} + + Check Created Resource Set To + ... created_resource=${expectation_payload} + ... response_body=${response.json()} + ... ignored_keys=${ignored_attributes} + + Check Dictionary Might Contain Additional Members of the NotificationParams ${response.json()} lastNotification + Check Dictionary Might Contain Additional Members of the NotificationParams ${response.json()} lastFailure + Check Dictionary Might Contain Additional Members of the NotificationParams ${response.json()} lastSuccess + Check Dictionary Might Contain Additional Members of the NotificationParams ${response.json()} timesSent + + +*** Keywords *** +Setup Initial Context Source Registration Subscription + ${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} + Set Suite Variable ${subscription_id} + +Delete Created Context Source Registration Subscription + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_02.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..38e117d9f0d0ef5bec1d81f35263776cb445417e --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_02.robot @@ -0,0 +1,21 @@ +*** Settings *** +Documentation Check that you cannot retrieve a context source registration subscription with an invalid URI, an error of type BadRequestData shall be raised + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Test Cases *** +040_02_01 Retrieve Context Source Registration Subscription With An Invalid Id + [Documentation] Check that you cannot retrieve a context source registration subscription with an invalid URI, an error of type BadRequestData shall be raised + [Tags] csrsub-retrieve 5_11_4 + ${response}= Retrieve Context Source Registration Subscription + ... subscription_id=invalidUri + + Check Response Status Code 400 ${response.status_code} + Check Response Reason set to ${response.reason} Bad Request + Check Response Headers Containing Content-Type set to ${CONTENT_TYPE_JSON} ${response.headers} + Check Response Body Containing ProblemDetails Element + ... response_body=${response.json()} + ... problem_type=${ERROR_TYPE_BAD_REQUEST_DATA} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_03.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..c615e3fd693a252fd248206f4d2f39faf9665cb6 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_03.robot @@ -0,0 +1,21 @@ +*** Settings *** +Documentation Check that you cannot retrieve an unknown context source registration subscription, an error of type ResourceNotFound shall be raised + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Test Cases *** +040_03_01 Retrieve Unknown Context Source Registration Subscription + [Documentation] Check that you cannot retrieve an unknown context source registration subscription, an error of type ResourceNotFound shall be raised + [Tags] csrsub-retrieve 5_11_4 + ${response}= Retrieve Context Source Registration Subscription + ... subscription_id=urn:ngsi-ld:Subscription:unknowSubscription + + Check Response Status Code 404 ${response.status_code} + Check Response Reason set to ${response.reason} Not Found + Check Response Headers Containing Content-Type set to ${CONTENT_TYPE_JSON} ${response.headers} + Check Response Body Containing ProblemDetails Element + ... response_body=${response.json()} + ... problem_type=${ERROR_TYPE_RESOURCE_NOT_FOUND} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_01.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..7269685b66d7d85f9ddbec7db51e1a5ae07fd457 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_01.robot @@ -0,0 +1,47 @@ +*** Settings *** +Documentation Check that you can update a context source registration subscription + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration Subscriptions +Test Teardown Delete Initial Context Source Registration Subscriptions + + +*** Variables *** +${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 *** +039_01_01 Update Context Source Registration Subscription + [Documentation] Check that you can update a context source registration subscription + [Tags] csrsub-update 5_11_3 + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + ${response}= Update Context Source Registration Subscription + ... ${subscription_id} + ... ${subscription_update_fragment} + Check Response Status Code 204 ${response.status_code} + Check Response Does Not Contain Body ${response} + Check Response Reason set to ${response.reason} No Content + + ${subscription}= Upsert Element In Entity ${subscription_payload} ${subscription_update_fragment} + ${response1}= Retrieve Context Source Registration Subscription + ... subscription_id=${subscription_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Updated Resource Set To ${subscription} ${response1.json()} + + +*** Keywords *** +Setup Initial Context Source Registration Subscriptions + ${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} + Set Suite Variable ${subscription_id} + Set Suite Variable ${subscription_payload} + +Delete Initial Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_02.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..bee88a1d9376eaf102cef9169af6666f5487c423 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_02.robot @@ -0,0 +1,22 @@ +*** Settings *** +Documentation Check that you cannot update a context source registration subscription with an invalid URI + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${subscription_update_fragment_file_path}= csourceSubscriptions/fragments/subscription-update-sample.json + + +*** Test Cases *** +039_02_01 Update Context Source Registration Subscription With Invalid Uri + [Documentation] Check that you cannot update a context source registration subscription with an invalid URI + [Tags] csrsub-update 5_11_3 + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + ${response}= Update Context Source Registration Subscription invalidUri ${subscription_update_fragment} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element + ... response_body=${response.json()} + ... problem_type=${ERROR_TYPE_BAD_REQUEST_DATA} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_03.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..b76d710e65bc8ed776495d39787a8214b4a76aca --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_03.robot @@ -0,0 +1,24 @@ +*** Settings *** +Documentation Check that you cannot update an unknown context source registration subscription + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variables *** +${subscription_update_fragment_file_path}= csourceSubscriptions/fragments/subscription-update-sample.json + + +*** Test Cases *** +039_03_01 Update Unknown Context Source Registration Subscription + [Documentation] Check that you cannot update an unknown context source registration subscription + [Tags] csrsub-update 5_11_3 + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + ${response}= Update Context Source Registration Subscription + ... urn:ngsi-ld:Subscription:unknowSubscription + ... ${subscription_update_fragment} + Check Response Status Code 404 ${response.status_code} + Check Response Body Containing ProblemDetails Element + ... response_body=${response.json()} + ... problem_type=${ERROR_TYPE_RESOURCE_NOT_FOUND} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_04.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..b9b6c64092ddf90a761713ada321d4f7ab7970c6 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_04.robot @@ -0,0 +1,47 @@ +*** Settings *** +Documentation Check that you cannot update a context source registration subscription with a fragment that does not meet the data types and restrictions expressed by clause 5.2.12 + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration Subscriptions +Test Teardown Delete Initial Context Source Registration Subscriptions +Test Template Update Context Source Registration Subscription With Invalid Fragment + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld + + +*** Test Cases *** FILEPATH +039_04_01 InvalidType + [Tags] csrsub-update 5_11_3 + csourceSubscriptions/fragments/subscription-update-invalid-type-sample.json +039_04_02 InvalidNotification + [Tags] csrsub-update 5_11_3 + csourceSubscriptions/fragments/subscription-update-invalid-notification-sample.json + + +*** Keywords *** +Update Context Source Registration Subscription With Invalid Fragment + [Documentation] Check that you cannot update a context source registration subscription with a fragment that does not meet the data types and restrictions expressed by clause 5.2.12 + [Arguments] ${filepath} + ${subscription_update_fragment}= Load Test Sample ${filepath} + ${response}= Update Context Source Registration Subscription + ... ${subscription_id} + ... ${subscription_update_fragment} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element + ... response_body=${response.json()} + ... problem_type=${ERROR_TYPE_BAD_REQUEST_DATA} + +Setup Initial Context Source Registration Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + ${response}= Create Context Source Registration Subscription ${subscription_payload} + Set Test Variable ${subscription_id} + +Delete Initial Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_05.robot b/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..a843710992964183e8bace7204a6fa1dd745a175 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_05.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you cannot update a context source registration subscription with an invalid request body (invalid JSON document) + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Context Source Registration Subscriptions +Test Teardown Delete Initial Context Source Registration Subscriptions + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path}= csourceSubscriptions/fragments/subscription-update-invalid-json-sample.json + + +*** Test Cases *** +039_05_01 Update Context Source Registration Subscription With Invalid JSON Fragment + [Documentation] Check that you cannot update a context source registration subscription with an invalid request body (invalid JSON document) + [Tags] csrsub-update 5_11_3 + ${response}= Update Context Source Registration Subscription From File + ... ${subscription_id} + ... ${subscription_update_fragment_file_path} + Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element + ... response_body=${response.json()} + ... problem_type=${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Setup Initial Context Source Registration Subscriptions + ${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} + Set Suite Variable ${subscription_id} + +Delete Initial Context Source Registration Subscriptions + Delete Context Source Registration Subscription ${subscription_id} diff --git a/data/csourceRegistrations/context-source-registration-building-and-bus-entities-sample.jsonld b/data/csourceRegistrations/context-source-registration-building-and-bus-entities-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..12a546f6fe869d59872bc3ecbb44b0194e0eb0f8 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-building-and-bus-entities-sample.jsonld @@ -0,0 +1,24 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ] + }, + { + "entities":[ + { + "type":"Bus" + } + ] + } + ], + "endpoint":"http://my.csource.org:1026", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-bus-entities-sample.jsonld b/data/csourceRegistrations/context-source-registration-bus-entities-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..1c39aed27cbd4576b017f217122bc528a8697dc8 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-bus-entities-sample.jsonld @@ -0,0 +1,17 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Bus" + } + ] + } + ], + "endpoint":"http://my.csource.org:1026", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-csourceProperty-sample.jsonld b/data/csourceRegistrations/context-source-registration-csourceProperty-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..a76f1967cbf3761df68ad1fa0f1eeda5ed7663aa --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-csourceProperty-sample.jsonld @@ -0,0 +1,23 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ] + } + ], + "location":{ + "type":"Point", + "coordinates":[-8.521,41.2] + }, + "endpoint":"http://my.csource.org:1026", + "csourceProperty1": "aValue", + "csourceProperty2": "anotherValue", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-detailed-information-sample.jsonld b/data/csourceRegistrations/context-source-registration-detailed-information-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..4560eee81efab13c9f2e44c981bb4717dfc708d6 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-detailed-information-sample.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ], + "propertyNames":["name", "subCategory"], + "relationshipNames":["locatedAt"] + } + ], + "endpoint":"http://my.csource.org:1026", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-invalid-json-sample.json b/data/csourceRegistrations/context-source-registration-invalid-json-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..e72bb9a4e4d86ccae072733c37f46f7e201062c6 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-invalid-json-sample.json @@ -0,0 +1,5 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration",, + "endpoint": "http://my.new.csource.org:1026" +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-invalid-sample.json b/data/csourceRegistrations/context-source-registration-invalid-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..b097e4f53a1dbe28e449f2f84065ee7436d2a22b --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-invalid-sample.json @@ -0,0 +1,5 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": null +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-invalid-sample.jsonld b/data/csourceRegistrations/context-source-registration-invalid-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..595a5d63d58ee07981092230f9cb4e44cf5e37c0 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-invalid-sample.jsonld @@ -0,0 +1,8 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": null, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-invalid-structure-sample.jsonld b/data/csourceRegistrations/context-source-registration-invalid-structure-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..97515561f23592e90a3cc795d9cfaa44d25cb8ba --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-invalid-structure-sample.jsonld @@ -0,0 +1,7 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-location-sample.jsonld b/data/csourceRegistrations/context-source-registration-location-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..a5603e7b82571b456458a8021ee882fe343a281b --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-location-sample.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ] + } + ], + "location":{ + "type":"Point", + "coordinates":[-8.521,41.2] + }, + "endpoint":"http://my.csource.org:1026", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-managementInterval-sample.jsonld b/data/csourceRegistrations/context-source-registration-managementInterval-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..329d4b7c08b0ae2d80a4197625d091ab34b2a544 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-managementInterval-sample.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ] + } + ], + "managementInterval":{ + "startAt":"2020-08-01T22:07:00Z", + "endAt":"2021-08-01T21:07:00Z" + }, + "endpoint":"http://my.csource.org:1026", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-no-id-sample.jsonld b/data/csourceRegistrations/context-source-registration-no-id-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..484ed252cdf95a7ea63c23127513d7db8f89edf4 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-no-id-sample.jsonld @@ -0,0 +1,39 @@ +{ + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "Vehicle" + } + ], + "propertyNames": ["brandName","speed"], + "relationshipNames": ["isParked"] + }, + { + "entities": [ + { + "idPattern": ".*downtown$", + "type": "OffStreetParking" + }, + { + "idPattern": ".*47$", + "type": "OffStreetParking" + } + ], + "propertyNames": ["availableSpotNumber","totalSpotNumber"], + "relationshipNames": ["isNextToBuilding"] + } + ], + "endpoint": "http://my.csource.org:1026", + "location": { + "type": "Polygon", + "coordinates": [ + [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], + [100.0, 1.0], [100.0, 0.0]] ] + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-observationInterval-sample.jsonld b/data/csourceRegistrations/context-source-registration-observationInterval-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..35ac3fc034f3309807319dbb4c99b1912e14a41d --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-observationInterval-sample.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ] + } + ], + "observationInterval":{ + "startAt":"2020-08-01T22:07:00Z", + "endAt":"2021-08-01T21:07:00Z" + }, + "endpoint":"http://my.csource.org:1026", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-past-expiration-sample.jsonld b/data/csourceRegistrations/context-source-registration-past-expiration-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..6078f7b0da81cea9e55af6d22d1db1a0b8c82d67 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-past-expiration-sample.jsonld @@ -0,0 +1,41 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "Vehicle" + } + ], + "propertyNames": ["brandName","speed"], + "relationshipNames": ["isParked"] + }, + { + "entities": [ + { + "idPattern": ".*downtown$", + "type": "OffStreetParking" + }, + { + "idPattern": ".*47$", + "type": "OffStreetParking" + } + ], + "propertyNames": ["availableSpotNumber","totalSpotNumber"], + "relationshipNames": ["isNextToBuilding"] + } + ], + "endpoint": "http://my.csource.org:1026", + "location": { + "type": "Polygon", + "coordinates": [ + [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], + [100.0, 1.0], [100.0, 0.0]] ] + }, + "expiresAt": " 2018-11-29T14:53:15Z", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-sample.json b/data/csourceRegistrations/context-source-registration-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..b4a6b06efb3f5a7e307eb5f2467e5b92afb248ac --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-sample.json @@ -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/csourceRegistrations/context-source-registration-sample.jsonld b/data/csourceRegistrations/context-source-registration-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..d24b35fd80a0409e072d6a9d02014d77bfe2b0f3 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-sample.jsonld @@ -0,0 +1,40 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "Vehicle" + } + ], + "propertyNames": ["brandName","speed"], + "relationshipNames": ["isParked"] + }, + { + "entities": [ + { + "idPattern": ".*downtown$", + "type": "OffStreetParking" + }, + { + "idPattern": ".*47$", + "type": "OffStreetParking" + } + ], + "propertyNames": ["availableSpotNumber","totalSpotNumber"], + "relationshipNames": ["isNextToBuilding"] + } + ], + "endpoint": "http://my.csource.org:1026", + "location": { + "type": "Polygon", + "coordinates": [ + [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], + [100.0, 1.0], [100.0, 0.0]] ] + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-unretrievable-context-sample.jsonld b/data/csourceRegistrations/context-source-registration-unretrievable-context-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..5d6274a86a096876b3c6591b9f4f2b3d1b1ba86e --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-unretrievable-context-sample.jsonld @@ -0,0 +1,17 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ] + } + ], + "endpoint":"http://my.csource.org:1026", + "@context":[ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-non-existing.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-vehicle-entities-sample.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-entities-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..4a80a599535e4323d7be56fbf4acb84815410b5d --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-vehicle-entities-sample.jsonld @@ -0,0 +1,17 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Vehicle" + } + ] + } + ], + "endpoint":"http://my.csource.org:1026", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-with-expiration-sample.jsonld b/data/csourceRegistrations/context-source-registration-with-expiration-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..0dbf966b7a07721827dbf9b131d4b14ba7026dcd --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-with-expiration-sample.jsonld @@ -0,0 +1,41 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "Vehicle" + } + ], + "propertyNames": ["brandName","speed"], + "relationshipNames": ["isParked"] + }, + { + "entities": [ + { + "idPattern": ".*downtown$", + "type": "OffStreetParking" + }, + { + "idPattern": ".*47$", + "type": "OffStreetParking" + } + ], + "propertyNames": ["availableSpotNumber","totalSpotNumber"], + "relationshipNames": ["isNextToBuilding"] + } + ], + "endpoint": "http://my.csource.org:1026", + "location": { + "type": "Polygon", + "coordinates": [ + [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], + [100.0, 1.0], [100.0, 0.0]] ] + }, + "expiresAt": "2025-11-29T14:53:15Z", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-with-only-properties-information-sample.jsonld b/data/csourceRegistrations/context-source-registration-with-only-properties-information-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..17425354d25127c83d4de9f9526709d91f863c4f --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-with-only-properties-information-sample.jsonld @@ -0,0 +1,13 @@ +{ + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "propertyNames":["name", "subCategory"] + } + ], + "endpoint":"http://my.csource.org:1026", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json b/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json new file mode 100644 index 0000000000000000000000000000000000000000..c557935b32c73e5c7250b206b7aed5056684cedd --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json @@ -0,0 +1,68 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "endpoint": "http://my.csource.org:1026", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "https://ngsi-ld-test-suite/context#Vehicle" + } + ], + "propertyNames": [ + "https://ngsi-ld-test-suite/context#brandName", + "https://ngsi-ld-test-suite/context#speed" + ], + "relationshipNames": [ + "isParked" + ] + }, + { + "entities": [ + { + "type": "https://ngsi-ld-test-suite/context#OffStreetParking", + "idPattern": ".*downtown$" + }, + { + "type": "https://ngsi-ld-test-suite/context#OffStreetParking", + "idPattern": ".*47$" + } + ], + "propertyNames": [ + "availableSpotNumber", + "totalSpotNumber" + ], + "relationshipNames": [ + "isNextToBuilding" + ] + } + ], + "location": { + "type": "Polygon", + "coordinates": [ + [ + [ + 100.0, + 0.0 + ], + [ + 101.0, + 0.0 + ], + [ + 101.0, + 1.0 + ], + [ + 100.0, + 1.0 + ], + [ + 100.0, + 0.0 + ] + ] + ] + } +} diff --git a/data/csourceRegistrations/expectations/context-source-registration.json b/data/csourceRegistrations/expectations/context-source-registration.json new file mode 100644 index 0000000000000000000000000000000000000000..a534ebc79efd2b876087d1a57917b21c67e5078d --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registration.json @@ -0,0 +1,37 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "Vehicle" + } + ], + "propertyNames": ["brandName","speed"], + "relationshipNames": ["isParked"] + }, + { + "entities": [ + { + "idPattern": ".*downtown$", + "type": "OffStreetParking" + }, + { + "idPattern": ".*47$", + "type": "OffStreetParking" + } + ], + "propertyNames": ["availableSpotNumber","totalSpotNumber"], + "relationshipNames": ["isNextToBuilding"] + } + ], + "endpoint": "http://my.csource.org:1026", + "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/csourceRegistrations/expectations/context-source-registrations-037-01-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..2b81da66dda4daf4521c5ffc313ca035ab54a104 --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-01-expectation.json @@ -0,0 +1,23 @@ +[ + { + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ], + "propertyNames":[ + "name", + "subCategory" + ], + "relationshipNames":[ + "locatedAt" + ] + } + ], + "endpoint":"http://my.csource.org:1026" + } +] \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/context-source-registrations-037-04-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-04-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..46ec3a76fcf8089aceb1bed258e497617b8a2038 --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-04-expectation.json @@ -0,0 +1,16 @@ +[ + { + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"https://ngsi-ld-test-suite/context#Building" + } + ] + } + ], + "endpoint":"http://my.csource.org:1026" + } +] \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/context-source-registrations-037-05-01-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-05-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..60ca6aadf70178bc7f1a192435d7fbee2088a0f1 --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-05-01-expectation.json @@ -0,0 +1,70 @@ +[ + { + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "Vehicle" + } + ], + "propertyNames": [ + "brandName", + "speed" + ], + "relationshipNames": [ + "isParked" + ] + }, + { + "entities": [ + { + "idPattern": ".*downtown$", + "type": "OffStreetParking" + }, + { + "idPattern": ".*47$", + "type": "OffStreetParking" + } + ], + "propertyNames": [ + "availableSpotNumber", + "totalSpotNumber" + ], + "relationshipNames": [ + "isNextToBuilding" + ] + } + ], + "endpoint": "http://my.csource.org:1026", + "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/csourceRegistrations/expectations/context-source-registrations-037-05-02-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-05-02-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..51faeabc320ba3587dcef25713c91c85ca763e02 --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-05-02-expectation.json @@ -0,0 +1,12 @@ +[ + { + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "propertyNames":["name", "subCategory"] + } + ], + "endpoint":"http://my.csource.org:1026" + } +] \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/context-source-registrations-037-06-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-06-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..baa1c66e89192e287d213340e4e65cc47c91d497 --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-06-expectation.json @@ -0,0 +1,18 @@ +[ + { + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ], + "propertyNames":["name", "subCategory"], + "relationshipNames":["locatedAt"] + } + ], + "endpoint":"http://my.csource.org:1026" + } +] \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/context-source-registrations-037-07-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-07-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..51487e5aab3a43d87d7424d531f493e14ba4041f --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-07-expectation.json @@ -0,0 +1,26 @@ +[ + { + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ] + } + ], + "location":{ + "type":"GeoProperty", + "value":{ + "type":"Point", + "coordinates":[ + -8.521, + 41.2 + ] + } + }, + "endpoint":"http://my.csource.org:1026" + } +] \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/context-source-registrations-037-08-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-08-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..26d12558396afde17e83cc46fc5eae3d20d51632 --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-08-expectation.json @@ -0,0 +1,39 @@ +[ + { + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "Vehicle" + } + ], + "propertyNames": ["brandName","speed"], + "relationshipNames": ["isParked"] + }, + { + "entities": [ + { + "idPattern": ".*downtown$", + "type": "OffStreetParking" + }, + { + "idPattern": ".*47$", + "type": "OffStreetParking" + } + ], + "propertyNames": ["availableSpotNumber","totalSpotNumber"], + "relationshipNames": ["isNextToBuilding"] + } + ], + "endpoint": "http://my.csource.org:1026", + "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/csourceRegistrations/expectations/context-source-registrations-037-09-01-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-09-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..1312004a07dd06e52f1d72ea100629a7a175b640 --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-09-01-expectation.json @@ -0,0 +1,20 @@ +[ + { + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ] + } + ], + "observationInterval":{ + "startAt":"2020-08-01T22:07:00Z", + "endAt":"2021-08-01T21:07:00Z" + }, + "endpoint":"http://my.csource.org:1026" + } +] \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/context-source-registrations-037-09-02-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-09-02-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..cb0ab1fe6188db83e637bd898c25dbc7c7f1987e --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-09-02-expectation.json @@ -0,0 +1,20 @@ +[ + { + "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type":"ContextSourceRegistration", + "information":[ + { + "entities":[ + { + "type":"Building" + } + ] + } + ], + "managementInterval":{ + "startAt":"2020-08-01T22:07:00Z", + "endAt":"2021-08-01T21:07:00Z" + }, + "endpoint":"http://my.csource.org:1026" + } +] \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/context-source-registrations-037-10-01-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-10-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..3240674ad45240d610e5eb312e4d681a7b2b9678 --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-10-01-expectation.json @@ -0,0 +1,42 @@ +[ + { + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "Building" + } + ] + } + ], + "endpoint": "http://my.csource.org:1026" + }, + { + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "Building" + } + ] + } + ], + "location": { + "type": "Point", + "coordinates": [ + -8.521, + 41.2 + ] + }, + "endpoint": "http://my.csource.org:1026", + "csourceProperty1": "aValue", + "csourceProperty2": "anotherValue", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } +] \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/context-source-registrations-037-10-02-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-10-02-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..28836a2ebbce818b83bf2d96a5ac02a4d4b69c77 --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-10-02-expectation.json @@ -0,0 +1,28 @@ +[ + { + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "Building" + } + ] + } + ], + "location": { + "type": "Point", + "coordinates": [ + -8.521, + 41.2 + ] + }, + "endpoint": "http://my.csource.org:1026", + "csourceProperty1": "aValue", + "csourceProperty2": "anotherValue", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } +] \ No newline at end of file diff --git a/data/csourceRegistrations/expectations/context-source-registrations-037-10-03-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-10-03-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..74af173bc058800d637e0c04322652de91d31a17 --- /dev/null +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-10-03-expectation.json @@ -0,0 +1,63 @@ +[ + { + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "Building" + } + ] + } + ], + "endpoint": "http://my.csource.org:1026" + }, + { + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "Building" + } + ], + "propertyNames": [ + "name", + "subCategory" + ], + "relationshipNames": [ + "locatedAt" + ] + } + ], + "endpoint": "http://my.csource.org:1026" + }, + { + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "type": "Building" + } + ] + } + ], + "location": { + "type": "Point", + "coordinates": [ + -8.521, + 41.2 + ] + }, + "endpoint": "http://my.csource.org:1026", + "csourceProperty1": "aValue", + "csourceProperty2": "anotherValue", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } +] \ No newline at end of file diff --git a/data/csourceRegistrations/fragments/context-source-registration-different-type-sample.jsonld b/data/csourceRegistrations/fragments/context-source-registration-different-type-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..19ef6f5b589a19834df337eaf355ffe92865b3c8 --- /dev/null +++ b/data/csourceRegistrations/fragments/context-source-registration-different-type-sample.jsonld @@ -0,0 +1,40 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "building", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:A456", + "type": "Vehicle" + } + ], + "propertyNames": ["brandName","speed"], + "relationshipNames": ["isParked"] + }, + { + "entities": [ + { + "idPattern": ".*downtown$", + "type": "OffStreetParking" + }, + { + "idPattern": ".*47$", + "type": "OffStreetParking" + } + ], + "propertyNames": ["availableSpotNumber","totalSpotNumber"], + "relationshipNames": ["isNextToBuilding"] + } + ], + "endpoint": "http://my.csource.org:1026", + "location": { + "type": "Polygon", + "coordinates": [ + [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], + [100.0, 1.0], [100.0, 0.0]] ] + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/fragments/context-source-registration-null-expiresAt.json b/data/csourceRegistrations/fragments/context-source-registration-null-expiresAt.json new file mode 100644 index 0000000000000000000000000000000000000000..3d463007a5c689c02dd66a3915bf38a53968b5cf --- /dev/null +++ b/data/csourceRegistrations/fragments/context-source-registration-null-expiresAt.json @@ -0,0 +1,3 @@ +{ + "expiresAt": null +} \ No newline at end of file diff --git a/data/csourceRegistrations/fragments/context-source-registration-update-information-sample.json b/data/csourceRegistrations/fragments/context-source-registration-update-information-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..5d6df96b98bf152d7226af568df810fb0036a46c --- /dev/null +++ b/data/csourceRegistrations/fragments/context-source-registration-update-information-sample.json @@ -0,0 +1,11 @@ +{ + "information":[ + { + "entities":[ + { + "type":"NewType" + } + ] + } + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/fragments/context-source-registration-update-sample.json b/data/csourceRegistrations/fragments/context-source-registration-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..133cc317c86912ac0e848648b14ca74175e64bf4 --- /dev/null +++ b/data/csourceRegistrations/fragments/context-source-registration-update-sample.json @@ -0,0 +1,3 @@ +{ + "endpoint":"http://my.new.csource.org:1026" +} \ No newline at end of file diff --git a/data/csourceSubscriptions/expectations/subscriptions-035-01-expectation.json b/data/csourceSubscriptions/expectations/subscriptions-035-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..731b679f9a456e1cabe882827ca0a03c36fcf58d --- /dev/null +++ b/data/csourceSubscriptions/expectations/subscriptions-035-01-expectation.json @@ -0,0 +1,40 @@ +[ + { + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "status": "active" + }, + { + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "watchedAttributes":[ + "name", + "subCategory" + ], + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "status": "active" + } +] diff --git a/data/csourceSubscriptions/expectations/subscriptions-040-01-expectation.json b/data/csourceSubscriptions/expectations/subscriptions-040-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..6ebc609265a13c73e86273f48afe9e45303dfc93 --- /dev/null +++ b/data/csourceSubscriptions/expectations/subscriptions-040-01-expectation.json @@ -0,0 +1,18 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "isActive": true, + "status": "active" +} \ No newline at end of file diff --git a/data/csourceSubscriptions/fragments/subscription-bus-entities-sample.json b/data/csourceSubscriptions/fragments/subscription-bus-entities-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..97bb80eed5a0a30644f69249e4bfe51ec7e36bc9 --- /dev/null +++ b/data/csourceSubscriptions/fragments/subscription-bus-entities-sample.json @@ -0,0 +1,7 @@ +{ + "entities":[ + { + "type":"Bus" + } + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/fragments/subscription-expiresAt-update-sample.json b/data/csourceSubscriptions/fragments/subscription-expiresAt-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..237d218065b6eea14c6b1c5117eb3baee3bcaf1d --- /dev/null +++ b/data/csourceSubscriptions/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/csourceSubscriptions/fragments/subscription-isActive-update-sample.json b/data/csourceSubscriptions/fragments/subscription-isActive-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..b432cbaef9391ee3b78deea727e71149c635b5f1 --- /dev/null +++ b/data/csourceSubscriptions/fragments/subscription-isActive-update-sample.json @@ -0,0 +1,3 @@ +{ + "isActive": false +} \ No newline at end of file diff --git a/data/csourceSubscriptions/fragments/subscription-update-invalid-json-sample.json b/data/csourceSubscriptions/fragments/subscription-update-invalid-json-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..972d1c5ccffa5333c446073dffce39e8dab7cbe6 --- /dev/null +++ b/data/csourceSubscriptions/fragments/subscription-update-invalid-json-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/csourceSubscriptions/fragments/subscription-update-invalid-notification-sample.json b/data/csourceSubscriptions/fragments/subscription-update-invalid-notification-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..e82d4022eec36304d1ef730214af5bdb788e22e1 --- /dev/null +++ b/data/csourceSubscriptions/fragments/subscription-update-invalid-notification-sample.json @@ -0,0 +1,5 @@ +{ + "notification":{ + "format":"keyValues" + } +} \ No newline at end of file diff --git a/data/csourceSubscriptions/fragments/subscription-update-invalid-type-sample.json b/data/csourceSubscriptions/fragments/subscription-update-invalid-type-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..3f46469e833cf51c496b774635d539a9c0c7199d --- /dev/null +++ b/data/csourceSubscriptions/fragments/subscription-update-invalid-type-sample.json @@ -0,0 +1,10 @@ +{ + "type": null, + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.second.endpoint.org/notify", + "accept":"application/json" + } + } +} \ No newline at end of file diff --git a/data/csourceSubscriptions/fragments/subscription-update-sample.json b/data/csourceSubscriptions/fragments/subscription-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..81f39078881addb707f6f2590cc853d609e0554d --- /dev/null +++ b/data/csourceSubscriptions/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/csourceSubscriptions/fragments/subscription-update-sample.jsonld b/data/csourceSubscriptions/fragments/subscription-update-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..1ede26103548359838ff307f1f3d60825e64b611 --- /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-v1.3.jsonld" +} \ No newline at end of file diff --git a/data/csourceSubscriptions/fragments/subscription-vehicle-and-bus-entities-sample.json b/data/csourceSubscriptions/fragments/subscription-vehicle-and-bus-entities-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..6040ffb660d4d851c4e992b49c82c9cb8048f855 --- /dev/null +++ b/data/csourceSubscriptions/fragments/subscription-vehicle-and-bus-entities-sample.json @@ -0,0 +1,10 @@ +{ + "entities":[ + { + "type":"Vehicle" + }, + { + "type":"Bus" + } + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/fragments/subscription-vehicle-entities-sample.json b/data/csourceSubscriptions/fragments/subscription-vehicle-entities-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..ff01dca79e195f50eb1efc707d46582403216d29 --- /dev/null +++ b/data/csourceSubscriptions/fragments/subscription-vehicle-entities-sample.json @@ -0,0 +1,7 @@ +{ + "entities":[ + { + "type":"Vehicle" + } + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-empty-watchedAttributes-sample.jsonld b/data/csourceSubscriptions/subscription-empty-watchedAttributes-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..c027db75183a3e1214b8ff9d824653891e55388b --- /dev/null +++ b/data/csourceSubscriptions/subscription-empty-watchedAttributes-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "watchedAttributes": [], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-expired-sample.jsonld b/data/csourceSubscriptions/subscription-expired-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..f19891b5f0cbf8948cd2326099f41e628873eb10 --- /dev/null +++ b/data/csourceSubscriptions/subscription-expired-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "expiresAt": "2018-08-01T22:07:00Z", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-expiresAt-sample.jsonld b/data/csourceSubscriptions/subscription-expiresAt-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..9286e21dd29f7d00c1daf64a95004d91841fa22e --- /dev/null +++ b/data/csourceSubscriptions/subscription-expiresAt-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "expiresAt": "2022-08-01T22:07:00Z", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-geoQ-sample.jsonld b/data/csourceSubscriptions/subscription-geoQ-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..ee67134fb057d1e4594c4ad4d5ecdf20a9a7bfcd --- /dev/null +++ b/data/csourceSubscriptions/subscription-geoQ-sample.jsonld @@ -0,0 +1,25 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "geoQ":{ + "georel":"near;maxDistance==2000", + "geometry":"Point", + "coordinates":[-8.52,41.2], + "geoproperty": "location" + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-geoQ-without-geoproperty-sample.jsonld b/data/csourceSubscriptions/subscription-geoQ-without-geoproperty-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..59c4e5957f39493277a85e2252c09c88f69d674e --- /dev/null +++ b/data/csourceSubscriptions/subscription-geoQ-without-geoproperty-sample.jsonld @@ -0,0 +1,24 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "geoQ":{ + "georel":"near;maxDistance==2000", + "geometry":"Point", + "coordinates":[-8.52,41.2] + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-inactive-sample.jsonld b/data/csourceSubscriptions/subscription-inactive-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..9d513e905f20817f9a0addbb3470eb10242218da --- /dev/null +++ b/data/csourceSubscriptions/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://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-invalid-query-sample.jsonld b/data/csourceSubscriptions/subscription-invalid-query-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..9a4012e3bbbdf54d4536c9dcfee4da66ba92ccd7 --- /dev/null +++ b/data/csourceSubscriptions/subscription-invalid-query-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "q": "invalidQuery", + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-invalid-type-sample.jsonld b/data/csourceSubscriptions/subscription-invalid-type-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..3db426ed26ec8af6ae69b2845db4919ccd27fd16 --- /dev/null +++ b/data/csourceSubscriptions/subscription-invalid-type-sample.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"RandomType", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-sample.jsonld b/data/csourceSubscriptions/subscription-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..aa4cf39e3b28c6c58022da1ce535fe5426beed90 --- /dev/null +++ b/data/csourceSubscriptions/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://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-temporalQ-createdAt-sample.jsonld b/data/csourceSubscriptions/subscription-temporalQ-createdAt-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..fe1ac00828040413a165222c2713d6c4b6dc40bf --- /dev/null +++ b/data/csourceSubscriptions/subscription-temporalQ-createdAt-sample.jsonld @@ -0,0 +1,24 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "temporalQ": { + "timerel": "after", + "timeAt": "2020-06-01T22:07:00Z", + "timeproperty": "createdAt" + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-temporalQ-modifiedAt-sample.jsonld b/data/csourceSubscriptions/subscription-temporalQ-modifiedAt-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..26bde451fe59880403646a2a68b82d2bd121649e --- /dev/null +++ b/data/csourceSubscriptions/subscription-temporalQ-modifiedAt-sample.jsonld @@ -0,0 +1,24 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "temporalQ": { + "timerel": "after", + "timeAt": "2020-06-01T22:07:00Z", + "timeproperty": "modifiedAt" + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-temporalQ-observedAt-sample.jsonld b/data/csourceSubscriptions/subscription-temporalQ-observedAt-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..9bb93fdb5f364f910cde40425ed7c0cef785738b --- /dev/null +++ b/data/csourceSubscriptions/subscription-temporalQ-observedAt-sample.jsonld @@ -0,0 +1,24 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "temporalQ": { + "timerel": "after", + "timeAt": "2020-06-01T22:07:00Z", + "timeproperty": "observedAt" + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-timeInterval-sample.jsonld b/data/csourceSubscriptions/subscription-timeInterval-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..fd01831e4b8690aac6d0b939817e5577d5d9d33b --- /dev/null +++ b/data/csourceSubscriptions/subscription-timeInterval-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 10, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-unreachable-endpoint-sample.jsonld b/data/csourceSubscriptions/subscription-unreachable-endpoint-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..2dbb680d5ddb34ef8b8943070a135d4c76ebb845 --- /dev/null +++ b/data/csourceSubscriptions/subscription-unreachable-endpoint-sample.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://unreachable.endpoint/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-watchedAttributes-sample.jsonld b/data/csourceSubscriptions/subscription-watchedAttributes-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..8858a4e239adcb2bdbb67d159f636ff0883040a6 --- /dev/null +++ b/data/csourceSubscriptions/subscription-watchedAttributes-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "watchedAttributes": ["name", "subCategory"], + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceSubscriptions/subscription-without-notification-sample.jsonld b/data/csourceSubscriptions/subscription-without-notification-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..2853928b384c579f655a165cef0b6947a9949f6d --- /dev/null +++ b/data/csourceSubscriptions/subscription-without-notification-sample.jsonld @@ -0,0 +1,12 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/batch/empty-sample.jsonld b/data/entities/batch/empty-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc --- /dev/null +++ b/data/entities/batch/empty-sample.jsonld @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/data/entities/batch/invalid-json-ld-sample.jsonld b/data/entities/batch/invalid-json-ld-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..fdf991952badf68d30effa6a62a3bd1b34f958ba --- /dev/null +++ b/data/entities/batch/invalid-json-ld-sample.jsonld @@ -0,0 +1,14 @@ +[ + { + "id":"urn:ngsi-ld:Building:randomUUID", + "type":"Building", + "name":{ + "type":"Property", + "value":null + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + ] + } +] \ No newline at end of file diff --git a/data/entities/batch/invalid-json-sample.jsonld b/data/entities/batch/invalid-json-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..8e4a66a2c056157e2f66c8617d579cfdd40bf06c --- /dev/null +++ b/data/entities/batch/invalid-json-sample.jsonld @@ -0,0 +1,10 @@ +[ + { + "id":"urn:ngsi-ld:Building:randomUUID",, + "type":"Building", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + ] + } +] \ No newline at end of file diff --git a/data/entities/building-location-attribute-sample.jsonld b/data/entities/building-location-attribute-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..081c7a016c1efa3e51878f447b6d55c2aa978898 --- /dev/null +++ b/data/entities/building-location-attribute-sample.jsonld @@ -0,0 +1,22 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/building-location-attribute.jsonld b/data/entities/building-location-attribute.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..778fe8f95f2b5734c82d4c1969cad1d14890cd38 --- /dev/null +++ b/data/entities/building-location-attribute.jsonld @@ -0,0 +1,23 @@ +{ + "id": "urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/building-minimal-sample.jsonld b/data/entities/building-minimal-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..b304755a7180a8cb688fd6ccd68a9a9c59231edd --- /dev/null +++ b/data/entities/building-minimal-sample.jsonld @@ -0,0 +1,7 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/building-minimal-without-context-sample.jsonld b/data/entities/building-minimal-without-context-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..78ff356510e1e04eaebead06bdd868d98d53a0b7 --- /dev/null +++ b/data/entities/building-minimal-without-context-sample.jsonld @@ -0,0 +1,4 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building" +} \ No newline at end of file diff --git a/data/entities/building-relationship-of-property-sample.jsonld b/data/entities/building-relationship-of-property-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..c87ae1ecadf9f8c9bd6096e11f716389b4519f09 --- /dev/null +++ b/data/entities/building-relationship-of-property-sample.jsonld @@ -0,0 +1,29 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "value": 4, + "unitCode": "C62", + "observedAt": "2020-09-09T16:40:00.000Z", + "hasWeatherObserved": { + "type": "Relationship", + "object": "urn:ngsi-ld:Sensor:43a1af27-4aa7-44fe-bee9-fe76d56978a4" + } + }, + "almostFull": { + "type": "Property", + "value": false + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/building-relationship-sample.jsonld b/data/entities/building-relationship-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..c82bc65b6a463088aff8e467998174faeca17a6f --- /dev/null +++ b/data/entities/building-relationship-sample.jsonld @@ -0,0 +1,11 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/building-simple-attributes-sample.json b/data/entities/building-simple-attributes-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..7b86aadd7f4f55f4990d69aed8c5732572a7f42e --- /dev/null +++ b/data/entities/building-simple-attributes-sample.json @@ -0,0 +1,22 @@ +{ + "id": "RandomUuidToBeReplaced", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "value": 4, + "unitCode": "C62", + "observedAt": "2020-09-09T16:40:00.000Z" + }, + "almostFull": { + "type": "Property", + "value": false + } +} \ No newline at end of file diff --git a/data/entities/building-simple-attributes-sample.jsonld b/data/entities/building-simple-attributes-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..ebfce095012d036550b2f22319b06d89b8203582 --- /dev/null +++ b/data/entities/building-simple-attributes-sample.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "value": 4, + "unitCode": "C62", + "observedAt": "2020-09-09T16:40:00.000Z" + }, + "almostFull": { + "type": "Property", + "value": false + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/building-simple-attributes-second-sample.jsonld b/data/entities/building-simple-attributes-second-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..a79af10ebaaebb4a46e91aec914ac85f6b6e901f --- /dev/null +++ b/data/entities/building-simple-attributes-second-sample.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Pisa Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "value": 6, + "unitCode": "C62", + "observedAt": "2020-10-10T16:40:00.000Z" + }, + "almostFull": { + "type": "Property", + "value": true + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/building-unretrievable-context-sample.jsonld b/data/entities/building-unretrievable-context-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..0393ff05bd75c67f488da86e4dfc7a92d5bf8957 --- /dev/null +++ b/data/entities/building-unretrievable-context-sample.jsonld @@ -0,0 +1,7 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-non-existing.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/empty-sample.jsonld b/data/entities/empty-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc --- /dev/null +++ b/data/entities/empty-sample.jsonld @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/data/entities/expectations/building-attributes-query-expectation.json b/data/entities/expectations/building-attributes-query-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..30988db6d2e2e187f6e3de78a99d465729446433 --- /dev/null +++ b/data/entities/expectations/building-attributes-query-expectation.json @@ -0,0 +1,15 @@ + + { + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://ngsi-ld-test-suite/context#Building", + "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#subCategory": { + "type": "Property", + "value": "tourism" + } + } \ No newline at end of file diff --git a/data/entities/expectations/building-geoproperty-query-expectation.jsonld b/data/entities/expectations/building-geoproperty-query-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..e5b32cf9eec99e4e690a724afec0931e3633dace --- /dev/null +++ b/data/entities/expectations/building-geoproperty-query-expectation.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://ngsi-ld-test-suite/context#Building", + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 13.3986, + 52.5547 + ] + } + }, + "https://ngsi-ld-test-suite/context#name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "https://ngsi-ld-test-suite/context#subCategory": { + "type": "Property", + "value": "tourism" + }, + "@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/entities/expectations/building-location-attribute-normalized.geojson b/data/entities/expectations/building-location-attribute-normalized.geojson new file mode 100644 index 0000000000000000000000000000000000000000..c025fc16e363ee204d378dc3ce4198356e5c0f25 --- /dev/null +++ b/data/entities/expectations/building-location-attribute-normalized.geojson @@ -0,0 +1,29 @@ +{ + "id": "urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9", + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + }, + "properties": { + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } +} diff --git a/data/entities/expectations/building-location-attribute-simplified.geojson b/data/entities/expectations/building-location-attribute-simplified.geojson new file mode 100644 index 0000000000000000000000000000000000000000..a211beadc0c7c3a90cd0a436c984195f01536b24 --- /dev/null +++ b/data/entities/expectations/building-location-attribute-simplified.geojson @@ -0,0 +1,20 @@ +{ + "id": "urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9", + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + }, + "properties": { + "type": "Building", + "name": "Eiffel Tower", + "subCategory": "tourism", + "location": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } +} diff --git a/data/entities/expectations/building-minimal-expectation.json b/data/entities/expectations/building-minimal-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..0c1b9efb3204a46f31399d0b3bf3cc6adef8d5e6 --- /dev/null +++ b/data/entities/expectations/building-minimal-expectation.json @@ -0,0 +1,4 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://ngsi-ld-test-suite/context#Building" +} \ No newline at end of file diff --git a/data/entities/expectations/building-simple-attributes-expectation.jsonld b/data/entities/expectations/building-simple-attributes-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..fcf71cdd68e33fa5822e4140c68d7b77c59bf592 --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-expectation.jsonld @@ -0,0 +1,25 @@ +{ + "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": "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" + }, + "@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/entities/expectations/building-simple-attributes-query-expectation.jsonld b/data/entities/expectations/building-simple-attributes-query-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..93f2fb86842a57edacef4493aa6bad8bbf77ff02 --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-query-expectation.jsonld @@ -0,0 +1,17 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://ngsi-ld-test-suite/context#Building", + "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#subCategory": { + "type": "Property", + "value": "tourism" + }, + "@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/entities/expectations/building-simple-attributes-sample-compacted-expectation.json b/data/entities/expectations/building-simple-attributes-sample-compacted-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..7b86aadd7f4f55f4990d69aed8c5732572a7f42e --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-sample-compacted-expectation.json @@ -0,0 +1,22 @@ +{ + "id": "RandomUuidToBeReplaced", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "value": 4, + "unitCode": "C62", + "observedAt": "2020-09-09T16:40:00.000Z" + }, + "almostFull": { + "type": "Property", + "value": false + } +} \ No newline at end of file diff --git a/data/entities/expectations/building-simple-attributes-sample-expanded-expectation.json b/data/entities/expectations/building-simple-attributes-sample-expanded-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..e6c0047cd9468fb7032380617d6e7318bc4d20f4 --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-sample-expanded-expectation.json @@ -0,0 +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": "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-simplified-expectation.json b/data/entities/expectations/building-simple-attributes-simplified-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..17d497896fef03350f27a78ff4217fe21c6e05c1 --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-simplified-expectation.json @@ -0,0 +1,8 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://ngsi-ld-test-suite/context#Building", + "https://ngsi-ld-test-suite/context#name": "Eiffel Tower", + "https://ngsi-ld-test-suite/context#airQualityLevel": 4, + "https://ngsi-ld-test-suite/context#almostFull": false, + "https://ngsi-ld-test-suite/context#subCategory": "tourism" +} \ No newline at end of file diff --git a/data/entities/expectations/building-simple-attributes-simplified-expectation.jsonld b/data/entities/expectations/building-simple-attributes-simplified-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..0fb90c69af3d9a9224e2e2ad141bed1504555f67 --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-simplified-expectation.jsonld @@ -0,0 +1,11 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://ngsi-ld-test-suite/context#Building", + "https://ngsi-ld-test-suite/context#name": "Eiffel Tower", + "https://ngsi-ld-test-suite/context#airQualityLevel": 4, + "https://ngsi-ld-test-suite/context#almostFull": false, + "https://ngsi-ld-test-suite/context#subCategory": "tourism", + "@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/entities/expectations/two-buildings-location-attribute-normalized.geojson b/data/entities/expectations/two-buildings-location-attribute-normalized.geojson new file mode 100644 index 0000000000000000000000000000000000000000..60a813242597fc535bf2610cbee464bd74e437e2 --- /dev/null +++ b/data/entities/expectations/two-buildings-location-attribute-normalized.geojson @@ -0,0 +1,60 @@ +{ + "type": "FeatureCollection", + "features": [{ + "id": "urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9", + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + }, + "properties": { + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } + }, { + "id": "urn:ngsi-ld:Building:3009ef20-9f62-41f5-bd66-92f041b428b9", + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + }, + "properties": { + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } + }] +} diff --git a/data/entities/expectations/two-types-vehicle-offstreetparking-expectation.jsonld b/data/entities/expectations/two-types-vehicle-offstreetparking-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..eba300f371aad57dde34d311897d913c973ecadb --- /dev/null +++ b/data/entities/expectations/two-types-vehicle-offstreetparking-expectation.jsonld @@ -0,0 +1,60 @@ +[ + { + "id": "urn:ngsi-ld:Vehicle:8012188779712372", + "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" + }, + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + ] + }, + { + "id": "urn:ngsi-ld:OffStreetParking:8309214349077321", + "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 + ] + } + }, + "https://ngsi-ld-test-suite/context#name": { + "type": "Property", + "value": "Downtown One" + }, + "@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/entities/expectations/two-vehicles-expectation.jsonld b/data/entities/expectations/two-vehicles-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..66aa4628641744ff859ca1e83cc677f6d27f4641 --- /dev/null +++ b/data/entities/expectations/two-vehicles-expectation.jsonld @@ -0,0 +1,42 @@ +[ + { + "id": "urn:ngsi-ld:Vehicle:8012188779712372", + "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" + }, + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + ] + }, + { + "id": "urn:ngsi-ld:Vehicle:8012188779712372", + "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" + }, + "@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/entities/expectations/vehicle-delete-datasetid-speed-expectation.jsonld b/data/entities/expectations/vehicle-delete-datasetid-speed-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..a7238cbb9bd3e336116a5c8fb3ace170f2d08896 --- /dev/null +++ b/data/entities/expectations/vehicle-delete-datasetid-speed-expectation.jsonld @@ -0,0 +1,29 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + }, + "datasetId": "urn:ngsi-ld:Relationship:parked12345" + }, + "speed": { + "type": "Property", + "value": 55, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-delete-default-speed-expectation.jsonld b/data/entities/expectations/vehicle-delete-default-speed-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..4df3a8c4ea5d7c083eddb8b4dad1f340880c5fca --- /dev/null +++ b/data/entities/expectations/vehicle-delete-default-speed-expectation.jsonld @@ -0,0 +1,31 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + }, + "datasetId": "urn:ngsi-ld:Relationship:parked12345" + }, + "speed": + { + "type": "Property", + "value": 54.5, + "source": { + "type": "Property", + "value": "GPS" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-delete-deleteall-speed-expectation.jsonld b/data/entities/expectations/vehicle-delete-deleteall-speed-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..29744061422af097b19af53ced2c0eacd36ad94f --- /dev/null +++ b/data/entities/expectations/vehicle-delete-deleteall-speed-expectation.jsonld @@ -0,0 +1,21 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + }, + "datasetId": "urn:ngsi-ld:Relationship:parked12345" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-isparked-update-expectation.jsonld b/data/entities/expectations/vehicle-isparked-update-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..b005ba61bebde6e5e51c5ce49108f04deb203eda --- /dev/null +++ b/data/entities/expectations/vehicle-isparked-update-expectation.jsonld @@ -0,0 +1,38 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:JohnDoe" + } + }, + "speed": [{ + "type": "Property", + "value": 55, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometer" + }, + { + "type": "Property", + "value": 54.5, + "source": { + "type": "Property", + "value": "GPS" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" + }], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-multi-attributes-expectation.jsonld b/data/entities/expectations/vehicle-multi-attributes-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..06decfb218146423061a49c7eeecbf2e2b7182f5 --- /dev/null +++ b/data/entities/expectations/vehicle-multi-attributes-expectation.jsonld @@ -0,0 +1,38 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + }, + "datasetId": "urn:ngsi-ld:Relationship:parked12345" + }, + "speed": [{ + "type": "Property", + "value": 55, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + { + "type": "Property", + "value": 99, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" + }], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-parking-simple-expectation.geojson b/data/entities/expectations/vehicle-parking-simple-expectation.geojson new file mode 100644 index 0000000000000000000000000000000000000000..a13e5641e171a51a647732916fa20d13181cc73f --- /dev/null +++ b/data/entities/expectations/vehicle-parking-simple-expectation.geojson @@ -0,0 +1,76 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "id": "urn:ngsi-ld:Vehicle:9584898452850406", + "type": "Feature", + "properties": { + "type": "Vehicle", + "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" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } + }, + { + "id": "urn:ngsi-ld:OffStreetParking:8449859096747487", + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -8.5, + 41.2 + ] + }, + "properties": { + "type": "OffStreetParking", + "name": { + "type": "Property", + "value": "Downtown One" + }, + "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 + ] + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } + } + ] +} diff --git a/data/entities/expectations/vehicle-simple-attributes-core-context-expectation.json b/data/entities/expectations/vehicle-simple-attributes-core-context-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..54eca92534d500d21893510ebaa7c7a8bf8b01da --- /dev/null +++ b/data/entities/expectations/vehicle-simple-attributes-core-context-expectation.json @@ -0,0 +1,17 @@ +{ + "id": "urn:ngsi-ld:Vehicle:3542857210001312", + "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-speed-appended-expectation.jsonld b/data/entities/expectations/vehicle-speed-appended-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..1eb89b2ca4582831fef0705e3626cd29833bdf22 --- /dev/null +++ b/data/entities/expectations/vehicle-speed-appended-expectation.jsonld @@ -0,0 +1,44 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "speed": [ + { + "type": "Property", + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometer", + "value": 55 + }, + { + "type": "Property", + "source": { + "type": "Property", + "value": "GPS" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed", + "value": 54.5 + } + ], + "attribute_to_be_added": { + "type": "Property", + "value": 23 + }, + "isParked": { + "type": "Relationship", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + }, + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-speed-different-datasetid-expectation.jsonld b/data/entities/expectations/vehicle-speed-different-datasetid-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..aff9a0d989aefe5bafe8c924d8d2f2bfe4fe8f6a --- /dev/null +++ b/data/entities/expectations/vehicle-speed-different-datasetid-expectation.jsonld @@ -0,0 +1,53 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "speed": [ + { + "type": "Property", + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometerA4567-speed2", + "value": 56 + }, + { + "type": "Property", + "source": { + "type": "Property", + "value": "GPS" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed", + "value": 54.5 + }, + { + "type": "Property", + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometer", + "value": 55 + } + ], + "attribute_to_be_added": { + "type": "Property", + "value": 23 + }, + "isParked": { + "type": "Relationship", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + }, + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-update-attributes-expectation.jsonld b/data/entities/expectations/vehicle-update-attributes-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..d869007366625c4a80a13c6a06fa4079faa75a38 --- /dev/null +++ b/data/entities/expectations/vehicle-update-attributes-expectation.jsonld @@ -0,0 +1,38 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + }, + "datasetId": "urn:ngsi-ld:Relationship:parked12345" + }, + "speed": [{ + "type": "Property", + "value": 99, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + { + "type": "Property", + "value": 54.5, + "source": { + "type": "Property", + "value": "GPS" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" + }], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-update-datasetid-attributes-expectation.jsonld b/data/entities/expectations/vehicle-update-datasetid-attributes-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..4b1781067e1126faea59308a4433850f305485cf --- /dev/null +++ b/data/entities/expectations/vehicle-update-datasetid-attributes-expectation.jsonld @@ -0,0 +1,38 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:JohnDoe" + }, + "datasetId": "urn:ngsi-ld:Relationship:parked12345" + }, + "speed": [{ + "type": "Property", + "value": 55, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + { + "type": "Property", + "value": 99, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" + }], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-update-speed-expectation.jsonld b/data/entities/expectations/vehicle-update-speed-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..afa00eda0d5c7ec8bde99b4b1e0f48df66bf7dcc --- /dev/null +++ b/data/entities/expectations/vehicle-update-speed-expectation.jsonld @@ -0,0 +1,38 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + } + }, + "speed": [{ + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometer" + }, + { + "type": "Property", + "value": 54.5, + "source": { + "type": "Property", + "value": "GPS" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" + }], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/airQualityLevel-fragment.jsonld b/data/entities/fragmentEntities/airQualityLevel-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..32b7ddf438b43601b21f9b561c89583cd8f1f661 --- /dev/null +++ b/data/entities/fragmentEntities/airQualityLevel-fragment.jsonld @@ -0,0 +1,11 @@ +{ + "airQualityLevel": { + "type": "Property", + "value": 5, + "unitCode": "C62", + "observedAt": "2020-10-10T16:40:00.000Z" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/airQualityLevel-with-relationship-fragment.json b/data/entities/fragmentEntities/airQualityLevel-with-relationship-fragment.json new file mode 100644 index 0000000000000000000000000000000000000000..cbf121c35664e3fd0f173e23a6cf7aa0d52d064d --- /dev/null +++ b/data/entities/fragmentEntities/airQualityLevel-with-relationship-fragment.json @@ -0,0 +1,12 @@ +{ + "airQualityLevel": { + "type": "Property", + "value": 4, + "unitCode": "C62", + "observedAt": "2020-09-09T16:40:00.000Z", + "hasWeatherObserved": { + "type": "Relationship", + "object": "urn:ngsi-ld:Sensor:43a1af27-4aa7-44fe-bee9-fe76d56978a4" + } + } +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/empty-fragment.json b/data/entities/fragmentEntities/empty-fragment.json new file mode 100644 index 0000000000000000000000000000000000000000..0db3279e44b0dc4fb7e694b6cb10210a96ba6ba5 --- /dev/null +++ b/data/entities/fragmentEntities/empty-fragment.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/data/entities/fragmentEntities/invalid-fragment.jsonld b/data/entities/fragmentEntities/invalid-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..cc6319ecbd545fe518880914f305f8e60c7c06a2 --- /dev/null +++ b/data/entities/fragmentEntities/invalid-fragment.jsonld @@ -0,0 +1,18 @@ +{ + "speed": { + "type": "Property",, + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometerA4567-speed2" + }, + "brandName": { + "type": "Property", + "value": "BMW" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/locatedAt-fragment.json b/data/entities/fragmentEntities/locatedAt-fragment.json new file mode 100644 index 0000000000000000000000000000000000000000..c48f459a3ab4bfba3339e8fe3c5e69a546b02ec2 --- /dev/null +++ b/data/entities/fragmentEntities/locatedAt-fragment.json @@ -0,0 +1,6 @@ +{ + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + } +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/location-fragment.json b/data/entities/fragmentEntities/location-fragment.json new file mode 100644 index 0000000000000000000000000000000000000000..00006a2a814b7eb03cb0ee8b8ecf0b94d3f65f19 --- /dev/null +++ b/data/entities/fragmentEntities/location-fragment.json @@ -0,0 +1,12 @@ +{ + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 13.3986, + 52.5547 + ] + } + } +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/simple-attributes-fragment.json b/data/entities/fragmentEntities/simple-attributes-fragment.json new file mode 100644 index 0000000000000000000000000000000000000000..b269075718730325df6ea49b25a6b09f4f445082 --- /dev/null +++ b/data/entities/fragmentEntities/simple-attributes-fragment.json @@ -0,0 +1,20 @@ +{ + "name":{ + "type":"Property", + "value":"Eiffel Tower" + }, + "subCategory":{ + "type":"Property", + "value":"tourism" + }, + "airQualityLevel":{ + "type":"Property", + "value":4, + "unitCode":"C62", + "observedAt":"2020-09-09T16:40:00.000Z" + }, + "almostFull":{ + "type":"Property", + "value":false + } +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/simple-attributes-relationship-of-property-fragment.json b/data/entities/fragmentEntities/simple-attributes-relationship-of-property-fragment.json new file mode 100644 index 0000000000000000000000000000000000000000..c09a92d650a60953d604784f85deb0ccd71c27c7 --- /dev/null +++ b/data/entities/fragmentEntities/simple-attributes-relationship-of-property-fragment.json @@ -0,0 +1,24 @@ +{ + "name":{ + "type":"Property", + "value":"Eiffel Tower" + }, + "subCategory":{ + "type":"Property", + "value":"tourism" + }, + "airQualityLevel":{ + "type":"Property", + "value":4, + "unitCode":"C62", + "observedAt":"2020-09-09T16:40:00.000Z", + "hasWeatherObserved":{ + "type":"Relationship", + "object":"urn:ngsi-ld:Sensor:43a1af27-4aa7-44fe-bee9-fe76d56978a4" + } + }, + "almostFull":{ + "type":"Property", + "value":false + } +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-attribute-to-add-fragment.jsonld b/data/entities/fragmentEntities/vehicle-attribute-to-add-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..b01f0570bd52c734b29a3435dc09f8aa286fe627 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-attribute-to-add-fragment.jsonld @@ -0,0 +1,18 @@ +{ + "speed": { + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometer" + }, + "attribute_to_be_added": { + "type": "Property", + "value": 23 + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-brandname-fragment.json b/data/entities/fragmentEntities/vehicle-brandname-fragment.json new file mode 100644 index 0000000000000000000000000000000000000000..d513c213aab0c7a0ede9e2787e783d44c4fa7905 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-brandname-fragment.json @@ -0,0 +1,4 @@ +{ + "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 new file mode 100644 index 0000000000000000000000000000000000000000..83729e515e8270ee960df5194beccf9aa8999b38 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-brandname-fragment.jsonld @@ -0,0 +1,5 @@ +{ + "type": "Property", + "value": "BMW", + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-isparked-fragment.jsonld b/data/entities/fragmentEntities/vehicle-isparked-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..774f93c22f311cd531b48aa9ba4c1f047f6832ef --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-isparked-fragment.jsonld @@ -0,0 +1,9 @@ +{ + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:JohnDoe" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/fragmentEntities/vehicle-new-attribute-fragment.jsonld b/data/entities/fragmentEntities/vehicle-new-attribute-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..0ff0b6c03931a37590b226eeff7a93f9594b4772 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-new-attribute-fragment.jsonld @@ -0,0 +1,9 @@ +{ + "attribute_to_be_added": { + "type": "Property", + "value": 23 + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-different-datasetid-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-different-datasetid-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..2ab1671543e9e304c5933fc34a4a3f49959ae901 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-different-datasetid-fragment.jsonld @@ -0,0 +1,18 @@ +{ + "speed": { + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometerA4567-speed2" + }, + "attribute_to_be_added": { + "type": "Property", + "value": 23 + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-different-type-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-different-type-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..9a023b68a1871de4c4a0f84b2bd91bef6e987ba9 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-different-type-fragment.jsonld @@ -0,0 +1,7 @@ +{ + "type": "Relationship", + "object": "urn:ngsi-ld:Entity:01", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..692d09f735cdb1d7002a4baa82b747fc66c1ce41 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-fragment.jsonld @@ -0,0 +1,7 @@ +{ + "value": 56, + "datasetId": "urn:ngsi-ld:Property:speedometer", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-no-datasetid-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-no-datasetid-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..38de190916875d96266499cd68130d80b304ad20 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-no-datasetid-fragment.jsonld @@ -0,0 +1,11 @@ +{ + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..2a4343ae50aa3dcb0b50fce6bc8c8fdc1347aedb --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-01-fragment.jsonld @@ -0,0 +1,13 @@ +{ + "speed": { + "type": "Property", + "value": 99, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-two-datasetid-02-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-02-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..52941b569bc053e5e958072ec47e83f607b34201 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-02-fragment.jsonld @@ -0,0 +1,24 @@ +{ + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:JohnDoe" + }, + "datasetId": "urn:ngsi-ld:Relationship:parked12345" + }, + "speed": { + "type": "Property", + "value": 99, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-two-datasetid-03-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-03-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..fd3c5b3e9d9b2a77fcbdbe710ee3bbd59ef750ef --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-two-datasetid-03-fragment.jsonld @@ -0,0 +1,24 @@ +{ + "isParked2": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:JohnDoe" + }, + "datasetId": "urn:ngsi-ld:Relationship:parked12345" + }, + "speed": { + "type": "Property", + "value": 99, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-unknown-datasetid-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-unknown-datasetid-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..2367d134b1c466c595e4dfb2816ce992d4a36dbe --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-unknown-datasetid-fragment.jsonld @@ -0,0 +1,12 @@ +{ + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:unknownDatasetId", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/invalid-json-sample.jsonld b/data/entities/invalid-json-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..8e4a66a2c056157e2f66c8617d579cfdd40bf06c --- /dev/null +++ b/data/entities/invalid-json-sample.jsonld @@ -0,0 +1,10 @@ +[ + { + "id":"urn:ngsi-ld:Building:randomUUID",, + "type":"Building", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.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 new file mode 100644 index 0000000000000000000000000000000000000000..a42762b44cbf575223e61751b1cc19fb55d5c52b --- /dev/null +++ b/data/entities/parking-simple-attributes-sample.jsonld @@ -0,0 +1,35 @@ +{ + "id": "urn:ngsi-ld:OffStreetParking:randomUUID", + "type": "OffStreetParking", + "name": { + "type": "Property", + "value": "Downtown One" + }, + "availableSpotNumber": { + "type": "Property", + "value": 121, + "observedAt": "2017-07-29T12:05:02Z", + "reliability": { + "type": "Property", + "value": 0.7 + }, + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Camera:C1" + } + }, + "totalSpotNumber": { + "type": "Property", + "value": 200 + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [-8.5, 41.2] + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } \ No newline at end of file diff --git a/data/entities/vehicle-simple-attributes-sample.json b/data/entities/vehicle-simple-attributes-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..9825fa9f6349b735ac5c030747501c03858c7185 --- /dev/null +++ b/data/entities/vehicle-simple-attributes-sample.json @@ -0,0 +1,13 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z" + } +} \ No newline at end of file diff --git a/data/entities/vehicle-simple-attributes-sample.jsonld b/data/entities/vehicle-simple-attributes-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..53363f9c02351ce09277434ae6b0cf20fc592f08 --- /dev/null +++ b/data/entities/vehicle-simple-attributes-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + } + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/vehicle-speed-two-datasetid-sample.jsonld b/data/entities/vehicle-speed-two-datasetid-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..87e01ca2e34e466c23df1c4a510978eac772a03b --- /dev/null +++ b/data/entities/vehicle-speed-two-datasetid-sample.jsonld @@ -0,0 +1,38 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + } + }, + "speed": [{ + "type": "Property", + "value": 55, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Property:speedometer" + }, + { + "type": "Property", + "value": 54.5, + "source": { + "type": "Property", + "value": "GPS" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" + }], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/vehicle-two-datasetid-attributes-sample.jsonld b/data/entities/vehicle-two-datasetid-attributes-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..d72a77df9bff2732b1096e98c6e6c1954e15ba9c --- /dev/null +++ b/data/entities/vehicle-two-datasetid-attributes-sample.jsonld @@ -0,0 +1,38 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + }, + "datasetId": "urn:ngsi-ld:Relationship:parked12345" + }, + "speed": [{ + "type": "Property", + "value": 55, + "source": { + "type": "Property", + "value": "Speedometer" + } + }, + { + "type": "Property", + "value": 54.5, + "source": { + "type": "Property", + "value": "GPS" + }, + "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" + }], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/notifications/expectations/1-timesSent-failed.json b/data/notifications/expectations/1-timesSent-failed.json new file mode 100644 index 0000000000000000000000000000000000000000..27b2d40f6ff4dcd854ea8b8556b0dfd558cd9415 --- /dev/null +++ b/data/notifications/expectations/1-timesSent-failed.json @@ -0,0 +1,9 @@ +{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + }, + "status":"failed", + "timesSent":1 +} \ No newline at end of file diff --git a/data/notifications/expectations/1-timesSent-ok.json b/data/notifications/expectations/1-timesSent-ok.json new file mode 100644 index 0000000000000000000000000000000000000000..2e61a8ba00a42c65d3f9eb0c9b69aeaa1b9b5428 --- /dev/null +++ b/data/notifications/expectations/1-timesSent-ok.json @@ -0,0 +1,9 @@ +{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + }, + "status":"ok", + "timesSent":1 +} \ No newline at end of file diff --git a/data/subscriptions/expectations/subscription-028-01-expectation.jsonld b/data/subscriptions/expectations/subscription-028-01-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..81afd4bd0218cc9fb20cbd0f94d374a7bb1e6777 --- /dev/null +++ b/data/subscriptions/expectations/subscription-028-01-expectation.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 5, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "status": "active", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/expectations/subscription-vehicle-expanded-types-sample.jsonld b/data/subscriptions/expectations/subscription-vehicle-expanded-types-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..2ba30b1f0b522269f227b229fe46027ef48f010e --- /dev/null +++ b/data/subscriptions/expectations/subscription-vehicle-expanded-types-sample.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"https://ngsi-ld-test-suite/context#Vehicle" + } + ], + "timeInterval": 5, + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "status": "active", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/expectations/subscription-vehicle-sample.jsonld b/data/subscriptions/expectations/subscription-vehicle-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..d7a6831132c413ceffd0e7875e172f8d3e704b9f --- /dev/null +++ b/data/subscriptions/expectations/subscription-vehicle-sample.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Vehicle" + } + ], + "timeInterval": 5, + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "status": "active", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/expectations/subscriptions-030-03-expectation.json b/data/subscriptions/expectations/subscriptions-030-03-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..4056c0ab7431ffa64b4ad1f111e7f1f84cff9247 --- /dev/null +++ b/data/subscriptions/expectations/subscriptions-030-03-expectation.json @@ -0,0 +1,18 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 5, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "status": "active" +} \ No newline at end of file diff --git a/data/subscriptions/expectations/subscriptions-031-01-expectation.json b/data/subscriptions/expectations/subscriptions-031-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..765af41a7d4ab7756e23318153e31f3e96d290a8 --- /dev/null +++ b/data/subscriptions/expectations/subscriptions-031-01-expectation.json @@ -0,0 +1,59 @@ +[ + { + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 5, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "status": "active" + }, + { + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "watchedAttributes":[ + "name", + "subCategory" + ], + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "status": "active" + }, + { + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "isActive": false, + "status": "paused" + } +] \ 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..0e75ce560e426110841087d259af8a9cfe91d032 --- /dev/null +++ b/data/subscriptions/fragments/subscription-expiresAt-future-update-sample.json @@ -0,0 +1,4 @@ +{ + "type":"Subscription", + "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..9ccbe33095d9024c5f79da05cbccb19373860f77 --- /dev/null +++ b/data/subscriptions/fragments/subscription-expiresAt-update-sample.json @@ -0,0 +1,4 @@ +{ + "type":"Subscription", + "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-update-sample.json b/data/subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..17b6ed74aee07bb5e38f9cb8726596be38e13b91 --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json @@ -0,0 +1,5 @@ +{ + "type":"Subscription", + "isActive": true, + "expiresAt": "2030-08-01T22:07:00Z" +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-false-update-sample.json b/data/subscriptions/fragments/subscription-isActive-false-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..c5c686bcc644e03e80335c021be9996884f75499 --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-false-update-sample.json @@ -0,0 +1,4 @@ +{ + "type":"Subscription", + "isActive": false +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-true-update-sample.json b/data/subscriptions/fragments/subscription-isActive-true-update-sample.json new file mode 100644 index 0000000000000000000000000000000000000000..8672d20d403483cba0a2ba3d67197b719087f1bd --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-true-update-sample.json @@ -0,0 +1,4 @@ +{ + "type":"Subscription", + "isActive": true +} \ 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..9e92aa016278a2fecf02b97376bb7fbcd7479850 --- /dev/null +++ b/data/subscriptions/fragments/subscription-null-properties-update-sample.json @@ -0,0 +1,7 @@ +{ + "type":"Subscription", + "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..694a088e098ceb58ba391d1358facca24cbb0453 --- /dev/null +++ b/data/subscriptions/fragments/subscription-update-sample.json @@ -0,0 +1,10 @@ +{ + "type":"Subscription", + "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..ce3a2d117be2674b3c451eeaf51eeee13317a5c9 --- /dev/null +++ b/data/subscriptions/fragments/subscription-vehicle-entities-sample.json @@ -0,0 +1,15 @@ +{ + "type":"Subscription", + "entities":[ + { + "type":"Vehicle" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + } +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-accept-jsonld.jsonld b/data/subscriptions/subscription-building-entities-accept-jsonld.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..6f280dce9b19bb93de3cb8984cdb3f1e50cedc73 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-accept-jsonld.jsonld @@ -0,0 +1,18 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/ld+json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-active-default-context.jsonld b/data/subscriptions/subscription-building-entities-active-default-context.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..016724ef37d46ecf20a0cd0eb147a95d30f74d50 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-active-default-context.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "isActive": true, + "entities":[ + { + "type":"https://ngsi-ld-test-suite/context#Building" + } + ], + "notification":{ + "attributes": ["https://ngsi-ld-test-suite/context#airQualityLevel"], + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@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/subscriptions/subscription-building-entities-active-endpoint-info.jsonld b/data/subscriptions/subscription-building-entities-active-endpoint-info.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..7e907cdbbd17f8d197a9e79da2f0f3a637a90949 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-active-endpoint-info.jsonld @@ -0,0 +1,22 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format": "normalized", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json", + "receiverInfo": [ + { "key": "X-Additional-Key", "value": "Value" } + ] + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-active-notificationAttributes.jsonld b/data/subscriptions/subscription-building-entities-active-notificationAttributes.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..e03e0dbd81100701e0a81e2d76cf9449c244a5cf --- /dev/null +++ b/data/subscriptions/subscription-building-entities-active-notificationAttributes.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "isActive": true, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + }, + "attributes": ["airQualityLevel"] + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-active-query.jsonld b/data/subscriptions/subscription-building-entities-active-query.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..7166057132955a0458f00094ccd8c900b08aebd3 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-active-query.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "isActive": true, + "entities":[ + { + "type":"Building" + } + ], + "q":"name==\"Eiffel Tower\"", + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-active-watchedAttributes-query.jsonld b/data/subscriptions/subscription-building-entities-active-watchedAttributes-query.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..86bce0f38d7097c3e59db359484cdc6fcca0b9d5 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-active-watchedAttributes-query.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "isActive": true, + "watchedAttributes": ["airQualityLevel"], + "q": "name==\"Eiffel%20Tower\"", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-active-watchedAttributes.jsonld b/data/subscriptions/subscription-building-entities-active-watchedAttributes.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..574126366a421d52bfbb28db6a4b7f360cbc98fa --- /dev/null +++ b/data/subscriptions/subscription-building-entities-active-watchedAttributes.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "isActive": true, + "watchedAttributes": ["airQualityLevel"], + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-active.json b/data/subscriptions/subscription-building-entities-active.json new file mode 100644 index 0000000000000000000000000000000000000000..36259c57a2dbbcd70352231134e04d14b2005a63 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-active.json @@ -0,0 +1,17 @@ +{ + "type":"Subscription", + "isActive": true, + "expiresAt": null, + "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/subscriptions/subscription-building-entities-active.jsonld b/data/subscriptions/subscription-building-entities-active.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..eb93455e8d107a4394fa1e57a9d5a4df8cc13d47 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-active.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "isActive": true, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format": "normalized", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-default.jsonld b/data/subscriptions/subscription-building-entities-default.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..48bb27b23b4217de738d790830e4d07f3666973f --- /dev/null +++ b/data/subscriptions/subscription-building-entities-default.jsonld @@ -0,0 +1,17 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "endpoint":{ + "uri":"http://my.endpoint.org/notify" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } \ No newline at end of file diff --git a/data/subscriptions/subscription-empty-sample.jsonld b/data/subscriptions/subscription-empty-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..7a73a41bfdf76d6f793007240d80983a52f15f97 --- /dev/null +++ b/data/subscriptions/subscription-empty-sample.jsonld @@ -0,0 +1,2 @@ +{ +} \ 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..9d513e905f20817f9a0addbb3470eb10242218da --- /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://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-invalid-json-sample.jsonld b/data/subscriptions/subscription-invalid-json-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..3762671e081d6db7dd599dd6ab914fc5b57761a5 --- /dev/null +++ b/data/subscriptions/subscription-invalid-json-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://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..19201f3a967f6e3e970c0954ecd6a79e8f77079c --- /dev/null +++ b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld @@ -0,0 +1,17 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : -30 +} \ No newline at end of file diff --git a/data/subscriptions/subscription-invalid-throttling-timeInterval-sample.jsonld b/data/subscriptions/subscription-invalid-throttling-timeInterval-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..f3e348663f48a199947bc3c1075530300741d915 --- /dev/null +++ b/data/subscriptions/subscription-invalid-throttling-timeInterval-sample.jsonld @@ -0,0 +1,18 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 10, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : 30 +} \ 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..d045159043a7db4be1c4a3f11bf12767cb034183 --- /dev/null +++ b/data/subscriptions/subscription-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 5, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-timeInterval-sample.jsonld b/data/subscriptions/subscription-timeInterval-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..a6bd1088b592fe44070de914d0baab7059fe5691 --- /dev/null +++ b/data/subscriptions/subscription-timeInterval-sample.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 10, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-unretrievable-context-sample.jsonld b/data/subscriptions/subscription-unretrievable-context-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..76af13934b1a9d7e5c44e911382f7714098071bb --- /dev/null +++ b/data/subscriptions/subscription-unretrievable-context-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://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-non-existing.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-valid-throttling-sample.jsonld b/data/subscriptions/subscription-valid-throttling-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..94b95eaee6344d22c810c6dcdfb0b1fe21845756 --- /dev/null +++ b/data/subscriptions/subscription-valid-throttling-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : 15, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-watchedAttributes-sample.jsonld b/data/subscriptions/subscription-watchedAttributes-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..8858a4e239adcb2bdbb67d159f636ff0883040a6 --- /dev/null +++ b/data/subscriptions/subscription-watchedAttributes-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "watchedAttributes": ["name", "subCategory"], + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/2020-08-bus-temporal-representation-sample.jsonld b/data/temporalEntities/2020-08-bus-temporal-representation-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..6144fcb18345005fd21f1f641cb92ec1e4d7611c --- /dev/null +++ b/data/temporalEntities/2020-08-bus-temporal-representation-sample.jsonld @@ -0,0 +1,41 @@ +{ + "id":"urn:ngsi-ld:Bus:randomUUID", + "type":"Bus", + "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://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/2020-08-vehicule-temporal-representation-multiple-instances-sample.jsonld b/data/temporalEntities/2020-08-vehicule-temporal-representation-multiple-instances-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..b25b175deaa34a8b8ea5622758f99fc2f7c006a9 --- /dev/null +++ b/data/temporalEntities/2020-08-vehicule-temporal-representation-multiple-instances-sample.jsonld @@ -0,0 +1,176 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:07:00Z" + }, + { + "type":"Property", + "value":110, + "observedAt":"2020-08-01T12:09:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:11:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:13:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T12:15:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T12:17:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T12:19:00Z" + }, + { + "type":"Property", + "value":60, + "observedAt":"2020-08-01T12:21:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:23:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2020-08-01T12:25:00Z" + }, + { + "type":"Property", + "value":105, + "observedAt":"2020-08-01T12:27:00Z" + }, + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:29:00Z" + }, + { + "type":"Property", + "value":125, + "observedAt":"2020-08-01T12:31:00Z" + }, + { + "type":"Property", + "value":130, + "observedAt":"2020-08-01T12:35:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2020-08-01T14:20:00Z" + }, + { + "type":"Property", + "value":30, + "observedAt":"2020-08-01T15:05:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2020-08-01T15:07:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T15:20:00Z" + }, + { + "type":"Property", + "value":76, + "observedAt":"2020-08-01T16:05:00Z" + }, + { + "type":"Property", + "value":70, + "observedAt":"2020-08-01T17:07:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T18:03:00Z" + }, + { + "type":"Property", + "value":48, + "observedAt":"2020-08-01T19:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T19:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2020-08-01T20:05:00Z" + }, + { + "type":"Property", + "value":31, + "observedAt":"2020-08-01T20:07:00Z" + }, + { + "type":"Property", + "value":28, + "observedAt":"2020-08-01T21:03:00Z" + }, + { + "type":"Property", + "value":24, + "observedAt":"2020-08-01T21:05:00Z" + }, + { + "type":"Property", + "value":19, + "observedAt":"2020-08-01T22:07:00Z" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/2020-08-vehicule-temporal-representation-sample.jsonld b/data/temporalEntities/2020-08-vehicule-temporal-representation-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..36eafba41ef429ba1d65bca47c532259e95ec366 --- /dev/null +++ b/data/temporalEntities/2020-08-vehicule-temporal-representation-sample.jsonld @@ -0,0 +1,41 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:07:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/2020-09-vehicule-temporal-representation-sample.jsonld b/data/temporalEntities/2020-09-vehicule-temporal-representation-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..bfbc5ca5aee870000c1f41a7a855884a6b0b9f7b --- /dev/null +++ b/data/temporalEntities/2020-09-vehicule-temporal-representation-sample.jsonld @@ -0,0 +1,41 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "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" + } + ], + "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" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/2020-10-vehicule-temporal-representation-with-location-sample.jsonld b/data/temporalEntities/2020-10-vehicule-temporal-representation-with-location-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..6b4f6c1effeb37e987e1b5825b62b0117b3198a6 --- /dev/null +++ b/data/temporalEntities/2020-10-vehicule-temporal-representation-with-location-sample.jsonld @@ -0,0 +1,65 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":150, + "observedAt":"2020-10-01T12:03:00Z" + }, + { + "type":"Property", + "value":90, + "observedAt":"2020-10-01T12:05:00Z" + }, + { + "type":"Property", + "value":127, + "observedAt":"2020-10-01T12:07:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":89, + "observedAt":"2020-10-01T12:03:00Z" + }, + { + "type":"Property", + "value":78, + "observedAt":"2020-10-01T13:05:00Z" + }, + { + "type":"Property", + "value":62, + "observedAt":"2020-10-01T14:07:00Z" + } + ], + "location":[ + { + "type": "GeoProperty", + "value": { + "type":"Point", + "coordinates":[ + 2.35, + 42.22 + ] + }, + "observedAt":"2020-10-01T12:03:00Z" + }, + { + "type": "GeoProperty", + "value": { + "type":"Point", + "coordinates":[ + -8.5, + 41.2 + ] + }, + "observedAt":"2020-10-01T12:05:00Z" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/bus-temporal-representation-unretrievable-context-sample.jsonld b/data/temporalEntities/bus-temporal-representation-unretrievable-context-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..87ccc946c49b7bda22756da1fca90e8f07bca479 --- /dev/null +++ b/data/temporalEntities/bus-temporal-representation-unretrievable-context-sample.jsonld @@ -0,0 +1,41 @@ +{ + "id":"urn:ngsi-ld:Bus:randomUUID", + "type":"Bus", + "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://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-non-existing.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/entity-operations-after-query.jsonld b/data/temporalEntities/entity-operations-after-query.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..22271295de145a0136b57cce4eb28d736a9c5764 --- /dev/null +++ b/data/temporalEntities/entity-operations-after-query.jsonld @@ -0,0 +1,10 @@ +{ + "type": "Query", + "entities": [{ + "type": "Vehicle" + }], + "temporalQ": { + "timerel":"after", + "timeAt":"2020-08-02T12:05:00Z" + } +} \ No newline at end of file diff --git a/data/temporalEntities/entity-operations-before-query.jsonld b/data/temporalEntities/entity-operations-before-query.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..41e11c34f39428a25c80bc5326dd23b246041724 --- /dev/null +++ b/data/temporalEntities/entity-operations-before-query.jsonld @@ -0,0 +1,10 @@ +{ + "type": "Query", + "entities": [{ + "type": "Vehicle" + }], + "temporalQ": { + "timerel":"before", + "timeAt":"2020-08-02T12:05:00Z" + } +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-01-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-01-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..7e6d410fb2ca3cc9d393efd7fb2a41af656a6f87 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-01-expectation.jsonld @@ -0,0 +1,39 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"https://ngsi-ld-test-suite/context#Vehicle", + "https://ngsi-ld-test-suite/context#speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:05:00Z" + }, + + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:07:00Z" + } + ], + "https://ngsi-ld-test-suite/context#fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-02-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-02-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..93c69aa94e4626526b8805232646bf2f498d903e --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-02-expectation.jsonld @@ -0,0 +1,39 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:05:00Z" + }, + + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:07:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-03-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-03-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..0c4045ef03096e55d3ba0ebb5d406f001ed8fa53 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-03-expectation.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-01-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-01-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..2ef6fc8a777f6babfa3c864b64039a89c90cc4cd --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-01-expectation.jsonld @@ -0,0 +1,17 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ], + "speed": [] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-02-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-02-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..8efc2ba33f79ad4267f0e901c3081f8b5348e1e2 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-02-expectation.jsonld @@ -0,0 +1,14 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":{ + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + "speed":{ + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + } +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-03-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-03-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..e5bb683ddeb6bb14df860a402368a8581682101a --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-03-expectation.jsonld @@ -0,0 +1,26 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":{ + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:07:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-01-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-01-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..0c5cf14aadb6a79cae228a5d41d58460b18ee34f --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-01-expectation.jsonld @@ -0,0 +1,108 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":76, + "observedAt":"2020-08-01T16:05:00Z" + }, + { + "type":"Property", + "value":70, + "observedAt":"2020-08-01T17:07:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T18:03:00Z" + }, + { + "type":"Property", + "value":48, + "observedAt":"2020-08-01T19:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T19:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2020-08-01T20:05:00Z" + }, + { + "type":"Property", + "value":31, + "observedAt":"2020-08-01T20:07:00Z" + }, + { + "type":"Property", + "value":28, + "observedAt":"2020-08-01T21:03:00Z" + }, + { + "type":"Property", + "value":24, + "observedAt":"2020-08-01T21:05:00Z" + }, + { + "type":"Property", + "value":19, + "observedAt":"2020-08-01T22:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T12:15:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T12:17:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T12:19:00Z" + }, + { + "type":"Property", + "value":60, + "observedAt":"2020-08-01T12:21:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:23:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2020-08-01T12:25:00Z" + }, + { + "type":"Property", + "value":105, + "observedAt":"2020-08-01T12:27:00Z" + }, + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:29:00Z" + }, + { + "type":"Property", + "value":125, + "observedAt":"2020-08-01T12:31:00Z" + }, + { + "type":"Property", + "value":130, + "observedAt":"2020-08-01T12:35:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-02-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-02-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..421a6ae70ca00895124365b45152875f7e8c2016 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-05-02-expectation.jsonld @@ -0,0 +1,173 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2020-08-01T14:20:00Z" + }, + { + "type":"Property", + "value":30, + "observedAt":"2020-08-01T15:05:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2020-08-01T15:07:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T15:20:00Z" + }, + { + "type":"Property", + "value":76, + "observedAt":"2020-08-01T16:05:00Z" + }, + { + "type":"Property", + "value":70, + "observedAt":"2020-08-01T17:07:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T18:03:00Z" + }, + { + "type":"Property", + "value":48, + "observedAt":"2020-08-01T19:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T19:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2020-08-01T20:05:00Z" + }, + { + "type":"Property", + "value":31, + "observedAt":"2020-08-01T20:07:00Z" + }, + { + "type":"Property", + "value":28, + "observedAt":"2020-08-01T21:03:00Z" + }, + { + "type":"Property", + "value":24, + "observedAt":"2020-08-01T21:05:00Z" + }, + { + "type":"Property", + "value":19, + "observedAt":"2020-08-01T22:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:07:00Z" + }, + { + "type":"Property", + "value":110, + "observedAt":"2020-08-01T12:09:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:11:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:13:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T12:15:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T12:17:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T12:19:00Z" + }, + { + "type":"Property", + "value":60, + "observedAt":"2020-08-01T12:21:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:23:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2020-08-01T12:25:00Z" + }, + { + "type":"Property", + "value":105, + "observedAt":"2020-08-01T12:27:00Z" + }, + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:29:00Z" + }, + { + "type":"Property", + "value":125, + "observedAt":"2020-08-01T12:31:00Z" + }, + { + "type":"Property", + "value":130, + "observedAt":"2020-08-01T12:35:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-10-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-10-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..032999f991ac49bfe3689559d756452532544bb9 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-10-expectation.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":{ + "type": "Property", + "values":[ + [ 120, "2020-08-01T12:03:00Z" ], + [ 80, "2020-08-01T12:05:00Z" ], + [ 100, "2020-08-01T12:07:00Z" ] + ] + }, + "fuelLevel":{ + "type": "Property", + "values":[ + [ 67, "2020-08-01T12:03:00Z" ], + [ 53, "2020-08-01T13:05:00Z" ], + [ 40, "2020-08-01T14:07:00Z" ] + ] + } +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-added-attribute-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-added-attribute-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..c4089b8ef2dc66b8de98e9a55b0f1da237ab5fa7 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-added-attribute-expectation.jsonld @@ -0,0 +1,54 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-09-01T12:05:00Z" + } + ], + "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", + "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel" + } + ], + "added_attribute":[ + { + "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" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-create-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-create-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..7c89313049b5bda15bd762ea25a842f76bcb65d7 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-create-expectation.jsonld @@ -0,0 +1,37 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-09-01T12:05:00Z" + } + ], + "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", + "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel" + } + ], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-create-with-no-context-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-create-with-no-context-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..b50a1eab2323c6ad6ee9d0e4035b8dded9d77883 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-create-with-no-context-expectation.jsonld @@ -0,0 +1,38 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "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" + } + ], + "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" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-datasetid-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-datasetid-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..ad6ecbd1f2aee3c42f0417e9a2f35df774709150 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-datasetid-expectation.jsonld @@ -0,0 +1,31 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-09-01T12:05:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-09-01T13:05:00Z" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..77db2073b912a5328850a5865f648f8fe33ae396 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-expectation.jsonld @@ -0,0 +1,25 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-09-01T12:05:00Z" + } + ], + "fuelLevel":{ + "type":"Property", + "value":40, + "observedAt":"2020-09-01T14:07:00Z", + "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel" + }, + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-delete-speed-instanceid-sample.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-delete-speed-instanceid-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..9c31bb90f3a947dfc6438f02a9dc4141e70a8599 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-delete-speed-instanceid-sample.jsonld @@ -0,0 +1,30 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":{ + "type":"Property", + "value":80, + "observedAt":"2020-09-01T12:05:00Z" + }, + "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", + "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-deleteall-fuelLevel-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-deleteall-fuelLevel-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..29f7c5645dd652363a509b575f937d06b1bfb779 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-deleteall-fuelLevel-expectation.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-09-01T12:05:00Z" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-modify-attribute-instance-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-modify-attribute-instance-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..375f5a3130b0f78c3364a82245c634bb0629c9f5 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-modify-attribute-instance-expectation.jsonld @@ -0,0 +1,37 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": [ + { + "type": "Property", + "value": 129, + "observedAt": "2020-09-01T12:03:00Z" + }, + { + "type": "Property", + "value":80, + "observedAt": "2020-09-01T12:05:00Z" + } + ], + "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", + "datasetId": "urn:ngsi-ld:Vehicle:12345-fuel" + } + ], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-update-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-update-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..33fb63cd0ec4099b3aeb49fb3740eefed9581557 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-update-expectation.jsonld @@ -0,0 +1,47 @@ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":121, + "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" + } + ], + "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" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-09-01T14:07:00Z", + "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] + } \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicles-temporal-representation-021-01-01-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-01-01-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..cdb6290aca128ecf4006c78e366355742813ccbc --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-01-01-expectation.jsonld @@ -0,0 +1,68 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "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", + "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/data/temporalEntities/expectations/vehicles-temporal-representation-021-01-02-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-01-02-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..cb63a41937c023c738bc33ac85ec84f46167799b --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-01-02-expectation.jsonld @@ -0,0 +1,73 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "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", + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-09-01T13:05: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/data/temporalEntities/expectations/vehicles-temporal-representation-021-02-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-02-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..105bf3a1c86bfacbdbc2f1d820a5a0f3f7c60fed --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-02-expectation.jsonld @@ -0,0 +1,44 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "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", + "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/data/temporalEntities/expectations/vehicles-temporal-representation-021-03-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-03-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..a864acbf128702e331e505e4e1eb4b196b97aa93 --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-03-expectation.jsonld @@ -0,0 +1,188 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:07:00Z" + }, + { + "type":"Property", + "value":110, + "observedAt":"2020-08-01T12:09:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:11:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:13:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T12:15:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T12:17:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T12:19:00Z" + }, + { + "type":"Property", + "value":60, + "observedAt":"2020-08-01T12:21:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:23:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2020-08-01T12:25:00Z" + }, + { + "type":"Property", + "value":105, + "observedAt":"2020-08-01T12:27:00Z" + }, + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:29:00Z" + }, + { + "type":"Property", + "value":125, + "observedAt":"2020-08-01T12:31:00Z" + }, + { + "type":"Property", + "value":130, + "observedAt":"2020-08-01T12:35:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":35, + "observedAt":"2020-08-01T14:20:00Z" + }, + { + "type":"Property", + "value":30, + "observedAt":"2020-08-01T15:05:00Z" + }, + { + "type":"Property", + "value":85, + "observedAt":"2020-08-01T15:07:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T15:20:00Z" + }, + { + "type":"Property", + "value":76, + "observedAt":"2020-08-01T16:05:00Z" + }, + { + "type":"Property", + "value":70, + "observedAt":"2020-08-01T17:07:00Z" + }, + { + "type":"Property", + "value":50, + "observedAt":"2020-08-01T18:03:00Z" + }, + { + "type":"Property", + "value":48, + "observedAt":"2020-08-01T19:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T19:07:00Z" + }, + { + "type":"Property", + "value":35, + "observedAt":"2020-08-01T20:05:00Z" + }, + { + "type":"Property", + "value":31, + "observedAt":"2020-08-01T20:07:00Z" + }, + { + "type":"Property", + "value":28, + "observedAt":"2020-08-01T21:03:00Z" + }, + { + "type":"Property", + "value":24, + "observedAt":"2020-08-01T21:05:00Z" + }, + { + "type":"Property", + "value":19, + "observedAt":"2020-08-01T22:07:00Z" + } + ] + }, + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "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" + } + ], + "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" + } + ] + } +] \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicles-temporal-representation-021-04-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-04-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..5044fa08184054eda1b0425557c9ac9e7f2cebd7 --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-04-expectation.jsonld @@ -0,0 +1,78 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "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", + "fuelLevel":[ + { + "type":"Property", + "value":53, + "observedAt":"2020-09-01T13:05:00Z" + }, + { + "type":"Property", + "value":67, + "observedAt":"2020-09-01T12:03: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/data/temporalEntities/expectations/vehicles-temporal-representation-021-05-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-05-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..94f0976af6f5ab77541f5310444c8186a921914b --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-05-expectation.jsonld @@ -0,0 +1,40 @@ +[ + { + "id":"urn:ngsi-ld:Bus:randomUUID", + "type":"Bus", + "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" + } + ], + "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" + } + ] + } +] \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicles-temporal-representation-021-06-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-06-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..ea0a97e4b938832c95aff345894d45e46c2945fd --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-06-expectation.jsonld @@ -0,0 +1,40 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + }, + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":100, + "observedAt":"2020-08-01T12:07:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + } + ] + } +] \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicles-temporal-representation-021-07-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-07-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..5044fa08184054eda1b0425557c9ac9e7f2cebd7 --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-07-expectation.jsonld @@ -0,0 +1,78 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "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", + "fuelLevel":[ + { + "type":"Property", + "value":53, + "observedAt":"2020-09-01T13:05:00Z" + }, + { + "type":"Property", + "value":67, + "observedAt":"2020-09-01T12:03: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/data/temporalEntities/expectations/vehicles-temporal-representation-021-08-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-08-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..0e177cd50abfeffac9a56153fdf6cd80af2840cf --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-08-expectation.jsonld @@ -0,0 +1,78 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "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", + "fuelLevel":[ + { + "type":"Property", + "value":53, + "observedAt":"2020-09-01T13:05:00Z" + }, + { + "type":"Property", + "value":67, + "observedAt":"2020-09-01T12:03: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/data/temporalEntities/expectations/vehicles-temporal-representation-021-09-01-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-09-01-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..f72267e5cdcb741156012a000e482e0a5e1bcb7f --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-09-01-expectation.jsonld @@ -0,0 +1,64 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":150, + "observedAt":"2020-10-01T12:03:00Z" + }, + { + "type":"Property", + "value":90, + "observedAt":"2020-10-01T12:05:00Z" + }, + { + "type":"Property", + "value":127, + "observedAt":"2020-10-01T12:07:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":89, + "observedAt":"2020-10-01T12:03:00Z" + }, + { + "type":"Property", + "value":78, + "observedAt":"2020-10-01T13:05:00Z" + }, + { + "type":"Property", + "value":62, + "observedAt":"2020-10-01T14:07:00Z" + } + ], + "location":[ + { + "type": "GeoProperty", + "value": { + "type":"Point", + "coordinates":[ + 2.35, + 42.22 + ] + }, + "observedAt":"2020-10-01T12:03:00Z" + }, + { + "type": "GeoProperty", + "value": { + "type":"Point", + "coordinates":[ + -8.5, + 41.2 + ] + }, + "observedAt":"2020-10-01T12:05:00Z" + } + ] + } +] \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicles-temporal-representation-021-09-02-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-09-02-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..f72267e5cdcb741156012a000e482e0a5e1bcb7f --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-09-02-expectation.jsonld @@ -0,0 +1,64 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":150, + "observedAt":"2020-10-01T12:03:00Z" + }, + { + "type":"Property", + "value":90, + "observedAt":"2020-10-01T12:05:00Z" + }, + { + "type":"Property", + "value":127, + "observedAt":"2020-10-01T12:07:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":89, + "observedAt":"2020-10-01T12:03:00Z" + }, + { + "type":"Property", + "value":78, + "observedAt":"2020-10-01T13:05:00Z" + }, + { + "type":"Property", + "value":62, + "observedAt":"2020-10-01T14:07:00Z" + } + ], + "location":[ + { + "type": "GeoProperty", + "value": { + "type":"Point", + "coordinates":[ + 2.35, + 42.22 + ] + }, + "observedAt":"2020-10-01T12:03:00Z" + }, + { + "type": "GeoProperty", + "value": { + "type":"Point", + "coordinates":[ + -8.5, + 41.2 + ] + }, + "observedAt":"2020-10-01T12:05:00Z" + } + ] + } +] \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicles-temporal-representation-021-13-01-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-13-01-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..224342c63e11b11370c1607f2eb4c3c003fd9d2e --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-13-01-expectation.jsonld @@ -0,0 +1,46 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel": [], + "speed": [] + }, + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":53, + "observedAt":"2020-09-01T13:05:00Z" + }, + { + "type":"Property", + "value":67, + "observedAt":"2020-09-01T12:03: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/data/temporalEntities/expectations/vehicles-temporal-representation-021-13-02-expectation.jsonld b/data/temporalEntities/expectations/vehicles-temporal-representation-021-13-02-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..4ae3b0a37bf255751bf4748c94c6f4cab597891b --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-13-02-expectation.jsonld @@ -0,0 +1,46 @@ +[ + { + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2020-08-01T14:07:00Z" + } + ], + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "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", + "fuelLevel": [], + "speed": [] + } +] \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicles-temporal-representation-021-14-01-expectation.json b/data/temporalEntities/expectations/vehicles-temporal-representation-021-14-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..229b21fe33ee524424a9c8f51ebef15289cf6ba5 --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-14-01-expectation.json @@ -0,0 +1,70 @@ +[ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "values": [ + [ + 80.0, + "2020-08-01T12:05:00Z" + ], + [ + 100.0, + "2020-08-01T12:07:00Z" + ] + ] + }, + "fuelLevel": { + "type": "Property", + "values": [ + [ + 53.0, + "2020-08-01T13:05:00Z" + ], + [ + 40.0, + "2020-08-01T14:07:00Z" + ] + ] + } + }, + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "values": [ + [ + 120.0, + "2020-09-01T12:03:00Z" + ], + [ + 80.0, + "2020-09-01T12:05:00Z" + ], + [ + 100.0, + "2020-09-01T12:07:00Z" + ] + ] + }, + "fuelLevel": { + "type": "Property", + "values": [ + [ + 67.0, + "2020-09-01T12:03:00Z" + ], + [ + 53.0, + "2020-09-01T13:05:00Z" + ], + [ + 40.0, + "2020-09-01T14:07:00Z" + ] + ] + } + } +] diff --git a/data/temporalEntities/expectations/vehicles-temporal-representation-021-14-02-expectation.json b/data/temporalEntities/expectations/vehicles-temporal-representation-021-14-02-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..6b0c8547ba2f22ebd7147fb323a5b1bf60af4385 --- /dev/null +++ b/data/temporalEntities/expectations/vehicles-temporal-representation-021-14-02-expectation.json @@ -0,0 +1,74 @@ +[ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "values": [ + [ + 120.0, + "2020-08-01T12:03:00Z" + ], + [ + 80.0, + "2020-08-01T12:05:00Z" + ], + [ + 100.0, + "2020-08-01T12:07:00Z" + ] + ] + }, + "fuelLevel": { + "type": "Property", + "values": [ + [ + 67.0, + "2020-08-01T12:03:00Z" + ], + [ + 53.0, + "2020-08-01T13:05:00Z" + ], + [ + 40.0, + "2020-08-01T14:07:00Z" + ] + ] + } + }, + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "values": [ + [ + 120.0, + "2020-09-01T12:03:00Z" + ], + [ + 80.0, + "2020-09-01T12:05:00Z" + ], + [ + 100.0, + "2020-09-01T12:07:00Z" + ] + ] + }, + "fuelLevel": { + "type": "Property", + "values": [ + [ + 67.0, + "2020-09-01T12:03:00Z" + ], + [ + 53.0, + "2020-09-01T13:05:00Z" + ] + ] + } + } +] \ No newline at end of file diff --git a/data/temporalEntities/fragments/vehicle-temporal-modify-attribute-instance-fragment.jsonld b/data/temporalEntities/fragments/vehicle-temporal-modify-attribute-instance-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..632a63a549706bcc0f1a0fa5985fd781c0dfe19c --- /dev/null +++ b/data/temporalEntities/fragments/vehicle-temporal-modify-attribute-instance-fragment.jsonld @@ -0,0 +1,5 @@ +{ + "type":"Property", + "value":129, + "observedAt":"2020-09-01T12:03:00Z" +} diff --git a/data/temporalEntities/fragments/vehicle-temporal-representation-empty-json-fragment.jsonld b/data/temporalEntities/fragments/vehicle-temporal-representation-empty-json-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 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 0000000000000000000000000000000000000000..d806a9c86d5894be27dd06385f358a31e74e733c --- /dev/null +++ b/data/temporalEntities/fragments/vehicle-temporal-representation-fragment.jsonld @@ -0,0 +1,22 @@ +{ + "added_attribute":[ + { + "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" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/fragments/vehicle-temporal-representation-invalid-json-fragment.jsonld b/data/temporalEntities/fragments/vehicle-temporal-representation-invalid-json-fragment.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..cd5e61bdffd5ddec714c28537898cc7d4eecbcc6 --- /dev/null +++ b/data/temporalEntities/fragments/vehicle-temporal-representation-invalid-json-fragment.jsonld @@ -0,0 +1,41 @@ +{ + "id":"urn:ngsi-ld:Vehicle:8313926113148778",, + "type":"Vehicle", + "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" + } + ], + "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" + } + ], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/vehicle-create-temporal-representation-sample.jsonld b/data/temporalEntities/vehicle-create-temporal-representation-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..99cbf8900edbd5ed4b54c1aba4ff74c673e023cb --- /dev/null +++ b/data/temporalEntities/vehicle-create-temporal-representation-sample.jsonld @@ -0,0 +1,37 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-09-01T12:05:00Z" + } + ], + "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", + "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/vehicle-create-temporal-representation-without-context-sample.jsonld b/data/temporalEntities/vehicle-create-temporal-representation-without-context-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..b50a1eab2323c6ad6ee9d0e4035b8dded9d77883 --- /dev/null +++ b/data/temporalEntities/vehicle-create-temporal-representation-without-context-sample.jsonld @@ -0,0 +1,38 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "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" + } + ], + "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" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/vehicle-temporal-representation-empty-json-sample.jsonld b/data/temporalEntities/vehicle-temporal-representation-empty-json-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/data/temporalEntities/vehicle-temporal-representation-invalid-json-sample.jsonld b/data/temporalEntities/vehicle-temporal-representation-invalid-json-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..76731949fb5bad8e4829545e9a3b93aec3960c18 --- /dev/null +++ b/data/temporalEntities/vehicle-temporal-representation-invalid-json-sample.jsonld @@ -0,0 +1,47 @@ +{ + "id":"urn:ngsi-ld:Vehicle:8313926113148778",, + "type":"Vehicle", + "brandName":[ + { + "type":"Property", + "value":"BMW" + } + ], + "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" + } + ], + "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" + } + ], + "@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/temporalEntities/vehicle-temporal-representation-sample.jsonld b/data/temporalEntities/vehicle-temporal-representation-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..99cbf8900edbd5ed4b54c1aba4ff74c673e023cb --- /dev/null +++ b/data/temporalEntities/vehicle-temporal-representation-sample.jsonld @@ -0,0 +1,37 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2020-09-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2020-09-01T12:05:00Z" + } + ], + "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", + "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/vehicle-temporal-representation-update-sample.jsonld b/data/temporalEntities/vehicle-temporal-representation-update-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..19ea07fb51f7464f2f2a1eefdb11a5d8586945b6 --- /dev/null +++ b/data/temporalEntities/vehicle-temporal-representation-update-sample.jsonld @@ -0,0 +1,41 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "speed":[ + { + "type":"Property", + "value":121, + "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" + } + ], + "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" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/vehicle-temporal-representation-without-id-sample.jsonld b/data/temporalEntities/vehicle-temporal-representation-without-id-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..dc8fae87688101905ab2658fb7fa8408571f6d21 --- /dev/null +++ b/data/temporalEntities/vehicle-temporal-representation-without-id-sample.jsonld @@ -0,0 +1,48 @@ +{ + "id":"", + "type":"Vehicle", + "brandName":[ + { + "type":"Property", + "value":"BMW" + } + ], + "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" + } + ], + "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", + "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel" + } + ], + "@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/types/expectations/attribute-026-01-01-expectation.json b/data/types/expectations/attribute-026-01-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..6515b8b6ae541efc7a236c5313bc7379c3785a41 --- /dev/null +++ b/data/types/expectations/attribute-026-01-01-expectation.json @@ -0,0 +1,34 @@ +[ + { + "id":"https://ngsi-ld-test-suite/context#name", + "type":"Attribute", + "attributeName":"https://ngsi-ld-test-suite/context#name", + "typeNames":[ + "https://ngsi-ld-test-suite/context#Building" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#subCategory", + "type":"Attribute", + "attributeName":"https://ngsi-ld-test-suite/context#subCategory", + "typeNames":[ + "https://ngsi-ld-test-suite/context#Building" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#airQualityLevel", + "type":"Attribute", + "attributeName":"https://ngsi-ld-test-suite/context#airQualityLevel", + "typeNames":[ + "https://ngsi-ld-test-suite/context#Building" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#almostFull", + "type":"Attribute", + "attributeName":"https://ngsi-ld-test-suite/context#almostFull", + "typeNames":[ + "https://ngsi-ld-test-suite/context#Building" + ] + } +] \ No newline at end of file diff --git a/data/types/expectations/attribute-026-01-02-expectation.json b/data/types/expectations/attribute-026-01-02-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..6997eaf6d9fc87422494c0e560b74e25599b29d8 --- /dev/null +++ b/data/types/expectations/attribute-026-01-02-expectation.json @@ -0,0 +1,34 @@ +[ + { + "id":"https://ngsi-ld-test-suite/context#name", + "type":"Attribute", + "attributeName":"name", + "typeNames":[ + "Building" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#subCategory", + "type":"Attribute", + "attributeName":"subCategory", + "typeNames":[ + "Building" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#airQualityLevel", + "type":"Attribute", + "attributeName":"airQualityLevel", + "typeNames":[ + "Building" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#almostFull", + "type":"Attribute", + "attributeName":"almostFull", + "typeNames":[ + "Building" + ] + } +] \ No newline at end of file diff --git a/data/types/expectations/attribute-027-01-expectation.json b/data/types/expectations/attribute-027-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..0453d27f5c245af562137c67fc09c9ebdab6f65e --- /dev/null +++ b/data/types/expectations/attribute-027-01-expectation.json @@ -0,0 +1,12 @@ +{ + "id":"https://ngsi-ld-test-suite/context#airQualityLevel", + "type":"Attribute", + "attributeName":"airQualityLevel", + "attributeCount":1, + "attributeTypes":[ + "Property" + ], + "typeNames":[ + "Building" + ] +} \ No newline at end of file diff --git a/data/types/expectations/attribute-list-025-01-01-expectation.json b/data/types/expectations/attribute-list-025-01-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..d63a05c5f3b44a93a93450f8a20893213b1f1b77 --- /dev/null +++ b/data/types/expectations/attribute-list-025-01-01-expectation.json @@ -0,0 +1,10 @@ +{ + "id": "urn:ngsi-ld:AttributeList:randomUUID", + "type": "AttributeList", + "attributeList": [ + "https://ngsi-ld-test-suite/context#airQualityLevel", + "https://ngsi-ld-test-suite/context#almostFull", + "https://ngsi-ld-test-suite/context#name", + "https://ngsi-ld-test-suite/context#subCategory" + ] +} \ No newline at end of file diff --git a/data/types/expectations/attribute-list-025-01-02-expectation.json b/data/types/expectations/attribute-list-025-01-02-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..b1d946b4ee2552efbdd96b9ddd1e73f82a7f043a --- /dev/null +++ b/data/types/expectations/attribute-list-025-01-02-expectation.json @@ -0,0 +1,10 @@ +{ + "id": "urn:ngsi-ld:AttributeList:randomUUID", + "type": "AttributeList", + "attributeList": [ + "name", + "subCategory", + "airQualityLevel", + "almostFull" + ] +} \ No newline at end of file diff --git a/data/types/expectations/entity-type-023-01-01-expectation.json b/data/types/expectations/entity-type-023-01-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..a192383199021914a7552174103630cdbae0d3f8 --- /dev/null +++ b/data/types/expectations/entity-type-023-01-01-expectation.json @@ -0,0 +1,22 @@ +[ + { + "id":"https://ngsi-ld-test-suite/context#Building", + "type":"EntityType", + "typeName":"https://ngsi-ld-test-suite/context#Building", + "attributeNames":[ + "https://ngsi-ld-test-suite/context#name", + "https://ngsi-ld-test-suite/context#subCategory", + "https://ngsi-ld-test-suite/context#airQualityLevel", + "https://ngsi-ld-test-suite/context#almostFull" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#Vehicle", + "type":"EntityType", + "typeName":"https://ngsi-ld-test-suite/context#Vehicle", + "attributeNames":[ + "https://ngsi-ld-test-suite/context#brandName", + "isParked" + ] + } +] \ No newline at end of file diff --git a/data/types/expectations/entity-type-023-01-02-expectation.json b/data/types/expectations/entity-type-023-01-02-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..8ccb9903d8c5b953b404008aa13745151793e17e --- /dev/null +++ b/data/types/expectations/entity-type-023-01-02-expectation.json @@ -0,0 +1,22 @@ +[ + { + "id":"https://ngsi-ld-test-suite/context#Building", + "type":"EntityType", + "typeName":"Building", + "attributeNames":[ + "name", + "subCategory", + "airQualityLevel", + "almostFull" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#Vehicle", + "type":"EntityType", + "typeName":"Vehicle", + "attributeNames":[ + "brandName", + "isParked" + ] + } +] \ No newline at end of file diff --git a/data/types/expectations/entity-type-info-024-01-expectation.json b/data/types/expectations/entity-type-info-024-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..4ae0962de1f42099ecb0a54dfe83e11f04bf52ed --- /dev/null +++ b/data/types/expectations/entity-type-info-024-01-expectation.json @@ -0,0 +1,40 @@ +{ + "id":"https://ngsi-ld-test-suite/context#Building", + "type":"EntityTypeInfo", + "typeName":"Building", + "entityCount":2, + "attributeDetails":[ + { + "id":"https://ngsi-ld-test-suite/context#name", + "type":"Attribute", + "attributeName":"name", + "attributeTypes":[ + "Property" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#subCategory", + "type":"Attribute", + "attributeName":"subCategory", + "attributeTypes":[ + "Property" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#airQualityLevel", + "type":"Attribute", + "attributeName":"airQualityLevel", + "attributeTypes":[ + "Property" + ] + }, + { + "id":"https://ngsi-ld-test-suite/context#almostFull", + "type":"Attribute", + "attributeName":"almostFull", + "attributeTypes":[ + "Property" + ] + } + ] +} \ No newline at end of file diff --git a/data/types/expectations/entity-type-list-022-01-01-expectation.json b/data/types/expectations/entity-type-list-022-01-01-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..9b60d3bb06c87ed54e77880f7130721faae96d64 --- /dev/null +++ b/data/types/expectations/entity-type-list-022-01-01-expectation.json @@ -0,0 +1,8 @@ +{ + "id": "urn:ngsi-ld:EntityTypeList:randomUUID", + "type": "EntityTypeList", + "typeList": [ + "https://ngsi-ld-test-suite/context#Building", + "https://ngsi-ld-test-suite/context#Vehicle" + ] +} \ No newline at end of file diff --git a/data/types/expectations/entity-type-list-022-01-02-expectation.json b/data/types/expectations/entity-type-list-022-01-02-expectation.json new file mode 100644 index 0000000000000000000000000000000000000000..c68c4bceaedc940fed7d8da7b2f561e2427f836c --- /dev/null +++ b/data/types/expectations/entity-type-list-022-01-02-expectation.json @@ -0,0 +1,8 @@ +{ + "id": "urn:ngsi-ld:EntityTypeList:randomUUID", + "type": "EntityTypeList", + "typeList": [ + "Building", + "Vehicle" + ] +} \ No newline at end of file diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..aee525a52dc2975ea3db365aa07d94cd3e6b6420 --- /dev/null +++ b/doc/README.md @@ -0,0 +1,67 @@ +# Automatic generation of documentation data (ETSI RGS CIM 013) + +These python code has been developed to facilitate the automatic generation of the test purposes descriptions in a JSON +format in order to generate afterward automatically the NGSI-LD Test Purposes Descriptions (ETSI RGS CIM 013) document. +To achieve this purpose, we are defining a full Unit Test Suite with several Test Cases to check that we can generate +the corresponding information of the Robot description files. + +This approach has a clear advantage, from one side, we can generate the corresponding info for the ETSI document and +for the other side, it can help us to know when a change in the Robot Description files were developed and therefore +and update in the ETSI document (new version of the document) must be generated. + +## Requirements + +These python code is developed under the scope of the overall NGSI-LD Test Suite Code, therefore we use the same +requirements and python virtual environment already defined in [README.md](../README.md). + +## Structure + +The unit tests where divided into several groups following the NGSI-LD Test Suite Structure (ETSI RGS CIM 012) divided +in test groups and subgroups: + +- Group 1: Context Information (CI), Provision (PROV), defined in the [test_ContextInformation_Provision.py](./tests/test_ContextInformation_Provision.py) file. +- Group 2: Context Information (CI), Consumption (CONS), defined in the [test_ContextInformation_Consumption.py](./tests/test_ContextInformation_Consumption.py) file. +- Group 3: Context Information (CI), Subscription (SUB), defined in the [test_ContextInformation_Subscription.py](./tests/test_ContextInformation_Subscription.py) file. +- Group 4: Context Source (CS), Registration (REG), defined in the [test_ContextSource_Registration.py](./tests/test_ContextSource_Registration.py) file. +- Group 5: Context Source (CS), Discovery (DISC), defined in the [test_ContextSource_Discovery.py](./tests/test_ContextSource_Discovery.py) file. +- Group 6: Context Source (CS), Registration Subscription (REGSUB), defined in the +[test_ContextSource_RegistrationSubscription.py](./tests/test_ContextSource_RegistrationSubscription.py) file. +- Group 7: Common Behaviours (CB), defined in the [test_CommonBehaviours.py]() file. + +Additionally, a specific unit test called [test_CheckTests.py](./tests/test_CheckTests.py) was created to check that all +robot files have the corresponding unit tests. + +Moreover, the folder [files](./files) contains the expected results of the execution of the Unit Tests, and they are +divided into the NGSI-LD Test Suite Structure groups: + +- [CommonBehaviours](./files/CommonBehaviours) contains the expected results of the Common Behaviours robot files. +- [ContextInformation](./files/ContextInformation) contains the expected results of the Context Information files. +- [ContextSource](./files/ContextSource) contains the expected results of the Context Source files. + + +## Execution + +You have several options to execute the tests. it was generated a set of PyCharm configuration files in the +[runConfigurations](../.idea/runConfigurations) folder to help in the execution of the unit tests from the IDE: + +- [All Unit Tests](../.idea/runConfigurations/All_Unit_Tests.xml) executes all Unit Tests associated to the robot files. +- [CheckTests Unit Tests](../.idea/runConfigurations/CheckTests_Unit_Tests.xml) checks that there is a unit test associated to each robot file. +- [CommonBehaviours Unit Tests](../.idea/runConfigurations/CommonBehaviours_Unit_Tests.xml) executes Common Behaviours unit tests associated to the robot files. +- [ContextInformation Consumption Unit Tests](../.idea/runConfigurations/ContextInformation_Consumption_Unit_Tests.xml) executes Context Information - Consumption unit tests associated to +the robot files. +- [ContextInformation Provision Unit Tests](../.idea/runConfigurations/ContextInformation_Provision_Unit_Tests.xml) executes Context Information - Provision unit tests associated to the +robot files. +- [ContextInformation Subscription Unit Tests](../.idea/runConfigurations/ContextInformation_Subscription_Unit_Tests.xml) executes Context Information - Subscription unit tests associated +to the robot files. +- [ContextSource Discovery Unit Tests](../.idea/runConfigurations/ContextSource_Discovery_Unit_Tests.xml) executes Context Source - Discovery unit tests associated to the robot +files. +- [ContextSource Registration Unit Tests](../.idea/runConfigurations/ContextSource_Registration_Unit_Tests.xml) executes Context Source - Registration unit tests associated to the +robot files. +- [ContextSource RegistrationSubscription Unit Tests](../.idea/runConfigurations/ContextSource_RegistrationSubscription_Unit_Tests.xml) executes Context Source - Registration Subscription unit +tests associated to the robot files. +- [Generate Documentation Data](../.idea/runConfigurations/Generate_Documentation_Data.xml) executes Generate Document +Data unit tests associated to the unit test execution of a specific robot file (e.g. 047_01). The generated files are +located in the [results](./results) folder. +- [Statistics Documentation Data](../.idea/runConfigurations/Statistics_Documentation_Data.xml) executes all the test +to generate the documentation and generate statistics about the execution. The generated files are located in the +[results](./results) folder, a special file called `testcases.json` is generated with a list of all generated data. diff --git a/doc/__init__.py b/doc/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/doc/analysis/__init__.py b/doc/analysis/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/doc/analysis/checks.py b/doc/analysis/checks.py new file mode 100644 index 0000000000000000000000000000000000000000..3c068c1345e9aecd593edec8ca12411dc3b9c647 --- /dev/null +++ b/doc/analysis/checks.py @@ -0,0 +1,1057 @@ +from http import HTTPStatus + + +class Checks: + def __init__(self): + self.checks = { + 'Check Response Status Code': + Checks.check_response_status_code, + 'Check Response Body Containing Array Of URIs set to': + Checks.check_response_body_containing_array_of_uris_set_to, + 'Check Created Resources Set To': + Checks.check_created_resources_set_to, + 'Check Response Headers Containing Content-Type set to': + Checks.check_response_headers_containing_content_type_set_to, + 'Check Response Headers Link Not Empty': + Checks.check_response_headers_link_not_empty, + 'Check Response Headers Containing URI set to': + Checks.check_response_headers_containing_uri_set_to, + 'Check Response Headers ID Not Empty': + Checks.check_response_headers_id_not_empty, + 'Check Response Body Containing an Attribute set to': + Checks.check_response_body_containing_an_attribute_set_to, + 'Check Response Body Containing Entity element': + Checks.check_response_body_containing_entity_element, + 'Check Response Body Containing List Containing Entity Elements': + Checks.check_response_body_containing_list_containing_entity_elements, + 'Check Response Body Containing List Containing Entity Elements With Different Types': + Checks.check_response_body_containing_list_containing_entity_elements_with_different_types, + 'Check Response Body Containing EntityTemporal element': + Checks.check_response_body_containing_entitytemporal_element, + 'Check Response Body Containing List Containing EntityTemporal elements': + Checks.check_response_body_containing_list_containing_entitytemporal_elements, + 'Check Response Body Containing Subscription element': + Checks.check_response_body_containing_subscription_element, + 'Check Response Body Containing List Containing Subscription elements': + Checks.check_response_body_containing_list_containing_subscription_elements, + 'Check Response Body Containing Number Of Entities': + Checks.check_response_body_containing_number_of_entities, + 'Check Response Body Containing Context Source Registration element': + Checks.check_response_body_containing_context_source_registration_element, + 'Check Response Body Containing EntityTypeList element': + Checks.check_response_body_containing_entitytypelist_element, + 'Check Response Body Containing EntityType element': + Checks.check_response_body_containing_entitytype_element, + 'Check Response Body Containing EntityTypeInfo element': + Checks.check_response_body_containing_entitytypeinfo_element, + 'Check Response Body Containing AttributeList element': + Checks.check_response_body_containing_attributelist_element, + 'Check Response Body Containing Attribute element': + Checks.check_response_body_containing_attribute_element, + 'Check Response Body Containing List Containing Context Source Registrations elements': + Checks.check_response_body_containing_list_containing_context_source_registrations_elements, + 'Check Response Body Type When Using Session Request': + Checks.check_response_body_type_when_using_session_request, + 'Check Response Body Containing ProblemDetails Element Containing Type Element set to': + Checks.check_response_body_containing_problemdetails_element_containing_type_element_set_to, + 'Check Response Body Title When Using Session Request': + Checks.check_response_body_title_when_using_session_request, + 'Check Response Body Containing a Boolean Attribute set to': + Checks.check_response_body_containing_a_boolean_attribute_set_to, + 'Check Response Body Contains DateTime Value': + Checks.check_response_body_contains_datetime_value, + 'Check Response Body Containing ProblemDetails Element Containing Title Element': + Checks.check_response_body_containing_problemdetails_element_containing_title_element, + 'Check Dictionary Might Contain Additional Members of the NotificationParams': + Checks.check_dictionary_might_contain_additional_members, + 'Check Response Body Containing ProblemDetails Element': + Checks.check_response_body_containing_problemdetails_element, + 'Check RL Response Body Containing ProblemDetails Element Containing Type Element set to': + Checks.check_rl_response_body_containing_problemdetails_element_containing_type_element_set_to, + 'Check RL Response Body Containing ProblemDetails Element Containing Title Element': + Checks.check_rl_response_body_containing_problemdetails_element_containing_title_element, + 'Check JSON Value In Response Body': + Checks.check_json_value_in_response_body, + 'Check Pagination Prev And Next Headers': + Checks.check_pagination_prev_and_next_headers, + 'Check Created Resource Set To': + Checks.check_created_resource_set_to, + 'Check Updated Resource Set To': + Checks.check_updated_resource_set_to, + 'Check Updated Resources Set To': + Checks.check_updated_resources_set_to, + 'Check SUT Not Containing Resource': + Checks.check_sut_not_containing_resource, + 'Check SUT Not Containing Resources': + Checks.check_sut_not_containing_resources, + 'Check NotificationParams': + Checks.check_notificationparams, + 'Check Response Body Containing Batch Operation Result': + Checks.check_response_body_containing_batch_operation_result, + 'Wait for notification': + Checks.wait_for_notification, + 'Wait for no notification': + Checks.wait_for_no_notification, + 'Wait for notification and validate it': + Checks.wait_for_notification_and_validate_it, + 'Should be Equal': + Checks.should_be_equal, + 'Dictionary Should Contain Key': + Checks.dictionary_should_contain_key, + 'Should Not Be Empty': + Checks.should_not_be_empty, + 'Should be True': + Checks.should_be_true, + 'Check Response Body Content': + Checks.check_response_body_content, + 'Check Retrieving Context Source Registration': + Checks.check_retrieving_context_source_registration, + 'Check JSON Value Not In Response Body': + Checks.check_json_value_not_in_response_body, + 'Check Response Reason set to': + Checks.check_response_reason_set_to, + 'Check Response Does Not Contain Body': + Checks.check_response_does_not_contain_body, + 'Check Response Header is Empty': + Checks.check_response_header_is_empty, + 'Check Response Headers Link set to': + Checks.check_response_headers_link_set_to, + 'Check Response Headers Containing NGSILD-Results-Count Equals To' : + Checks.check_response_header_contains_ngsild_results_count_equals_to, + } + + self.args = { + 'Check Response Status Code': { + 'params': ['status_code'], + 'position': [0] + }, + 'Check Response Body Containing Array Of URIs set to': { + 'params': ['expected_entities_ids', 'response_body'], + 'position': [0, 1] + }, + 'Check Response Body Containing ProblemDetails Element Containing Type Element set to': { + 'params': ['type'], + 'position': [1] + }, + 'Check Response Body Containing ProblemDetails Element': { + 'params': ['problem_type'], + 'position': [1] + }, + 'Check Response Headers Containing Content-Type set to': { + 'params': ['content_type'], + 'position': [0] + }, + 'Check Updated Resource Set To': { + 'params': ['updated_resource', 'response_body', 'ignored_keys'], + 'position': [0] + }, + 'Check Response Body Containing ProblemDetails Element Containing Title Element': { + 'params': ['response_body'], + 'position': [0] + }, + 'Check Dictionary Might Contain Additional Members of the NotificationParams': { + 'params': ['dictionary', 'key'], + 'position': [0, 1] + }, + 'Check Response Headers Containing URI set to': { + 'params': ['expected_entity_id', 'response_headers'], + 'position': [0, 1] + }, + 'Check Response Body Title When Using Session Request': { + 'params': ['response_body'], + 'position': [0] + }, + 'Check Response Body Containing EntityTypeInfo element': { + 'params': ['expectation_filename', 'response_body'], + 'position': [0, 1] + }, + 'Check Response Body Containing List Containing Entity Elements': { + 'params': ['expectation_filename', 'entities_ids', 'response_body', 'ignore_core_context_version'], + 'position': [] + }, + 'Check Response Body Containing List Containing Entity Elements With Different Types': { + 'params': ['filename', 'entities_representation_ids', 'response_body', 'ignore_core_context_version'], + 'position': [] + }, + 'Check Response Body Containing an Attribute set to': { + 'params': ['expected_attribute_name', 'response_body', 'expected_attribute_value'], + 'position': [] + }, + 'Check Response Body Containing Attribute element': { + 'params': ['expectation_filename', 'response_body'], + 'position': [0, 1] + }, + 'Check Response Body Containing EntityTemporal element': { + 'params': ['filename', 'temporal_entity_representation_id', 'response_body'], + 'position': [0, 1, 2] + }, + 'Check SUT Not Containing Resources': { + 'params': ['response_body'], + 'position': [0] + }, + 'Check Response Body Containing List Containing EntityTemporal elements': { + 'params': ['filename', 'entity_ids'], + 'position': [0, 1] + }, + 'Check RL Response Body Containing ProblemDetails Element Containing Title Element': { + 'params': ['response_body'], + 'position': [0] + }, + 'Check Response Body Containing a Boolean Attribute set to': { + 'params': ['expected_attribute_name', 'response_body', 'expected_attribute_value'], + 'position': [0, 1, 2] + }, + 'Check Response Body Contains DateTime Value': { + 'params': ['dictionary', 'key', 'expected value'], + 'position': [0, 1, 2] + }, + 'Check Response Body Containing List Containing Subscription elements': { + 'params': ['file', 'id', 'response'], + 'position': [0, 1, 2] + }, + 'Check Response Body Containing Number Of Entities': { + 'params': ['entity_type', 'number_entities', 'response'], + 'position': [0, 1, 2] + }, + 'Check Response Body Containing Context Source Registration element': { + 'params': ['file', 'id', 'response'], + 'position': [0, 1, 2] + }, + 'Check Response Body Containing EntityTypeList element': { + 'params': ['filename', 'response'], + 'position': [0, 1] + }, + 'Check Response Body Containing EntityType element': { + 'params': ['filename', 'response'], + 'position': [0, 1] + }, + 'Check Response Body Type When Using Session Request': { + 'params': ['type'], + 'position': [1] + }, + 'Check Created Resource Set To': { + 'params': ['created_resource', 'response_body', 'ignored_keys'], + 'position': [] + }, + 'Check Created Resources Set To': { + 'params': ['expected_resources', 'response_body', 'ignored_keys'], + 'position': [] + }, + 'Check RL Response Body Containing ProblemDetails Element Containing Type Element set to': { + 'params': ['type'], + 'position': [1] + }, + 'Check JSON Value In Response Body': { + 'params': ['key', 'value'], + 'position': [0, 1] + }, + 'Check Pagination Prev And Next Headers': { + 'params': ['previous', 'next'], + 'position': [1, 2] + }, + 'Check Updated Resources Set To': { + 'params': ['number_entities'], + 'position': [0] + }, + 'Check SUT Not Containing Resource': { + 'params': ['status_code'], + 'position': [0] + }, + 'Check NotificationParams': { + 'params': ['filename', 'expected_additional_members', 'response_body'], + 'position': [0, 1, 2] + }, + 'Check Response Body Containing Batch Operation Result': { + 'params': ['operation'], + 'position': [0] + }, + 'Should be Equal': { + 'params': ['expected_value', 'obtained_value'], + 'position': [0, 1] + }, + 'Check Response Body Containing Subscription element': { + 'params': ['filename', 'subscription_id', 'response_body'], + 'position': [0, 1, 2] + }, + 'Wait for notification': { + 'params': ['timeout'], + 'position': [] + }, + 'Wait for notification and validate it': { + 'params': ['expected_subscription_id', 'expected_context_source_registration_ids', + 'expected_trigger_reason', 'expected_notification_data_entities', + 'timeout'], + 'position': [] + }, + 'Wait for no notification': { + 'params': ['timeout'], + 'position': [] + }, + 'Check Response Body Containing AttributeList element': { + 'params': ['filename', 'response'], + 'position': [0, 1] + }, + 'Check Response Body Containing Entity element': { + 'params': ['filename', 'id', 'response'], + 'position': [0, 1, 2] + }, + 'Check Response Body Content': { + 'params': ['expectation_filename', 'response_body', 'additional_ignored_path'], + 'position': [] + }, + 'Dictionary Should Contain Key': { + 'params': ['dictionary', 'key'], + 'position': [0, 1] + }, + 'Should Not Be Empty': { + 'params': ['variable'], + 'position': [0] + }, + 'Should be True': { + 'params': ['expression'], + 'position': [0] + }, + 'Check Retrieving Context Source Registration': { + 'params': ['registration_id', 'context', 'accept', 'registration_payload'], + 'position': [0, 1, 2, 3] + }, + 'Check JSON Value Not In Response Body': { + 'params': ['json_path_expr'], + 'position': [0] + }, + 'Check Response Reason set to': { + 'params': ['reason'], + 'position': [1] + }, + 'Check Response Does Not Contain Body': { + 'params': ['response'], + 'position': [0] + }, + 'Check Response Header is Empty': { + 'params': ['response_headers'], + 'position': [0] + }, + 'Check Response Headers Link set to': { + 'params': ['response_headers', 'expected_link_header'], + 'position': [0, 1] + } + , + 'Check Response Headers Containing NGSILD-Results-Count Equals To': { + 'params': ['expected_result_count' , 'response_headers'], + 'position': [0, 1] + } + } + + @staticmethod + def check_response_status_code(kwargs: list) -> str: + if "status_code" in kwargs: + status_code = kwargs['status_code'] + try: + return f'Response Status Code set to {status_code} ({HTTPStatus(status_code).phrase})' + except ValueError: + return f'Response Status Code set to {status_code}' + else: + raise Exception(f'ERROR, Expected status_code parameter but received: {kwargs}') + + @staticmethod + def wait_for_notification(kwargs: list) -> str: + if 'timeout' in kwargs and kwargs['timeout'] != '': + result = f"After waiting '{kwargs['timeout']}' seconds" + else: + result = f"After waiting '5' seconds" + + return result + + @staticmethod + def wait_for_notification_and_validate_it(kwargs: list) -> str: + expected_parameters = ['expected_subscription_id', 'expected_context_source_registration_ids', + 'expected_trigger_reason', 'expected_notification_data_entities', + 'timeout'] + + if 'expected_notification_data_entities' not in kwargs: + kwargs['expected_notification_data_entities'] = "${EMPTY}" + + if 'timeout' not in kwargs: + kwargs['timeout'] = '5' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Waiting for Notification and validate it" + for key, value in kwargs.items(): + match key: + case 'expected_subscription_id': + response = f"{response} and\n Query Parameter: expected_subscription_id set to '{value}'" + case 'expected_context_source_registration_ids': + response = f"{response} and\n Query Parameter: expected_context_source_registration_ids set to '{value}'" + case 'expected_trigger_reason': + response = f"{response} and\n Query Parameter: expected_trigger_reason set to '{value}'" + case 'expected_notification_data_entities': + response = f"{response} and\n Query Parameter: expected_notification_data_entities set to '{value}'" + case 'timeout': + response = f"{response} and\n Query Parameter: timeout set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case 'checks': + pass + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def check_response_header_is_empty(kwargs: list) -> str: + return "The response header contains an empty dictionary" + + @staticmethod + def check_response_headers_link_set_to(kwargs: list) -> str: + return f"The response headers Link is set to '{kwargs['expected_link_header']}'" + + @staticmethod + def wait_for_no_notification(kwargs: list) -> str: + expected_parameters = ['timeout'] + + if 'timeout' not in kwargs: + kwargs['timeout'] = '5' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Waiting for no Notification data" + for key, value in kwargs.items(): + match key: + case 'timeout': + response = f"{response} and\n Query Parameter: timeout set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case 'checks': + pass + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def check_response_reason_set_to(kwargs: list) -> str: + return f"Response reason set to '{kwargs['reason']}'" + + @staticmethod + def check_response_does_not_contain_body(kwargs: list) -> str: + return f"Response does not contain a body" + + @staticmethod + def check_response_body_containing_array_of_uris_set_to(kwargs: list) -> str: + return 'Response Body set to an array of created entities ids' + + @staticmethod + def check_created_resources_set_to(kwargs: list) -> str: + return 'Created resources set to ${entities}' + + @staticmethod + def dictionary_should_contain_key(kwargs: list) -> str: + if 'dictionary' in kwargs and 'key' in kwargs: + return f"The dictionary `{kwargs['dictionary']}' should contain the key '{kwargs['key']}'" + else: + raise Exception(f'ERROR, Expected dictionary and key parameters but received: {kwargs}') + + @staticmethod + def should_not_be_empty(kwargs: list) -> str: + if 'variable' in kwargs: + return f"The variable `{kwargs['variable']}' should not be '${{EMPTY}}'" + else: + raise Exception(f'ERROR, Expected dictionary and key parameters but received: {kwargs}') + + @staticmethod + def should_be_true(kwargs: list) -> str: + if 'expression' in kwargs: + return f"The expression `{kwargs['expression']}' should be True" + else: + raise Exception(f'ERROR, Expected dictionary and key parameters but received: {kwargs}') + + @staticmethod + def check_response_headers_containing_content_type_set_to(kwargs: list) -> str: + if "content_type" in kwargs: + content_type = kwargs['content_type'] + return f'Response Header: Content-Type set to {content_type}' + else: + raise Exception(f'ERROR, Expected status_code parameter but received: {kwargs}') + + @staticmethod + def check_response_body_containing_a_boolean_attribute_set_to(kwargs: list) -> str: + return (f"Check that the payload body contains a boolean attribute with name " + f"'{kwargs['expected_attribute_name']}' and value '{kwargs['expected_attribute_value']}") + + @staticmethod + def check_response_headers_link_not_empty(kwargs: list) -> str: + return f'Response Header: Link is not Empty' + + @staticmethod + def check_response_headers_containing_uri_set_to(kwargs: list) -> str: + if 'expected_entity_id' in kwargs and 'response_headers' in kwargs: + return f"Response Header: Location containing ${kwargs['expected_entity_id']}" + else: + raise Exception(f'ERROR, Expected expected_entity_id and response_headers parameters ' + f'but received: {kwargs}') + + @staticmethod + def check_response_headers_id_not_empty(kwargs: list) -> str: + return 'Response Header: Location is not Empty' + + @staticmethod + def check_dictionary_might_contain_additional_members(kwargs: list) -> str: + if 'dictionary' in kwargs and 'key' in kwargs: + return f"The dictionary `{kwargs['dictionary']}' might contain the key '{kwargs['key']}'" + else: + raise Exception(f"ERROR, Expected 'dictionary' and 'key' parameters but received: {kwargs}") + + @staticmethod + def check_response_body_containing_an_attribute_set_to(kwargs: list) -> str: + expected_parameters = ['checks', 'expected_attribute_name', 'response_body', 'expected_attribute_value'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Check Response Body containing an Attribute set to" + for key, value in kwargs.items(): + match key: + case 'expected_attribute_name': + response = f"{response} and\n Query Parameter: expected_attribute_name set to '{value}'" + case 'response_body': + response = f"{response} and\n Query Parameter: response_body set to '{value}'" + case 'expected_attribute_value': + response = f"{response} and\n Query Parameter: expected_attribute_value set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case 'checks': + pass + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def check_response_body_containing_entity_element(kwargs: list) -> str: + if 'filename' in kwargs and 'id' in kwargs and 'response' in kwargs: + return f"Response Body containing en entity element with id set to '{kwargs['id']}' and body content set to '{kwargs['filename']}'" + + @staticmethod + def check_response_body_containing_list_containing_entity_elements(kwargs: list) -> str: + expected_parameters = ['expectation_filename', 'entities_ids', 'response_body', 'ignore_core_context_version'] + + if 'ignore_core_context_version' not in kwargs: + kwargs['ignore_core_context_version'] = False + + result = [x for x in kwargs if x not in expected_parameters] + response = "Response Body containing a list containing Entity Elements" + for key, value in kwargs.items(): + match key: + case 'expectation_filename': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'entities_ids': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'response_body': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'ignore_core_context_version': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'checks': + pass + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def check_response_body_containing_list_containing_entity_elements_with_different_types(kwargs: list) -> str: + expected_parameters = ['filename', 'entities_representation_ids', 'response_body', 'ignore_core_context_version'] + + if 'ignore_core_context_version' not in kwargs: + kwargs['ignore_core_context_version'] = False + + result = [x for x in kwargs if x not in expected_parameters] + response = "Response body containing a list containing entity elements with different types" + for key, value in kwargs.items(): + match key: + case 'filename': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'entities_representation_ids': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'response_body': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'ignore_core_context_version': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'checks': + pass + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def check_retrieving_context_source_registration(kwargs: list) -> str: + expected_parameters = ['registration_id', 'context', 'accept', 'registration_payload'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Check Retrieving Context Source Registration" + for key, value in kwargs.items(): + match key: + case 'registration_id': + response = f"{response} and\n Query Parameter: registration_id set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case 'registration_payload': + response = f"{response} and\n Query Parameter: registration_payload set to '{value}'" + case 'checks': + pass + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def check_response_body_containing_entitytemporal_element(kwargs: list) -> str: + if 'filename' in kwargs and 'temporal_entity_representation_id' in kwargs and 'response_body' in kwargs: + return (f"Response Body containing EntityTemporal element containing attribute instances in the time range" + f" specified by the NGSI-LD temporal query:\n" + f" * the payload is defined in the file set to '{kwargs['filename']}'\n" + f" * the id was changed to '{kwargs['temporal_entity_representation_id']}'\n" + f" * response body to be checked set to '{kwargs['response_body']}'") + else: + raise Exception(f"ERROR, expected 'filename', 'temporal_entity_representation_id', and 'response_body' " + f"attributes, received: '{kwargs}'") + + @staticmethod + def check_response_body_containing_list_containing_entitytemporal_elements(kwargs: list) -> str: + if 'filename' in kwargs and 'entity_ids' in kwargs: + return (f"Request response body containing a list that contains Entity Temporal Elements\n" + f" compared with file '{kwargs['filename']}'\n" + f" and using the list of entity ids define in '{kwargs['entity_ids']}'") + else: + raise Exception(f"ERROR, expected parameters 'filename' and 'entity_ids', but received '{kwargs}'") + + @staticmethod + def check_response_body_contains_datetime_value(kwargs: list) -> str: + # ${dictionary} ${key} ${expected value} + return (f"Check that the dictionary contains the key '{kwargs['key']}' with type DateTime and value set " + f"to '{kwargs['expected value']}'") + + @staticmethod + def check_response_body_containing_subscription_element(kwargs: list) -> str: + if 'filename' in kwargs and 'subscription_id' in kwargs and 'response_body' in kwargs: + return (f"Response Body containing the same content defined in file '{kwargs['filename']}'" + f" with subscription id '{kwargs['subscription_id']}'") + else: + raise Exception(f"ERROR, expected parameters 'filename' and 'entity_ids', but received '{kwargs}'") + + @staticmethod + def check_response_body_containing_list_containing_subscription_elements(kwargs: list) -> str: + if 'file' in kwargs and 'id' in kwargs and 'response' in kwargs: + return (f"Response containing:\n" + f" * file set to '{kwargs['file']}'\n" + f" * id set to '{kwargs['id']}'\n" + f" * response set to '{kwargs['response']}'") + else: + raise Exception(f"ERROR, expected 'file', 'id', and 'response' attributes, received: '{kwargs}'") + + @staticmethod + def check_response_body_containing_number_of_entities(kwargs: list) -> str: + if "entity_type" in kwargs and 'number_entities' in kwargs and 'response' in kwargs: + number_entities = kwargs['number_entities'] + entity_type = kwargs['entity_type'] + response = kwargs['response'] + return (f"Response Body containing a list of entities equal to '{number_entities}' of type '{entity_type}' " + f"with response set to '{response}'") + else: + raise Exception(f'ERROR, expected entity_type and number_entities attributes, but received: {kwargs}') + + @staticmethod + def check_response_body_containing_context_source_registration_element(kwargs: list) -> str: + if 'file' in kwargs and 'id' in kwargs and 'response' in kwargs: + return (f"Response containing:\n" + f" * file set to '{kwargs['file']}'\n" + f" * id set to '{kwargs['id']}'\n" + f" * response set to '{kwargs['response']}'") + else: + raise Exception(f"ERROR, expected 'file', 'id', and 'response' attributes, received: '{kwargs}'") + # if 'csr_description' in kwargs: + # csr = kwargs['csr_description'] + # return f"Response body containing a '{csr}'" + # else: + # raise Exception(f"ERROR, expected csr_description attribute, but received: {kwargs}") + + @staticmethod + def check_response_body_containing_entitytypelist_element(kwargs: list) -> str: + if 'filename' in kwargs and 'response' in kwargs: + return f"Response Body containing an Entity Type List with expectation body equal to file: '{kwargs['filename']}'" + else: + raise Exception(f"ERROR, expected filename and response attributes, but received: {kwargs}") + + @staticmethod + def check_response_body_containing_entitytype_element(kwargs: list) -> str: + if 'filename' in kwargs and 'response' in kwargs: + return f"Response Body containing an Entity Type Element with expectation body equal to file: '{kwargs['filename']}'" + else: + raise Exception(f"ERROR, expected filename and response attributes, but received: {kwargs}") + + @staticmethod + def check_response_body_containing_entitytypeinfo_element(kwargs: list) -> str: + if 'expectation_filename' in kwargs and 'response_body' in kwargs: + return (f"Response body containing an Entity Type Info " + f"with expectation body set to file '{kwargs['expectation_filename']}' " + f"and response body to be checked set to '{kwargs['response_body']}'") + else: + raise Exception(f"ERROR, expected filename and response attributes, but received: {kwargs}") + + @staticmethod + def check_response_body_containing_attributelist_element(kwargs: list) -> str: + if 'filename' in kwargs and 'response' in kwargs: + return (f"Response Body containing an Attribute List element" + f"\n * with filename set to '{kwargs['filename']}'" + f"\n * response set to '{kwargs['response']}'") + + @staticmethod + def check_response_body_containing_attribute_element(kwargs: list) -> str: + if 'expectation_filename' in kwargs and 'response_body' in kwargs: + return (f"Response body containing an array of attributes" + f"\n * with the expected payload defined in the file '{kwargs['expectation_filename']}'" + f"\n * and response body set to '{kwargs['response_body']}'") + + @staticmethod + def check_response_body_containing_list_containing_context_source_registrations_elements(kwargs: list) -> str: + return 'Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context' + + @staticmethod + def check_response_body_type_when_using_session_request(kwargs: list) -> str: + if 'type' in kwargs: + type = kwargs['type'] + return f"Response Body containing the type '{type}'" + else: + raise Exception(f"ERROR, expected type attribute, but received: {kwargs}") + + @staticmethod + def check_response_body_containing_problemdetails_element_containing_type_element_set_to(kwargs: list) -> str: + if 'type' in kwargs: + type = kwargs['type'] + return f"Response Body containing the type '{type}'" + else: + raise Exception(f"ERROR, expected type attribute, but received: {kwargs}") + + @staticmethod + def check_response_body_containing_problemdetails_element(kwargs: list) -> str: + if 'problem_type' in kwargs: + problem_type = kwargs['problem_type'] + return (f"Response Body containing the type '{problem_type}' and " + f"Response Body Title is a string and is not ${{EMPTY}} and " + f"Response Body Detail is a string and is not ${{EMPTY}} and " + f"Response Boty Title is not equal to Response Body Detail") + else: + raise Exception(f"ERROR, expected type attribute, but received: {kwargs}") + + @staticmethod + def check_response_body_title_when_using_session_request(kwargs: list) -> str: + return "Response body containing 'title' element" + + @staticmethod + def check_response_body_containing_problemdetails_element_containing_title_element(kwargs: list) -> str: + return "Response body containing 'title' element" + + @staticmethod + def check_rl_response_body_containing_problemdetails_element_containing_type_element_set_to(kwargs: list) -> str: + if 'type' in kwargs: + type = kwargs['type'] + return f"Response Body containing the type '{type}'" + else: + raise Exception(f"ERROR, expected type attribute, but received: {kwargs}") + + @staticmethod + def check_rl_response_body_containing_problemdetails_element_containing_title_element(kwargs: list) -> str: + return "Response body containing 'title' element" + + @staticmethod + def check_json_value_in_response_body(kwargs: list) -> str: + if 'key' in kwargs and 'value' in kwargs: + key = kwargs['key'] + value = kwargs['value'] + return f"Response Body containing the key '{key}', with the value '{value}'" + else: + raise Exception(f"ERROR, expected key and value attributes, but received: {kwargs}") + + @staticmethod + def check_json_value_not_in_response_body(kwargs: list) -> str: + if 'json_path_expr' in kwargs: + key = kwargs['json_path_expr'] + return f"Check that response body does not contain the key '{key}'" + else: + raise Exception(f"ERROR, expected key and value attributes, but received: {kwargs}") + + @staticmethod + def check_pagination_prev_and_next_headers(kwargs: list) -> str: + previous = None + next = None + if 'previous' in kwargs: + previous = kwargs['previous'] + previous_text = f"with 'Prev' header equal to '{previous}'" + + if 'next' in kwargs: + next = kwargs['next'] + next_text = f"with 'Next' header equal to '{next}'" + + if previous is None and next is None: + raise Exception(f"ERROR, expected previous or next attributes, but received: {kwargs}") + elif previous is not None and next is None: + result = f"Response header {previous_text}" + elif previous is None and next is not None: + result = f"Response header {next_text}" + else: + result = f"Response header {previous_text} and {next_text}" + + return result + + @staticmethod + def check_created_resource_set_to(kwargs: list) -> str: + expected_parameters = ['created_resource', 'response_body', 'ignored_keys'] + + if 'ignored_keys' not in kwargs: + kwargs['ignored_keys'] = '${None}' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Check Created Resource Set To" + for key, value in kwargs.items(): + match key: + case 'created_resource': + response = f"{response} and\n Query Parameter: '{key}' set to '{value}'" + case 'response_body': + response = f"{response} and\n Query Parameter: '{key}' set to '{value}'" + case 'ignored_keys': + response = f"{response} and\n Query Parameter: '{key}' set to '{value}' list of keys" + # If an exact match is not confirmed, this last case will be used if provided + case 'checks': + pass + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def check_created_resources_set_to(kwargs: list) -> str: + expected_parameters = ['expected_resources', 'response_body', 'ignored_keys'] + + if 'ignored_keys' not in kwargs: + kwargs['ignored_keys'] = '${None}' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Check Created Resource Set To" + for key, value in kwargs.items(): + match key: + case 'expected_resources': + response = f"{response} and\n Query Parameter: '{key}' set to '{value}'" + case 'response_body': + response = f"{response} and\n Query Parameter: '{key}' set to '{value}'" + case 'ignored_keys': + response = f"{response} and\n Query Parameter: '{key}' set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case 'checks': + pass + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def check_updated_resource_set_to(kwargs: list) -> str: + return "Updated Entity set to ${entity}" + + @staticmethod + def check_updated_resources_set_to(kwargs: list) -> str: + if 'number_entities' in kwargs: + number_entities = kwargs['number_entities'] + return f"Updated Entities set to '{number_entities}' valid entities" + + @staticmethod + def check_sut_not_containing_resource(kwargs: list) -> str: + if "status_code" in kwargs: + status_code = kwargs['status_code'] + try: + return f'Response Status Code set to {status_code} ({HTTPStatus(status_code).phrase})' + except ValueError: + return f'Response Status Code set to {status_code}' + else: + raise Exception(f'ERROR, Expected status_code parameter but received: {kwargs}') + + @staticmethod + def check_sut_not_containing_resources(kwargs: list) -> str: + return f'Response body is empty' + + @staticmethod + def check_notificationparams(kwargs: list) -> str: + if 'filename' in kwargs and 'expected_additional_members' in kwargs and 'response_body' in kwargs: + return (f"Response containing:\n" + f" * Notification expectation file path set to '{kwargs['filename']}'\n" + f" * Expected Additional Members set to '{kwargs['expected_additional_members']}'\n" + f" * Response Body set to '{kwargs['response_body']}'\n") + else: + raise Exception(f"ERROR, expected 'filename', 'expected_additional_members', and 'response_body', " + f"but received '{kwargs}'") + + @staticmethod + def check_response_body_containing_batch_operation_result(kwargs: list) -> str: + if "operation" in kwargs: + return f"Response body containing batch operation result set to '{kwargs['operation']}'" + else: + raise Exception(f'ERROR, Expected operation parameter but received: {kwargs}') + + @staticmethod + def check_response_body_content(kwargs: list) -> str: + expected_parameters = ['expectation_filename', 'response_body', 'additional_ignored_path'] + + if 'additional_ignored_path' not in kwargs: + kwargs['additional_ignored_path'] = '${EMPTY}' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Check Response Body Content" + for key, value in kwargs.items(): + match key: + case 'expectation_filename': + response = f"{response} and\n Query Parameter: expectation_filename set to '{value}'" + case 'response_body': + response = f"{response} and\n Query Parameter: response_body set to '{value}'" + case 'additional_ignored_path': + response = f"{response} and\n Query Parameter: additional_ignored_path set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case 'checks': + pass + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + + @staticmethod + def should_be_equal(kwargs: list) -> str: + if 'expected_value' in kwargs and 'obtained_value' in kwargs: + return f"Notification data: '{kwargs['obtained_value']}' equal to '{kwargs['expected_value']}'" + else: + raise Exception(f"ERROR, Expected 'expected_value' and 'obtained_value' parameters but received: '{kwargs}'") + + @staticmethod + def check_response_header_contains_ngsild_results_count_equals_to(kwargs: list) -> str: + if 'expected_result_count' in kwargs: + expected_result_count = kwargs['expected_result_count'] + return f'Response Header: NGSILD-Results-Count equals to {expected_result_count}' + else: + raise Exception(f"ERROR, Expected 'expected_result_count' but received: '{kwargs}'") + + def get_checks(self, **kwargs) -> str: + checking = None + + if "checks" in kwargs: + checking = kwargs["checks"] + else: + raise Exception(f'ERROR, the attribute checks is mandatory, but received: {kwargs}') + + if isinstance(checking, str): + result = self.checks[checking](kwargs) + elif isinstance(checking, list): + result = [self.checks[x](kwargs) for x in checking] + result = " and\n".join(result) + else: + raise Exception(f"ERROR, checks type not supported: {checking}") + + return result + + +if __name__ == "__main__": + data = Checks() + + print(data.get_checks(checks='Check Response Status Code', + status_code=201)) + print(data.get_checks(checks='Check Response Body Containing Array Of URIs set to')) + print(data.get_checks(checks='Check Created Resources Set To')) + print(data.get_checks(checks='Check Response Headers Containing Content-Type set to', + content_type='application/json')) + print(data.get_checks(checks='Check Response Headers Link Not Empty')) + print(data.get_checks(checks='Check Response Headers Containing URI set to')) + print(data.get_checks(checks='Check Response Headers ID Not Empty')) + print(data.get_checks(checks='Check Response Body Containing an Attribute set to', + attribute_name='status')) + print(data.get_checks(checks='Check Response Body Containing an Attribute set to', + attribute_name='status', + attribute_value='active')) + print(data.get_checks(checks='Check Response Body Containing Entity element')) + print(data.get_checks(checks='Check Response Body Containing List Containing Entity Elements')) + print(data.get_checks(checks='Check Response Body Containing List Containing Entity Elements With Different Types')) + print(data.get_checks(checks='Check Response Body Containing EntityTemporal element')) + print(data.get_checks(checks='Check Response Body Containing List Containing EntityTemporal elements', + timeRel='after', + timeAt='2020-07-01T12:05:00Z')) + print(data.get_checks(checks='Check Response Body Containing Subscription element')) + print(data.get_checks(checks='Check Response Body Containing List Containing Subscription elements', + number=2)) + print(data.get_checks(checks='Check Response Body Containing List Containing Subscription elements', + number=1)) + print(data.get_checks(checks='Check Response Body Containing Number Of Entities', + entity_type="Vehicle", + number_entities=3)) + print(data.get_checks(checks='Check Response Body Containing Context Source Registration element', + csr_description='Context Source Registration')) + print(data.get_checks(checks='Check Response Body Containing EntityTypeList element', + description='Json object with list of entity types with context')) + print(data.get_checks(checks='Check Response Body Containing EntityType element', + description='Json object with an entity type with context')) + print(data.get_checks(checks='Check Response Body Containing EntityTypeInfo element')) + print(data.get_checks(checks='Check Response Body Containing AttributeList element')) + print(data.get_checks(checks='Check Response Body Containing Attribute element')) + print(data.get_checks(checks='Check Response Body Containing List Containing Context Source Registrations elements')) + print(data.get_checks(checks='Check Response Body Type When Using Session Request', + type='https://uri.etsi.org/ngsi-ld/errors/BadRequestData')) + print(data.get_checks(checks='Check Response Body Containing ProblemDetails Element Containing Type Element set to', + type='https://uri.etsi.org/ngsi-ld/errors/BadRequestData')) + print(data.get_checks(checks='Check Response Body Title When Using Session Request')) + print(data.get_checks(checks='Check Response Body Containing ProblemDetails Element Containing Title Element')) + print(data.get_checks(checks='Check RL Response Body Containing ProblemDetails Element Containing Type Element set to', + type='https://uri.etsi.org/ngsi-ld/errors/BadRequestData')) + print(data.get_checks(checks='Check RL Response Body Containing ProblemDetails Element Containing Title Element')) + print(data.get_checks(checks='Check JSON Value In Response Body', + key="['information']['entities'][0]['type']", + value="Building")) + print(data.get_checks(checks='Check Pagination Prev And Next Headers', + previous=';rel="prev";type="application/ld+json"', + next=';rel="next";type="application/ld+json"')) + print(data.get_checks(checks='Check Pagination Prev And Next Headers', + previous='', + next=';rel="next";type="application/ld+json"')) + print(data.get_checks(checks='Check Pagination Prev And Next Headers', + previous=';rel="prev";type="application/ld+json"', + next='')) + print(data.get_checks(checks='Check Pagination Prev And Next Headers', + previous='', + next='')) + print(data.get_checks(checks='Check Created Resource Set To')) + print(data.get_checks(checks='Check Updated Resource Set To')) + print(data.get_checks(checks='Check Updated Resources Set To', + number_entities=2)) + print(data.get_checks(checks='Check SUT Not Containing Resource', + status_code=404)) + print(data.get_checks(checks='Check SUT Not Containing Resources')) + print(data.get_checks(checks='Check NotificationParams', + format="keyValues", + uri="http://my.endpoint.org/notify", + accept="application/json", + status="ok", + timesSent="1")) + + print() + print(data.get_checks(checks= + ['Check Response Status Code', + 'Check Response Body Containing Array Of URIs set to', + 'Check Created Resources Set To'] + , status_code=201)) + print() + print(data.get_checks(checks='Check Response Headers Containing NGSILD-Results-Count Equals To')) + + # Check exceptions + try: + print(data.get_checks(checks='Check Response Body Containing an Attribute set to')) + except Exception as e: + print(e) diff --git a/doc/analysis/generaterobotdata.py b/doc/analysis/generaterobotdata.py new file mode 100644 index 0000000000000000000000000000000000000000..ba74bcb037b6e5679eb5b5fca9139c8b5279a8ed --- /dev/null +++ b/doc/analysis/generaterobotdata.py @@ -0,0 +1,572 @@ +from os.path import dirname +from robot.api import TestSuiteBuilder +from doc.analysis.parserobotfile import ParseRobotFile +from doc.analysis.parseapiutilsfile import ParseApiUtilsFile +from doc.analysis.parsevariablesfile import ParseVariablesFile +from doc.analysis.initial_setup import InitialSetup +from re import match, findall, finditer, sub, MULTILINE + + +class GenerateRobotData: + def __init__(self, robot_file: str, execdir: str): + self.robot_file = robot_file + self.execdir = execdir + self.suite = TestSuiteBuilder().build(robot_file) + + self.config_variables = ParseVariablesFile() + self.robot = ParseRobotFile(filename=robot_file, execdir=execdir, config_file=self.config_variables) + self.apiutils = [ParseApiUtilsFile(filename=file) for file in self.robot.resource_files] + self.robot.set_apiutils(self.apiutils) + + self.test_cases = list() + self.test_suite = dict() + self.tags_template = list() + self.documentation_template = str() + self.arguments = list() + self.args = list() + self.identifier = { + 'ContextInformation': 'CI', + 'CommonBehaviours': 'CB', + 'Consumption': 'Cons', + 'Provision': 'Prov', + 'ContextSource': 'CS', + 'Discovery/RetrieveAvailableAttributeInformation': 'DISC', + 'Discovery/RetrieveAvailableEntityTypeInformation': 'DISC', + 'Discovery/RetrieveAvailableEntityTypes': 'DISC', + 'Discovery/RetrieveDetailsOfAvailableEntityTypes': 'DISC', + 'Discovery/RetrieveAvailableAttributes': 'DISC', + 'Discovery/RetrieveDetailsOfAvailableAttributes': 'DISC', + 'Entity/RetrieveEntity': 'E', + 'Entities/CreateEntity': 'E', + 'Entity/QueryEntities': 'E', + 'Entities/DeleteEntity': 'E', + 'EntityAttributes/AppendEntityAttributes': 'EA', + 'EntityAttributes/UpdateEntityAttributes': 'EA', + 'EntityAttributes/PartialAttributeUpdate': 'EA', + 'EntityAttributes/DeleteEntityAttribute': 'EA', + 'BatchEntities/CreateBatchOfEntities': 'BE', + 'BatchEntities/UpsertBatchOfEntities': 'BE', + 'BatchEntities/UpdateBatchOfEntities': 'BE', + 'BatchEntities/DeleteBatchOfEntities': 'BE', + 'TemporalEntity/QueryTemporalEvolutionOfEntities': 'TE', + 'TemporalEntity/DeleteTemporalRepresentationOfEntity': 'TE', + 'TemporalEntity/UpdateTemporalRepresentationOfEntity': 'TE', + 'TemporalEntity/RetrieveTemporalEvolutionOfEntity': 'TE', + 'TemporalEntity/CreateTemporalRepresentationOfEntity': 'TE', + 'TemporalEntityAttributes/DeleteAttributeInstance': 'TEA', + 'TemporalEntityAttributes/DeleteAttribute': 'TEA', + 'TemporalEntityAttributes/PartialUpdateAttributeInstance': 'TEA', + 'TemporalEntityAttributes/AddAttributes': 'TEA', + 'Subscription/CreateSubscription': 'SUB', + 'Subscription/DeleteSubscription': 'SUB', + 'Subscription/QuerySubscriptions': 'SUB', + 'Subscription/RetrieveSubscription': 'SUB', + 'Subscription/UpdateSubscription': 'SUB', + 'Subscription/SubscriptionNotificationBehaviour': 'SUB', + 'Registration/CreateContextSourceRegistration': 'REG', + 'Registration/CreateCSRegistration': 'REG', + 'Registration/UpdateCSRegistration': 'REG', + 'Registration/DeleteCSRegistration': 'REG', + 'Registration/RegisterCS': 'CSR', + 'RegistrationSubscription/CreateCSRegistrationSubscription': 'REGSUB', + 'RegistrationSubscription/UpdateCSRegistrationSubscription': 'REGSUB', + 'RegistrationSubscription/RetrieveCSRegistrationSubscription': 'REGSUB', + 'RegistrationSubscription/QueryCSRegistrationSubscriptions': 'REGSUB', + 'RegistrationSubscription/DeleteCSRegistrationSubscription': 'REGSUB', + 'RegistrationSubscription/CSRegistrationSubscriptionNotificationBehaviour': 'REGSUB', + 'RegistrationSUBBehaviour': 'REGSUB', + 'Discovery/RetrieveCSRegistration': 'DISC', + 'Discovery/QueryCSRegistrations': 'DISC', + 'CommonResponses/VerifyLdContextNotAvailable': 'HTTP', + 'CommonResponses/VerifyMergePatchJson': 'HTTP', + 'CommonResponses/VerifyGETWithoutAccept': 'HTTP', + 'CommonResponses/VerifyUnsupportedMediaType': 'HTTP', + 'CommonResponses/VerifyNotAcceptableMediaType': 'HTTP' + } + self.references = { + 'v1.3.1': 'ETSI GS CIM 009 V1.3.1 []' + } + self.initial_conditions = { + 'Setup Initial Entity': + 'with {\n the SUT containing an initial Entity ${entity} with an id set to ${entityId}\n}', + 'Initial State': + 'with {\n the SUT in the "initial state"\n}' + } + self.headers = { + '${CONTENT_TYPE_LD_JSON}': 'Content-Type' + } + self.ids = { + '${ENTITIES_ENDPOINT_PATH}': '${entityId}' + } + self.base_TP_id = str() + + self.initial_setup = InitialSetup() + + def get_info(self): + self.test_suite['robotpath'] = (self.robot_file.replace(f'{self.execdir}/TP/NGSI-LD/', '') + .replace(f'/{self.robot.test_suite}.robot', '')) + self.test_suite['robotfile'] = self.robot.test_suite + return self.test_suite + + def parse_robot(self): + self.start_suite() + _ = [self.visit_test(test=x) for x in self.suite.tests] + + _ = [self.get_step_data(test=x.name) for x in self.suite.tests] + self.test_suite['test_cases'] = self.test_cases + + # Generate the permutation keys to provide the keys in test_cases list that are different + self.test_suite['permutations'] = self.get_permutation_keys(data=self.test_suite['test_cases']) + + # Generate the initial_condition of the test suite + self.test_suite['initial_condition'] = self.generate_initial_condition() + + def generate_initial_condition(self) -> str: + aux = [x['setup'] for x in self.test_cases] + if all(element == aux[0] for element in aux[1:]): + aux = self.initial_setup.get_initial_condition(initial_condition=aux[0]) + return aux + else: + print(f'Something went wrong, the test suite {self.suite.resource.source} ' + f'has different "setup" values for its test cases.') + + @staticmethod + def get_permutation_keys(data): + all_keys = set().union(*data) + excluded_keys = ['doc', 'permutation_tp_id', 'setup', 'teardown', 'name', 'tags'] + all_keys = [x for x in all_keys if x not in excluded_keys] + + keys_with_different_values = [ + key for key in all_keys if any(d.get(key) != data[0].get(key) for d in data[1:]) + ] + + keys_with_different_values.sort() + + return keys_with_different_values + + def get_data_template(self, string: str) -> str: + if self.robot.test_template_name != '': + result = self.robot.string_test_template + else: + result = string + + return result + + def get_params(self, test_case: str): + test_case = self.get_data_template(string=test_case) + lines_starting_response = findall(r'^\s*\$\{response}.*|^\s*\$\{notification}.*', test_case, MULTILINE) + + # If there is more than one line, it means that the test case has several operations, all of them to + # create the environment content to execute the last one, which is the correct one to test the Test Case + if (len(lines_starting_response) > 1 and + any(map(lambda item: 'notification' in item, lines_starting_response)) is False): + # The last one corresponds to the execution of the test, the rest corresponds to the initial condition of + # test case... + response_to_check = lines_starting_response[-1] + else: + response_to_check = lines_starting_response[0] + + index = test_case.find(response_to_check) + aux = test_case[index:].split('\n') + aux = [x for x in aux if x != ''] + + params = list() + request = list() + + # Get the list of params of the function, they are the keys + if ' ... ' in aux[1]: + request = aux[0].split(' ') + request = [x for x in request if x != ''][1] + + # We are in the case that the attributes are in following lines + for i in range(1, len(aux)): + if ' ... ' in aux[i]: + regex = r'(\s{4})*\s{4}\.{3}\s{4}(.*)' + param = match(pattern=regex, string=aux[i]) + if aux: + params.append(param.groups()[1]) + else: + break + else: + # the attributes are in the same line + regex = r"\s*\$\{response\}=\s{4}(.*)" + matches = finditer(regex, response_to_check, MULTILINE) + request = aux[0].split(' ')[2] + + # We have two options from here, or the parameters are defined in the same line or the parameters are + # defined in following lines, next lines + for a_match in matches: + # Check that we have 1 group matched + if len(a_match.groups()) == 1: + aux = a_match.group(1) + + # Get the list of keys + params = aux.split(' ')[1:] + else: + raise Exception(f"Error, unexpected format, received: '{response_to_check}'") + + return request, params + + def get_step_data(self, test: str): + if self.robot.string_test_template == '': + string = self.robot.test_cases[test] + else: + string = self.robot.string_test_template + + request, params = self.get_params(test_case=string) + + verb = str() + query_param = str() + url = str() + for data in self.apiutils: + verb, url, query_param = data.get_response(keyword=request) + if verb != '': + break + + index = None + for i, item in enumerate(self.test_cases): + if 'name' in item and item['name'] == test: + index = i + break + + self.test_cases[index]['http_verb'] = verb + self.test_cases[index]['endpoint'] = self.get_values_url(keys=url, + query_param=query_param, + request=request, + params=params) + + self.test_cases[index]['when'] = self.robot.generate_when_content(http_verb=self.test_cases[index]['http_verb'], + endpoint=self.test_cases[index]['endpoint'], + when=self.test_cases[index]['when']) + + def check_header_parameters(self, params: list, test: str): + value = str() + + # 1st case: value of the parameters are sent as it is + header_key = [x for x in params if x in self.headers.keys()] + if len(header_key) != 0: + key = header_key[0] + value = self.get_header_value(key=key) + else: + aux = list() + # 2nd case, maybe the params are defined in the way = + for k in self.headers: + aux = [x for x in params if k in x] + + if len(aux) != 0: + key = aux[0].split('=')[1] + value = self.get_header_value(key=key) + else: + key = None + value = None + + if key is not None and value is not None: + # Iterate over the list and find the index + index = None + for i, item in enumerate(self.test_cases): + if 'name' in item and item['name'] == test: + index = i + break + + # self.test_cases[index]['params'] = params + self.test_cases[index][self.headers[key]] = value + + def get_values_url(self, keys: list, query_param: bool, request: str, params: list) -> str: + data = [self.get_value_url(key=x, request=request, params=params) for x in keys] + + if not query_param: + data = '/'.join(data).replace('//', '/').replace('?/', '?') + else: + aux = '/'.join(data[:-1]).replace('//', '/').replace('?/', '?') + data = f"{aux}?{data[-1]}" + + return data + + def get_value_url(self, key: str, request: str, params: list) -> str: + key_to_search = f'${key}' + try: + flattened_list_variables = {k: v for d in self.apiutils for k, v in d.variables.items()} + value = flattened_list_variables[key_to_search] + except KeyError: + # It is not defined in ApiUtils, maybe in Robot File? + try: + value = self.robot.variables[key_to_search] + except KeyError: + # Maybe the url is defined in the proper resource file through an operation + try: + value = self.check_resource_for_url(string=key_to_search, request=request, params=params) + except KeyError: + # The variable is not defined, so it is keep as it is in the url + value = key + + return value + + def check_resource_for_url(self, string: str, request: str, params: list) -> str: + data_file_contents = '\n'.join([x.file_contents for x in self.apiutils]) + flattened_list_variables = {k: v for d in self.apiutils for k, v in d.variables.items()} + flattened_list_variables = {key.split(' ')[0]: value for key, value in flattened_list_variables.items()} + + index1 = data_file_contents.find(string) + + if index1 != -1: + index2 = data_file_contents[index1:].find("\n") + line = data_file_contents[index1:index1 + index2] + + if string in line: + if 'Get From Dictionary' in line: + # We have to obtain the information of the endpoint from the dictionary + aux = line.split("Get From Dictionary")[1].strip().split(" ") + key = aux[0] + value = aux[1] + url_dict = flattened_list_variables[key] + + if request == 'Batch Request Entities From File': + url = url_dict[params[0]] + else: + raise KeyError + + return url + else: + raise KeyError + else: + raise KeyError + else: + raise KeyError + + def get_header_value(self, key: str): + value = str() + # We can have a simple variable or a compound of two variables + count = key.count('$') + if count == 1: + # Get the value of the Header key + try: + value = self.apiutils.variables[key] + except KeyError: + # It is not defined in ApiUtils, maybe in Robot File + try: + value = self.robot.variables[key] + except KeyError: + # ERROR, the header key is not defined + raise Exception(f"ERROR, the header key '{key}' is undefined") + elif count == 2: + keys = key.split("$") + key = f'${keys[1]}' + second_key = f'${keys[2]}' + + try: + second_key = self.ids[key] + except KeyError: + raise Exception(f"ERROR: Need to manage the '{second_key}' in GenerateRobotData::self.ids") + # Get the value of the Header key + try: + value = self.apiutils.variables[key] + value = f'{value}{second_key}' + except KeyError: + # It is not defined in ApiUtils, maybe in Robot File + try: + value = self.robot.variables[key] + value = f'{value}{second_key}' + except KeyError: + # ERROR, the header key is not defined + raise Exception(f"ERROR, the header key '{key}' is undefined") + + return value + + def start_suite(self): + """Modify suite's tests to contain only every Xth.""" + version = 'v1.3.1' + tp_id = self.generate_name() + reference, clauses = self.generate_reference(version=version) + + # TODO: robotframework==7.0 has not property keywords in the class TestSuite(), we can get the data from + # [x.to_dict()['name'] for x in list(self.suite.resource.keywords)] but with some differences in execution code + self.test_suite = { + 'tp_id': tp_id, + 'test_objective': self.suite.doc, + 'reference': reference, + 'config_id': str(), + 'parent_release': version, + 'clauses': clauses, + 'pics_selection': str(), + # 'keywords': [str(x) for x in self.suite.keywords], + 'keywords': [x.to_dict()['name'] for x in list(self.suite.resource.keywords)], + 'teardown': str(self.suite.teardown), + 'initial_condition': str(), + 'test_cases': list() + } + + def visit_test(self, test): + # Get Tags associated to the test + if len(test.tags) == 0 and self.tags_template is not None: + tags = self.tags_template + else: + tags = list(test.tags) + + # Get the Documentation associated to the test + if len(test.doc) == 0 and len(self.documentation_template) != 0: + documentation = self.documentation_template + else: + documentation = test.doc + + # Get the Content-Type and Body associated to the Test + if len(self.args) != 0: + # We are talking about Test Cases with Test Template, so we need to check the keyword content with the + # definition of the template + + # Generate Checks for Test Data + then = self.robot.get_checks(test_name=test.template, apiutils=self.apiutils, name=test.name) + + # Generate Request for Test Data + when = self.robot.get_request(test_name=test.template, name=test.name) + else: + # We are talking about a Test Cases without Test Template + # Generate Checks for Test Data + then = self.robot.get_checks(test_name=test.name, apiutils=self.apiutils, name=test.name) + + # Generate Request for Test Data + when = self.robot.get_request(test_name=test.name, name=test.name) + + test_case = { + 'name': test.name, + 'permutation_tp_id': f'{self.base_TP_id}/{test.name.split(" ")[0]}', + 'doc': documentation, + 'tags': tags, + 'setup': test.setup.name, + 'teardown': test.teardown.name, + 'template': test.template, + 'then': then, + 'when': when + } + + try: + self.test_suite['initial_condition'] = self.initial_conditions[test.setup.name] + string = self.robot.get_substring(initial_string='** Keywords ***', final_string='', include=False) + except KeyError: + self.test_suite['initial_condition'] = self.initial_conditions['Initial State'] + string = self.robot.get_substring(initial_string='** Keywords ***', final_string='', include=False) + + self.test_cases.append(test_case) + + def get_body(self, string: str) -> str: + aux = string.split(' ')[1:] + + if len(aux) >= 2: + aux = [self.get_body(x) for x in aux] + aux = ' '.join(aux) + elif len(aux) == 1: + aux = sub(r'([a-z])([A-Z])', r'\1 \2', aux[0]) + else: + aux = sub(r'([a-z])([A-Z])', r'\1 \2', string) + + return aux + + def generate_name(self): + base_dir = dirname(dirname(dirname(__file__))) + tp_id = str(self.suite.source.parent).replace(f'{base_dir}/', "") + + for key, value in self.identifier.items(): + tp_id = tp_id.replace(key, value) + + self.base_TP_id = tp_id + + name = self.suite.name.replace(" ", "_") + tp_id = f'{self.base_TP_id}/{name}' + + return tp_id + + def generate_reference(self, version): + # Get the list of tags in the different tests + tags = [x.tags for x in self.suite.tests] + tags = [element for sublist in tags for element in sublist if element[0].isdigit()] + + if len(tags) == 0: + # We have different tests cases that call a test template, maybe the Tags are defined in the template + reference, clauses = self.generate_reference_template(version=version) + else: + if len(self.robot.test_template_name) == 0: + # We have normal tests cases + reference, clauses = self.generate_reference_testcases(tags=tags, version=version) + else: + # We have tests cases with information about tags but a template with information about documentation + reference, clauses = self.generate_reference_testcases(tags=tags, version=version) + _, _ = self.generate_reference_template(version=version, need_tags=False) + + return reference, clauses + + def generate_reference_template(self, version, need_tags=True): + # Get the list of arguments, we select the first one because the 2nd keyword corresponds + # to the teardown operation + args = [list(x.keywords)[0] for x in self.suite.tests] + args = [{str(x.parent): list(x.args)} for x in args] + self.args = dict() + _ = [self.args.update(x) for x in args] + + template_name = list(set([list(x.keywords)[0].name for x in self.suite.tests]))[0] + + # Due to the information of the tags are contained in the Keyword description of the template, we need to + # analyse the Keyword. + string = self.robot.get_substring(initial_string='** Keywords ***', final_string='', include=False) + reference, clauses = self.get_info_from_template(name=template_name, + string=string, + version=version, + need_tags=need_tags) + + return reference, clauses + + def get_info_from_template(self, name: str, string: str, version: str, need_tags: bool): + # TODO: Check that the name of the template is in the string receive + # Get the Tags line and the tag value + reference = str() + clauses = list() + + tags = self.get_substring(string=string, key='[Tags]') + self.tags_template = tags[1:] + + if need_tags: + try: + clauses = list(set([element.replace("_", ".") + for sublist in tags for element in tags if element[0].isdigit()])) + clauses.sort() + except IndexError: + raise Exception("ERROR, Probably [Tags] does not include reference to the section in the spec.") + + if len(clauses) == 1: + reference = f'{self.references[version]}, clause {clauses[0]}' + elif len(clauses) > 1: + reference = f'{self.references[version]}, clauses {", ".join(clauses)}' + + # clauses = f'PICS_{tag}' + + # Get the arguments + self.arguments = self.get_substring(string=string, key='[Arguments]') + self.arguments = self.arguments[1:] + + # Get the documentation + self.documentation_template = self.get_substring(string=string, key='[Documentation]') + self.documentation_template = self.documentation_template[1:][0] + + return reference, clauses + + @staticmethod + def get_substring(string: str, key: str): + pos1 = string.find(key) - 1 + pos2 = string[pos1:].find('\n') + result = string[pos1:pos1+pos2].split(' ') + + return result + + def generate_reference_testcases(self, tags: list, version: str): + clauses = [x.replace("_", ".") for x in tags if match(pattern=r'^(\d+_\d+_\d+)|^(\d+_\d+)', string=x)] + clauses = list(set(clauses)) + clauses.sort() + + if len(clauses) == 0: + raise Exception( + f'ERROR: the Test Suite {self.suite.name} has different clauses or no clauses (Tags): {tags}\n' + f'Unable to select the corresponding Reference of this Test Suite') + elif len(clauses) == 1: + reference = f'{self.references[version]}, clause {clauses[0]}' + else: + reference = f'{self.references[version]}, clauses {", ".join(clauses)}' + + return reference, clauses diff --git a/doc/analysis/initial_setup.py b/doc/analysis/initial_setup.py new file mode 100644 index 0000000000000000000000000000000000000000..a23d90777071579155381b304e8d708e01f16c2c --- /dev/null +++ b/doc/analysis/initial_setup.py @@ -0,0 +1,289 @@ +import os +import json + + +class InitialSetup: + def __init__(self): + self.init = { + 'Setup Initial Context Source Registration': InitialSetup.init_csr(), + 'Initialize the Test Case': InitialSetup.init_csr(), + 'Create New Context Source Registration': InitialSetup.init_csr(), + 'Create Initial Context Source Registration': InitialSetup.init_csr(), + 'Initiate Test Case': InitialSetup.init_entity(), + 'Create Initial Entity': InitialSetup.init_entity2(), + 'Setup Initial Entity': InitialSetup.init_entity2(), + 'Initialize Environment': InitialSetup.init_entity2(), + 'Initialize Test': InitialSetup.init_entity2(), + 'Create Temporal Entity': InitialSetup.init_temporal_entity(), + 'Create Initial Temporal Entity': InitialSetup.init_temporal_entity2(), + 'Initialize Test Case': InitialSetup.init_temporal_entity2(), + 'Initialize Setup': InitialSetup.init_temporal_entity2(), + 'Create Id': InitialSetup.init_temporal_entity2(), + 'Create Initial Subscription': InitialSetup.init_subscription(), + 'Setup Initial Subscriptions': InitialSetup.init_subscription(), + 'Setup Initial Entities': InitialSetup.init_entities(), + 'Setup Initial Temporal Entities': InitialSetup.init_temporal_entities(), + 'Create Initial Context Source Registration and Context Source Registration Subscription': + InitialSetup.init_csr_and_sub(), + 'Create Initial Context Source Registrations And Context Source Registration Subscription': + InitialSetup.init_csrs_and_sub(), + 'Setup Initial Context Source Registrations': InitialSetup.init_csrs(), + 'Setup Initial Context Source Registration Subscription': InitialSetup.init_csr_sub(), + 'Setup Initial Context Source Registration Subscriptions': InitialSetup.init_csr_subs(), + 'Create Initial Context Source Registration and Mock Server': InitialSetup.init_csr_and_server(), + } + + self.total_files = -1 + self.files_with_setup = -1 + self.files_without_setup = -1 + + self.code = list() + self.files_with_setup = list() + self.files_without_setup = list() + + self.check_keys() + + @staticmethod + def init_csr() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT contains a Context Source Registration + with id equal to ${context_source_registration_id} + and payload set to ${context_source_registration_payload_file_path} +}''' + + return data + + @staticmethod + def init_entity() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing an initial Entity ${entity} + with an id set to ${entityId} + and an attribute with an id set to ${atrId} +}''' + return data + + @staticmethod + def init_entity2() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing an initial Entity ${entity} + with an id set to ${entityId} +}''' + return data + + @staticmethod + def init_temporal_entity() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing an initial Temporal Entity ${entity} + with an id set to ${temporal_entity_representation_id} + and an attribute with an id set to ${atrId} +}''' + return data + + @staticmethod + def init_temporal_entity2() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing an initial Temporal Entity ${entity} + with an id set to ${temporal_entity_representation_id} +}''' + return data + + @staticmethod + def init_subscription() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing an initial Subscription ${subscription} + with an id set to ${subscription_id} +}''' + return data + + @staticmethod + def init_entities() -> str: + data = '''with { + the SUT being in the "initial state" and + and containing a list of entities +}''' + return data + + @staticmethod + def init_temporal_entities() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing an a list of Temporal Entities +}''' + return data + + @staticmethod + def init_csr_and_sub() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing a Context Source Registration (CSR1) providing latest information about some entities + and the SUT containing a Context Source Registration Subscription (CSRS1) +}''' + return data + + @staticmethod + def init_csrs() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing a list of Context Source Registrations (CSRs) providing latest information about some entities +}''' + return data + + @staticmethod + def init_csrs_and_sub() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing a list of Context Source Registrations (CSRs) providing latest information about some entities + and the SUT containing a Context Source Registration Subscription (CSRS1) +}''' + return data + + @staticmethod + def init_csr_sub() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing a Context Source Registration Subscription (CSRS1) +}''' + return data + + @staticmethod + def init_csr_subs() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing a set of Context Source Registration Subscriptions (CSRSs) +}''' + return data + + @staticmethod + def init_csr_and_server() -> str: + data = '''with { + the SUT containing a Context Source Registration of a context source (CS1) + providing temporal information of two entities of type Building between 2020-08-01T22:07:00Z and 2021-08-01T21:07:00Z + and CS1 containing two temporal entities of type Building and temporal evolution of those entities in the mentioned interval. +}''' + return data + + @staticmethod + def init_csrs_subs() -> str: + data = '''with { + the SUT containing a Context Source Registration of a context source (CS1) + providing temporal information of two entities of type Building between 2020-08-01T22:07:00Z and 2021-08-01T21:07:00Z + and CS1 containing two temporal entities of type Building and temporal evolution of those entities in the mentioned interval. +}''' + return data + + def get_property_values(self, root_folder: str, property_name: str) -> [str, str]: + robot_files_without_setup = list() + robot_files_with_setup = list() + self.total_files = 0 + + for root, dirs, files in os.walk(root_folder): + for file in files: + if file.endswith(".json"): + file_path = os.path.join(root, file) + self.total_files = self.total_files + 1 + + with open(file_path, "r") as f: + try: + data = json.load(f) + value = [x[property_name] for x in data['test_cases']] + + status = all(item == value[0] for item in value) + + if not status: + print(f"{file_path} has different values of setup processes") + else: + value = value[0] + + info = { + 'file': file_path, + 'data': value + } + + if value is None: + robot_files_without_setup.append(file_path) + else: + robot_files_with_setup.append(info) + except (KeyError, json.JSONDecodeError): + # Handle cases where the property is not found or file is not valid JSON + pass + + return robot_files_with_setup, robot_files_without_setup + + def check_keys(self): + self.generate_dictionaries() + + keys = self.init.keys() + + deleted_setup = [item for item in keys if item not in self.code] + not_included_keys = [item for item in self.code if item not in keys] + + print('Checking the Setup functions...') + if len(deleted_setup) != 0: + print(f" WARNING: Some of the Setup functions were deleted:\n{deleted_setup}") + else: + print(f" INFO: All current Setup functions are used in the Robot files") + + if len(not_included_keys) != 0: + print(f" ERROR: Some Setup functions are not include in the Class:\n{not_included_keys}") + else: + print(f" INFO: All the current Setup functions used in Robot files are included in the Class") + + print() + + def generate_dictionaries(self): + folder = "/home/fla/Documents/workspace/bdd/ngsi-ld-test-suite/doc/files" + attribute = "setup" + + self.files_with_setup, self.files_without_setup = self.get_property_values(folder, attribute) + + aux = [x['data'] for x in self.files_with_setup] + self.code = list(set(aux)) + + self.files_with_setup = len(self.code) + self.files_without_setup = len(self.files_without_setup) + + def print_numbers(self): + print("Show details of the Setup functions:") + print(f" Total number of Robot files: {self.total_files}\n" + f" Total number of Robot Files with Setup information: {self.files_with_setup}\n" + f" Total number of Robot Files without Setup information: {self.files_without_setup}") + + print() + + def get_setups(self) -> list: + return self.code + + def get_robot_files_without_setup(self) -> list: + return self.files_without_setup + + def get_initial_condition(self, initial_condition: str) -> str: + try: + if initial_condition is not None: + data = self.init[initial_condition] + else: + data = '''with { + the SUT containing an initial state +}''' + except KeyError: + print(f"ERROR: the initial condition '{initial_condition}' is not defined in the dictionary. " + f"Please check it and add the new initial condition.") + data = '''with { + the SUT containing an initial state +}''' + + return data + + +if __name__ == "__main__": + instance = InitialSetup() + + instance.print_numbers() + + print(instance.get_initial_condition(initial_condition="Setup Initial Context Source Registration")) + print(instance.get_initial_condition(initial_condition="Lorem Ipsum dolor sit")) diff --git a/doc/analysis/parseapiutilsfile.py b/doc/analysis/parseapiutilsfile.py new file mode 100644 index 0000000000000000000000000000000000000000..d1caf3823b6905ec2922e13c470bf351a287c2cc --- /dev/null +++ b/doc/analysis/parseapiutilsfile.py @@ -0,0 +1,141 @@ +import re + + +class ParseApiUtilsFile: + def __init__(self, filename: str): + with open(filename, 'r') as file: + # Read the contents of the file + self.file_contents = file.read() + + self.variables = dict() + + self.get_variables_data() + + def get_response(self, keyword): + verb = str() + url = list() + query_param = False + + string = self.get_substring(initial_string=keyword, final_string='RETURN', include=True) + index = string.find(' ${response}') + string = string[index:] + string = string.split('\n') + + for i, item in enumerate(string): + if 'response' in item: + regex = r"\s{4}\$\{response\}=\s{4}(POST|GET|PUT|PATCH|DELETE).*" + match = re.match(pattern=regex, string=item) + + if match: + verb = match.groups()[0] + elif 'url' in item: + url, query_param = self.get_url_request(url=item) + + return verb, url, query_param + + @staticmethod + def get_url_request(url: str) -> [list, bool]: + # We have two options, the url is defined in the same line of the response, or it is defined in the following + # lines with '...' + keys = list() + parameters = list() + query_param = False + + if 'response' in url: + url = [x for x in url.split(' ') if 'url' in x][0] + + regex = r"\s*\.*\s*url=\$\{url\}\/(.*)" + + match = re.match(pattern=regex, string=url) + if match: + aux = match.groups()[0] + + # We need to extract the url parameters first + if aux.find('?') != -1: + parameters = aux.split('?') + aux = parameters[0] + query_param = True + + keys = re.split(r'[$/]', aux) + keys = [k for k in keys if k != ''] + + if len(parameters) != 0: + keys.append("".join(parameters[1:])) + else: + regex = r"\s*\.*\s*url=\$\{temporal_api_url\}\/(.*)" + + match = re.match(pattern=regex, string=url) + if match: + aux = match.groups()[0] + keys = re.split(r'[$/]', aux) + keys = [k for k in keys if k != ''] + + return keys, query_param + + def get_variables_data(self): + string = self.get_substring(initial_string='*** Variables ***', final_string='*** ', include=False) + + self.get_variables_data_variables(string=string) + self.get_variables_data_dictionaries(string=string) + + def get_variables_data_variables(self, string): + # Get the simple variables from the file + regex = r"^(\$\{.*\})\s*(.*)\n" + + matches = re.finditer(regex, string, re.MULTILINE) + for match in matches: + # Check that we have two groups matched + if len(match.groups()) == 2: + if match.group(1) not in self.variables.keys(): + self.variables[match.group(1)] = match.group(2) + else: + raise Exception("Error, the variable is not following the format ${thing} = ") + + def get_variables_data_dictionaries(self, string): + # Get the dictionary variables from the file + regex = r'(\&\{.*\})' + matches = re.finditer(regex, string, re.MULTILINE) + for match in matches: + # Check that we have two groups matched + if len(match.groups()) == 1: + # We need to find in the string the index to know the next lines from which extract the data + key_dict = match.group(1).replace("&", "$") + + index = string.find(match.group(1)) + aux = string[index:] + index = aux.find('\n') + aux = aux[index:] + index = aux.find('\n${') + aux = aux[:index + 1] + + regex = r'\.{3}[ ]*([a-zA-Z]+)=(.*)\n' + matches2 = re.finditer(regex, aux, re.MULTILINE) + dict_values = dict() + for match2 in matches2: + # Check that we have two groups matched + if len(match2.groups()) == 2: + key = match2.group(1) + value = match2.group(2) + + value_is_variable = re.match(pattern=r'\$\{.*\}', string=value) + if value_is_variable: + value = self.variables[value] + + dict_values[key] = value + + self.variables[key_dict] = dict_values + else: + raise Exception("Error, the variable is not following the format ${thing} = ") + + def get_substring(self, initial_string: str, final_string: str, include: bool) -> str: + index_start = self.file_contents.find(initial_string + '\n') + + if include: + string = self.file_contents[index_start:] + else: + string = self.file_contents[index_start+len(initial_string):] + + index_end = string.find(final_string) + string = string[:index_end] + + return string diff --git a/doc/analysis/parserobotfile.py b/doc/analysis/parserobotfile.py new file mode 100644 index 0000000000000000000000000000000000000000..2d9666b5d565c654a830ba312257a8dd0538cb3b --- /dev/null +++ b/doc/analysis/parserobotfile.py @@ -0,0 +1,524 @@ +import re +import os +from doc.analysis.checks import Checks +from doc.analysis.requests import Requests + + +class ParseRobotFile: + def __init__(self, filename: str, execdir: str, config_file): + self.test_suite = os.path.basename(filename).split('.')[0] + + with open(filename, 'r') as file: + # Read the contents of the file + self.file_contents = file.read() + + self.variables = dict() + self.execdir = execdir + self.resource_files = list() + self.apiutils = list() + + self.string_test_template = str() + self.test_template_name = str() + self.template_params_value = dict() + self.check_template() + + self.get_variables_data() + self.get_apiutils_path() + self.get_test_cases() + + self.config_file = config_file + + def check_template(self): + # Check if there is a template and which template we have + aux = re.findall(pattern=r'Test Template[ ]+(.*)', string=self.file_contents) + + if len(aux) != 0: + self.test_template_name = aux[0] + else: + self.test_template_name = '' + + def set_apiutils(self, apiutils): + self.apiutils = apiutils + + def get_variables_data(self): + string = self.get_substring(initial_string='*** Variables ***\n', final_string='*** ', include=False) + + regex = r"(\$\{.*\})\s*=\s*(.*)\n" + + matches = re.finditer(regex, string, re.MULTILINE) + for match in matches: + # Check that we have two groups matched + if len(match.groups()) == 2: + self.variables[match.group(1)] = match.group(2) + else: + raise Exception("Error, the variable is not following the format ${thing} = ") + + def get_apiutils_path(self): + string = self.get_substring(initial_string='Resource', final_string='*** Variables ***', include=True) + result = [item for item in string.split('\n') if 'ApiUtils' in item and item[0] != '#'] + self.resource_files = [x.replace('${EXECDIR}', self.execdir) for x in result] + + regex = r"\s*Resource\s*(.*)\s*" + result = [re.match(pattern=regex, string=x).group(1) for x in result] + self.resource_files = [x.replace('${EXECDIR}', self.execdir) for x in result] + + # if len(result) >= 1: + # regex = r"\s*Resource\s*(.*)\s*" + # + # matches = re.finditer(regex, result[0], re.MULTILINE) + # for match in matches: + # # Check that we have 1 group matched + # if len(match.groups()) == 1: + # self.resource_file.append(match.group(1)) + # else: + # raise Exception("Error, unexpected format") + # + # self.resource_file = self.resource_file.replace('${EXECDIR}', self.execdir) + + def get_substring(self, initial_string: str, final_string: str, include: bool) -> str: + index_start = self.file_contents.find(initial_string) + + if include: + string = self.file_contents[index_start:] + else: + string = self.file_contents[index_start+len(initial_string):] + + if final_string != '': + index_end = string.find(final_string) + string = string[:index_end] + + return string + + def get_test_cases(self): + if self.test_template_name == '': + self.get_test_cases_without_template() + else: + self.get_test_cases_with_template() + + def get_test_cases_with_template(self): + # In case of template, we have to get the value of the tags and the parameters value from the Test Cases and + # the content of the operations from the corresponding Keyword content corresponding to the Test Template + index_start_test_cases = self.file_contents.find('*** Test Cases ***') + index_start_keywords = self.file_contents.find('*** Keywords ***') + + string_test_cases = self.file_contents[index_start_test_cases+len('*** Test Cases ***')+1:index_start_keywords] + self.string_test_template = self.file_contents[index_start_keywords+len('*** Keywords ***')+1:] + self.get_template_content(string=self.string_test_template) + + self.get_test_cases_content(string=string_test_cases) + self.get_template_param_values(test_cases=string_test_cases) + + def get_template_content(self, string: str): + matches = re.findall(pattern=r'^(([a-zA-z0-9\-\/]+[ ]*)+)$', string=string, flags=re.MULTILINE) + + indexes = list() + for match in matches: + indexes.append(string.rfind(match[0])) + + subdata = list() + for i in range(0, len(indexes) - 1): + subdata.append(string[indexes[i]:indexes[i + 1]]) + + index = indexes[len(indexes) - 1] + subdata.append(string[index:]) + + self.string_test_template = [x for x in subdata if self.test_template_name in x][0] + + def get_template_param_values(self, test_cases): + # Extract the parameter of the Test Cases + # the first line is the argument of the test case + params = test_cases.split("\n")[0].strip().split(" ") + params = [x.lower() for x in params] + + # Obtain the params values + keys = self.test_cases.keys() + data = self.test_cases + + for k in keys: + aux = data[k] + aux = aux.split('\n')[1:] + aux = [x.strip() for x in aux if x.find("[Tags]") == -1][0] + aux = aux.split(" ") + + result = [{f"${{{k}}}": v} for k, v in zip(params, aux)] + result = {k: v for d in result for k, v in d.items()} + + self.template_params_value[k] = result + + def get_test_cases_content(self, string): + pattern = f'{self.test_suite}_\d+[ ]+.*' + matches = re.findall(pattern=pattern, string=string) + + indexes = list() + self.test_case_names = list() + if matches: + for match in matches: + name = match.strip() + self.test_case_names.append(name) + indexes.append(string.find(name)) + else: + # The test case has the same id. number as the test suite + pattern = f'{self.test_suite}\s.*' + matches = re.findall(pattern=pattern, string=string) + + for match in matches: + name = match.strip() + self.test_case_names.append(name) + indexes.append(string.find(name)) + + self.test_cases = dict() + for i in range(0, len(indexes)-1): + self.test_cases[self.test_case_names[i]] = string[indexes[i]:indexes[i+1]] + + try: + self.test_cases[self.test_case_names[-1]] = string[indexes[-1]:] + except IndexError: + raise Exception(f"ERROR, List index out of range, " + f"probably the name of the Test Case is not following the pattern '{pattern}'") + + def get_test_cases_without_template(self): + index_start_test_cases = self.file_contents.find('*** Test Cases ***') + index_start_keywords = self.file_contents.find('*** Keywords ***') + + string_test_cases = self.file_contents[index_start_test_cases+len('*** Test Cases ***')+1:index_start_keywords] + + self.get_test_cases_content(string=string_test_cases) + + def get_text_cases_content(self, name: str): + if self.test_template_name == '': + result = self.test_cases[name] + else: + result = self.string_test_template + + return result + + def get_checks(self, test_name, apiutils, name): + data = Checks() + self.test_name = test_name + self.test_case_name = name + + # test_content = self.test_cases[test_name] + test_content = self.get_text_cases_content(name=test_name) + + # Get The lines starting by 'Check' + checks = list() + param = dict() + lines_starting_with_check = self.get_lines_with_checks(content=test_content) + for line in lines_starting_with_check: + check, param, attributes = self.get_data_check(test_case=test_content, checks=data, line=line) + operation = self.get_operation_of_the_check(test_content=test_content, param=attributes) + result = data.get_checks(checks=check, **param) + + content = { + 'operation': operation, + 'checks': result + } + + checks.append(content) + + result = self.generate_then_content(content=checks) + + return result + + def get_operation_of_the_check(self, test_content: str, param: dict) -> str: + if param == 'Notification': + operation = param + else: + values = [x for x in param if x.find('${') != -1] + values = [f"{x.split('.')[0]}}}" if x.find(".") != -1 else x for x in values] + + values = [x for x in values if x.find('response') != -1] + + if len(values) != 0: + # We need to find the operation of the response + index = [test_content.find(x) for x in values] + index = [x for x in index if x != -1][0] + + substring = test_content[index:] + end_line = substring.find('\n') + substring = substring[0:end_line] + + operation = substring.split(' ')[1] + else: + # We have a notification operation + operation = 'Notification' + + return operation + + def get_lines_with_checks(self, content): + new_list = list() + + # Obtain the complete list of lines that contains a Check + lines_starting_with_check = re.findall(r'^\s*Check.*', content, re.MULTILINE) + + if len(lines_starting_with_check) != 0: + # TODO: From the list of Checks, we need to discard all 'Check Response Status Code' except the last one. Should be resolve when clearly defined the Setup process of the Test Suite + # check_string = 'Check Response Status Code' + # lines_starting_with_check = [x.strip() for x in lines_starting_with_check] + # new_list = [value for value in lines_starting_with_check if not value.startswith(check_string)] + # abb_values = [value for value in lines_starting_with_check if value.startswith(check_string)] + + # if abb_values: + # new_list.append(abb_values[-1]) + new_list = [x.strip() for x in lines_starting_with_check] + elif content.find('Wait for notification') != 0: + # There is no Check, we need to check if there is a 'Wait for notification', + # then we need to check the 'Should be Equal' sentences + pattern = r'(Wait for no notification)|(Wait for notification and validate it)|(Wait for notification)([ ]{4}(.*))?' + param = re.findall(pattern=pattern, string=content, flags=re.MULTILINE) + for i in range(0, len(param)): + data = tuple(element for element in param[i] if element != '') + + match data[0]: + case 'Wait for notification and validate it': + new_list.append(f'Wait for notification and validate it') + case 'Wait for no notification': + new_list.append(f'Wait for no notification') + case 'Wait for notification': + last_index = len(data) - 1 + timeout = data[last_index] + + if timeout != '': + new_list.append(f'Wait for notification {timeout}') + else: + new_list.append(f'Wait for notification 5') + case _: + raise Exception(f"Unexpected Wait for notification check: '{param[i][0]}'") + + lines_starting_with_should = re.findall(r'^\s*Should be Equal.*', content, re.MULTILINE) + _ = [new_list.append(x.strip()) for x in lines_starting_with_should] + + lines_starting_with_should = re.findall(r'^\s*Dictionary Should Contain Key.*', content, re.MULTILINE) + _ = [new_list.append(x.strip()) for x in lines_starting_with_should] + + lines_starting_with_should = re.findall(r'^\s*Should Not Be Empty.*', content, re.MULTILINE) + _ = [new_list.append(x.strip()) for x in lines_starting_with_should] + + lines_starting_with_should = re.findall(r'^\s*Should be True.*', content, re.MULTILINE) + _ = [new_list.append(x.strip()) for x in lines_starting_with_should] + + return new_list + + def get_request(self, test_name, name): + flattened_list_variables = {k: v for d in self.apiutils for k, v in d.variables.items()} + data = Requests(variables=self.variables, + apiutils_variables=flattened_list_variables, + config_file=self.config_file, + template_params_value=self.template_params_value, + test_name=test_name, + name=name) + + if self.test_template_name == '': + description = data.get_description(string=self.test_cases[test_name]) + else: + description = data.get_description(string=self.string_test_template) + + return description + + def generate_then_content(self, content): + # Need to check if it is a Notification data or a normal Response + aux = [x for x in content if x['checks'].find('Notification data') != -1 or x['checks'].find('After waiting') != -1 or x['checks'].find('Notification and validate') != -1] + + if len(aux) == 0: + # The SUT sends a valid Response + checks = [f"{x['operation']} with {x['checks']}" for x in content] + checks = [x.replace(" ", " ") for x in checks] + if len(content) > 1: + checks = " and\n ".join(checks) + checks = f"then {{\n the SUT sends a valid Response for the operations:\n {checks}\n}}" + elif len(content) == 1: + checks = f"then {{\n the SUT sends a valid Response for the operation:\n {checks[0]}\n}}" + else: + raise Exception("ERROR, It is expected at least 1 Check operation in the Test Case") + else: + # The Client receives a valid Notification + checks = [f"{x['operation']} received {x['checks']}" for x in content] + if len(checks) > 1: + checks = " and\n ".join(checks) + checks = (f"then {{\n the client at '${{endpoint}}' receives a valid Notification containing:\n" + f" {checks}\n}}") + elif len(content) == 1: + checks = checks[0] + checks = (f"then {{\n the client at '${{endpoint}}' receives a valid Notification containing:\n" + f" {checks}\n}}") + # if content[0]['checks'].find('Waiting for no Notification') != -1: + # # Waiting for no notification data + # print("Error, need to control the generation of then message") + # exit(-1) + # match = re.match(pattern=r"[\W\w]+'(\d+)'", string=content[0]) + # try: + # checks = f"then {{\n the SUT will not send a CsourceNotification after {match.group(1)} seconds}}" + # except Exception: + # raise Exception(f"ERROR: unexpected timeout parameter: '{content[0]}'") + # else: + # print("Error, need to control the generation of then message") + # exit(-1) + # checks = (f"then {{\n the client at '${{endpoint}}' receives a valid Notification, {content[0]}\n}}") + else: + raise Exception("ERROR, It is expected at least 1 Notification Check operation in the Test Case") + + return checks + + def generate_when_content(self, http_verb, endpoint, when): + if when.find("a subscription with id set to") == -1: + url = f"URL set to '/ngsi-ld/v1/{endpoint}'" + method = f"method set to '{http_verb}'" + when = (f"when {{\n the SUT receives a Request from the client containing:\n" + f" {url}\n" + f" {method}\n" + f" {when}\n" + f"}}") + else: + # This is a Notification operation + when = f"The client at ${{endpoint}} receives a valid Notification containing {when}" + return when + + def get_data_check(self, test_case, checks, line): + content = line.split(" ") + + # Discard lines that are comments + # content = [x for x in content if x.strip()[0] != '#'] + aux = len(content) + + try: + position_params = checks.args[content[0]] + if aux == 1: + # We are in multiline classification of the Check, need to extract the parameter for the next lines + params, attributes = self.find_attributes_next_line(test_case=test_case, name=content[0], + position_params=position_params) + return content[0], params, attributes + elif aux > 1: + # We are in one line definition + params = self.find_attributes_same_line(params=position_params, content=content[1:]) + + if content[0] == 'Wait for notification' or content[0] == 'Should be Equal': + attributes = 'Notification' + else: + attributes = content[1:] + + return content[0], params, attributes + else: + raise Exception("ERROR, line should contain data") + except KeyError: + # The Check operation does not require parameters + return content[0], dict(), list() + + def find_attributes_same_line(self, params, content): + result = dict() + + if len(params['position']) > 0: + for i in range(0, len(params['position'])): + param_key = params['params'][i] + param_position = params['position'][i] + param_value = self.get_param_value(position=content[param_position]) + result[param_key] = param_value + elif len(params['position']) == 0: + for i in range(0, len(params['params'])): + param_key = params['params'][i] + param_value = self.get_param_value_for_waiting(param_key=param_key, content=content) + + if param_value is not None: + result[param_key] = param_value + + return result + + def get_param_value_for_waiting(self, param_key, content): + found = [x for x in content if x.find(param_key) != -1] + length = len(found) + + if length != 0: + found = found[0] + + if found.find('=') != -1: + # in the format variable=${value} + # pattern = f"{param_key}=\${{(\d+)}}" + pattern = f"{param_key}=\${{([\w\W]+)}}|{param_key}=([\w\W]+)" + else: + pattern = f"\${{([\w\W]+)}}|([\w\W]+)" + + # elif length == 0 and len(content) > 1: + # # There is params but they are not written in the form key=value + # found = content[1] + # # pattern = f"\${{(\d+)}}" + # pattern = f"\${{([\w\W]+)}}|([\w\W]+)" + else: + pattern = '' + found = '' + return + + value = re.match(pattern=pattern, string=found) + + try: + aux = value.group(2) + if aux is None: + aux = value.group(1) + value = aux + except AttributeError: + value = '' + + return value + + def find_attributes_next_line(self, test_case, name, position_params): + index_start = test_case.find(name) + + aux = test_case[index_start+len(name)+1:].split('\n') + + params = list() + attributes = list() + for a in range(0, len(aux)): + param = aux[a] + # if param.startswith(" ..."): + # data = param.split(' ')[-1] + # params.append(data) + # if data.find('=') != -1: + # data = data.split('=')[-1] + # + # attributes.append(data) + # else: + # break + + regex = '(\s{4})*\s{4}\.{3}\s{4}(.*)' + data = re.match(pattern=regex, string=param) + if data: + data = data.groups()[-1] + params.append(data) + + if data.find('=') != -1: + data = data.split('=')[-1] + + attributes.append(data) + else: + break + + param = self.find_attributes_same_line(params=position_params, content=params) + return param, attributes + + def get_param_value(self, position): + try: + # Check if we can get the data from the current robot files + result = self.variables[position] + except KeyError: + try: + # Check if we can get the data from the apiutils file + # TODO: this operation is calculated every time that wanted to calculate this operation + flattened_list = {k: v for d in self.apiutils for k, v in d.variables.items()} + result = flattened_list[position] + except KeyError: + try: + aux = re.findall(pattern=r'\$\{(.*)}', string=position) + if len(aux) != 0: + aux = aux[0] + else: + aux = position + result = self.config_file.get_variable(aux) + except KeyError: + try: + aux = self.template_params_value[self.test_case_name] + result = aux[position] + + if result[:2] == "${": + result = self.get_param_value(result) + except KeyError: + result = position + + return result diff --git a/doc/analysis/parsevariablesfile.py b/doc/analysis/parsevariablesfile.py new file mode 100644 index 0000000000000000000000000000000000000000..a7cbb1a61fdfafb1692c47db681218d8530ac52f --- /dev/null +++ b/doc/analysis/parsevariablesfile.py @@ -0,0 +1,31 @@ +from os.path import dirname + + +class ParseVariablesFile: + def __init__(self): + folder = dirname(dirname(dirname(__file__))) + filename = f'{folder}/resources/variables.py' + self.variables = dict() + + with open(filename, 'r') as file: + # Read the contents of the file + file_content = file.read() + + # Generate a list of lines from the file content + file_content = file_content.split('\n') + + # Dismiss the blank lines and the lines starting with # -> comments + file_content = [x for x in file_content if x != '' and x[0] != '#'] + + # Extract the key = value format of the variables + file_content = [x.split('=') for x in file_content if x != ''] + + # Delete the ' characters from the keys and delete blank spaces + self.variables = {x[0].strip(): x[1].replace("'", "").strip() for x in file_content} + + def get_variable(self, variable: str) -> str: + # We request the variable in the form '${...}' + variable = variable.strip('${}') + value = self.variables[variable] + + return value diff --git a/doc/analysis/requests.py b/doc/analysis/requests.py new file mode 100644 index 0000000000000000000000000000000000000000..612d9a58e1a30c380b87bd3054a680934db8afe5 --- /dev/null +++ b/doc/analysis/requests.py @@ -0,0 +1,1570 @@ +import re + + +class Requests: + def __init__(self, variables, apiutils_variables, config_file, template_params_value, test_name, name): + self.op = { + 'Create Entity Selecting Content Type': { + 'positions': [0, 2], + 'params': ['filename', 'content_type'] + }, + 'Create Subscription': { + 'positions': [1, 2], + 'params': ['filename', 'content_type'] + }, + 'Create Or Update Temporal Representation Of Entity Selecting Content Type': { + 'positions': [], + 'params': ['temporal_entity_representation_id', 'filename', 'content_type', 'accept'] + }, + 'Create Entity From File': { + 'positions': [0], + 'params': ['filename'] + }, + 'Batch Create Entities': { + 'positions': [1], + 'params': ['content_type'] + }, + 'Create Context Source Registration With Return': { + 'positions': [0], + 'params': ['filename'] + }, + 'Query Entity': { + 'positions': [], + 'params': ['id', 'accept', 'attrs', 'context', 'geoproperty', 'options'] + }, + 'Retrieve Subscription': { + 'positions': [], + 'params': ['id', 'accept', 'context', 'content_type'] + }, + 'Query Context Source Registrations With Return': { + 'positions': [0, 1], + 'params': ["type", "accept"] + }, + 'Query Temporal Representation Of Entities With Return': { + 'positions': [], + 'params': [] + }, + 'Partial Update Entity Attributes': { + 'positions': [], + 'params': ['entityId', 'attributeId', 'fragment_filename', 'content_type', 'accept', 'context'] + }, + 'Update Subscription': { + 'positions': [1, 2, 3], + 'params': ['filename', 'content', 'context'] + + }, + 'Query Context Source Registration Subscriptions': { + 'positions': [], + 'params': ['context', 'limit', 'page', 'accept'] + }, + 'Query Temporal Representation Of Entities': { + 'positions': [], + 'params': ['context', 'entity_types', 'entity_ids', 'entity_id_pattern', + 'ngsild_query', 'csf', 'georel', 'geometry', + 'coordinates', 'geoproperty', 'timerel', 'timeAt', + 'attrs', 'limit', 'lastN', 'accept', 'options'] + }, + 'Query Temporal Representation Of Entities Via Post': { + 'positions': [], + 'params': ['query_file_name', 'content_type', 'context'] + }, + 'Retrieve Attribute': { + 'positions': [0], + 'params': ['attribute_name'] + }, + 'Retrieve Entity Type': { + 'positions': [0, 1], + 'params': ['type', 'context'] + }, + 'Retrieve Entity by Id': { + 'positions': [], + 'params': ['id', 'accept', 'context'] + }, + 'Query Entities': { + 'positions': [], + 'params': ['entity_ids', 'entity_types', 'accept', + 'attrs', 'context', 'geoproperty', + 'options', 'limit', 'entity_id_pattern', + 'georel', 'coordinates', 'geometry', 'count', 'q'] + }, + 'Query Entities Via POST': { + 'positions': [], + 'params': ['entity_ids', 'entity_type', 'content_type', 'accept', + 'context', 'attrs', 'entity_id_pattern', 'geometry_property'] + }, + 'Retrieve Temporal Representation Of Entity': { + 'positions': [], + 'params': ['temporal_entity_representation_id', 'attrs', 'options', + 'context', 'timerel', 'timeAt', + 'endTimeAt', 'lastN', 'accept'] + }, + 'Delete Entity by Id': { + 'positions': [0], + 'params': ['id'] + }, + 'Append Entity Attributes': { + 'positions': [0, 1, 2], + 'params': ['id', 'fragment_filename', 'content_type'] + }, + 'Update Entity Attributes': { + 'positions': [0, 1, 2], + 'params': ['id', 'fragment_filename', 'content_type'] + }, + 'Delete Temporal Representation Of Entity With Returning Response': { + 'positions': [0], + 'params': ['id'] + }, + 'Append Attribute To Temporal Entity': { + 'positions': [0, 1, 2], + 'params': ['id', 'fragment_filename', 'content_type'] + }, + 'Delete Subscription': { + 'positions': [0], + 'params': ['id'] + }, + 'Query Subscriptions': { + 'positions': [], + 'params': ['context', 'limit', 'offset', 'accept'] + }, + 'Retrieve Context Source Registration Subscription': { + 'positions': [], + 'params': ['subscription_id', 'context', 'accept'] + }, + 'Retrieve Context Source Registration': { + 'positions': [], + 'params': ['context_source_registration_id', 'context', 'accept'] + }, + 'Delete Context Source Registration With Return': { + 'positions': [0], + 'params': ['id'] + }, + 'Query Context Source Registrations': { + 'positions': [], + 'params': ['context', 'id', 'type', 'idPattern', 'attrs', + 'q', 'csf', 'georel', 'geometry', + 'coordinates', 'geoproperty', 'timeproperty', 'timerel', + 'timeAt', 'limit', 'offset', 'accept'] + }, + 'Update Context Source Registration With Return': { + 'positions': [0, 1, 2], + 'params': ['id', 'filename', 'content'] + }, + 'Retrieve context source registration subscription': { + 'positions': [0], + 'params': ['id'] + }, + 'Create Context Source Registration Subscription': { + 'positions': [0], + 'params': ['filename'] + }, + 'Create Context Source Registration': { + 'positions': [0], + 'params': ['context_source_registration_payload'] + }, + 'Delete Context Source Registration Subscription': { + 'positions': [0], + 'params': ['id'] + }, + 'Update Context Source Registration Subscription': { + 'positions': [0, 1], + 'params': ['subscription_id', 'subscription_update_fragment'] + }, + 'Update Context Source Registration': { + 'positions': [0, 1], + 'params': ['context_source_registration_id', 'update_fragment'] + }, + 'Update Context Source Registration From File': { + 'positions': [0, 1], + 'params': ['context_source_registration_id', 'filename'] + }, + 'Update Context Source Registration Subscription From File': { + 'positions': [0, 1], + 'params': ['subscription_id', 'subscription_update_fragment'] + }, + 'Retrieve Attributes': { + 'positions': [], + 'params': ['context', 'details', 'accept'] + }, + 'Retrieve Entity Types': { + 'positions': [], + 'params': ['context', 'details', 'accept'] + }, + 'Batch Request Entities From File': { + 'positions': [0, 1], + 'params': ['operation', 'filename'] + }, + 'Batch Delete Entities': { + 'positions': [], + 'params': ['entities_ids_to_be_deleted', 'teardown'] + }, + 'Batch Update Entities': { + 'positions': [0], + 'params': ['entities', 'overwrite_option'] + }, + 'Batch Upsert Entities': { + 'positions': [], + 'params': ['entities_to_be_upserted', 'update_option'] + }, + 'Request Entity From File': { + 'positions': [0], + 'params': ['filename'] + }, + 'Delete Entity Attributes': { + 'positions': [], + 'params': ['entityId', 'attributeId', 'datasetId', 'deleteAll', 'context'] + }, + 'Create Temporal Representation Of Entity Selecting Content Type': { + 'positions': [0, 1], + 'params': ['filename', 'content_type'] + }, + 'Delete Attribute From Temporal Entity': { + 'positions': [], + 'params': ['entityId', 'attributeId', 'content_type', 'datasetId', 'deleteAll', 'context'] + }, + 'Delete Attribute Instance From Temporal Entity': { + 'positions': [0, 1, 2, 3, 4], + 'params': ['temporal_entity_id', 'attributeId', 'instanceId', 'content_type', 'context'] + }, + 'Modify Attribute Instance From Temporal Entity': { + 'positions': [0, 1, 2, 3, 4], + 'params': ['temporal_entity_id', 'attributeId', 'instanceId', 'fragment_filename', 'content_type', 'context'] + }, + 'Create Subscription From File': { + 'positions': [0], + 'params': ['filename'] + }, + 'Wait for notification': { + 'positions': [0], + 'params': ['timeout'] + }, + 'Append Entity Attributes With Parameters': { + 'positions': [0, 1, 2, 3], + 'params': ['id', 'fragment_filename', 'content_type', 'options'] + }, + 'Setup Initial Subscriptions': { + 'positions': [], + 'params': [] + } + } + + self.description = { + 'Create Entity Selecting Content Type': + Requests.create_entity_selecting_content_type, + 'Create Subscription': + Requests.create_entity_selecting_content_type, + 'Create Entity From File': + Requests.create_entity_from_file, + 'Create Or Update Temporal Representation Of Entity Selecting Content Type': + Requests.create_or_update_temporal_representation_of_entity_selecting_content_type, + 'Batch Create Entities': + Requests.batch_create_entities, + 'Create Context Source Registration With Return': + Requests.create_context_source_registration_with_return, + 'Query Entity': + Requests.query_entity, + 'Retrieve Subscription': + Requests.retrieve_subscription, + 'Query Context Source Registrations With Return': + Requests.query_context_source_registrations_with_return, + 'Query Temporal Representation Of Entities With Return': + Requests.query_temporal_representation_of_entities_with_return, + 'Partial Update Entity Attributes': + Requests.partial_update_entity_attributes, + 'Update Subscription': + Requests.update_subscription, + 'Query Context Source Registration Subscriptions': + Requests.query_context_source_registration_subscriptions, + 'Query Temporal Representation Of Entities': + Requests.query_temporal_representation_of_entities, + 'Append Entity Attributes With Parameters': + Requests.append_entity_attributes_with_parameters, + 'Retrieve Attribute': + Requests.retrieve_attribute, + 'Retrieve Entity Type': + Requests.retrieve_entity_type, + 'Retrieve Entity by Id': + Requests.retrieve_entity_by_id, + 'Query Entities': + Requests.query_entities, + 'Delete Entity by Id': + Requests.delete_entity_by_id, + 'Append Entity Attributes': + Requests.append_entity_attributes, + 'Update Entity Attributes': + Requests.update_entity_attributes, + 'Retrieve Temporal Representation Of Entity': + Requests.retrieve_temporal_representation_of_entity, + 'Delete Temporal Representation Of Entity With Returning Response': + Requests.delete_temporal_representation_of_entity_with_returning_response, + 'Append Attribute To Temporal Entity': + Requests.append_attribute_to_temporal_entity, + 'Delete Subscription': + Requests.delete_subscription, + 'Query Subscriptions': + Requests.query_subscriptions, + 'Retrieve Context Source Registration Subscription': + Requests.retrieve_context_source_registration_subscription, + 'Retrieve Context Source Registration': + Requests.retrieve_context_source_registration, + 'Delete Context Source Registration With Return': + Requests.delete_context_source_registration_with_return, + 'Query Context Source Registrations': + Requests.query_context_source_registrations, + 'Update Context Source Registration With Return': + Requests.update_context_source_registration_with_return, + 'Update Context Source Registration': + Requests.update_context_source_registration, + 'Update Context Source Registration From File': + Requests.update_context_source_registration_from_file, + 'Retrieve context source registration subscription': + Requests.retrieve_context_source_registration_subscription_2, + 'Create Context Source Registration Subscription': + Requests.create_context_source_registration_subscription, + 'Delete Context Source Registration Subscription': + Requests.delete_context_source_registration_subscription, + 'Update Context Source Registration Subscription': + Requests.update_context_source_registration_subscription, + 'Update Context Source Registration Subscription From File': + Requests.update_context_source_registration_subscription_from_file, + 'Retrieve Attributes': + Requests.retrieve_attributes, + 'Retrieve Entity Types': + Requests.retrieve_entity_types, + 'Batch Request Entities From File': + Requests.batch_request_entities_from_file, + 'Batch Delete Entities': + Requests.batch_delete_entities, + 'Batch Update Entities': + Requests.batch_update_entities, + 'Batch Upsert Entities': + Requests.batch_upsert_entities, + 'Request Entity From File': + Requests.request_entity_from_file, + 'Delete Entity Attributes': + Requests.delete_entity_attributes, + 'Create Temporal Representation Of Entity Selecting Content Type': + Requests.create_temporal_representation_of_entity_selecting_content_type, + 'Delete Attribute From Temporal Entity': + Requests.delete_attribute_from_temporal_entity, + 'Delete Attribute Instance From Temporal Entity': + Requests.delete_attribute_instance_from_temporal_entity, + 'Modify Attribute Instance From Temporal Entity': + Requests.modify_attribute_instance_from_temporal_entity, + 'Create Subscription From File': + Requests.create_subscription_from_file, + 'Wait for notification': + Requests.wait_for_notification, + 'Create Context Source Registration': + Requests.create_context_source_registration, + 'Query Entities Via POST': + Requests.query_entities_via_post, + 'Query Temporal Representation Of Entities Via Post': + Requests.query_temporal_representation_of_entities_via_post, + 'Setup Initial Subscriptions': + Requests.setup_initial_subscriptions + } + + self.variables = variables + self.apiutils_variables = apiutils_variables + self.config_file = config_file + self.template_params_value = template_params_value + self.test_name = test_name + self.name = name + + def get_description(self, string): + keys = self.op.keys() + params = dict() + + # New version + #lines_starting_response = re.findall(r'^\s*\$\{response\}.*|^\s*\$\{notification\}.*', string, re.MULTILINE) + lines_starting_response = re.findall(r'^\s*\$\{response\}.*', string, re.MULTILINE) + + # If there is more than one line, it means that the test case has several operations, all of them to + # create the environment content to execute the last one, which is the correct one to test the Test Case + if len(lines_starting_response) > 1: + # The last one corresponds to the execution of the test, the rest corresponds to the initial condition of + # test case... + response_to_check = lines_starting_response[-1] + else: + response_to_check = lines_starting_response[0] + + index = string.find(response_to_check) + aux = string[index:].split('\n') + aux = [x for x in aux if x != ''] + + params = list() + request = str() + + # Get the list of params of the function, they are the keys + if len(aux) == 1 or (len(aux) > 1 and ' ... ' not in aux[1]): + # the attributes are in the same line + regex = r"\s*\$\{response\}=\s{4}(.*)" + matches = re.finditer(regex, response_to_check, re.MULTILINE) + request = aux[0].split(' ')[2] + + # We have two options from here, or the parameters are defined in the same line or the parameters are defined in + # following lines, next lines + for match in matches: + # Check that we have 1 group matched + if len(match.groups()) == 1: + aux = match.group(1) + + # Get the list of keys + params = aux.split(' ')[1:] + else: + raise Exception(f"Error, unexpected format, received: '{response_to_check}'") + + params = self.find_attributes_in_the_same_line(request_name=request, params=params) + elif ' ... ' in aux[1]: + request = aux[0].split(' ') + request = [x for x in request if x != ''][1] + # We are in the case that the attributes are in following lines + for i in range(1, len(aux)): + if ' ... ' in aux[i]: + regex = '(\s{4})*\s{4}\.{3}\s{4}(.*)' + param = re.match(pattern=regex, string=aux[i]) + if aux: + params.append(param.groups()[1]) + else: + break + + params = self.find_attributes_in_the_same_line(request_name=request, params=params) + + params = self.change_param_value(params) + + # Need to check if the key of the params is a variable (Cases 037_01, 037_03, 037_10) + params = self.resolve_variable_key_in_params(params) + + description = self.description[request](params) + return description + + def resolve_variable_key_in_params(self, params: dict) -> dict: + new_dict = dict() + + for old_key, value in params.items(): + if '${' in old_key: + new_key = self.change_param_value_iter(value=old_key) + new_dict[new_key] = value + else: + new_dict[old_key] = value + + return new_dict + + def find_attributes_in_the_same_line(self, request_name, params): + param = dict() + if len(self.op[request_name]['positions']) == 0: + # We do not know the position of the different parameters and the order in which they are received, + # therefore in these cases all the parameters have identified the corresponding name + # param = {x.split('=')[0]: self.get_value_simple(x.split('=')[1]) for x in params} + for i in range(0, len(params)): + x = params[i] + if x.find('=') != -1: + aux = x.split('=') + key = aux[0] + value = self.get_value_simple(aux[1]) + + param[key] = value + else: + key = self.op[request_name]['params'][i] + param[key] = x + else: + for i in range(0, len(self.op[request_name]['positions'])): + param_position = self.op[request_name]['positions'][i] + param_key = self.op[request_name]['params'][i] + param_value = self.get_value(params=params, param_position=param_position, param_key=param_key) + param[param_key] = param_value + + return param + + def find_attributes_next_lines(self, string, position, request_name): + aux = string[position+len(request_name)+1:].split('\n') + + params = list() + for a in range(0, len(aux)): + param = aux[a] + if param.startswith(" ..."): + params.append(param.split(' ')[-1]) + else: + break + + param = dict() + for i in range(0, len(self.op[request_name]['positions'])): + param_position = self.op[request_name]['positions'][i] - 1 + param_key = self.op[request_name]['params'][i] + param_value = self.get_value(params=params, param_position=param_position, param_key=param_key) + param[param_key] = param_value + + return param + + def change_param_value_iter(self, value): + try: + # Check if we can get the data from the current robot files + result = self.variables[value] + except KeyError: + try: + # Check if we can get the data from the apiutils file + result = self.apiutils_variables[value] + except KeyError: + try: + aux = re.findall(pattern=r'\$\{(.*)}', string=value) + if len(aux) != 0: + aux = aux[0] + else: + aux = value + result = self.config_file.get_variable(aux) + except KeyError: + try: + # aux = self.template_params_value[self.test_name] + aux = self.template_params_value[self.name] + result = aux[value] + + if result[:2] == "${": + result = self.change_param_value_iter(result) + except KeyError: + result = value + + return result + + def change_param_value(self, position): + for k, v in position.items(): + position[k] = self.change_param_value_iter(value=v) + + return position + + @staticmethod + def create_entity_selecting_content_type(kwargs) -> str: + if 'filename' in kwargs and 'content_type' in kwargs: + result = (f"Request Header['Content-Type'] set to '{kwargs['content_type']}' and\n " + f"payload defined in file: '{kwargs['filename']}'") + return result + else: + raise Exception(f"ERROR, expected filename and content_type attributes, but received {kwargs}") + + @staticmethod + def append_entity_attributes_with_parameters(kwargs) -> str: + expected_parameters = ['id', 'fragment_filename', 'content_type', 'options'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Append entity attributes with parameters:" + for key, value in kwargs.items(): + match key: + case 'id': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'fragment_filename': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case 'options': + response = f"{response} and\n Query Parameter: {key} set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def create_entity_from_file(kwargs) -> str: + if 'filename' in kwargs: + result = (f"Request creation of an entity from filename '{kwargs['filename']}'" + f" and Content-Type set to 'application/ld+json'") + return result + else: + raise Exception(f"ERROR, expected filename attribute, but received {kwargs}") + + @staticmethod + def batch_update_entities(kwargs) -> str: + if 'overwrite_option' not in kwargs: + kwargs['overwrite_option'] = '${EMPTY}' + + if 'entities' in kwargs: + result = (f"Request batch update operation over entity from filename '{kwargs['entities']}' " + f"with overwrite_option set to '{kwargs['overwrite_option']}' " + f"and Content-Type set to 'application/ld+json'") + return result + else: + raise Exception(f"ERROR, expected filename attribute, but received {kwargs}") + + @staticmethod + def batch_upsert_entities(kwargs) -> str: + if 'update_option' not in kwargs: + kwargs['update_option'] = 'replace' + + if 'entities_to_be_upserted' in kwargs: + result = (f"Request batch upsert operation over entity from filename '{kwargs['entities_to_be_upserted']}' " + f"with update_option set to '{kwargs['update_option']}' " + f"and Content-Type set to 'application/ld+json'") + return result + else: + raise Exception(f"ERROR, expected filename attribute, but received {kwargs}") + + def create_context_source_registration(kwargs) -> str: + if 'context_source_registration_payload' in kwargs: + result = (f"Create Context Source Registration Request with Content-Type set to 'application/ld+json' " + f"and payload set to '{kwargs['context_source_registration_payload']}'") + return result + else: + raise Exception(f"ERROR, expected filename and content_type attributes, but received {kwargs}") + + @staticmethod + def wait_for_notification(kwargs) -> str: + if 'timeout' in kwargs: + result = f"Waiting for notification with timeout set to '{kwargs['timeout']}'" + return result + else: + raise Exception(f"ERROR, expected filename and content_type attributes, but received {kwargs}") + + @staticmethod + def setup_initial_subscriptions(kwargs) -> str: + result = """a subscription with id set to ${subscriptionId} + and status equals 'active' + and timeInterval is set to '${timeInterval}' + and watchedAttributes is 'Empty' + and q is 'Empty' + and geoQ is 'Empty' + and with subscription.entity with type 'Building' + and notification.endpoint.accept is 'application/json' + + When the timeinterval is reached at ${timeInterval} seconds + the SUT needs to send out a notification to the client + sends a notification to the client every ${timeInterval} seconds""" + + return result + + @staticmethod + def create_subscription_from_file(kwargs) -> str: + if 'filename' in kwargs: + result = (f"Create Subscription Request with Header['Content-Type'] set to 'application/ld+json' and\n " + f"payload defined in file: '{kwargs['filename']}'") + return result + else: + raise Exception(f"ERROR, expected filename and content_type attributes, but received {kwargs}") + + @staticmethod + def batch_request_entities_from_file(kwargs) -> str: + if 'operation' in kwargs and 'filename' in kwargs: + result = (f"Batch Entity Delete Request with operation set to '{kwargs['operation']}', Content-Type set to 'application/ld+json', and body set to '{kwargs['filename']}") + return result + else: + raise Exception(f"ERROR, expected content_type attribute, but received {kwargs}") + + @staticmethod + def request_entity_from_file(kwargs) -> str: + if 'filename' in kwargs: + result = f"Request Entity from file with filename set to '{kwargs['filename']}' and content-type set to 'application/ld+json'" + return result + else: + raise Exception(f"ERROR, expected filename attribute, but received {kwargs}") + + @staticmethod + def batch_create_entities(kwargs) -> str: + if 'content_type' in kwargs: + result = (f"Request Header['Content-Type'] set to '{kwargs['content_type']}' and\n " + f"payload set to a list of entities to be created") + return result + else: + raise Exception(f"ERROR, expected content_type attribute, but received {kwargs}") + + @staticmethod + def create_context_source_registration_with_return(kwargs) -> str: + if 'filename' in kwargs: + result = (f"Request Header['Content-Type'] set to 'application/ld+json' and\n " + f"payload defined in file: '{kwargs['filename']}'") + return result + else: + raise Exception(f"ERROR, expected filename attribute, but received {kwargs}") + + @staticmethod + def query_entity(kwargs) -> str: + expected_parameters = ['id', 'accept', 'attrs', 'context', 'geoproperty', 'options'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Get Entity Request:" + for key, value in kwargs.items(): + match key: + case 'id': + response = f"{response} and\n Query Parameter: id set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case 'attrs': + response = f"{response} and\n Query Parameter: attrs set to '{value}'" + case 'context': + response = (f"{response} and\n Query Parameter: Link set to " + f"'<${value}>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'") + case 'geoproperty': + response = f"{response} and\n Query Parameter: geoproperty set to '{value}'" + case 'options': + response = f"{response} and\n Query Parameter: options set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def modify_attribute_instance_from_temporal_entity(kwargs) -> str: + expected_parameters = ['temporal_entity_id', 'attributeId', 'instanceId', 'fragment_filename', 'content_type', 'context'] + + if 'context' not in kwargs: + kwargs['context'] = '${EMPTY}' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Modify Attribute Instance from Temporal Entity:" + for key, value in kwargs.items(): + match key: + case 'temporal_entity_id': + response = f"{response} and\n Query Parameter: temporal_entity_id set to '{value}'" + case 'attributeId': + response = f"{response} and\n Query Parameter: attributeId set to '{value}'" + case 'instanceId': + response = f"{response} and\n Query Parameter: instanceId set to '{value}'" + case 'fragment_filename': + response = f"{response} and\n Query Parameter: fragment_filename set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def delete_attribute_instance_from_temporal_entity(kwargs) -> str: + expected_parameters = ['temporal_entity_id', 'attributeId', 'instanceId', 'content_type', 'context'] + + if 'context' not in kwargs: + kwargs['context'] = '${EMPTY}' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Delete Attribute Instance from Temporal Entity:" + for key, value in kwargs.items(): + match key: + case 'temporal_entity_id': + response = f"{response} and\n Query Parameter: temporal_entity_id set to '{value}'" + case 'attributeId': + response = f"{response} and\n Query Parameter: attributeId set to '{value}'" + case 'instanceId': + response = f"{response} and\n Query Parameter: instanceId set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def delete_attribute_from_temporal_entity(kwargs) -> str: + expected_parameters = ['entityId', 'attributeId', 'content_type', 'datasetId', 'deleteAll', 'context'] + + if 'context' not in kwargs: + kwargs['context'] = '${EMPTY}' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Delete Attribute From Temporal Entity:" + for key, value in kwargs.items(): + match key: + case 'entityId': + response = f"{response} and\n Query Parameter: entityId set to '{value}'" + case 'attributeId': + response = f"{response} and\n Query Parameter: attributeId set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + case 'datasetId': + response = f"{response} and\n Query Parameter: datasetId set to '{value}'" + case 'deleteAll': + response = f"{response} and\n Query Parameter: deleteAll set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def create_or_update_temporal_representation_of_entity_selecting_content_type(kwargs) -> str: + expected_parameters = ['temporal_entity_representation_id', 'filename', 'content_type', 'accept'] + + if 'accept' not in kwargs: + kwargs['accept'] = '${EMPTY}' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Create or Update Temporal Representation of Entity Selecting Content Type:" + for key, value in kwargs.items(): + match key: + case 'temporal_entity_representation_id': + response = f"{response} and\n Query Parameter: temporal_entity_representation_id set to '{value}'" + case 'filename': + response = f"{response} and\n Query Parameter: filename set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def create_temporal_representation_of_entity_selecting_content_type(kwargs) -> str: + expected_parameters = ['filename', 'content_type'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Create Temporal Representation of Entity Selecting Content Type:" + for key, value in kwargs.items(): + match key: + case 'filename': + response = f"{response} and\n Query Parameter: filename set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def delete_entity_attributes(kwargs) -> str: + expected_parameters = ['entityId', 'attributeId', 'datasetId', 'deleteAll', 'context'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Delete Entity Attributes:" + for key, value in kwargs.items(): + match key: + case 'entityId': + response = f"{response} and\n Query Parameter: entityId set to '{value}'" + case 'attributeId': + response = f"{response} and\n Query Parameter: attributeId set to '{value}'" + case 'datasetId': + response = f"{response} and\n Query Parameter: datasetId set to '{value}'" + case 'deleteAll': + response = f"{response} and\n Query Parameter: deleteAll set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def retrieve_attributes(kwargs) -> str: + expected_parameters = ['details', 'accept', 'context'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Retrieve attributes:" + for key, value in kwargs.items(): + match key: + case 'details': + response = f"{response} and\n Query Parameter: details set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def batch_delete_entities(kwargs) -> str: + expected_parameters = ['entities_ids_to_be_deleted', 'teardown'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Batch Delete Entities:" + for key, value in kwargs.items(): + match key: + case 'entities_ids_to_be_deleted': + response = f"{response} and\n Query Parameter: entities_ids_to_be_deleted set to '{value}'" + case 'teardown': + response = f"{response} and\n Query Parameter: teardown set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def retrieve_entity_types(kwargs) -> str: + expected_parameters = ['details', 'accept', 'context'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Retrieve entity types:" + for key, value in kwargs.items(): + match key: + case 'details': + response = f"{response} and\n Query Parameter: details set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def retrieve_subscription(kwargs) -> str: + # if 'accept' in kwargs: + # return f"Request a subscription\nHeader['Accept'] set to '{kwargs['accept']}'" + # else: + # return "Request a subscription" + expected_parameters = ['id', 'accept', 'context', 'content_type'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Subscription Retrieve with the following data:" + for key, value in kwargs.items(): + match key: + case 'id': + response = f"{response} and\n Query Parameter: id set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + def query_context_source_registrations_with_return(kwargs) -> str: + if 'type' in kwargs and 'accept' in kwargs: + result = "Request a Context Source Registration with Return" + + if kwargs['type'] != '': + result = f"{result}\nEntity Type set to '{kwargs['type']}'" + + if kwargs['accept'] != '': + result = f"{result}\nHeader['Accept'] set to '{kwargs['accept']}'" + else: + result = "Request a Context Source Registration with Return" + + return result + + def query_temporal_representation_of_entities_with_return(kwargs) -> str: + return "Request a Temporal Representation of Entities with Return" + + def partial_update_entity_attributes(kwargs) -> str: + expected_parameters = ['entityId', 'attributeId', 'fragment_filename', 'content_type', 'accept', 'context'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Request Partial Update Entity Attributes" + for key, value in kwargs.items(): + match key: + case 'entityId': + response = f"{response} and\n Query Parameter: entityId set to '{value}'" + case 'attributeId': + response = f"{response} and\n Query Parameter: AttributeId set to '{value}'" + case 'fragment_filename': + response = f"{response} and\n Query Parameter: fragment_filename set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + def update_subscription(kwargs) -> str: + if 'context' in kwargs and 'content' in kwargs and 'filename' in kwargs: + context = kwargs['context'] + if context == '': + return (f"Request Update Subscription and \n" + f"Header['Content-Type'] set to '{kwargs['content']}' and\n" + f"Payload defined in file '{kwargs['filename']}'") + else: + return (f"Request Update Subscription and \n" + f"Header['Link'] contain the context '{kwargs['context']}' and\n" + f"Header['Content-Type'] set to '{kwargs['content']}' and\n" + f"Payload defined in file '{kwargs['filename']}'") + else: + raise Exception(f"ERROR, expected context attribute, but received {kwargs}") + + @staticmethod + def query_context_source_registration_subscriptions(kwargs) -> str: + expected_parameters = ['context', 'limit', 'page', 'accept'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Query Context Source Registration Subscriptions" + for key, value in kwargs.items(): + match key: + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case 'limit': + response = f"{response} and\n Query Parameter: limit set to '{value}'" + case 'page': + response = f"{response} and\n Query Parameter: page set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def query_temporal_representation_of_entities(kwargs) -> str: + # This function is a little bit special because we have a number of parameters not always defined and not always + # in the same position, so we make a different analysis to extract the values + expected_parameters = ['context', 'entity_types', 'entity_ids', 'entity_id_pattern', + 'ngsild_query', 'csf', 'georel', 'geometry', + 'coordinates', 'geoproperty', 'timerel', 'timeAt', + 'attrs', 'limit', 'lastN', 'accept', 'options'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Query Temporal Representation of Entities" + for key, value in kwargs.items(): + match key: + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case 'entity_types': + response = f"{response} and\n Query Parameter: entity_types set to '{value}'" + case 'entity_ids': + response = f"{response} and\n Query Parameter: entity_ids set to '{value}'" + case 'entity_id_pattern': + response = f"{response} and\n Query Parameter: entity_id_pattern set to '{value}'" + case 'ngsild_query': + response = f"{response} and\n Query Parameter: ngsild_query set to '{value}'" + case 'csf': + response = f"{response} and\n Query Parameter: csf set to '{value}'" + case 'georel': + response = f"{response} and\n Query Parameter: georel set to '{value}'" + case 'geometry': + response = f"{response} and\n Query Parameter: geometry set to '{value}'" + case 'coordinates': + response = f"{response} and\n Query Parameter: coordinates set to '{value}'" + case 'geoproperty': + response = f"{response} and\n Query Parameter: geoproperty set to '{value}'" + case 'timerel': + response = f"{response} and\n Query Parameter: timerel set to '{value}'" + case 'timeAt': + response = f"{response} and\n Query Parameter: timeAt set to '{value}'" + case 'attrs': + response = f"{response} and\n Query Parameter: attrs set to '{value}'" + case 'limit': + response = f"{response} and\n Query Parameter: limit set to '{value}'" + case 'lastN': + value = re.search(pattern=r'\d+', string=value).group() + response = f"{response} and\n Query Parameter: lastN set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case 'options': + response = f"{response} and\n Query Parameter: options set to '{value}'" + + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def retrieve_temporal_representation_of_entity(kwargs) -> str: + expected_parameters = ['temporal_entity_representation_id', 'attrs', 'options', + 'context', 'timerel', 'timeAt', + 'endTimeAt', 'lastN', 'accept'] + result = [x for x in kwargs if x not in expected_parameters] + response = "Retrieve Temporal Representation of Entity" + for key, value in kwargs.items(): + match key: + case 'temporal_entity_representation_id': + response = f"{response} and\n Query Parameter: id set to '{value}'" + case 'attrs': + response = f"{response} and\n Query Parameter: attrs set to '{value}'" + case 'options': + response = f"{response} and\n Query Parameter: options set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case 'timerel': + response = f"{response} and\n Query Parameter: timerel set to '{value}'" + case 'timeAt': + response = f"{response} and\n Query Parameter: timeAt set to '{value}'" + case 'endTimeAt': + response = f"{response} and\n Query Parameter: endTimeAt set to '{value}'" + case 'lastN': + value = re.search(pattern=r'\d+', string=value).group() + response = f"{response} and\n Query Parameter: lastN set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def retrieve_attribute(kwargs) -> str: + if 'attribute_name' in kwargs: + return f"Retrieve Attribute with attributeName set to '{kwargs['attribute_name']}'" + + @staticmethod + def retrieve_entity_type(kwargs) -> str: + result = "Retrieve Entity Type" + if 'type' in kwargs: + result = f"{result}, with type set to '{kwargs['type']}'" + + if 'context' in kwargs and kwargs['context'] != '': + result = f"{result}, with Header['Link'] containing '{kwargs['context']}'" + + if 'type' not in kwargs or 'context' not in kwargs: + raise Exception(f"ERROR, expected type or context attributes, received '{kwargs}'") + + return result + + @staticmethod + def query_entities(kwargs) -> str: + expected_parameters = ['entity_ids', 'entity_types', 'accept', + 'attrs', 'context', 'geoproperty', + 'options', 'limit', 'entity_id_pattern', + 'georel', 'coordinates', 'geometry', 'count' , 'q'] + + result = [x for x in kwargs if x not in expected_parameters] + response = "Get Entities Request:" + for key, value in kwargs.items(): + match key: + case 'entity_ids': + response = f"{response} and\n Query Parameter: entity_ids set to '{value}'" + case 'entity_types': + response = f"{response} and\n Query Parameter: entity_types set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case 'attrs': + response = f"{response} and\n Query Parameter: attrs set to '{value}'" + case 'context': + response = (f"{response} and\n Query Parameter: Link set to " + f"'<${value}>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'") + case 'geoproperty': + response = f"{response} and\n Query Parameter: geoproperty set to '{value}'" + case 'options': + response = f"{response} and\n Query Parameter: options set to '{value}'" + case 'limit': + response = f"{response} and\n Query Parameter: limit set to '{value}'" + case 'entity_id_pattern': + response = f"{response} and\n Query Parameter: entity_id_pattern set to '{value}'" + case 'georel': + response = f"{response} and\n Query Parameter: georel set to '{value}'" + case 'coordinates': + response = f"{response} and\n Query Parameter: coordinates set to '{value}'" + case 'geometry': + response = f"{response} and\n Query Parameter: geometry set to '{value}'" + case 'count': + response = f"{response} and\n Query Parameter: count set to '{value}'" + case 'q': + response = f"{response} and\n Query Parameter: q set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + def query_entities_via_post(kwargs) -> str: + expected_parameters = ['entity_id', 'entity_type', 'content_type', 'accept', + 'attrs', 'entity_id_pattern', 'geometry_property'] + + if 'content_type' not in kwargs: + kwargs['content_type'] = 'application/json' + + if 'accept' not in kwargs: + kwargs['accept'] = 'application/json' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Get Entities Via POST Request:" + for key, value in kwargs.items(): + match key: + case 'entity_id': + response = f"{response} and\n Query Parameter: entity_ids set to '{value}'" + case 'entity_type': + response = f"{response} and\n Query Parameter: entity_types set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case 'attrs': + response = f"{response} and\n Query Parameter: attrs set to '{value}'" + case 'geometry_property': + response = f"{response} and\n Query Parameter: geoproperty set to '{value}'" + case 'entity_id_pattern': + response = f"{response} and\n Query Parameter: entity_id_pattern set to '{value}'" + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + def query_temporal_representation_of_entities_via_post(kwargs) -> str: + expected_parameters = ['query_file_name', 'content_type', 'context'] + + if 'content_type' not in kwargs: + kwargs['content_type'] = 'application/json' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Query Temporal Representation of Entities Via POST Request:" + for key, value in kwargs.items(): + match key: + case 'query_file_name': + response = f"{response} and\n Query Parameter: query_file_name set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + case 'context': + response = (f"{response} and\n Query Parameter: Link set to " + f"'<${value}>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'") + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + + @staticmethod + def retrieve_entity_by_id(kwargs) -> str: + expected_parameters = ['id', 'accept', 'context'] + + result = [x for x in kwargs if x not in expected_parameters] + response = 'Request Retrieve Entity by Id' + for key, value in kwargs.items(): + match key: + case 'id': + response = f"{response} and\n Query Parameter: id set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def delete_entity_by_id(kwargs) -> str: + if 'id' in kwargs: + return f"Delete Entity Request with id set to '{kwargs['id']}'" + + @staticmethod + def delete_subscription(kwargs) -> str: + if 'id' in kwargs: + return f"Delete Subscription with id set to '{kwargs['id']}'" + + @staticmethod + def query_subscriptions(kwargs) -> str: + expected_parameters = ['context', 'limit', 'offset', 'accept'] + + result = [x for x in kwargs if x not in expected_parameters] + response = 'Query Subscription Request with data:' + for key, value in kwargs.items(): + match key: + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case 'limit': + response = f"{response} and\n Query Parameter: limit set to '{value}'" + case 'offset': + response = f"{response} and\n Query Parameter: offset set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def retrieve_context_source_registration_subscription(kwargs) -> str: + expected_parameters = ['subscription_id', 'context', 'accept'] + + result = [x for x in kwargs if x not in expected_parameters] + response = 'Retrieve Context Source Registration Subscription with data:' + for key, value in kwargs.items(): + match key: + case 'subscription_id': + response = f"{response} and\n Query Parameter: subscription id set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def delete_context_source_registration_with_return(kwargs) -> str: + if 'id' in kwargs: + return f"Delete Context Source Registration with id set to '{kwargs['id']}'" + + @staticmethod + def update_context_source_registration(kwargs) -> str: + if 'context_source_registration_id' in kwargs and 'update_fragment' in kwargs: + return (f"Update Context Source Registration " + f"with CSR Id set to '{kwargs['context_source_registration_id']}' and " + f"subscription update fragment set to '{kwargs['update_fragment']}'") + else: + raise Exception(f"ERROR, expected 'context_source_registration_id' and 'update_fragment'" + f" but received: {kwargs}") + + @staticmethod + def update_context_source_registration_from_file(kwargs) -> str: + if 'context_source_registration_id' in kwargs and 'filename' in kwargs: + return (f"Update Context Source Registration " + f"with CSR Id set to '{kwargs['context_source_registration_id']}' and " + f"subscription update from file '{kwargs['filename']}'") + else: + raise Exception(f"ERROR, expected 'context_source_registration_id' and 'update_fragment'" + f" but received: {kwargs}") + + @staticmethod + def update_context_source_registration_subscription(kwargs) -> str: + if 'subscription_id' in kwargs and 'subscription_update_fragment' in kwargs: + return (f"Update Context Source Registration Subscription " + f"with subscription id set to '{kwargs['subscription_id']}' and " + f"subscription update fragment set to '{kwargs['subscription_update_fragment']}'") + else: + raise Exception(f"ERROR, expected 'subscription_id' and 'subscription_update_fragment' but received: {kwargs}") + + @staticmethod + def update_context_source_registration_subscription_from_file(kwargs) -> str: + if 'subscription_id' in kwargs and 'subscription_update_fragment' in kwargs: + return (f"Update Context Source Registration Subscription from file " + f"with subscription id set to '{kwargs['subscription_id']}' and " + f"subscription update fragment set to '{kwargs['subscription_update_fragment']}'") + else: + raise Exception(f"ERROR, expected 'subscription_id' and 'subscription_update_fragment' but received: {kwargs}") + + @staticmethod + def retrieve_context_source_registration(kwargs) -> str: + expected_parameters = ['context_source_registration_id', 'context', 'accept'] + + result = [x for x in kwargs if x not in expected_parameters] + response = 'Retrieve Context Source Registration with data:' + for key, value in kwargs.items(): + match key: + case 'context_source_registration_id': + response = f"{response} and\n Query Parameter: context source registration id set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def query_context_source_registrations(kwargs) -> str: + expected_parameters = ['context', 'id', 'type', 'idPattern', 'attrs', + 'q', 'csf', 'georel', 'geometry', + 'coordinates', 'geoproperty', 'timeproperty', 'timerel', + 'timeAt', 'limit', 'offset', 'accept'] + + # kwargs = {key: kwargs.get(key, '${EMPTY}') for key in expected_parameters} + + result = [x for x in kwargs if x not in expected_parameters] + response = "Retrieve Temporal Representation of Entity" + for key, value in kwargs.items(): + match key: + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case 'id': + response = f"{response} and\n Query Parameter: id set to '{value}'" + case 'type': + response = f"{response} and\n Query Parameter: type set to '{value}'" + case 'attrs': + response = f"{response} and\n Query Parameter: attrs set to '{value}'" + case 'idPattern': + response = f"{response} and\n Query Parameter: idPattern set to '{value}'" + case 'q': + response = f"{response} and\n Query Parameter: q set to '{value}'" + case 'csf': + response = f"{response} and\n Query Parameter: csf set to '{value}'" + case 'georel': + response = f"{response} and\n Query Parameter: georel set to '{value}'" + case 'geometry': + response = f"{response} and\n Query Parameter: geometry set to '{value}'" + case 'coordinates': + response = f"{response} and\n Query Parameter: coordinates set to '{value}'" + case 'geoproperty': + response = f"{response} and\n Query Parameter: geoproperty set to '{value}'" + case 'timeproperty': + response = f"{response} and\n Query Parameter: timeproperty set to '{value}'" + case 'timerel': + response = f"{response} and\n Query Parameter: timerel set to '{value}'" + case 'timeAt': + response = f"{response} and\n Query Parameter: timeAt set to '{value}'" + case 'limit': + response = f"{response} and\n Query Parameter: limit set to '{value}'" + case 'offset': + response = f"{response} and\n Query Parameter: offset set to '{value}'" + case 'accept': + response = f"{response} and\n Query Parameter: accept set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def update_context_source_registration_with_return(kwargs) -> str: + if 'id' in kwargs and 'filename' in kwargs and 'content' in kwargs: + return (f"Update Context Source Registration with id set to '{kwargs['id']}' " + f"and registration update fragment set to '{kwargs['filename']}' " + f"and content-type set to '{kwargs['content']}'") + + @staticmethod + def delete_temporal_representation_of_entity_with_returning_response(kwargs) -> str: + if 'id' in kwargs: + return f"Delete Temporal Representation Of Entity With Returning Response with id set to '{kwargs['id']}'" + + @staticmethod + def retrieve_context_source_registration_subscription_2(kwargs) -> str: + if 'id' in kwargs: + return f"Retrieve Context Source Registration Subscription with id set to '{kwargs['id']}'" + else: + raise Exception(f"ERROR, expected 'id' but received: '{kwargs}'") + + @staticmethod + def delete_context_source_registration_subscription(kwargs) -> str: + if 'id' in kwargs: + return f"Delete Context Source Registration Subscription with id set to '{kwargs['id']}'" + else: + raise Exception(f"ERROR, expected 'id' but received: '{kwargs}'") + + @staticmethod + def create_context_source_registration_subscription(kwargs) -> str: + if 'filename' in kwargs: + return (f"Create Context Source Registration Subscription with filename set to '{kwargs['filename']}', " + f"accept set to '${{EMPTY}}', and content-type set to 'application/ld+json'") + else: + raise Exception(f"ERROR, expected 'filename' but received: '{kwargs}'") + + @staticmethod + def append_attribute_to_temporal_entity(kwargs) -> str: + expected_parameters = ['id', 'fragment_filename', 'content_type'] + + result = [x for x in kwargs if x not in expected_parameters] + response = 'Append Attribute to Temporal Entity' + for key, value in kwargs.items(): + match key: + case 'id': + response = f"{response} and\n Query Parameter: id set to '{value}'" + case 'fragment_filename': + response = f"{response} and\n Query Parameter: fragment_filename set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def append_entity_attributes(kwargs) -> str: + expected_parameters = ['id', 'fragment_filename', 'content_type'] + + result = [x for x in kwargs if x not in expected_parameters] + response = 'Append Entity Attributes' + for key, value in kwargs.items(): + match key: + case 'id': + response = f"{response} and\n Query Parameter: id set to '{value}'" + case 'fragment_filename': + response = f"{response} and\n Query Parameter: fragment_filename set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + @staticmethod + def update_entity_attributes(kwargs) -> str: + expected_parameters = ['id', 'fragment_filename', 'content_type'] + + result = [x for x in kwargs if x not in expected_parameters] + response = 'Update Entity Attributes' + for key, value in kwargs.items(): + match key: + case 'id': + response = f"{response} and\n Query Parameter: id set to '{value}'" + case 'fragment_filename': + response = f"{response} and\n Query Parameter: fragment_filename set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + # If an exact match is not confirmed, this last case will be used if provided + case _: + raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " + f"'{expected_parameters}', but received: {kwargs}") + + return response + + def get_value(self, params, param_position, param_key): + data = [x for x in params if f'{param_key}=' in x] + + if len(data) == 1: + # The name of the attribute is passed to the function in the form attribute=value + data = data[0] + data = data.split('=') + if data[0] != param_key: + return '' + + data = data[1] + elif len(data) == 0: + # There is no attribute=something therefore we have to apply the position + try: + data = params[param_position] + + # Workaround + if 'accept' in data and param_key != 'accept': + data = '' + except IndexError: + return '' + + return self.get_value_simple(data=data) + + def get_value_simple(self, data): + try: + value = self.variables[data] + return value + except KeyError: + try: + value = self.apiutils_variables[data] + return value + except KeyError: + try: + value = self.config_file.get_variable(variable=data) + return value + except KeyError: + try: + aux = self.template_params_value[self.name] + value = aux[data] + return value + except KeyError: + return data + diff --git a/doc/files/CommonBehaviours/043_01.json b/doc/files/CommonBehaviours/043_01.json new file mode 100644 index 0000000000000000000000000000000000000000..a2c342ab577e9a36726ed93d8889685216590c51 --- /dev/null +++ b/doc/files/CommonBehaviours/043_01.json @@ -0,0 +1,108 @@ +{ + "tp_id": "TP/NGSI-LD/CB/HTTP/043_01", + "test_objective": "Verify receiving 503 \u2013 LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.2.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.2.2" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "043_01_01 Create entity", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/043_01_01", + "doc": "Verify receiving 503 \u2013 LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create entity)", + "tags": [ + "5_2_2", + "cb-ldcontext", + "e-create" + ], + "setup": null, + "teardown": "Delete Entity by Id", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 503 and\n Create Entity Selecting Content Type with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/LdContextNotAvailable' and\n Create Entity Selecting Content Type with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-unretrievable-context-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "043_01_02 Create subscription", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/043_01_02", + "doc": "Verify receiving 503 \u2013 LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create subscription)", + "tags": [ + "5_2_2", + "cb-ldcontext", + "sub-create" + ], + "setup": null, + "teardown": "Delete Subscription", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription with Response Status Code set to 503 and\n Create Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/LdContextNotAvailable' and\n Create Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscriptions/subscription-unretrievable-context-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + }, + { + "name": "043_01_03 Create Temporal Representation of Entities", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/043_01_03", + "doc": "Verify receiving 503 \u2013 LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create Temporal Representation of Entities)", + "tags": [ + "5_2_2", + "cb-ldcontext", + "te-create" + ], + "setup": null, + "teardown": "Delete Temporal Representation Of Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 503 and\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/LdContextNotAvailable' and\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'POST'\n Create or Update Temporal Representation of Entity Selecting Content Type: and\n Query Parameter: temporal_entity_representation_id set to '${temporal_entity_representation_id}' and\n Query Parameter: filename set to 'bus-temporal-representation-unretrievable-context-sample.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: accept set to '${EMPTY}'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities" + }, + { + "name": "043_01_04 Batch entity create", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/043_01_04", + "doc": "Verify receiving 503 \u2013 LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Batch entity create)", + "tags": [ + "5_2_2", + "be-create", + "cb-ldcontext" + ], + "setup": null, + "teardown": "Batch Delete Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 503 and\n Batch Create Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/LdContextNotAvailable' and\n Batch Create Entities with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + }, + { + "name": "043_01_05 Create context source registration", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/043_01_05", + "doc": "Verify receiving 503 \u2013 LdContextNotAvailable error if remote JSON-LD @context cannot be retrieved (Create context source registration)", + "tags": [ + "5_2_2", + "cb-ldcontext", + "csr-create" + ], + "setup": null, + "teardown": "Delete Context Source Registration", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Create Context Source Registration With Return with Response Status Code set to 503\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "endpoint", + "then", + "when" + ], + "robotpath": "CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable", + "robotfile": "043_01" +} \ No newline at end of file diff --git a/doc/files/CommonBehaviours/044_01.json b/doc/files/CommonBehaviours/044_01.json new file mode 100644 index 0000000000000000000000000000000000000000..0452c10b00d28f82be3f1a24bf20d48e5bcdf3e6 --- /dev/null +++ b/doc/files/CommonBehaviours/044_01.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CB/HTTP/044_01", + "test_objective": "Verify that PATCH HTTP requests can be done with \"application/merge-patch+json\" as Content-Type", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.4" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "044_01_01 endpoint /entities/{entityId}/attrs/{attrId}", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/044_01_01", + "doc": "Verify that PATCH HTTP requests can be done with \"application/merge-patch+json\" as Content-Type", + "tags": [ + "6_3_4", + "cb-mergepatch", + "ea-partial-update" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Partial Update Entity Attributes with Response Status Code set to 204\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'brandName' and\n Query Parameter: fragment_filename set to 'vehicle-brandname-fragment.json' and\n Query Parameter: content_type set to 'application/merge-patch+json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "CommonBehaviours/CommonResponses/VerifyMergePatchJson", + "robotfile": "044_01" +} \ No newline at end of file diff --git a/doc/files/CommonBehaviours/044_02.json b/doc/files/CommonBehaviours/044_02.json new file mode 100644 index 0000000000000000000000000000000000000000..80ee40408aba5563f8709351fa56eddaa2acb0e4 --- /dev/null +++ b/doc/files/CommonBehaviours/044_02.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CB/HTTP/044_02", + "test_objective": "Verify that PATCH HTTP requests can be done with \"application/merge-patch+json\" as Content-Type", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.4" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription", + "Delete Initial Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id} \n}", + "test_cases": [ + { + "name": "044_02_01 Endpoint /subscriptions/{subscriptionId}", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/044_02_01", + "doc": "Verify that PATCH HTTP requests can be done with \"application/merge-patch+json\" as Content-Type", + "tags": [ + "6_3_4", + "cb-mergepatch", + "sub-update" + ], + "setup": "Create Initial Subscription", + "teardown": "Delete Initial Subscription", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Update Subscription with Response Status Code set to 204\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Link'] contain the context 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\nHeader['Content-Type'] set to 'application/merge-patch+json' and\nPayload defined in file 'subscriptions/fragments/subscription-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "CommonBehaviours/CommonResponses/VerifyMergePatchJson", + "robotfile": "044_02" +} \ No newline at end of file diff --git a/doc/files/CommonBehaviours/045_01.json b/doc/files/CommonBehaviours/045_01.json new file mode 100644 index 0000000000000000000000000000000000000000..f0c2261e4002b7d80715a3238a29e55894643b91 --- /dev/null +++ b/doc/files/CommonBehaviours/045_01.json @@ -0,0 +1,91 @@ +{ + "tp_id": "TP/NGSI-LD/CB/HTTP/045_01", + "test_objective": "Verify that on a GET HTTP request if nothing is specified on the Accept header, \"application/json\" is assumed", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.4" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "045_01_01 Endpoint /entities/{entityId}", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/045_01_01", + "doc": "Verify that on a GET HTTP request if nothing is specified on the Accept header, \"application/json\" is assumed (/entities/{entityId})", + "tags": [ + "6_3_4", + "cb-get", + "e-query" + ], + "setup": null, + "teardown": "Delete Entity by Id", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 200 and\n Create Entity Selecting Content Type with Response Header: Content-Type set to application/json and\n Notification with Response Header: Link is not Empty\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${id}' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"' and\n Query Parameter: accept set to '*/*'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "045_01_02 Endpoint /subscriptions/{subscriptionId}", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/045_01_02", + "doc": "Verify that on a GET HTTP request if nothing is specified on the Accept header, \"application/json\" is assumed (/subscriptions/{subscriptionId})", + "tags": [ + "6_3_4", + "cb-get", + "sub-retrieve" + ], + "setup": null, + "teardown": "Delete Subscription", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription with Response Status Code set to 201 and\n Create Subscription with Response Status Code set to 200 and\n Create Subscription with Response Header: Content-Type set to application/json and\n Notification with Response Header: Link is not Empty\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{id}'\n method set to 'GET'\n Subscription Retrieve with the following data: and\n Query Parameter: id set to '${id}' and\n Query Parameter: accept set to '*/*'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/{id}" + }, + { + "name": "045_01_03 Endpoint /csourceRegistrations/", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/045_01_03", + "doc": "Verify that on a GET HTTP request if nothing is specified on the Accept header, \"application/json\" is assumed (/csourceRegistrations/)", + "tags": [ + "6_3_4", + "cb-get", + "csr-query" + ], + "setup": null, + "teardown": "Delete Context Source Registration", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Create Context Source Registration With Return with Response Status Code set to 200 and\n Create Context Source Registration With Return with Response Header: Content-Type set to application/json and\n Notification with Response Header: Link is not Empty\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Request a Context Source Registration with Return\nEntity Type set to 'Vehicle'\nHeader['Accept'] set to '*/*'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "045_01_04 Endpoint /temporal/entities", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/045_01_04", + "doc": "Verify that on a GET HTTP request if nothing is specified on the Accept header, \"application/json\" is assumed (/temporal/entities)", + "tags": [ + "6_3_4", + "cb-get", + "te-query" + ], + "setup": null, + "teardown": "Delete Temporal Representation Of Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 201 and\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 200 and\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Header: Content-Type set to application/json and\n Notification with Response Header: Link is not Empty\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Request a Temporal Representation of Entities with Return\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [ + "endpoint", + "then", + "when" + ], + "robotpath": "CommonBehaviours/CommonResponses/VerifyGETWithoutAccept", + "robotfile": "045_01" +} \ No newline at end of file diff --git a/doc/files/CommonBehaviours/048_01.json b/doc/files/CommonBehaviours/048_01.json new file mode 100644 index 0000000000000000000000000000000000000000..5721211f0383b520151aa25fea70fc6b5820287c --- /dev/null +++ b/doc/files/CommonBehaviours/048_01.json @@ -0,0 +1,126 @@ +{ + "tp_id": "TP/NGSI-LD/CB/HTTP/048_01", + "test_objective": "Verify throwing 415 HTTP status code (Unsupported Media Type) if \"Content-Type\" header is not \"application/json\" or \"application/ld+json\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.4" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "048_01_01 Endpoint patch /entities/{entityId}/attrs/{attrId}", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/048_01_01", + "doc": "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})", + "tags": [ + "6_3_4", + "cb-unsupport-medtype", + "ea-partial-update" + ], + "setup": null, + "teardown": "Delete Entity by Id", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Partial Update Entity Attributes with Response Status Code set to 415\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'speed' and\n Query Parameter: fragment_filename set to 'vehicle-brandname-fragment.jsonld' and\n Query Parameter: content_type set to 'application/xml'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "048_01_02 Endpoint patch /subscriptions/{subscriptionId}", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/048_01_02", + "doc": "Verify throwing 415 HTTP status code (Unsupported Media Type) if \"Content-Type\" header is not \"application/json\" or \"application/ld+json\" (patch /subscriptions/{subscriptionId})", + "tags": [ + "6_3_4", + "cb-unsupport-medtype", + "sub-update" + ], + "setup": null, + "teardown": "Delete Subscription", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Update Subscription with Response Status Code set to 415\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/xml' and\nPayload defined in file 'csourceSubscriptions/fragments/subscription-update-sample.jsonld'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + }, + { + "name": "048_01_03 Endpoint post /entities/", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/048_01_03", + "doc": "Verify throwing 415 HTTP status code (Unsupported Media Type) if \"Content-Type\" header is not \"application/json\" or \"application/ld+json\" (post /entities/)", + "tags": [ + "6_3_4", + "cb-unsupport-medtype", + "e-create" + ], + "setup": null, + "teardown": "Delete Entity by Id", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Create Entity Selecting Content Type with Response Status Code set to 415\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/xml' and\n payload defined in file: 'building-simple-attributes-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "048_01_04 Endpoint post /subscriptions/", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/048_01_04", + "doc": "Verify throwing 415 HTTP status code (Unsupported Media Type) if \"Content-Type\" header is not \"application/json\" or \"application/ld+json\" (post /subscriptions/)", + "tags": [ + "6_3_4", + "cb-unsupport-medtype", + "sub-create" + ], + "setup": null, + "teardown": "Delete Subscription", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Create Subscription with Response Status Code set to 415\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/xml' and\n payload defined in file: 'csourceSubscriptions/subscription-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + }, + { + "name": "048_01_05 Endpoint post /entityOperations/create", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/048_01_05", + "doc": "Verify throwing 415 HTTP status code (Unsupported Media Type) if \"Content-Type\" header is not \"application/json\" or \"application/ld+json\" (post /entityOperations/create)", + "tags": [ + "6_3_4", + "be-create", + "cb-unsupport-medtype" + ], + "setup": null, + "teardown": "Batch Delete Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Batch Create Entities with Response Status Code set to 415\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/xml' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + }, + { + "name": "048_01_06 Endpoint post /temporal/entities/", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/048_01_06", + "doc": "Verify throwing 415 HTTP status code (Unsupported Media Type) if \"Content-Type\" header is not \"application/json\" or \"application/ld+json\" (post /temporal/entities/)", + "tags": [ + "6_3_4", + "cb-unsupport-medtype", + "te-create" + ], + "setup": null, + "teardown": "Delete Temporal Representation Of Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 415\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'POST'\n Create or Update Temporal Representation of Entity Selecting Content Type: and\n Query Parameter: temporal_entity_representation_id set to '${temporal_entity_representation_id}' and\n Query Parameter: filename set to 'vehicle-temporal-representation-sample.jsonld' and\n Query Parameter: content_type set to 'application/xml' and\n Query Parameter: accept set to '${EMPTY}'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities" + } + ], + "permutations": [ + "endpoint", + "http_verb", + "then", + "when" + ], + "robotpath": "CommonBehaviours/CommonResponses/VerifyUnsupportedMediaType", + "robotfile": "048_01" +} \ No newline at end of file diff --git a/doc/files/CommonBehaviours/049_01.json b/doc/files/CommonBehaviours/049_01.json new file mode 100644 index 0000000000000000000000000000000000000000..cc2f9a93fb8bd3cbff0346151ce73eec868a031e --- /dev/null +++ b/doc/files/CommonBehaviours/049_01.json @@ -0,0 +1,108 @@ +{ + "tp_id": "TP/NGSI-LD/CB/HTTP/049_01", + "test_objective": "Verify throwing 406 HTTP status code (Not Acceptable Media Type) if the \"Accept\" header does not imply \"application/json\" nor \"application/ld+json\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.4" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "049_01_01 Endpoint get /entities/{entityId}", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/049_01_01", + "doc": "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})", + "tags": [ + "6_3_4", + "cb-noacceptable-medtype", + "e-query" + ], + "setup": null, + "teardown": "Delete Entity by Id", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Query Entity with Response Status Code set to 406\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/xml'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "049_01_02 Endpoint get /subscriptions/{subscriptionId}", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/049_01_02", + "doc": "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})", + "tags": [ + "6_3_4", + "cb-noacceptable-medtype", + "sub-retrieve" + ], + "setup": null, + "teardown": "Delete Subscription", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Subscription with Response Status Code set to 406\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{id}'\n method set to 'GET'\n Subscription Retrieve with the following data: and\n Query Parameter: id set to '${id}' and\n Query Parameter: accept set to 'application/xml'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/{id}" + }, + { + "name": "049_01_03 Endpoint get /csourceRegistrations/", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/049_01_03", + "doc": "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/)", + "tags": [ + "6_3_4", + "cb-noacceptable-medtype", + "csr-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Query Context Source Registrations With Return with Response Status Code set to 406\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Request a Context Source Registration with Return\nEntity Type set to 'Building'\nHeader['Accept'] set to 'application/xml'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "049_01_04 Endpoint get /csourceSubscriptions/", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/049_01_04", + "doc": "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/)", + "tags": [ + "6_3_4", + "cb-noacceptable-medtype", + "csrsub-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Query Context Source Registration Subscriptions with Response Status Code set to 406\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: accept set to 'application/xml'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + }, + { + "name": "049_01_05 Endpoint get /temporal/entities", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/049_01_05", + "doc": "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)", + "tags": [ + "6_3_4", + "cb-noacceptable-medtype", + "te-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Query Temporal Representation Of Entities with Response Status Code set to 406\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-08-01T12:05:00Z' and\n Query Parameter: accept set to 'application/xml'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [ + "endpoint", + "then", + "when" + ], + "robotpath": "CommonBehaviours/CommonResponses/VerifyNotAcceptableMediaType", + "robotfile": "049_01" +} \ No newline at end of file diff --git a/doc/files/CommonBehaviours/049_02.json b/doc/files/CommonBehaviours/049_02.json new file mode 100644 index 0000000000000000000000000000000000000000..020f97efbd10a85d1e54e1bd727822adf956991a --- /dev/null +++ b/doc/files/CommonBehaviours/049_02.json @@ -0,0 +1,74 @@ +{ + "tp_id": "TP/NGSI-LD/CB/HTTP/049_02", + "test_objective": "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\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.4" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "049_02_01 Retrieve subscription by id", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/049_02_01", + "doc": "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\" (get /subscriptions/{subscriptionId})", + "tags": [ + "6_3_4", + "cb-noacceptable-medtype", + "sub-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Subscription with Response Status Code set to 406\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{id}'\n method set to 'GET'\n Subscription Retrieve with the following data: and\n Query Parameter: id set to '${id}' and\n Query Parameter: accept set to 'application/geo+json'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/{id}" + }, + { + "name": "049_02_02 Query temporal entities", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/049_02_02", + "doc": "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\" (get /temporal/entities)", + "tags": [ + "6_3_4", + "cb-noacceptable-medtype", + "te-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Query Temporal Representation Of Entities with Response Status Code set to 406\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-08-01T12:05:00Z' and\n Query Parameter: accept set to 'application/geo+json'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + }, + { + "name": "049_02_03 Query context source registration", + "permutation_tp_id": "TP/NGSI-LD/CB/HTTP/049_02_03", + "doc": "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\" (get /csourceRegistrations)", + "tags": [ + "6_3_4", + "cb-noacceptable-medtype", + "csr-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Query Context Source Registrations With Return with Response Status Code set to 406\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Request a Context Source Registration with Return\nEntity Type set to 'Building'\nHeader['Accept'] set to 'application/geo+json'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "endpoint", + "then", + "when" + ], + "robotpath": "CommonBehaviours/CommonResponses/VerifyNotAcceptableMediaType", + "robotfile": "049_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_01_01.json b/doc/files/ContextInformation/Consumption/018_01_01.json new file mode 100644 index 0000000000000000000000000000000000000000..d25620acf75c70f54a4313a17880049c13638746 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_01_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_01_01", + "test_objective": "Check that you can get an entity by id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Entity" + ], + "teardown": "Delete Created Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "018_01_01 Get an entity by id", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_01_01", + "doc": "Check that you can get an entity by id", + "tags": [ + "5_7_1", + "e-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entity with Response Status Code set to 200 and\n Query Entity with Response Body containing en entity element with id set to '${entity_id}' and body content set to 'building-simple-attributes-expectation.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/ld+json'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_01_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_01_02.json b/doc/files/ContextInformation/Consumption/018_01_02.json new file mode 100644 index 0000000000000000000000000000000000000000..4aff9ddf1142097b4dd42efa058f222b30b2e62d --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_01_02.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_01_02", + "test_objective": "Check that you can query some attributes from an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Entity" + ], + "teardown": "Delete Created Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "018_01_02 Query some attributes from an entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_01_02", + "doc": "Check that you can query some attributes from an entity", + "tags": [ + "5_7_1", + "e-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entity with Response Status Code set to 200 and\n Query Entity with Response Body containing en entity element with id set to '${entity_id}' and body content set to 'building-simple-attributes-query-expectation.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/ld+json' and\n Query Parameter: attrs set to '${attributes_to_be_retrieved}'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_01_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_01_03.json b/doc/files/ContextInformation/Consumption/018_01_03.json new file mode 100644 index 0000000000000000000000000000000000000000..2e7bef604b41c6931524ba1004d0641aed875ead --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_01_03.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_01_03", + "test_objective": "Check that you can query the geometry property from an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Entity" + ], + "teardown": "Delete Created Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "018_01_03 Query the geometry property from an entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_01_03", + "doc": "Check that you can query the geometry property from an entity", + "tags": [ + "5_7_1", + "e-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entity with Response Status Code set to 200 and\n Query Entity with Response Body containing en entity element with id set to '${entity_id}' and body content set to 'building-geoproperty-query-expectation.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/ld+json' and\n Query Parameter: geoproperty set to 'location'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_01_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_02.json b/doc/files/ContextInformation/Consumption/018_02.json new file mode 100644 index 0000000000000000000000000000000000000000..0edd12cc3eb476d64b61eb4fd8bfa30b099e3403 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_02.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_02", + "test_objective": "Check that you cannot get an entity with invalid id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Get Entity With Invalid Id" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "018_02_01 Get an entity if the Entity Id is not a valid URI", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_02_01", + "doc": "Check that you cannot get an entity with invalid/missing id", + "tags": [ + "e-retrieve", + "5_7_1" + ], + "setup": null, + "teardown": null, + "template": "Get Entity With Invalid Id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entity with Response Status Code set to 400 and\n Query Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to 'thisisaninvaliduri' and\n Query Parameter: accept set to 'application/ld+json'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_03_01.json b/doc/files/ContextInformation/Consumption/018_03_01.json new file mode 100644 index 0000000000000000000000000000000000000000..7d2e069b5243c88b67f4fc018fa25b469a2c5122 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_03_01.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_03_01", + "test_objective": "Check that you cannot get an entity if the entity id is not known to the system", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.1" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "018_03_01 Get an entity if the Entity Id is not known to the system", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_03_01", + "doc": "Check that you cannot get an entity if the entity id or attributes are not known to the system", + "tags": [ + "5_7_1", + "e-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entity with Response Status Code set to 404 and\n Query Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Query Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/ld+json'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_03_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_03_02.json b/doc/files/ContextInformation/Consumption/018_03_02.json new file mode 100644 index 0000000000000000000000000000000000000000..0e4d74a375bcb17fb9e449accced94997c8dedf5 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_03_02.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_03_02", + "test_objective": "Check that you cannot get an entity if an attribute is not known to the system", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Entity" + ], + "teardown": "Delete Created Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "018_03_02 Get an entity if an attribute is not known to the system", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_03_02", + "doc": "Check that you cannot get an entity if an attribute is not known to the system", + "tags": [ + "5_7_1", + "e-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entity with Response Status Code set to 404 and\n Query Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Query Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/ld+json' and\n Query Parameter: attrs set to '${attributes_to_be_retrieved}'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_03_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_04.json b/doc/files/ContextInformation/Consumption/018_04.json new file mode 100644 index 0000000000000000000000000000000000000000..ed3011358f20ec6f5c2054949c3462c4425c59f0 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_04.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_04", + "test_objective": "Check that the queried entity by Id can be returned in a simplified representation", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.7" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "018_04_01 Get an entity in a simplified representation", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_04_01", + "doc": "Check that the queried entity by Id can be returned in a simplified representation", + "tags": [ + "6_3_7", + "e-retrieve" + ], + "setup": null, + "teardown": "Delete Created Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entity with Response Status Code set to 200 and\n Query Entity with Response Body containing en entity element with id set to '${entity_id}' and body content set to 'building-simple-attributes-simplified-expectation.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/ld+json' and\n Query Parameter: options set to 'keyValues'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_05.json b/doc/files/ContextInformation/Consumption/018_05.json new file mode 100644 index 0000000000000000000000000000000000000000..237b6beb0c4e65ba2d6bfe8d548e537d11acc2d7 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_05.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_05", + "test_objective": "Check that the queried entity by id can be returned in a GeoJSON format", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.7" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Entity In GeoJSON Representation", + "Create Initial Entity", + "Delete Created Entity" + ], + "teardown": "Delete Created Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "018_05_01 Simplified", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_05_01", + "doc": "Check that the queried entity by id can be returned in a GeoJSON format", + "tags": [ + "6_3_7", + "e-retrieve" + ], + "setup": null, + "teardown": null, + "template": "Retrieve Entity In GeoJSON Representation", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entity with Response Status Code set to 200 and\n Query Entity with Response Body containing en entity element with id set to '${entity_id}' and body content set to 'building-location-attribute-simplified.geojson'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/geo+json' and\n Query Parameter: options set to 'keyValues' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "018_05_02 Normalized", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_05_02", + "doc": "Check that the queried entity by id can be returned in a GeoJSON format", + "tags": [ + "6_3_7", + "e-retrieve" + ], + "setup": null, + "teardown": null, + "template": "Retrieve Entity In GeoJSON Representation", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entity with Response Status Code set to 200 and\n Query Entity with Response Body containing en entity element with id set to '${entity_id}' and body content set to 'building-location-attribute-normalized.geojson'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/geo+json' and\n Query Parameter: options set to '${EMPTY}' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_06.json b/doc/files/ContextInformation/Consumption/018_06.json new file mode 100644 index 0000000000000000000000000000000000000000..a17ae1c3b896ee5c23728c70e27235a8f48cacef --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_06.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_06", + "test_objective": "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", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Review JSON-LD Resolution When retrieving an entity", + "Setup Initial Entity", + "Delete Created Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "018_06_01 EmptyJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_06_01", + "doc": "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": [ + "6_3_5", + "e-retrieve" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Created Entity", + "template": "Review JSON-LD Resolution When retrieving an entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entity with Response Status Code set to 200 and\n Query Entity with Response Body containing en entity element with id set to '${entity_id}' and body content set to 'building-simple-attributes-sample-expanded-expectation.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/json' and\n Query Parameter: Link set to '<$${EMPTY}>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "018_06_02 CreationTimeJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_06_02", + "doc": "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": [ + "6_3_5", + "e-retrieve" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Created Entity", + "template": "Review JSON-LD Resolution When retrieving an entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entity with Response Status Code set to 200 and\n Query Entity with Response Body containing en entity element with id set to '${entity_id}' and body content set to 'building-simple-attributes-sample-compacted-expectation.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/json' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_01_01.json b/doc/files/ContextInformation/Consumption/019_01_01.json new file mode 100644 index 0000000000000000000000000000000000000000..28bb8ddae445e4c8be5bef5d461ce7c17a94e1e2 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_01_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_01", + "test_objective": "Check that you can query several entities based on ids", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_01_01 Query several entities based on ids", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_01", + "doc": "Check that you can query several entities based on ids", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list containing Entity Elements and\n Query Parameter: expectation_filename set to 'expectation_filename' and\n Query Parameter: entities_ids set to 'entities_ids_to_be_compared' and\n Query Parameter: ignore_core_context_version set to 'False'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_ids set to '${entities_ids_to_be_retrieved}' and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_01_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_01_02.json b/doc/files/ContextInformation/Consumption/019_01_02.json new file mode 100644 index 0000000000000000000000000000000000000000..c83004741877a906a73e09de909226b1dc03f0c0 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_01_02.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_02", + "test_objective": "Check that you can query several entities based on the entities types", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_01_02 Query several entities based on the entities types", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_02", + "doc": "Check that you can query several entities based on the entities types", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response body containing a list containing entity elements with different types and\n Query Parameter: filename set to 'expectation_filename' and\n Query Parameter: entities_representation_ids set to 'entities_ids_to_be_compared' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: ignore_core_context_version set to 'True'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: accept set to 'application/ld+json'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_01_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_01_03.json b/doc/files/ContextInformation/Consumption/019_01_03.json new file mode 100644 index 0000000000000000000000000000000000000000..cff4ac0a5f2b4e5988f1398e19204f95ab563819 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_01_03.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_03", + "test_objective": "Check that you can query several entities based on the given id pattern", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_01_03 Query several entities based on the given id pattern", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_03", + "doc": "Check that you can query several entities based on the given id pattern", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list containing Entity Elements and\n Query Parameter: expectation_filename set to 'expectation_filename' and\n Query Parameter: entities_ids set to 'entities_ids_to_be_compared' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: ignore_core_context_version set to 'False'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_id_pattern set to 'urn:ngsi-ld:Building:.*' and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_01_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_01_04.json b/doc/files/ContextInformation/Consumption/019_01_04.json new file mode 100644 index 0000000000000000000000000000000000000000..d748fa8b0f73b16fb7326d950d9bd2072f800045 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_01_04.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_04", + "test_objective": "Check that you can query several entities based on attribute names", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_01_04 Query several entities based on attribute names", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_04", + "doc": "Check that you can query several entities based on attribute names", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list containing Entity Elements and\n Query Parameter: expectation_filename set to 'expectation_filename' and\n Query Parameter: entities_ids set to 'entities_ids_to_be_compared' and\n Query Parameter: ignore_core_context_version set to 'False'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: attrs set to '${attributes_to_be_retrieved}'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_01_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_01_05.json b/doc/files/ContextInformation/Consumption/019_01_05.json new file mode 100644 index 0000000000000000000000000000000000000000..d7c2dcd4b75f35777c72760ba56125eec4859175 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_01_05.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_05", + "test_objective": "Check that you can query entities based on a geoquery", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_01_05 Query several entities based on a geoquery", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_05", + "doc": "Check that you can query entities based on a geoquery", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list containing Entity Elements and\n Query Parameter: expectation_filename set to 'expectation_filename' and\n Query Parameter: entities_ids set to 'entities_ids_to_be_compared' and\n Query Parameter: ignore_core_context_version set to 'False'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: accept set to 'application/ld+json' and\n Query Parameter: georel set to 'equals' and\n Query Parameter: geometry set to 'Point' and\n Query Parameter: coordinates set to '[13.3986, 52.5547]'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_01_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_02_01.json b/doc/files/ContextInformation/Consumption/019_02_01.json new file mode 100644 index 0000000000000000000000000000000000000000..1471f5f433cbc8d7d78d5a0a8e802bac8e685b89 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_02_01.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_02_01", + "test_objective": "Check that you can query one entity via POST Interaction based on id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Create Entities", + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_02_01 Query one entity via POST Interaction based on id", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_02_01", + "doc": "Check that you can query one entity via POST Interaction based on id", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities Via POST with Response Status Code set to 200 and\n Query Entities Via POST with Response Body containing a list containing Entity Elements and\n Query Parameter: expectation_filename set to 'expectation_filename' and\n Query Parameter: entities_ids set to 'entities_ids_to_be_compared' and\n Query Parameter: ignore_core_context_version set to 'False'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/query'\n method set to 'POST'\n Get Entities Via POST Request: and\n Query Parameter: entity_ids set to '${first_entity_id}' and\n Query Parameter: entity_types set to 'https://ngsi-ld-test-suite/context#Building' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: accept set to 'application/json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/query" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_02_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_02_02.json b/doc/files/ContextInformation/Consumption/019_02_02.json new file mode 100644 index 0000000000000000000000000000000000000000..cfcf88af795cadb06dd15bcb0d845e4077fe69b9 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_02_02.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_02_02", + "test_objective": "Check that you can query several entities via POST Interaction based on the entity type", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Create Entities", + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_02_02 Query several entities via POST Interaction based on the entities types", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_02_02", + "doc": "Check that you can query several entities via POST Interaction based on the entity type", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities Via POST with Response Status Code set to 200 and\n Query Entities Via POST with Response body containing a list containing entity elements with different types and\n Query Parameter: filename set to 'expectation_filename' and\n Query Parameter: entities_representation_ids set to 'entities_ids_to_be_compared' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: ignore_core_context_version set to 'True'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/query'\n method set to 'POST'\n Get Entities Via POST Request: and\n Query Parameter: entity_types set to 'https://ngsi-ld-test-suite/context#Vehicle' and\n Query Parameter: accept set to 'application/ld+json' and\n Query Parameter: content_type set to 'application/json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/query" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_02_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_02_03.json b/doc/files/ContextInformation/Consumption/019_02_03.json new file mode 100644 index 0000000000000000000000000000000000000000..2860bf8d8fe43c5e5ed925b60f36a23f859ed22a --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_02_03.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_02_03", + "test_objective": "Check that you can query several entities via POST Interaction based on the given id pattern", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Create Entities", + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_02_03 Query several entities via POST Interaction based on the given id pattern", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_02_03", + "doc": "Check that you can query several entities via POST Interaction based on the given id pattern", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities Via POST with Response Status Code set to 200 and\n Query Entities Via POST with Response Body containing a list containing Entity Elements and\n Query Parameter: expectation_filename set to 'expectation_filename' and\n Query Parameter: entities_ids set to 'entities_ids_to_be_compared' and\n Query Parameter: ignore_core_context_version set to 'False'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/query'\n method set to 'POST'\n Get Entities Via POST Request: and\n Query Parameter: entity_id_pattern set to 'urn:ngsi-ld:Building:.*' and\n Query Parameter: entity_types set to 'https://ngsi-ld-test-suite/context#Building' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: accept set to 'application/json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/query" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_02_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_02_04.json b/doc/files/ContextInformation/Consumption/019_02_04.json new file mode 100644 index 0000000000000000000000000000000000000000..de2976e2f31ec3546e325d36f736761f59a69e89 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_02_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_02_04", + "test_objective": "Check that you can query several entities via POST Interaction based on attribute names", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Create Entities", + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_02_04 Query several entities via POST Interaction based on attribute names", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_02_04", + "doc": "Check that you can query several entities via POST Interaction based on attribute names", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities Via POST with Response Status Code set to 200 and\n Query Entities Via POST with Response Body containing a list containing Entity Elements and\n Query Parameter: expectation_filename set to 'expectation_filename' and\n Query Parameter: entities_ids set to 'entities_ids_to_be_retrieved' and\n Query Parameter: ignore_core_context_version set to 'False'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/query'\n method set to 'POST'\n Get Entities Via POST Request: and\n Query Parameter: attrs set to '${attributes_to_be_retrieved}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: accept set to 'application/json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/query" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_02_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_02_05.json b/doc/files/ContextInformation/Consumption/019_02_05.json new file mode 100644 index 0000000000000000000000000000000000000000..db75a2738bdf9f25b1bd516c9171912595ba7ffd --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_02_05.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_02_05", + "test_objective": "Check that you can query entitites via POST Interaction asking for a GeoJSON representation", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Create Entities", + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_02_05 Query several entities via POST Interaction asking for a GeoJSON representation", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_02_05", + "doc": "Check that you can query entities via POST Interaction asking for a GeoJSON representation", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities Via POST with Response Status Code set to 200 and\n Query Entities Via POST with Check Response Body Content and\n Query Parameter: expectation_filename set to 'expectation_filename' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/query'\n method set to 'POST'\n Get Entities Via POST Request: and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: accept set to 'application/geo+json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: content_type set to 'application/json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/query" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_02_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_03_01.json b/doc/files/ContextInformation/Consumption/019_03_01.json new file mode 100644 index 0000000000000000000000000000000000000000..50cb5365a151f955099e4517c49820caded49e01 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_03_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_01", + "test_objective": "Check that you cannot query entities if the requested ids are incorrect", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_03_01 Query entities based on incorrect ids", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_01", + "doc": "Check that you cannot query entities if the requested ids are incorrect", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 400 and\n Query Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Entities with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_ids set to '${entities_ids_to_be_retrieved}' and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_03_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_03_02.json b/doc/files/ContextInformation/Consumption/019_03_02.json new file mode 100644 index 0000000000000000000000000000000000000000..17b5464c9a25efc939c5205609e74ccd01e13d90 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_03_02.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_02", + "test_objective": "Check that you cannot query entities if the requested entity types are incorrect", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_03_02 Query entities based on incorrect entity types", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_02", + "doc": "Check that you cannot query entities if the requested entity types are incorrect", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 400 and\n Query Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Entities with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_03_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_03_03.json b/doc/files/ContextInformation/Consumption/019_03_03.json new file mode 100644 index 0000000000000000000000000000000000000000..3dfa22fe513abb7cf9c70749ee68285aa449d2b2 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_03_03.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_03", + "test_objective": "Check that you cannot query entities if the requested id pattern is incorrect", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_03_03 Query several entities based on incorrect id pattern", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_03", + "doc": "Check that you cannot query entities if the requested id pattern is incorrect", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 400 and\n Query Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Entities with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_id_pattern set to 'invalid_entity_id_pattern**' and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_03_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_03_04.json b/doc/files/ContextInformation/Consumption/019_03_04.json new file mode 100644 index 0000000000000000000000000000000000000000..0d3ed4405f80c7ccce0792685812e4320994ca39 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_03_04.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_04", + "test_objective": "Check that you cannot query entities if the requested attribute names are incorrect", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_03_04 Query several entities based on incorrect attribute names", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_04", + "doc": "Check that you cannot query entities if the requested attribute names are incorrect", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 400 and\n Query Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Entities with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: attrs set to '${attributes_to_be_retrieved}'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_03_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_03_05.json b/doc/files/ContextInformation/Consumption/019_03_05.json new file mode 100644 index 0000000000000000000000000000000000000000..477b5a8dfbe300fdcc7f766be5eac0172a26728f --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_03_05.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_05", + "test_objective": "Check that you cannot query entities if the request has a wrong geometryProperty", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_03_05 Query entities when the request has a wrong geometryProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_05", + "doc": "Check that you cannot query entities if the request has a wrong geometryProperty", + "tags": [ + "5_7_2", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 400 and\n Query Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Entities with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: geoproperty set to 'location' and\n Query Parameter: georel set to 'invalid' and\n Query Parameter: geometry set to 'Point' and\n Query Parameter: coordinates set to '[-8.503,41.202]' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_03_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_04.json b/doc/files/ContextInformation/Consumption/019_04.json new file mode 100644 index 0000000000000000000000000000000000000000..78ed17f1cd9496608b483b549221647b763e0308 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_04.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_04", + "test_objective": "Check that the queried entities by Id can be returned in a simplified representation", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.7" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_04_01 Query entities in a simplified representation", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_04_01", + "doc": "Check that the queried entities by Id can be returned in a simplified representation", + "tags": [ + "6_3_7", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list containing Entity Elements and\n Query Parameter: expectation_filename set to 'expectation_filename' and\n Query Parameter: entities_ids set to 'entities_ids_to_be_compared' and\n Query Parameter: ignore_core_context_version set to 'False'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_ids set to '${entities_ids_to_be_retrieved}' and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: options set to 'keyValues'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_05.json b/doc/files/ContextInformation/Consumption/019_05.json new file mode 100644 index 0000000000000000000000000000000000000000..3a8d9be2cf3a8b73d8934350b417d3cbb0e4c549 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_05.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_05", + "test_objective": "Check that the queried entities by id can be returned in GeoJSON format", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.7" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Entities", + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_05_01 Get an entity by id that can be returned in GeoJSON format", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_05_01", + "doc": "Check that the queried entities by id can be returned in GeoJSON format", + "tags": [ + "6_3_7", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Check Response Body Content and\n Query Parameter: expectation_filename set to 'expectation_filename' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_ids set to '${entities_ids_to_be_retrieved}' and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: accept set to 'application/geo+json' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_06.json b/doc/files/ContextInformation/Consumption/019_06.json new file mode 100644 index 0000000000000000000000000000000000000000..5d70cf016cfd23135869e916fb83211d49c68772 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_06.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_06", + "test_objective": "Check that you can query entities specifying a maximum number of results", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.10", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.10" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_06_01 Query entities specifying a maximum number of results", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_06_01", + "doc": "Check that you can query entities specifying a maximum number of results", + "tags": [ + "6_3_10", + "e-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list of entities equal to '${2}' of type 'https://ngsi-ld-test-suite/context#Building' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_ids set to '${entities_ids_to_be_retrieved}' and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: limit set to '2'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_07.json b/doc/files/ContextInformation/Consumption/019_07.json new file mode 100644 index 0000000000000000000000000000000000000000..8b688e4978303c9515bdd828f850e1c60be9922d --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_07.json @@ -0,0 +1,60 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_07", + "test_objective": "If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results.", + "reference": "ETSI GS CIM 009 V1.3.1 [], clauses 5.7.2, 6.3.13", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.2", + "6.3.13" + ], + "pics_selection": "", + "keywords": [ + "Query Entities With Count", + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "Delete Initial Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_07_01 Check that the total number of matching results is returned if the count parameter is set to true and only the entity type is provided", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_07_01", + "doc": "If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results.", + "tags": [ + "e-query", + "5_7_2", + "6_3_13" + ], + "setup": null, + "teardown": null, + "template": "Query Entities With Count", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to ${expected_status_code} and\n Query Entities with Response Header: NGSILD-Results-Count equals to 2\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: q set to '${q}' and\n Query Parameter: count set to '${True}' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_07_02 Check that the total number of matching results is returned if the count parameter is set to true and a q parameter is provided", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_07_02", + "doc": "If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results.", + "tags": [ + "e-query", + "5_7_2", + "6_3_13" + ], + "setup": null, + "teardown": null, + "template": "Query Entities With Count", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to ${expected_status_code} and\n Query Entities with Response Header: NGSILD-Results-Count equals to 1\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: q set to '${q}' and\n Query Parameter: count set to '${True}' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_01.json b/doc/files/ContextInformation/Consumption/020_01.json new file mode 100644 index 0000000000000000000000000000000000000000..0e8cc7c667301dc6537e026ce70e46241776dc8b --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_01.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_01", + "test_objective": "Check that you can retrieve the temporal evolution of an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "Delete Initial Temporal Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "020_01_01 Retrieve the temporal evolution of an entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_01_01", + "doc": "Check that you can retrieve the temporal evolution of an entity", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-020-01-expectation.jsonld'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_02.json b/doc/files/ContextInformation/Consumption/020_02.json new file mode 100644 index 0000000000000000000000000000000000000000..ed48c4f77c1062818b5685226dd6be0c705cb2e7 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_02.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_02", + "test_objective": "Check that you can retrieve the temporal evolution of an entity using a context", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "Delete Initial Temporal Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "020_02_01 Retrieve the temporal evolution of an entity using a context", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_02_01", + "doc": "Check that you can retrieve the temporal evolution of an entity using a context", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-020-02-expectation.jsonld'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_03.json b/doc/files/ContextInformation/Consumption/020_03.json new file mode 100644 index 0000000000000000000000000000000000000000..55afadde9d8442ccdc7cd57b35207b82facc4b7d --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_03.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_03", + "test_objective": "Check that you can retrieve the temporal evolution of certain attributes of an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n and an attribute with an id set to ${atrId}\n}", + "test_cases": [ + { + "name": "020_03_01 Retrieve the temporal evolution of certain attributes of an entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_03_01", + "doc": "Check that you can retrieve the temporal evolution of certain attributes of an entity", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-020-03-expectation.jsonld'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: attrs set to '${temporal_attributes_to_be_retrieved}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_04.json b/doc/files/ContextInformation/Consumption/020_04.json new file mode 100644 index 0000000000000000000000000000000000000000..2a74af7de6cd1afa907a2ec339383ab6fe46902e --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_04.json @@ -0,0 +1,74 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_04", + "test_objective": "Check that you can retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query", + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n and an attribute with an id set to ${atrId}\n}", + "test_cases": [ + { + "name": "020_04_01 After", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_04_01", + "doc": "Check that you can retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-020-04-01-expectation.jsonld'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-08-01T13:03:00Z' and\n Query Parameter: endTimeAt set to '${EMPTY}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + }, + { + "name": "020_04_02 Before", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_04_02", + "doc": "Check that you can retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-020-04-02-expectation.jsonld'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: timerel set to 'before' and\n Query Parameter: timeAt set to '2020-08-01T12:05:00Z' and\n Query Parameter: endTimeAt set to '${EMPTY}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + }, + { + "name": "020_04_03 Between", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_04_03", + "doc": "Check that you can retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-020-04-03-expectation.jsonld'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: timerel set to 'between' and\n Query Parameter: timeAt set to '2020-08-01T12:00:00Z' and\n Query Parameter: endTimeAt set to '2020-08-01T13:00:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_05.json b/doc/files/ContextInformation/Consumption/020_05.json new file mode 100644 index 0000000000000000000000000000000000000000..b47b46515ffa48e0b8417c11e9a2eaf3c4543cc6 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_05.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_05", + "test_objective": "Check that you can retrieve the temporal evolution of the last N instances of entity attributes", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Retrieve the temporal evolution of the last N instances of entity attributes", + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n and an attribute with an id set to ${atrId}\n}", + "test_cases": [ + { + "name": "020_05_01 Retrieve Some Instances", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_05_01", + "doc": "Check that you can retrieve the temporal evolution of the last N instances of entity attributes", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Retrieve the temporal evolution of the last N instances of entity attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-020-05-01-expectation.jsonld'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: lastN set to '10' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + }, + { + "name": "020_05_02 Retrieve All Instances", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_05_02", + "doc": "Check that you can retrieve the temporal evolution of the last N instances of entity attributes", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Retrieve the temporal evolution of the last N instances of entity attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-020-05-02-expectation.jsonld'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: lastN set to '20' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_06.json b/doc/files/ContextInformation/Consumption/020_06.json new file mode 100644 index 0000000000000000000000000000000000000000..cd4ca044833c6cf8a954ce13a904bc2e1dd98e5b --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_06.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_06", + "test_objective": "Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI)", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.3" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "020_06_01 Retrieve the temporal evolution of an entity with an invalid id", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_06_01", + "doc": "Check that you cannot retrieve the temporal evolution of an entity with an invalid id (invalid URI)", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 400 and\n Retrieve Temporal Representation Of Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Retrieve Temporal Representation Of Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to 'invalidUri'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_07.json b/doc/files/ContextInformation/Consumption/020_07.json new file mode 100644 index 0000000000000000000000000000000000000000..c503e41a1e05a328345199832509ed787f4c0a48 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_07.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_07", + "test_objective": "Check that you cannot retrieve the temporal evolution of a non-existing entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.3" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "020_07_01 Retrieve the temporal evolution of a non-existing entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_07_01", + "doc": "Check that you cannot retrieve the temporal evolution of a non-existing entity", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 404 and\n Retrieve Temporal Representation Of Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Retrieve Temporal Representation Of Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to 'urn:ngsi-ld:Vehicle:unknowEntity'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_08.json b/doc/files/ContextInformation/Consumption/020_08.json new file mode 100644 index 0000000000000000000000000000000000000000..058a359b7271d4a346056b04fd46531bb2f19b69 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_08.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_08", + "test_objective": "Check that you cannot retrieve the temporal evolution of non-existing entity attributes", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "Delete Initial Temporal Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "020_08_01 Retrieve the temporal evolution of non-existing entity attributes", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_08_01", + "doc": "Check that you cannot retrieve the temporal evolution of non-existing entity attributes", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 404 and\n Retrieve Temporal Representation Of Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Retrieve Temporal Representation Of Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: attrs set to '${temporal_attributes_to_be_retrieved}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_08" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_09.json b/doc/files/ContextInformation/Consumption/020_09.json new file mode 100644 index 0000000000000000000000000000000000000000..2b0f0feb9547639c81d4cce93b55e059d7b108b9 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_09.json @@ -0,0 +1,73 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_09", + "test_objective": "Check that you cannot retrieve the temporal evolution of an entity with an invalid request content", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Retrieve the temporal evolution of an entity with an invalid request content", + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n and an attribute with an id set to ${atrId}\n}", + "test_cases": [ + { + "name": "020_09_01 After", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_09_01", + "doc": "Check that you cannot retrieve the temporal evolution of an entity with an invalid request content", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Retrieve the temporal evolution of an entity with an invalid request content", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 400 and\n Retrieve Temporal Representation Of Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Retrieve Temporal Representation Of Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '${EMPTY}' and\n Query Parameter: endTimeAt set to '${EMPTY}'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + }, + { + "name": "020_09_02 Before", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_09_02", + "doc": "Check that you cannot retrieve the temporal evolution of an entity with an invalid request content", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Retrieve the temporal evolution of an entity with an invalid request content", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 400 and\n Retrieve Temporal Representation Of Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Retrieve Temporal Representation Of Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: timerel set to 'before' and\n Query Parameter: timeAt set to '${EMPTY}' and\n Query Parameter: endTimeAt set to '${EMPTY}'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + }, + { + "name": "020_09_03 Between", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_09_03", + "doc": "Check that you cannot retrieve the temporal evolution of an entity with an invalid request content", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Retrieve the temporal evolution of an entity with an invalid request content", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 400 and\n Retrieve Temporal Representation Of Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Retrieve Temporal Representation Of Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: timerel set to 'between' and\n Query Parameter: timeAt set to '2020-08-01T12:00:00Z' and\n Query Parameter: endTimeAt set to '${EMPTY}'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_09" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_10.json b/doc/files/ContextInformation/Consumption/020_10.json new file mode 100644 index 0000000000000000000000000000000000000000..151f1dd524f320f4f8f872e250bf6777d1f24e1b --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_10.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_10", + "test_objective": "Check that you can retrieve the temporal evolution of an entity with the simplified temporal representation", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "Delete Initial Temporal Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "020_10_01 Retrieve the temporal evolution of an entity with the simplified temporal representation", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_10_01", + "doc": "Check that you can retrieve the temporal evolution of an entity with the simplified temporal representation", + "tags": [ + "5_7_3", + "te-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-020-10-expectation.jsonld'\n * the id was changed to '${temporal_entity_representation_id}'\n * response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: options set to '${options}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_10" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_01.json b/doc/files/ContextInformation/Consumption/021_01.json new file mode 100644 index 0000000000000000000000000000000000000000..ccf6e75f110e864b8927dab2b640973ee21da6c0 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_01.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_01", + "test_objective": "Check that you can query the temporal evolution of entities", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Query the temporal evolution of entities", + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n and containing a list of entities\n}", + "test_cases": [ + { + "name": "021_01_01 After", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_01_01", + "doc": "Check that you can query the temporal evolution of entities", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Query the temporal evolution of entities", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-01-01-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-08-01T12:04:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + }, + { + "name": "021_01_02 Before", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_01_02", + "doc": "Check that you can query the temporal evolution of entities", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Query the temporal evolution of entities", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-01-02-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: timerel set to 'before' and\n Query Parameter: timeAt set to '2020-09-01T13:06:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_02.json b/doc/files/ContextInformation/Consumption/021_02.json new file mode 100644 index 0000000000000000000000000000000000000000..f06d4efca8114d1a62bc95c57ac85898e6cad90e --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_02.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_02", + "test_objective": "Check that you can query the temporal evolution of certain attributes of entities", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Temporal Entities", + "Delete Initial Temporal Entities" + ], + "teardown": "Delete Initial Temporal Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "021_02_01 Query the temporal evolution of certain attributes of entities", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_02_01", + "doc": "Check that you can query the temporal evolution of certain attributes of entities", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-02-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: attrs set to '${temporal_attributes_to_be_retrieved}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_03.json b/doc/files/ContextInformation/Consumption/021_03.json new file mode 100644 index 0000000000000000000000000000000000000000..21060d4e6e19763a214b2490be9e38d652e84ea3 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_03.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_03", + "test_objective": "Check that you can query the temporal evolution of the last N instances of entities attributes", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Temporal Entities", + "Delete Initial Temporal Entities" + ], + "teardown": "Delete Initial Temporal Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "021_03_01 Query the temporal evolution of the last N instances of entities attributes", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_03_01", + "doc": "Check that you can query the temporal evolution of the last N instances of entities attributes", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-03-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: lastN set to '14' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_04.json b/doc/files/ContextInformation/Consumption/021_04.json new file mode 100644 index 0000000000000000000000000000000000000000..7b34c6861d247c4e0b18a29ba2eb35f180e159f7 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_04", + "test_objective": "Check that you can query the temporal evolution of entities using a context", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Temporal Entities", + "Delete Initial Temporal Entities" + ], + "teardown": "Delete Initial Temporal Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "021_04_01 Query the temporal evolution of entities using a context", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_04_01", + "doc": "Check that you can query the temporal evolution of entities using a context", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-04-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_05.json b/doc/files/ContextInformation/Consumption/021_05.json new file mode 100644 index 0000000000000000000000000000000000000000..761143a1a1c1087e7b0af64dd6da6d8e66297174 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_05.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_05", + "test_objective": "Check that you can query the temporal evolution of entities matching the given type(s)", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Temporal Entities", + "Delete Initial Temporal Entities" + ], + "teardown": "Delete Initial Temporal Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "021_05_01 Query the temporal evolution of entities matching the given type(s)", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_05_01", + "doc": "Check that you can query the temporal evolution of entities matching the given type(s)", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-05-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_06.json b/doc/files/ContextInformation/Consumption/021_06.json new file mode 100644 index 0000000000000000000000000000000000000000..287ef1d22c5be69cdb2fb0e71527bf6da0c0bf70 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_06.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_06", + "test_objective": "Check that you can query the temporal evolution of entities matching the given identifier(s)", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Temporal Entities", + "Delete Initial Temporal Entities" + ], + "teardown": "Delete Initial Temporal Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "021_06_01 Query the temporal evolution of entities matching the given identifier(s)", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_06_01", + "doc": "Check that you can query the temporal evolution of entities matching the given identifier(s)", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-06-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: entity_ids set to '${entity_ids_to_be_retrieved}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_07.json b/doc/files/ContextInformation/Consumption/021_07.json new file mode 100644 index 0000000000000000000000000000000000000000..e7e51ca7678f804bfba9055a885cba8c961d64b1 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_07.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_07", + "test_objective": "Check that you can query the temporal evolution of entities matching the given id pattern", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Temporal Entities", + "Delete Initial Temporal Entities" + ], + "teardown": "Delete Initial Temporal Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "021_07_01 Query the temporal evolution of entities matching the given id pattern", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_07_01", + "doc": "Check that you can query the temporal evolution of entities matching the given id pattern", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-07-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: entity_id_pattern set to 'urn:ngsi-ld:Vehicle:.*' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_08.json b/doc/files/ContextInformation/Consumption/021_08.json new file mode 100644 index 0000000000000000000000000000000000000000..8d9727be9801667b495367759f5aa16c0bcb9f0a --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_08.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_08", + "test_objective": "Check that you can query the temporal evolution of entities matching the given NGSI-LD query", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Temporal Entities", + "Delete Initial Temporal Entities" + ], + "teardown": "Delete Initial Temporal Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "021_08_01 Query the temporal evolution of entities matching the given NGSI-LD query", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_08_01", + "doc": "Check that you can query the temporal evolution of entities matching the given NGSI-LD query", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-08-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: ngsild_query set to 'speed>90' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_08" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_09.json b/doc/files/ContextInformation/Consumption/021_09.json new file mode 100644 index 0000000000000000000000000000000000000000..914b647546c4cad43fee418ab28918622be9ef57 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_09.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_09", + "test_objective": "Check that you can query the temporal evolution of entities matching the given NGSI-LD geo-query", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Query the temporal evolution of entities matching the given NGSI-LD geo-query", + "Setup Initial Temporal Entities", + "Delete Initial Temporal Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an a list of Temporal Entities \n}", + "test_cases": [ + { + "name": "021_09_01 Near Point", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_09_01", + "doc": "Check that you can query the temporal evolution of entities matching the given NGSI-LD geo-query", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Setup Initial Temporal Entities", + "teardown": "Delete Initial Temporal Entities", + "template": "Query the temporal evolution of entities matching the given NGSI-LD geo-query", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-09-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: georel set to 'near;maxDistance==2000' and\n Query Parameter: geometry set to 'Point' and\n Query Parameter: coordinates set to '[-8.503,41.202]' and\n Query Parameter: geoproperty set to '${EMPTY}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + }, + { + "name": "021_09_02 Within Polygon", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_09_02", + "doc": "Check that you can query the temporal evolution of entities matching the given NGSI-LD geo-query", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Setup Initial Temporal Entities", + "teardown": "Delete Initial Temporal Entities", + "template": "Query the temporal evolution of entities matching the given NGSI-LD geo-query", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-09-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: georel set to 'contains' and\n Query Parameter: geometry set to 'Polygon' and\n Query Parameter: coordinates set to '[[[-13.503,47.202],[6.541, 52.961],[20.37,44.653],[9.46,32.57],[-13.503,32.57],[-13.503,47.202]]]' and\n Query Parameter: geoproperty set to 'location' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_09" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_10.json b/doc/files/ContextInformation/Consumption/021_10.json new file mode 100644 index 0000000000000000000000000000000000000000..17082eaaafbc6bb8de9b5976bbadbefb6c3ccd5e --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_10.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_10", + "test_objective": "Check that you can query the temporal evolution of entities matching the given NGSI-LD Context Source filter", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Context Source Registration and Mock Server", + "Delete Initial Context Source Registration and Mock Server" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing a Context Source Registration of a context source (CS1) \n providing temporal information of two entities of type Building between 2020-08-01T22:07:00Z and 2021-08-01T21:07:00Z\n and CS1 containing two temporal entities of type Building and temporal evolution of those entities in the mentioned interval.\n}", + "test_cases": [ + { + "name": "021_10_01 Query the temporal evolution of entities matching the given NGSI-LD context source filter", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_10_01", + "doc": "Check that you can query the temporal evolution of entities matching the given NGSI-LD Context Source filter", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Create Initial Context Source Registration and Mock Server", + "teardown": "Delete Initial Context Source Registration and Mock Server", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Query Temporal Representation Of Entities with Response Status Code set to 200\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: csf set to 'endpoint' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_10" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_11.json b/doc/files/ContextInformation/Consumption/021_11.json new file mode 100644 index 0000000000000000000000000000000000000000..52059da0afda9969691f244a20645b085bee98db --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_11.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_11", + "test_objective": "Check that you can query the temporal evolution of entities with a limit to the number of entities to be retrieved", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Query the temporal evolution of entities with a limit to the number of entities to be retrieved", + "Setup Initial Temporal Entities", + "Delete Initial Temporal Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an a list of Temporal Entities \n}", + "test_cases": [ + { + "name": "021_11_01 Query Some entities", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_11_01", + "doc": "Check that you can query the temporal evolution of entities with a limit to the number of entities to be retrieved", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Setup Initial Temporal Entities", + "teardown": "Delete Initial Temporal Entities", + "template": "Query the temporal evolution of entities with a limit to the number of entities to be retrieved", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Response Body containing a list of entities equal to '${2}' of type 'Vehicle' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: limit set to '${2}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + }, + { + "name": "021_11_02 Query All entities", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_11_02", + "doc": "Check that you can query the temporal evolution of entities with a limit to the number of entities to be retrieved", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Setup Initial Temporal Entities", + "teardown": "Delete Initial Temporal Entities", + "template": "Query the temporal evolution of entities with a limit to the number of entities to be retrieved", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Response Body containing a list of entities equal to '${3}' of type 'Vehicle' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: limit set to '${3}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_11" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_12.json b/doc/files/ContextInformation/Consumption/021_12.json new file mode 100644 index 0000000000000000000000000000000000000000..3ecf629183d6d185325f40b58ed05596efaae9cb --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_12.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_12", + "test_objective": "Check that you cannot query the temporal evolution of entities with an invalid request or invalid request content", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "Delete Initial Temporal Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "021_12_01 Query the temporal evolution of entities with an invalid request", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_12_01", + "doc": "Check that you cannot query the temporal evolution of entities with an invalid request", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 400 and\n Query Temporal Representation Of Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Temporal Representation Of Entities with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-07-01T12:05:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_12" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_13.json b/doc/files/ContextInformation/Consumption/021_13.json new file mode 100644 index 0000000000000000000000000000000000000000..ec2c4f635fa3dc5a6ee0cf16792bcb456822bb12 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_13.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_13", + "test_objective": "Check that you can query the temporal evolution of entities using the entityOperations method", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Query the temporal evolution of entities using the entityOperations method", + "Setup Initial Temporal Entities", + "Delete Initial Temporal Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an a list of Temporal Entities \n}", + "test_cases": [ + { + "name": "021_13_01 After", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_13_01", + "doc": "Check that you can query the temporal evolution of entities using the entityOperations method", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Setup Initial Temporal Entities", + "teardown": "Delete Initial Temporal Entities", + "template": "Query the temporal evolution of entities using the entityOperations method", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities Via Post with Response Status Code set to 200 and\n Query Temporal Representation Of Entities Via Post with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-13-01-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entityOperations/query'\n method set to 'POST'\n Query Temporal Representation of Entities Via POST Request: and\n Query Parameter: query_file_name set to 'entity-operations-after-query.jsonld' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"' and\n Query Parameter: content_type set to 'application/json'\n}", + "http_verb": "POST", + "endpoint": "temporal/entityOperations/query" + }, + { + "name": "021_13_02 Before", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_13_02", + "doc": "Check that you can query the temporal evolution of entities using the entityOperations method", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Setup Initial Temporal Entities", + "teardown": "Delete Initial Temporal Entities", + "template": "Query the temporal evolution of entities using the entityOperations method", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities Via Post with Response Status Code set to 200 and\n Query Temporal Representation Of Entities Via Post with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-13-02-expectation.jsonld'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entityOperations/query'\n method set to 'POST'\n Query Temporal Representation of Entities Via POST Request: and\n Query Parameter: query_file_name set to 'entity-operations-before-query.jsonld' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"' and\n Query Parameter: content_type set to 'application/json'\n}", + "http_verb": "POST", + "endpoint": "temporal/entityOperations/query" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_13" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/021_14.json b/doc/files/ContextInformation/Consumption/021_14.json new file mode 100644 index 0000000000000000000000000000000000000000..2257cdf07a2cf544f7797cda6a0b7b331cdd0400 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/021_14.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_14", + "test_objective": "Check that you can query the temporal evolution of entities with the simplified representation", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.4" + ], + "pics_selection": "", + "keywords": [ + "Query the temporal evolution of entities", + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n and containing a list of entities\n}", + "test_cases": [ + { + "name": "021_14_01 After", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_14_01", + "doc": "Check that you can query the temporal evolution of entities with the simplified representation", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Query the temporal evolution of entities", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-14-01-expectation.json'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: timerel set to 'after' and\n Query Parameter: timeAt set to '2020-08-01T12:04:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: options set to 'temporalValues'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + }, + { + "name": "021_14_02 Before", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_14_02", + "doc": "Check that you can query the temporal evolution of entities with the simplified representation", + "tags": [ + "5_7_4", + "te-query" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Query the temporal evolution of entities", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Temporal Representation Of Entities with Response Status Code set to 200 and\n Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n compared with file 'vehicles-temporal-representation-021-14-02-expectation.json'\n and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'GET'\n Query Temporal Representation of Entities and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: timerel set to 'before' and\n Query Parameter: timeAt set to '2020-09-01T13:06:00Z' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: options set to 'temporalValues'\n}", + "http_verb": "GET", + "endpoint": "temporal/entities" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities", + "robotfile": "021_14" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/022_01.json b/doc/files/ContextInformation/Consumption/022_01.json new file mode 100644 index 0000000000000000000000000000000000000000..c81516bc0342921bb8ad347cdad05279e33fcd49 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/022_01.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/DISC/022_01", + "test_objective": "Check that you can retrieve a list of NGSI-LD entity types", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.5" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Available Entity Types", + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n and containing a list of entities\n}", + "test_cases": [ + { + "name": "022_01_01 WithoutJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/022_01_01", + "doc": "Check that you can retrieve a list of NGSI-LD entity types", + "tags": [ + "5_7_5", + "ed-types" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Retrieve Available Entity Types", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity Types with Response Status Code set to 200 and\n Retrieve Entity Types with Response Body containing an Entity Type List with expectation body equal to file: 'types/expectations/entity-type-list-022-01-01-expectation.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/types'\n method set to 'GET'\n Retrieve entity types: and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "GET", + "endpoint": "types" + }, + { + "name": "022_01_02 WithJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/022_01_02", + "doc": "Check that you can retrieve a list of NGSI-LD entity types", + "tags": [ + "5_7_5", + "ed-types" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Retrieve Available Entity Types", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity Types with Response Status Code set to 200 and\n Retrieve Entity Types with Response Body containing an Entity Type List with expectation body equal to file: 'types/expectations/entity-type-list-022-01-02-expectation.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/types'\n method set to 'GET'\n Retrieve entity types: and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "types" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypes", + "robotfile": "022_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/023_01.json b/doc/files/ContextInformation/Consumption/023_01.json new file mode 100644 index 0000000000000000000000000000000000000000..9304f516396f2f1f17314461219d29fe9c0390a5 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/023_01.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/DISC/023_01", + "test_objective": "Check that you can retrieve a list with a detailed representation of NGSI-LD entity types", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.6" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Details Of Available Entity Types", + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n and containing a list of entities\n}", + "test_cases": [ + { + "name": "023_01_01 WithoutJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/023_01_01", + "doc": "Check that you can retrieve a list with a detailed representation of NGSI-LD entity types", + "tags": [ + "5_7_6", + "ed-types-details" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Retrieve Details Of Available Entity Types", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity Types with Response Status Code set to 200 and\n Retrieve Entity Types with Response Body containing an Entity Type Element with expectation body equal to file: 'types/expectations/entity-type-023-01-01-expectation.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/types'\n method set to 'GET'\n Retrieve entity types: and\n Query Parameter: context set to '${EMPTY}' and\n Query Parameter: details set to 'true'\n}", + "http_verb": "GET", + "endpoint": "types" + }, + { + "name": "023_01_02 WithJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/023_01_02", + "doc": "Check that you can retrieve a list with a detailed representation of NGSI-LD entity types", + "tags": [ + "5_7_6", + "ed-types-details" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Retrieve Details Of Available Entity Types", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity Types with Response Status Code set to 200 and\n Retrieve Entity Types with Response Body containing an Entity Type Element with expectation body equal to file: 'types/expectations/entity-type-023-01-02-expectation.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/types'\n method set to 'GET'\n Retrieve entity types: and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: details set to 'true'\n}", + "http_verb": "GET", + "endpoint": "types" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Discovery/RetrieveDetailsOfAvailableEntityTypes", + "robotfile": "023_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/024_01.json b/doc/files/ContextInformation/Consumption/024_01.json new file mode 100644 index 0000000000000000000000000000000000000000..32abe0f1d71c200c2302ffcde7a55044c1fd2b25 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/024_01.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/DISC/024_01", + "test_objective": "Check that you cannot retrieve a detailed representation of an unknown NGSI-LD entity type", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "Delete Initial Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "024_01_01 Retrieve Detailed Representation Of Available Entity Type Without Context", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/024_01_01", + "doc": "Check that you cannot retrieve a detailed representation of an unknown NGSI-LD entity type", + "tags": [ + "5_7_7", + "ed-type" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity Type with Response Status Code set to 404 and\n Retrieve Entity Type with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Retrieve Entity Type with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/types/{type}'\n method set to 'GET'\n Retrieve Entity Type, with type set to 'Building'\n}", + "http_verb": "GET", + "endpoint": "types/{type}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypeInformation", + "robotfile": "024_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/024_02.json b/doc/files/ContextInformation/Consumption/024_02.json new file mode 100644 index 0000000000000000000000000000000000000000..b3e7e9ef20b1027134d27845abb227d4cab728bc --- /dev/null +++ b/doc/files/ContextInformation/Consumption/024_02.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/DISC/024_02", + "test_objective": "Check that you can retrieve a detailed representation of a specified NGSI-LD entity type", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "Delete Initial Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "024_02_01 Retrieve Detailed Representation Of Available Entity Type", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/024_02_01", + "doc": "Check that you can retrieve a detailed representation of a specified NGSI-LD entity type", + "tags": [ + "5_7_7", + "ed-type" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity Type with Response Status Code set to 200 and\n Retrieve Entity Type with Response body containing an Entity Type Info with expectation body set to file 'types/expectations/entity-type-info-024-01-expectation.json' and response body to be checked set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/types/{type}'\n method set to 'GET'\n Retrieve Entity Type, with type set to 'Building', with Header['Link'] containing 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "types/{type}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypeInformation", + "robotfile": "024_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/025_01.json b/doc/files/ContextInformation/Consumption/025_01.json new file mode 100644 index 0000000000000000000000000000000000000000..d7d1260bdcf8e19bf6abc396452160b439b7f2ac --- /dev/null +++ b/doc/files/ContextInformation/Consumption/025_01.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/DISC/025_01", + "test_objective": "Check that you can retrieve a list of NGSI-LD attributes", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.8", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.8" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Available Attributes", + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "025_01_01 WithoutJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/025_01_01", + "doc": "Check that you can retrieve a list of NGSI-LD attributes", + "tags": [ + "5_7_8", + "ed-attrs" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Retrieve Available Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Attributes with Response Status Code set to 200 and\n Retrieve Attributes with Response Body containing an Attribute List element\n * with filename set to 'types/expectations/attribute-list-025-01-01-expectation.json'\n * response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/attributes'\n method set to 'GET'\n Retrieve attributes: and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "GET", + "endpoint": "attributes" + }, + { + "name": "025_01_02 WithJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/025_01_02", + "doc": "Check that you can retrieve a list of NGSI-LD attributes", + "tags": [ + "5_7_8", + "ed-attrs" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Retrieve Available Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Attributes with Response Status Code set to 200 and\n Retrieve Attributes with Response Body containing an Attribute List element\n * with filename set to 'types/expectations/attribute-list-025-01-02-expectation.json'\n * response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/attributes'\n method set to 'GET'\n Retrieve attributes: and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "attributes" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Discovery/RetrieveAvailableAttributes", + "robotfile": "025_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/026_01.json b/doc/files/ContextInformation/Consumption/026_01.json new file mode 100644 index 0000000000000000000000000000000000000000..e00b43dc7e0e5d1404f774732245207ea4d39b1f --- /dev/null +++ b/doc/files/ContextInformation/Consumption/026_01.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/DISC/026_01", + "test_objective": "Check that you can retrieve a list with a detailed representation of NGSI-LD attributes", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.9", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.9" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Details Of Available Attributes", + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "026_01_01 WithoutJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/026_01_01", + "doc": "Check that you can retrieve a list with a detailed representation of NGSI-LD attributes", + "tags": [ + "5_7_9", + "ed-attrs-details" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Retrieve Details Of Available Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Attributes with Response Status Code set to 200 and\n Retrieve Attributes with Response body containing an array of attributes\n * with the expected payload defined in the file 'types/expectations/attribute-026-01-01-expectation.json'\n * and response body set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/attributes'\n method set to 'GET'\n Retrieve attributes: and\n Query Parameter: context set to '${EMPTY}' and\n Query Parameter: details set to 'true'\n}", + "http_verb": "GET", + "endpoint": "attributes" + }, + { + "name": "026_01_02 WithJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/026_01_02", + "doc": "Check that you can retrieve a list with a detailed representation of NGSI-LD attributes", + "tags": [ + "5_7_9", + "ed-attrs-details" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Retrieve Details Of Available Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Attributes with Response Status Code set to 200 and\n Retrieve Attributes with Response body containing an array of attributes\n * with the expected payload defined in the file 'types/expectations/attribute-026-01-02-expectation.json'\n * and response body set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/attributes'\n method set to 'GET'\n Retrieve attributes: and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: details set to 'true'\n}", + "http_verb": "GET", + "endpoint": "attributes" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Discovery/RetrieveDetailsOfAvailableAttributes", + "robotfile": "026_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/027_01.json b/doc/files/ContextInformation/Consumption/027_01.json new file mode 100644 index 0000000000000000000000000000000000000000..421007f9e3bfa03ce91c92e394ccc961c94b066a --- /dev/null +++ b/doc/files/ContextInformation/Consumption/027_01.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/DISC/027_01", + "test_objective": "Check that you cannot retrieve a detailed representation of an unknown NGSI-LD attribute", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.10", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.10" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "Delete Initial Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "027_01_01 Retrieve Detailed Representation Of Available Attribute Without Context", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/027_01_01", + "doc": "Check that you cannot retrieve a detailed representation of an unknown NGSI-LD attribute", + "tags": [ + "5_7_10", + "ed-attr" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Attribute with Response Status Code set to 404 and\n Retrieve Attribute with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Retrieve Attribute with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/attributes/{attribute_name}'\n method set to 'GET'\n Retrieve Attribute with attributeName set to 'airQualityLevel'\n}", + "http_verb": "GET", + "endpoint": "attributes/{attribute_name}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Discovery/RetrieveAvailableAttributeInformation", + "robotfile": "027_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/027_02.json b/doc/files/ContextInformation/Consumption/027_02.json new file mode 100644 index 0000000000000000000000000000000000000000..d378877557bf6d5365ebf465a9a7b1c13da1f31a --- /dev/null +++ b/doc/files/ContextInformation/Consumption/027_02.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/DISC/027_02", + "test_objective": "Check that you can retrieve a list with a detailed representation of NGSI-LD attributes", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.10", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.7.10" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "Delete Initial Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "027_02_01 Retrieve Detailed Representation Of Available Attribute", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/DISC/027_02_01", + "doc": "Check that you can retrieve a list with a detailed representation of NGSI-LD attributes", + "tags": [ + "5_7_10", + "ed-attr" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Attribute with Response Status Code set to 200 and\n Retrieve Attribute with Response body containing an array of attributes\n * with the expected payload defined in the file 'types/expectations/attribute-027-01-expectation.json'\n * and response body set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/attributes/{attribute_name}'\n method set to 'GET'\n Retrieve Attribute with attributeName set to 'airQualityLevel'\n}", + "http_verb": "GET", + "endpoint": "attributes/{attribute_name}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Discovery/RetrieveAvailableAttributeInformation", + "robotfile": "027_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_01.json b/doc/files/ContextInformation/Provision/001_01.json new file mode 100644 index 0000000000000000000000000000000000000000..0bfc084d940a768c324f95448ddda0bf980e1e8f --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_01.json @@ -0,0 +1,88 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_01", + "test_objective": "Check that you can create an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.1" + ], + "pics_selection": "", + "keywords": [ + "Create Entity Scenarios", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_01_01 MinimalEntity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_01_01", + "doc": "Check that you can create an entity", + "tags": [ + "5_6_1", + "e-create" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": "Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'created_entity' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-minimal-without-context-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "001_01_02 EntityWithSimpleProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_01_02", + "doc": "Check that you can create an entity", + "tags": [ + "5_6_1", + "e-create" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": "Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'created_entity' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-simple-attributes-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "001_01_03 EntityWithRelationshipsProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_01_03", + "doc": "Check that you can create an entity", + "tags": [ + "5_6_1", + "e-create" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": "Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'created_entity' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-relationship-of-property-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "001_01_04 EntityWithLocationAttribute", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_01_04", + "doc": "Check that you can create an entity", + "tags": [ + "5_6_1", + "e-create" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": "Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'created_entity' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-location-attribute-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_02.json b/doc/files/ContextInformation/Provision/001_02.json new file mode 100644 index 0000000000000000000000000000000000000000..81a53fb3cec4f1f3f508841186dfdcc24945a573 --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_02.json @@ -0,0 +1,72 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_02", + "test_objective": "Check that you cannot create an entity with an invalid request", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.1" + ], + "pics_selection": "", + "keywords": [ + "Create Entity With Invalid Request Scenarios" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_02_01 InvalidJson", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_02_01", + "doc": "Check that you cannot create an entity with an invalid request", + "tags": [ + "5_6_1", + "e-create" + ], + "setup": null, + "teardown": null, + "template": "Create Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity From File with Response Status Code set to 400 and\n Create Entity From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Create Entity From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request creation of an entity from filename 'invalid-json-sample.jsonld' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "001_02_02 EmptyJson", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_02_02", + "doc": "Check that you cannot create an entity with an invalid request", + "tags": [ + "5_6_1", + "e-create" + ], + "setup": null, + "teardown": null, + "template": "Create Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity From File with Response Status Code set to 400 and\n Create Entity From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Create Entity From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request creation of an entity from filename 'empty-sample.jsonld' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "001_02_03 EntityWithNoContext", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_02_03", + "doc": "Check that you cannot create an entity with an invalid request", + "tags": [ + "5_6_1", + "e-create" + ], + "setup": null, + "teardown": null, + "template": "Create Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity From File with Response Status Code set to 400 and\n Create Entity From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Entity From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request creation of an entity from filename 'building-minimal-without-context-sample.jsonld' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_03.json b/doc/files/ContextInformation/Provision/001_03.json new file mode 100644 index 0000000000000000000000000000000000000000..406bd644a0c97459006d1dfc8a1510a6b66f102a --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_03.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_03", + "test_objective": "Check that you cannot create an entity with an existing id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.1" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Entity" + ], + "teardown": "Delete Initial Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_03_01 Create one valid entity and one invalid entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_03_01", + "doc": "Check that you cannot create an entity with an existing id", + "tags": [ + "5_6_1", + "e-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Status Code set to 409 and\n Create Entity Selecting Content Type with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/AlreadyExists' and\n Create Entity Selecting Content Type with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-minimal-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_04.json b/doc/files/ContextInformation/Provision/001_04.json new file mode 100644 index 0000000000000000000000000000000000000000..c52a5a09848383027c4e6c103ef7b9e9bfffd1cb --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_04.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_04", + "test_objective": "Check that the @context is obtained from a Link Header if the Content-Type header is \"application/json\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_04_01 Create one entity using a provided Link header with JSON content type and NGSILD context", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_04_01", + "doc": "Check that the @context is obtained from a Link Header if the Content-Type header is \"application/json\"", + "tags": [ + "6_3_5", + "e-create" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-simple-attributes-sample.json'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "001_04_02 Create one entity using a provided Link header with JSON content type and no context", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_04_02", + "doc": "Check that the @context is obtained from a Link Header if the Content-Type header is \"application/json\"", + "tags": [ + "6_3_5", + "e-create" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'https://ngsi-ld-test-suite/context#almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-simple-attributes-sample.json'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_05.json b/doc/files/ContextInformation/Provision/001_05.json new file mode 100644 index 0000000000000000000000000000000000000000..d62f0e51fa927a8b5748745986b6c75167b17a80 --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_05.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_05", + "test_objective": "Check that the default @context is used if the Content-Type header is \"application/json\" and the Link header does not contain a JSON-LD @context", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_05_01 Create one entity using the default context with JSON content type and request without context", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_05_01", + "doc": "Check that the default @context is used if the Content-Type header is \"application/json\" and the Link header does not contain a JSON-LD @context, requesting without context", + "tags": [ + "6_3_5", + "e-create" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-simple-attributes-sample.json'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "001_05_02 Create one entity using the default context with JSON content type and request with context", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_05_02", + "doc": "Check that the default @context is used if the Content-Type header is \"application/json\" and the Link header does not contain a JSON-LD @context, requesting with context", + "tags": [ + "6_3_5", + "e-create" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'ngsi-ld:default-context/almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-simple-attributes-sample.json'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_06.json b/doc/files/ContextInformation/Provision/001_06.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b9822c4679fd840c33d395bfd99310797ed139 --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_06.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_06", + "test_objective": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/json\" and the request payload body (as JSON) contains a \"@context\" term", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_06_01 Create one entity containing a JSON-LD @context with a JSON content type", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_06_01", + "doc": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/json\" and the request payload body (as JSON) contains a \"@context\" term", + "tags": [ + "6_3_5", + "e-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 400 and\n Create Entity Selecting Content Type with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Entity Selecting Content Type with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-simple-attributes-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_07.json b/doc/files/ContextInformation/Provision/001_07.json new file mode 100644 index 0000000000000000000000000000000000000000..5d99bef0b35aa40f61309f15b4514071e7889afe --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_07.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_07", + "test_objective": "Check that the @context is obtained from the request payload body itself if the Content-Type header is \"application/ld+json\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_07_01 Create one entity using a JSON-LD @context obtained from the request payload with ld context", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_07_01", + "doc": "Check that the @context is obtained from the request payload body itself if the Content-Type header is \"application/ld+json\" and retrieve with ld context", + "tags": [ + "6_3_5", + "e-create" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-simple-attributes-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "001_07_02 Create one entity using a JSON-LD @context obtained from the request payload without context", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_07_02", + "doc": "Check that the @context is obtained from the request payload body itself if the Content-Type header is \"application/ld+json\" and retrieve without context", + "tags": [ + "6_3_5", + "e-create" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'https://ngsi-ld-test-suite/context#almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-simple-attributes-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_08.json b/doc/files/ContextInformation/Provision/001_08.json new file mode 100644 index 0000000000000000000000000000000000000000..73b24d2df7bc9f92c5fd05f8f66f2dc8cc1232b7 --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_08.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_08", + "test_objective": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and the request payload body does not contain a @context term", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_08_01 Create one entity not containing a JSON-LD @context with a JSON-LD content type", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_08_01", + "doc": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and the request payload body does not contain a @context term", + "tags": [ + "6_3_5", + "e-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 400 and\n Create Entity Selecting Content Type with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Entity Selecting Content Type with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-simple-attributes-sample.json'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_08" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_09.json b/doc/files/ContextInformation/Provision/001_09.json new file mode 100644 index 0000000000000000000000000000000000000000..4870ec22537c320dd05036847f459dfcdb8bf93c --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_09.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_09", + "test_objective": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and a JSON-LD Link header is present in the incoming HTTP request", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_09_01 Create one entity with a Link header and a JSON-LD content type", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_09_01", + "doc": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and a JSON-LD Link header is present in the incoming HTTP request", + "tags": [ + "6_3_5", + "e-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 400 and\n Create Entity Selecting Content Type with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Entity Selecting Content Type with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-simple-attributes-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_09" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/002_01.json b/doc/files/ContextInformation/Provision/002_01.json new file mode 100644 index 0000000000000000000000000000000000000000..ea1a0ae8f2b445d7efeaa78f1d0118378a0e6465 --- /dev/null +++ b/doc/files/ContextInformation/Provision/002_01.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/002_01", + "test_objective": "Check that you can delete an entity by id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.6" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "002_01_01 Delete an entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/002_01_01", + "doc": "Check that you can delete an entity by id", + "tags": [ + "5_6_6", + "e-delete" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Delete Entity by Id with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Status Code set to ${response2.status_code}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-simple-attributes-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/Entities/DeleteEntity", + "robotfile": "002_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/002_02.json b/doc/files/ContextInformation/Provision/002_02.json new file mode 100644 index 0000000000000000000000000000000000000000..c563210c1e83e358f44b8384bcb94b0833e3cf0f --- /dev/null +++ b/doc/files/ContextInformation/Provision/002_02.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/002_02", + "test_objective": "Check that you cannot delete an entity with invalid/missing id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.6" + ], + "pics_selection": "", + "keywords": [ + "Delete Entity Scenarios" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "002_02_01 Delete an entity if the Entity Id is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/002_02_01", + "doc": "Check that you cannot delete an entity with invalid/missing id", + "tags": [ + "5_6_6", + "e-delete" + ], + "setup": null, + "teardown": null, + "template": "Delete Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Entity by Id with Response Status Code set to 405 and\n Delete Entity by Id with Response Body containing the type '${EMPTY}' and\n Delete Entity by Id with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'DELETE'\n Delete Entity Request with id set to '${EMPTY}'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{id}" + }, + { + "name": "002_02_02 Delete an entity if the Entity Id is not a valid URI", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/002_02_02", + "doc": "Check that you cannot delete an entity with invalid/missing id", + "tags": [ + "5_6_6", + "e-delete" + ], + "setup": null, + "teardown": null, + "template": "Delete Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Entity by Id with Response Status Code set to 400 and\n Delete Entity by Id with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Delete Entity by Id with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'DELETE'\n Delete Entity Request with id set to 'thisisaninvaliduri'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/Entities/DeleteEntity", + "robotfile": "002_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/002_03.json b/doc/files/ContextInformation/Provision/002_03.json new file mode 100644 index 0000000000000000000000000000000000000000..c56c145de2581bc48e8d06f8fcb771f15404dff0 --- /dev/null +++ b/doc/files/ContextInformation/Provision/002_03.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/002_03", + "test_objective": "Check that you cannot delete an entity if the entity id is not known to the system", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.6" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "002_03_01 Delete an entity with an id not known to the system", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/002_03_01", + "doc": "Check that you cannot delete an entity if the entity id is not known to the system", + "tags": [ + "5_6_6", + "e-delete" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Entity by Id with Response Status Code set to 404 and\n Delete Entity by Id with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Delete Entity by Id with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'DELETE'\n Delete Entity Request with id set to '${entity_id}'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/Entities/DeleteEntity", + "robotfile": "002_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/003_01.json b/doc/files/ContextInformation/Provision/003_01.json new file mode 100644 index 0000000000000000000000000000000000000000..1aa60d5cc664fbd2e9a874c97e9c35a9ca3f28dc --- /dev/null +++ b/doc/files/ContextInformation/Provision/003_01.json @@ -0,0 +1,86 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/003_01", + "test_objective": "Check that you can create a batch of entities", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.7" + ], + "pics_selection": "", + "keywords": [ + "Batch Create Entity Scenarios", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "003_01_01 MinimalEntity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_01_01", + "doc": "Check that you can create a batch of entities", + "tags": [ + "5_6_7", + "be-create" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Batch Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 201 and\n Batch Create Entities with Response Body set to an array of created entities ids and\n Query Entities with Check Created Resource Set To and\n Query Parameter: 'expected_resources' set to 'entities_to_be_created' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to '' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + }, + { + "name": "003_01_02 EntityWithSimpleProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_01_02", + "doc": "Check that you can create a batch of entities", + "tags": [ + "5_6_7", + "be-create" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Batch Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 201 and\n Batch Create Entities with Response Body set to an array of created entities ids and\n Query Entities with Check Created Resource Set To and\n Query Parameter: 'expected_resources' set to 'entities_to_be_created' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to '' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + }, + { + "name": "003_01_03 EntityWithSimpleRelationships", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_01_03", + "doc": "Check that you can create a batch of entities", + "tags": [ + "5_6_7", + "be-create" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Batch Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 201 and\n Batch Create Entities with Response Body set to an array of created entities ids and\n Query Entities with Check Created Resource Set To and\n Query Parameter: 'expected_resources' set to 'entities_to_be_created' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to '' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + }, + { + "name": "003_01_04 EntityWithRelationshipsProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_01_04", + "doc": "Check that you can create a batch of entities", + "tags": [ + "5_6_7", + "be-create" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Batch Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 201 and\n Batch Create Entities with Response Body set to an array of created entities ids and\n Query Entities with Check Created Resource Set To and\n Query Parameter: 'expected_resources' set to 'entities_to_be_created' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to '' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/CreateBatchOfEntities", + "robotfile": "003_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/003_02.json b/doc/files/ContextInformation/Provision/003_02.json new file mode 100644 index 0000000000000000000000000000000000000000..65f8c15bc290a6ef25dafa8f46c3b2cd78b967e4 --- /dev/null +++ b/doc/files/ContextInformation/Provision/003_02.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/003_02", + "test_objective": "Check that you can create a batch of entities where some will succeed and others will fail", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Entity", + "Delete Initial Entities" + ], + "teardown": "Delete Initial Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "003_02_01 Create a batch of two valid entities and one invalid entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_02_01", + "doc": "Check that you can create a batch of two valid entities and one invalid entity", + "tags": [ + "5_6_7", + "be-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 207 and\n Batch Create Entities with Response body containing batch operation result set to '${expected_batch_operation_result}' and\n Query Entities with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to '' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/CreateBatchOfEntities", + "robotfile": "003_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/003_03.json b/doc/files/ContextInformation/Provision/003_03.json new file mode 100644 index 0000000000000000000000000000000000000000..8edd0961f865dbd28478edbc3314dfa8612ad0f1 --- /dev/null +++ b/doc/files/ContextInformation/Provision/003_03.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/003_03", + "test_objective": "Check that you cannot create a batch of entities with an invalid request", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.7" + ], + "pics_selection": "", + "keywords": [ + "Create Batch Entity With Invalid Request Scenarios" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "003_03_01 InvalidJson", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_03_01", + "doc": "Check that you cannot create a batch of entities with an invalid request", + "tags": [ + "5_6_7", + "be-create" + ], + "setup": null, + "teardown": null, + "template": "Create Batch Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Request Entities From File with Response Status Code set to 400 and\n Batch Request Entities From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Batch Request Entities From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Batch Entity Delete Request with operation set to 'create', Content-Type set to 'application/ld+json', and body set to 'batch/invalid-json-sample.jsonld\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + }, + { + "name": "003_03_02 EmptyJson", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_03_02", + "doc": "Check that you cannot create a batch of entities with an invalid request", + "tags": [ + "5_6_7", + "be-create" + ], + "setup": null, + "teardown": null, + "template": "Create Batch Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Request Entities From File with Response Status Code set to 400 and\n Batch Request Entities From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Batch Request Entities From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Batch Entity Delete Request with operation set to 'create', Content-Type set to 'application/ld+json', and body set to 'batch/empty-sample.jsonld\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/BatchEntities/CreateBatchOfEntities", + "robotfile": "003_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/003_04.json b/doc/files/ContextInformation/Provision/003_04.json new file mode 100644 index 0000000000000000000000000000000000000000..dc73f06bc80cc82f54437ab38c7d71daf64f1a40 --- /dev/null +++ b/doc/files/ContextInformation/Provision/003_04.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/003_04", + "test_objective": "Check that the @context is obtained from a Link Header if the Content-Type header is \"application/json\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "003_04_01 Create a batch of one entity using a provided Link header with JSON content type and retrieve the entity with context detail", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_04_01", + "doc": "Check that the @context is obtained from a Link Header if the Content-Type header is \"application/json\"", + "tags": [ + "6_3_5", + "be-create" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 201 and\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + }, + { + "name": "003_04_02 Create a batch of one entity using a provided Link header with JSON content type and retrieve the entity without context detail", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_04_02", + "doc": "Check that the @context is obtained from a Link Header if the Content-Type header is \"application/json\"", + "tags": [ + "6_3_5", + "be-create" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 201 and\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'https://ngsi-ld-test-suite/context#almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Provision/BatchEntities/CreateBatchOfEntities", + "robotfile": "003_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/003_05.json b/doc/files/ContextInformation/Provision/003_05.json new file mode 100644 index 0000000000000000000000000000000000000000..0c1266991edf82d58d03a34f4c0d95e560cb967a --- /dev/null +++ b/doc/files/ContextInformation/Provision/003_05.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/003_05", + "test_objective": "Check that the default @context is used if the Content-Type header is \"application/json\" and the Link header does not contain a JSON-LD @context", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "003_05_01 Create a batch of one entity using the default context with JSON content type", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_05_01", + "doc": "Check that the default @context is used if the Content-Type header is \"application/json\" and the Link header does not contain a JSON-LD @context and retrieve the entity without context", + "tags": [ + "6_3_5", + "be-create" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 201 and\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + }, + { + "name": "003_05_02 Create a batch of one entity using the default context with JSON content type", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_05_02", + "doc": "Check that the default @context is used if the Content-Type header is \"application/json\" and the Link header does not contain a JSON-LD @context and retrieve the entity with context", + "tags": [ + "6_3_5", + "be-create" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 201 and\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'ngsi-ld:default-context/almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Provision/BatchEntities/CreateBatchOfEntities", + "robotfile": "003_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/003_06.json b/doc/files/ContextInformation/Provision/003_06.json new file mode 100644 index 0000000000000000000000000000000000000000..8868b6a7c03b0c93e89e816feb41fa67b902f6e1 --- /dev/null +++ b/doc/files/ContextInformation/Provision/003_06.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/003_06", + "test_objective": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/json\" and the request payload body (as JSON) contains a \"@context\" term", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "003_06_01 Create a batch of one entity containing a JSON-LD @context with a JSON content type", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_06_01", + "doc": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/json\" and the request payload body (as JSON) contains a \"@context\" term", + "tags": [ + "6_3_5", + "be-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 400 and\n Batch Create Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Batch Create Entities with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/CreateBatchOfEntities", + "robotfile": "003_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/003_07.json b/doc/files/ContextInformation/Provision/003_07.json new file mode 100644 index 0000000000000000000000000000000000000000..436f5d68628c880dc7a77a8964073c93dbde9962 --- /dev/null +++ b/doc/files/ContextInformation/Provision/003_07.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/003_07", + "test_objective": "Check that the @context is obtained from the request payload body itself if the Content-Type header is \"application/ld+json\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "003_07_01 Create a batch of one entity using a JSON-LD @context obtained from the request payload", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_07_01", + "doc": "Check that the @context is obtained from the request payload body itself if the Content-Type header is \"application/ld+json\" and the response attribute should be compacted as we used the same context as provided when creating the entity", + "tags": [ + "6_3_5", + "be-create" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 201 and\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + }, + { + "name": "003_07_02 Create a batch of one entity using a JSON-LD @context obtained from the request payload", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_07_02", + "doc": "Check that the @context is obtained from the request payload body itself if the Content-Type header is \"application/ld+json\" and response attribute should not be compacted as we did not provide a context containing this term", + "tags": [ + "6_3_5", + "be-create" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 201 and\n Retrieve Entity by Id with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'https://ngsi-ld-test-suite/context#almostFull' and\n Query Parameter: response_body set to 'response1.json()'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Provision/BatchEntities/CreateBatchOfEntities", + "robotfile": "003_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/003_08.json b/doc/files/ContextInformation/Provision/003_08.json new file mode 100644 index 0000000000000000000000000000000000000000..9cc9abf3da0e72c184ac54bc7da775a75cbb9182 --- /dev/null +++ b/doc/files/ContextInformation/Provision/003_08.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/003_08", + "test_objective": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and the request payload body does not contain a @context term", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "003_08_01 Create a batch of one entity not containing a JSON-LD @context with a JSON-LD content type", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_08_01", + "doc": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and the request payload body does not contain a @context term", + "tags": [ + "6_3_5", + "be-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 400 and\n Batch Create Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Batch Create Entities with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/CreateBatchOfEntities", + "robotfile": "003_08" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/003_09.json b/doc/files/ContextInformation/Provision/003_09.json new file mode 100644 index 0000000000000000000000000000000000000000..27667e06d1581a1a0b5a5b0ed776f010421b6b14 --- /dev/null +++ b/doc/files/ContextInformation/Provision/003_09.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/003_09", + "test_objective": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and a JSON-LD Link header is present in the incoming HTTP request", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "003_09_01 Create a batch of one entity with a Link header and a JSON-LD content type", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_09_01", + "doc": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and a JSON-LD Link header is present in the incoming HTTP request", + "tags": [ + "6_3_5", + "be-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 400 and\n Batch Create Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Batch Create Entities with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/CreateBatchOfEntities", + "robotfile": "003_09" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/004_01.json b/doc/files/ContextInformation/Provision/004_01.json new file mode 100644 index 0000000000000000000000000000000000000000..37c74bf50996538b2c3c6060c7ebe6b343b306b6 --- /dev/null +++ b/doc/files/ContextInformation/Provision/004_01.json @@ -0,0 +1,70 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/004_01", + "test_objective": "Check that you can upsert a batch of non-existing entities and they will be created", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.8", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Batch Upsert Entity Scenarios", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "004_01_01 EntityWithSimpleProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_01_01", + "doc": "Check that you can upsert a batch of non-existing entities", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 201 and\n Batch Upsert Entities with Response Body set to an array of created entities ids and\n Query Entities with Updated Entities set to '${entities_to_be_upserted}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + }, + { + "name": "004_01_02 EntityWithSimpleRelationships", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_01_02", + "doc": "Check that you can upsert a batch of non-existing entities", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 201 and\n Batch Upsert Entities with Response Body set to an array of created entities ids and\n Query Entities with Updated Entities set to '${entities_to_be_upserted}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + }, + { + "name": "004_01_03 EntityWithRelationshipsProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_01_03", + "doc": "Check that you can upsert a batch of non-existing entities", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 201 and\n Batch Upsert Entities with Response Body set to an array of created entities ids and\n Query Entities with Updated Entities set to '${entities_to_be_upserted}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities", + "robotfile": "004_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/004_02.json b/doc/files/ContextInformation/Provision/004_02.json new file mode 100644 index 0000000000000000000000000000000000000000..4d2eec8c4ae255e9d490c5cee2540c72662bded0 --- /dev/null +++ b/doc/files/ContextInformation/Provision/004_02.json @@ -0,0 +1,71 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/004_02", + "test_objective": "Check that you can upsert a batch of non-existing and existing entities where non-existing will be created and existing will be replaced", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.8", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Batch Upsert Non-existing And Existing Entities Scenarios", + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "004_02_01 EntityWithSimpleProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_02_01", + "doc": "Check that you can upsert a batch of non-existing and existing entities", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Non-existing And Existing Entities Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 201 and\n Batch Upsert Entities with Response Body set to an array of created entities ids and\n Query Entities with Updated Entities set to '${entities_to_be_upserted}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + }, + { + "name": "004_02_02 EntityWithSimpleRelationships", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_02_02", + "doc": "Check that you can upsert a batch of non-existing and existing entities", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Non-existing And Existing Entities Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 201 and\n Batch Upsert Entities with Response Body set to an array of created entities ids and\n Query Entities with Updated Entities set to '${entities_to_be_upserted}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + }, + { + "name": "004_02_03 EntityWithRelationshipsProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_02_03", + "doc": "Check that you can upsert a batch of non-existing and existing entities", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Non-existing And Existing Entities Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 201 and\n Batch Upsert Entities with Response Body set to an array of created entities ids and\n Query Entities with Updated Entities set to '${entities_to_be_upserted}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities", + "robotfile": "004_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/004_03.json b/doc/files/ContextInformation/Provision/004_03.json new file mode 100644 index 0000000000000000000000000000000000000000..6e024155fec71e18772886e15447fb795d00e15f --- /dev/null +++ b/doc/files/ContextInformation/Provision/004_03.json @@ -0,0 +1,71 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/004_03", + "test_objective": "Check that you can upsert a batch of existing entities and they will be replaced", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.8", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Batch Upsert Existing Entities Scenarios", + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n and containing a list of entities\n}", + "test_cases": [ + { + "name": "004_03_01 EntityWithSimpleProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_03_01", + "doc": "Check that you can upsert a batch of existing entities", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Existing Entities Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 204 and\n Query Entities with Updated Entities set to '${entities_to_be_upserted}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + }, + { + "name": "004_03_02 EntityWithSimpleRelationships", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_03_02", + "doc": "Check that you can upsert a batch of existing entities", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Existing Entities Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 204 and\n Query Entities with Updated Entities set to '${entities_to_be_upserted}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + }, + { + "name": "004_03_03 EntityWithRelationshipsProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_03_03", + "doc": "Check that you can upsert a batch of existing entities", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Existing Entities Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 204 and\n Query Entities with Updated Entities set to '${entities_to_be_upserted}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities", + "robotfile": "004_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/004_04.json b/doc/files/ContextInformation/Provision/004_04.json new file mode 100644 index 0000000000000000000000000000000000000000..33f7bd0aba739fc006c22d9742d9f475729499e3 --- /dev/null +++ b/doc/files/ContextInformation/Provision/004_04.json @@ -0,0 +1,71 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/004_04", + "test_objective": "Check that you can upsert a batch of entities with update option", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.8", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Batch Upsert Entities With Update Option Scenarios", + "Setup Initial Entity", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "004_04_01 EntityWithSimpleProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_04_01", + "doc": "Check that you can upsert a batch of entities with update option", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Entities With Update Option Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 201 and\n Batch Upsert Entities with Response Body set to an array of created entities ids and\n Query Entities with Updated Entities set to '${updated_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'update' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + }, + { + "name": "004_04_02 EntityWithSimpleRelationships", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_04_02", + "doc": "Check that you can upsert a batch of entities with update option", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Entities With Update Option Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 201 and\n Batch Upsert Entities with Response Body set to an array of created entities ids and\n Query Entities with Updated Entities set to '${updated_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'update' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + }, + { + "name": "004_04_03 EntityWithRelationshipsProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_04_03", + "doc": "Check that you can upsert a batch of entities with update option", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entities", + "template": "Batch Upsert Entities With Update Option Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 201 and\n Batch Upsert Entities with Response Body set to an array of created entities ids and\n Query Entities with Updated Entities set to '${updated_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'update' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities", + "robotfile": "004_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/004_05.json b/doc/files/ContextInformation/Provision/004_05.json new file mode 100644 index 0000000000000000000000000000000000000000..551b379681a6fb72b13dad16e5738142b2897cc0 --- /dev/null +++ b/doc/files/ContextInformation/Provision/004_05.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/004_05", + "test_objective": "Check that you can upsert a batch of entities where some will succeed and others will fail", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.8", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "004_05_01 Upsert a batch of two valid entities and one invalid entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_05_01", + "doc": "Check that you can upsert a batch of two valid entities and one invalid entity", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": null, + "teardown": "Delete Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 207 and\n Batch Upsert Entities with Response body containing batch operation result set to '${expected_batch_operation_result}' and\n Query Entities with Updated Entities set to '${upserted_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities", + "robotfile": "004_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/004_06.json b/doc/files/ContextInformation/Provision/004_06.json new file mode 100644 index 0000000000000000000000000000000000000000..2e217abcd63c6087bd4146b691712e56dc2a1b03 --- /dev/null +++ b/doc/files/ContextInformation/Provision/004_06.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/004_06", + "test_objective": "Check that you cannot upsert a batch of entities with an invalid request", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.8", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Batch Upsert Entity With Invalid Request Scenarios" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "004_06_01 InvalidJson", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_06_01", + "doc": "Check that you cannot upsert a batch of entities with an invalid request", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": null, + "teardown": null, + "template": "Batch Upsert Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Request Entities From File with Response Status Code set to 400 and\n Batch Request Entities From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Batch Request Entities From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert'\n method set to 'POST'\n Batch Entity Delete Request with operation set to 'upsert', Content-Type set to 'application/ld+json', and body set to 'batch/invalid-json-sample.jsonld\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert" + }, + { + "name": "004_06_02 InvalidJsonLd", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_06_02", + "doc": "Check that you cannot upsert a batch of entities with an invalid request", + "tags": [ + "5_6_8", + "be-upsert" + ], + "setup": null, + "teardown": null, + "template": "Batch Upsert Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Request Entities From File with Response Status Code set to 400 and\n Batch Request Entities From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Batch Request Entities From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert'\n method set to 'POST'\n Batch Entity Delete Request with operation set to 'upsert', Content-Type set to 'application/ld+json', and body set to 'batch/invalid-json-ld-sample.jsonld\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities", + "robotfile": "004_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/005_01.json b/doc/files/ContextInformation/Provision/005_01.json new file mode 100644 index 0000000000000000000000000000000000000000..946b236e07bd00aab249417cb670d432be3cf236 --- /dev/null +++ b/doc/files/ContextInformation/Provision/005_01.json @@ -0,0 +1,71 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/005_01", + "test_objective": "Check that you can update a batch of entities", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.9", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.9" + ], + "pics_selection": "", + "keywords": [ + "Batch Update Entity Scenarios", + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n and containing a list of entities\n}", + "test_cases": [ + { + "name": "005_01_01 EntityWithSimpleProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/005_01_01", + "doc": "Check that you can update a batch of entities", + "tags": [ + "5_6_9", + "be-update" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Batch Update Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Update Entities with Response Status Code set to 204 and\n Query Entities with Updated Entities set to '${updated_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/update?${params_as_string}'\n method set to 'POST'\n Request batch update operation over entity from filename '@{entities_to_be_updated}' with overwrite_option set to '${EMPTY}' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/update?${params_as_string}" + }, + { + "name": "005_01_02 EntityWithSimpleRelationships", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/005_01_02", + "doc": "Check that you can update a batch of entities", + "tags": [ + "5_6_9", + "be-update" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Batch Update Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Update Entities with Response Status Code set to 204 and\n Query Entities with Updated Entities set to '${updated_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/update?${params_as_string}'\n method set to 'POST'\n Request batch update operation over entity from filename '@{entities_to_be_updated}' with overwrite_option set to '${EMPTY}' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/update?${params_as_string}" + }, + { + "name": "005_01_03 EntityWithRelationshipsProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/005_01_03", + "doc": "Check that you can update a batch of entities", + "tags": [ + "5_6_9", + "be-update" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Batch Update Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Update Entities with Response Status Code set to 204 and\n Query Entities with Updated Entities set to '${updated_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/update?${params_as_string}'\n method set to 'POST'\n Request batch update operation over entity from filename '@{entities_to_be_updated}' with overwrite_option set to '${EMPTY}' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/update?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities", + "robotfile": "005_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/005_02.json b/doc/files/ContextInformation/Provision/005_02.json new file mode 100644 index 0000000000000000000000000000000000000000..aef00418b007e2d54292bfa50d91d48eb866e8db --- /dev/null +++ b/doc/files/ContextInformation/Provision/005_02.json @@ -0,0 +1,71 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/005_02", + "test_objective": "Check that you can update a batch of entities with noOverwrite option", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.9", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.9" + ], + "pics_selection": "", + "keywords": [ + "Batch Update Entity With NoOverwrite Option Scenarios", + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n and containing a list of entities\n}", + "test_cases": [ + { + "name": "005_02_01 EntityWithExistingAttributes", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/005_02_01", + "doc": "Check that you can update a batch of entities with noOverwrite option", + "tags": [ + "5_6_9", + "be-update" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Batch Update Entity With NoOverwrite Option Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Update Entities with Response Status Code set to 204 and\n Query Entities with Updated Entities set to '${updated_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/update?${params_as_string}'\n method set to 'POST'\n Request batch update operation over entity from filename '@{entities_to_be_updated}' with overwrite_option set to '${EMPTY}' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/update?${params_as_string}" + }, + { + "name": "005_02_02 EntityWithNewAttribute", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/005_02_02", + "doc": "Check that you can update a batch of entities with noOverwrite option", + "tags": [ + "5_6_9", + "be-update" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Batch Update Entity With NoOverwrite Option Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Update Entities with Response Status Code set to 204 and\n Query Entities with Updated Entities set to '${updated_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/update?${params_as_string}'\n method set to 'POST'\n Request batch update operation over entity from filename '@{entities_to_be_updated}' with overwrite_option set to '${EMPTY}' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/update?${params_as_string}" + }, + { + "name": "005_02_03 EntityWithNewAndExistingAttribute", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/005_02_03", + "doc": "Check that you can update a batch of entities with noOverwrite option", + "tags": [ + "5_6_9", + "be-update" + ], + "setup": "Setup Initial Entities", + "teardown": "Delete Initial Entities", + "template": "Batch Update Entity With NoOverwrite Option Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Update Entities with Response Status Code set to 204 and\n Query Entities with Updated Entities set to '${updated_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/update?${params_as_string}'\n method set to 'POST'\n Request batch update operation over entity from filename '@{entities_to_be_updated}' with overwrite_option set to '${EMPTY}' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/update?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities", + "robotfile": "005_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/005_03.json b/doc/files/ContextInformation/Provision/005_03.json new file mode 100644 index 0000000000000000000000000000000000000000..6b73fdd05a782145d3be69304f0da29f72408963 --- /dev/null +++ b/doc/files/ContextInformation/Provision/005_03.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/005_03", + "test_objective": "Check that you can update a batch of entities where some will succeed and others will fail", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.9", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.9" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "Delete Initial Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "005_03_01 Update a batch of non-existing and existing entities", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/005_03_01", + "doc": "Check that you can update a batch of non-existing and existing entities", + "tags": [ + "5_6_9", + "be-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Update Entities with Response Status Code set to 207 and\n Batch Update Entities with Response body containing batch operation result set to '${expected_batch_operation_result}' and\n Query Entities with Updated Entities set to '${updated_entities}' valid entities\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/update?${params_as_string}'\n method set to 'POST'\n Request batch update operation over entity from filename '@{entities_to_be_updated}' with overwrite_option set to '${EMPTY}' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/update?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities", + "robotfile": "005_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/005_04.json b/doc/files/ContextInformation/Provision/005_04.json new file mode 100644 index 0000000000000000000000000000000000000000..38527c528392528e07af9ad9b42e1dccc4811eb7 --- /dev/null +++ b/doc/files/ContextInformation/Provision/005_04.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/005_04", + "test_objective": "Check that you cannot update a batch of entities with an invalid request", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.9", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.9" + ], + "pics_selection": "", + "keywords": [ + "Batch Update Entity With Invalid Request Scenarios" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "005_04_01 InvalidJson", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/005_04_01", + "doc": "Check that you cannot update a batch of entities with an invalid request", + "tags": [ + "5_6_9", + "be-update" + ], + "setup": null, + "teardown": null, + "template": "Batch Update Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Request Entities From File with Response Status Code set to 400 and\n Batch Request Entities From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Batch Request Entities From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/update'\n method set to 'POST'\n Batch Entity Delete Request with operation set to 'update', Content-Type set to 'application/ld+json', and body set to 'batch/invalid-json-sample.jsonld\n}", + "http_verb": "POST", + "endpoint": "entityOperations/update" + }, + { + "name": "005_04_02 InvalidJsonLd", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/005_04_02", + "doc": "Check that you cannot update a batch of entities with an invalid request", + "tags": [ + "5_6_9", + "be-update" + ], + "setup": null, + "teardown": null, + "template": "Batch Update Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Request Entities From File with Response Status Code set to 400 and\n Batch Request Entities From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Batch Request Entities From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/update'\n method set to 'POST'\n Batch Entity Delete Request with operation set to 'update', Content-Type set to 'application/ld+json', and body set to 'batch/invalid-json-ld-sample.jsonld\n}", + "http_verb": "POST", + "endpoint": "entityOperations/update" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities", + "robotfile": "005_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/006_01.json b/doc/files/ContextInformation/Provision/006_01.json new file mode 100644 index 0000000000000000000000000000000000000000..81e54d432f87c4069071ecf46cf20ebb43075948 --- /dev/null +++ b/doc/files/ContextInformation/Provision/006_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/006_01", + "test_objective": "Check that you can delete a batch of entities", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.10", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.10" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n and containing a list of entities\n}", + "test_cases": [ + { + "name": "006_01_01 Delete a batch of entities", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/006_01_01", + "doc": "Check that you can delete a batch of entities", + "tags": [ + "5_6_10", + "be-delete" + ], + "setup": "Setup Initial Entities", + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Delete Entities with Response Status Code set to 204 and\n Query Entities with Response body is empty\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/delete'\n method set to 'POST'\n Batch Delete Entities: and\n Query Parameter: entities_ids_to_be_deleted set to '@{entities_ids_to_be_deleted}'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/delete" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities", + "robotfile": "006_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/006_02.json b/doc/files/ContextInformation/Provision/006_02.json new file mode 100644 index 0000000000000000000000000000000000000000..ba73cc078dc6e4b06b2ad8c44f8bf352671949f1 --- /dev/null +++ b/doc/files/ContextInformation/Provision/006_02.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/006_02", + "test_objective": "Check that you can delete a batch of entities where some will succeed and others will fail", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.10", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.10" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "006_02_01 Delete a batch of non-existing and existing entities", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/006_02_01", + "doc": "Check that you can delete a batch of non-existing and existing entities", + "tags": [ + "5_6_10", + "be-delete" + ], + "setup": "Setup Initial Entity", + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Delete Entities with Response Status Code set to 207 and\n ${response.json()} with Response body containing batch operation result set to '${response1}' and\n Query Entities with Response body is empty\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/delete'\n method set to 'POST'\n Batch Delete Entities: and\n Query Parameter: entities_ids_to_be_deleted set to '@{entities_ids_to_be_deleted}'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/delete" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities", + "robotfile": "006_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/006_03.json b/doc/files/ContextInformation/Provision/006_03.json new file mode 100644 index 0000000000000000000000000000000000000000..d7a8b45dd25bfa02beb02da1a5c0c3b1d9a06fff --- /dev/null +++ b/doc/files/ContextInformation/Provision/006_03.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/006_03", + "test_objective": "Check that you cannot delete a batch of entities with an invalid request", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.10", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.10" + ], + "pics_selection": "", + "keywords": [ + "Batch Delete Entity With Invalid Request Scenarios" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "006_03_01 InvalidJson", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/006_03_01", + "doc": "Check that you cannot delete a batch of entities with an invalid request", + "tags": [ + "5_6_10", + "be-delete" + ], + "setup": null, + "teardown": null, + "template": "Batch Delete Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Request Entities From File with Response Status Code set to 400 and\n Batch Request Entities From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Batch Request Entities From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/delete'\n method set to 'POST'\n Batch Entity Delete Request with operation set to 'delete', Content-Type set to 'application/ld+json', and body set to 'batch/invalid-json-sample.jsonld\n}", + "http_verb": "POST", + "endpoint": "entityOperations/delete" + }, + { + "name": "006_03_02 EmptyJson", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/006_03_02", + "doc": "Check that you cannot delete a batch of entities with an invalid request", + "tags": [ + "5_6_10", + "be-delete" + ], + "setup": null, + "teardown": null, + "template": "Batch Delete Entity With Invalid Request Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Request Entities From File with Response Status Code set to 400 and\n Batch Request Entities From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Batch Request Entities From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/delete'\n method set to 'POST'\n Batch Entity Delete Request with operation set to 'delete', Content-Type set to 'application/ld+json', and body set to 'batch/empty-sample.jsonld\n}", + "http_verb": "POST", + "endpoint": "entityOperations/delete" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities", + "robotfile": "006_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/007_01.json b/doc/files/ContextInformation/Provision/007_01.json new file mode 100644 index 0000000000000000000000000000000000000000..188bc965d4bb010c90e67f6d47509479da5b0ea5 --- /dev/null +++ b/doc/files/ContextInformation/Provision/007_01.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TE/007_01", + "test_objective": "Check that you can create a temporal representation of an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.11", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.11" + ], + "pics_selection": "", + "keywords": [ + "Create Temporal Entity", + "Delete Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "007_01_01 Create a temporal representation of an entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/007_01_01", + "doc": "Check that you can create a temporal representation of an entity", + "tags": [ + "te-create", + "5_6_11" + ], + "setup": null, + "teardown": "Delete Temporal Entity", + "template": "Create Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 201 and\n Retrieve Temporal Representation Of Entity with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'POST'\n Create or Update Temporal Representation of Entity Selecting Content Type: and\n Query Parameter: temporal_entity_representation_id set to '${temporal_entity_representation_id}' and\n Query Parameter: filename set to 'vehicle-create-temporal-representation-sample.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: accept set to '${EMPTY}'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities" + }, + { + "name": "007_01_02 Create a temporal entity with no context", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/007_01_02", + "doc": "Check that you can create a temporal representation of an entity", + "tags": [ + "te-create", + "5_6_11" + ], + "setup": null, + "teardown": "Delete Temporal Entity", + "template": "Create Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 201 and\n Retrieve Temporal Representation Of Entity with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'POST'\n Create or Update Temporal Representation of Entity Selecting Content Type: and\n Query Parameter: temporal_entity_representation_id set to '${temporal_entity_representation_id}' and\n Query Parameter: filename set to 'vehicle-create-temporal-representation-without-context-sample.jsonld' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: accept set to '${EMPTY}'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity", + "robotfile": "007_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/007_02.json b/doc/files/ContextInformation/Provision/007_02.json new file mode 100644 index 0000000000000000000000000000000000000000..5bba381e84b98c4f49535fe17b7ddb3bfce0f3f4 --- /dev/null +++ b/doc/files/ContextInformation/Provision/007_02.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TE/007_02", + "test_objective": "Check that you cannot create a temporal entity with an empty/invalid json/id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.11", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.11" + ], + "pics_selection": "", + "keywords": [ + "Create Temporal Entity From File" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "007_02_01 Create a temporal entity with an invalid json", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/007_02_01", + "doc": "Check that you cannot create a temporal entity with an empty/invalid json/id", + "tags": [ + "te-create", + "5_6_11" + ], + "setup": null, + "teardown": null, + "template": "Create Temporal Entity From File", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 400 and\n Create Temporal Representation Of Entity Selecting Content Type with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Create Temporal Representation Of Entity Selecting Content Type with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'POST'\n Create Temporal Representation of Entity Selecting Content Type: and\n Query Parameter: filename set to 'vehicle-temporal-representation-invalid-json-sample.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities" + }, + { + "name": "007_02_02 Create a temporal entity with an empty json", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/007_02_02", + "doc": "Check that you cannot create a temporal entity with an empty/invalid json/id", + "tags": [ + "te-create", + "5_6_11" + ], + "setup": null, + "teardown": null, + "template": "Create Temporal Entity From File", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 400 and\n Create Temporal Representation Of Entity Selecting Content Type with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Create Temporal Representation Of Entity Selecting Content Type with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'POST'\n Create Temporal Representation of Entity Selecting Content Type: and\n Query Parameter: filename set to 'vehicle-temporal-representation-empty-json-sample.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity", + "robotfile": "007_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/007_03.json b/doc/files/ContextInformation/Provision/007_03.json new file mode 100644 index 0000000000000000000000000000000000000000..e1e4e21efb606cfb67c12962d4895f96be9d082c --- /dev/null +++ b/doc/files/ContextInformation/Provision/007_03.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TE/007_03", + "test_objective": "Check that you cannot create a temporal entity with an empty/invalid json/id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.11", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.11" + ], + "pics_selection": "", + "keywords": [ + "Create Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "007_03_01 Create a temporal entity with missing id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/007_03_01", + "doc": "Check that you cannot create a temporal entity with an invalid @context", + "tags": [ + "te-create", + "5_6_11" + ], + "setup": null, + "teardown": null, + "template": "Create Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'POST'\n Create or Update Temporal Representation of Entity Selecting Content Type: and\n Query Parameter: temporal_entity_representation_id set to '${EMPTY}' and\n Query Parameter: filename set to 'vehicle-temporal-representation-without-id-sample.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: accept set to '${EMPTY}'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities" + }, + { + "name": "007_03_02 Create a temporal invalid URI", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/007_03_02", + "doc": "Check that you cannot create a temporal entity with an invalid @context", + "tags": [ + "te-create", + "5_6_11" + ], + "setup": null, + "teardown": null, + "template": "Create Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'POST'\n Create or Update Temporal Representation of Entity Selecting Content Type: and\n Query Parameter: temporal_entity_representation_id set to 'invalidId' and\n Query Parameter: filename set to 'vehicle-temporal-representation-sample.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: accept set to '${EMPTY}'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity", + "robotfile": "007_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/008_01.json b/doc/files/ContextInformation/Provision/008_01.json new file mode 100644 index 0000000000000000000000000000000000000000..ca58c05cdbca6c335961a9af3ac551d55c763f1f --- /dev/null +++ b/doc/files/ContextInformation/Provision/008_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TE/008_01", + "test_objective": "Check that you can update a temporal representation of an entity with simple temporal properties", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.11", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.11" + ], + "pics_selection": "", + "keywords": [ + "Delete Temporal Entity" + ], + "teardown": "Delete Temporal Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "008_01_01 Update a temporal representation of an entity with simple temporal properties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/008_01_01", + "doc": "Check that you can update a temporal representation of an entity with simple temporal properties", + "tags": [ + "5_6_11", + "te-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 201 and\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 204 and\n Retrieve Temporal Representation Of Entity with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'POST'\n Create or Update Temporal Representation of Entity Selecting Content Type: and\n Query Parameter: temporal_entity_representation_id set to '${temporal_entity_representation_id}' and\n Query Parameter: filename set to 'vehicle-create-temporal-representation-sample.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: accept set to '${EMPTY}'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/TemporalEntity/UpdateTemporalRepresentationOfEntity", + "robotfile": "008_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/009_01.json b/doc/files/ContextInformation/Provision/009_01.json new file mode 100644 index 0000000000000000000000000000000000000000..53e37b1ffacc41010420f6482b5d62bbe630be05 --- /dev/null +++ b/doc/files/ContextInformation/Provision/009_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TE/009_01", + "test_objective": "Check that you can delete a temporal representation of an entity with simple temporal properties", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.16", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.16" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "009_01_01 Delete a temporal representation of an entity with simple temporal properties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/009_01_01", + "doc": "Check that you can delete a temporal representation of an entity with simple temporal properties", + "tags": [ + "5_6_16", + "te-delete" + ], + "setup": "Create Initial Temporal Entity", + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Temporal Representation Of Entity With Returning Response with Response Status Code set to 204 and\n Retrieve Temporal Representation Of Entity with Response Status Code set to ${response1.status_code}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'DELETE'\n Delete Temporal Representation Of Entity With Returning Response with id set to '${temporal_entity_representation_id}'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity", + "robotfile": "009_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/009_02.json b/doc/files/ContextInformation/Provision/009_02.json new file mode 100644 index 0000000000000000000000000000000000000000..3ac4a799a21c424a12270cdb4214b17fa7300280 --- /dev/null +++ b/doc/files/ContextInformation/Provision/009_02.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TE/009_02", + "test_objective": "Check that an error is raised if you delete a temporal entity with an empty/invalid EntityId", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.16", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.16" + ], + "pics_selection": "", + "keywords": [ + "Delete Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "009_02_01 Delete a temporal representation of an entity with an empty entity id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/009_02_01", + "doc": "Check that an error is raised if you delete a temporal entity with an empty/invalid EntityId", + "tags": [ + "te-delete", + "5_6_16" + ], + "setup": null, + "teardown": null, + "template": "Delete Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Temporal Representation Of Entity With Returning Response with Response Status Code set to 405 and\n Delete Temporal Representation Of Entity With Returning Response with Response Body containing the type '${EMPTY}' and\n Delete Temporal Representation Of Entity With Returning Response with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'DELETE'\n Delete Temporal Representation Of Entity With Returning Response with id set to '${EMPTY}'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + }, + { + "name": "009_02_02 Delete a temporal representation of an entity with an invalid entity id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/009_02_02", + "doc": "Check that an error is raised if you delete a temporal entity with an empty/invalid EntityId", + "tags": [ + "te-delete", + "5_6_16" + ], + "setup": null, + "teardown": null, + "template": "Delete Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Temporal Representation Of Entity With Returning Response with Response Status Code set to 400 and\n Delete Temporal Representation Of Entity With Returning Response with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Delete Temporal Representation Of Entity With Returning Response with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'DELETE'\n Delete Temporal Representation Of Entity With Returning Response with id set to 'invalidId'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity", + "robotfile": "009_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/009_03.json b/doc/files/ContextInformation/Provision/009_03.json new file mode 100644 index 0000000000000000000000000000000000000000..f1ba1f4adf4179b6ef650da7558d784d129f7aba --- /dev/null +++ b/doc/files/ContextInformation/Provision/009_03.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TE/009_03", + "test_objective": "Check that an error is raised if you delete a temporal entity with a non-existing/invalid EntityId", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.16", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.16" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "009_03_01 Delete a temporal representation of an entity with an unknown entity id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TE/009_03_01", + "doc": "Check that an error is raised if you delete a temporal entity with a non-existing entity id", + "tags": [ + "5_6_16", + "te-delete" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Temporal Representation Of Entity With Returning Response with Response Status Code set to 404 and\n Delete Temporal Representation Of Entity With Returning Response with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Delete Temporal Representation Of Entity With Returning Response with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_representation_id}'\n method set to 'DELETE'\n Delete Temporal Representation Of Entity With Returning Response with id set to '${temporal_entity_id}'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_representation_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity", + "robotfile": "009_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/010_01.json b/doc/files/ContextInformation/Provision/010_01.json new file mode 100644 index 0000000000000000000000000000000000000000..dea3aca0a5123649148c7ebf3eff2f0ceef1427b --- /dev/null +++ b/doc/files/ContextInformation/Provision/010_01.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/010_01", + "test_objective": "Check that you can append entity attributes", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.3" + ], + "pics_selection": "", + "keywords": [ + "Append Attributes Without Params", + "Create Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "010_01_01 Append entity attributes", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_01_01", + "doc": "Check that you can append entity attributes", + "tags": [ + "ea-append", + "5_6_3" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Append Attributes Without Params", + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}/attrs'\n method set to 'POST'\n Append Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'vehicle-new-attribute-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entities/{id}/attrs" + }, + { + "name": "010_01_02 Append entity attributes with different datasetid", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_01_02", + "doc": "Check that you can append entity attributes", + "tags": [ + "ea-append", + "5_6_3" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Append Attributes Without Params", + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}/attrs'\n method set to 'POST'\n Append Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'vehicle-speed-different-datasetid-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entities/{id}/attrs" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/AppendEntityAttributes", + "robotfile": "010_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/010_02.json b/doc/files/ContextInformation/Provision/010_02.json new file mode 100644 index 0000000000000000000000000000000000000000..14ecc1789146ebf886db1b56aba92fe376b7123f --- /dev/null +++ b/doc/files/ContextInformation/Provision/010_02.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/010_02", + "test_objective": "Check that you cannot append entity attributes with invalid/missing id or invalid request body", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.3" + ], + "pics_selection": "", + "keywords": [ + "Append Attributes", + "Create Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "010_02_01 Append entity attributes if the entity Id is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_02_01", + "doc": "Check that you cannot append entity attributes with invalid/missing id or invalid request body", + "tags": [ + "ea-append", + "5_6_3" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Append Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes with Response Status Code set to 400 and\n Append Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Append Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}/attrs'\n method set to 'POST'\n Append Entity Attributes and\n Query Parameter: id set to '${EMPTY}' and\n Query Parameter: fragment_filename set to 'vehicle-attribute-to-add-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entities/{id}/attrs" + }, + { + "name": "010_02_02 Append entity attributes if the Entity Id is not a valid URI", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_02_02", + "doc": "Check that you cannot append entity attributes with invalid/missing id or invalid request body", + "tags": [ + "ea-append", + "5_6_3" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Append Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes with Response Status Code set to 400 and\n Append Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Append Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}/attrs'\n method set to 'POST'\n Append Entity Attributes and\n Query Parameter: id set to 'thisisaninvaliduri' and\n Query Parameter: fragment_filename set to 'vehicle-attribute-to-add-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entities/{id}/attrs" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/AppendEntityAttributes", + "robotfile": "010_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/010_03.json b/doc/files/ContextInformation/Provision/010_03.json new file mode 100644 index 0000000000000000000000000000000000000000..b5ab8d9c581e4b0117df3ee673a9bbe838da78f0 --- /dev/null +++ b/doc/files/ContextInformation/Provision/010_03.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/010_03", + "test_objective": "Check that you cannot append entity attributes if the entity id is not known to the system", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.3" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Entities" + ], + "teardown": "Delete Initial Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "010_03_01 Append entity attributes when the entity id is not known to the system", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_03_01", + "doc": "Check that you cannot append entity attributes if the entity id is not known to the system", + "tags": [ + "5_6_3", + "ea-append" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes with Response Status Code set to 404 and\n Append Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Append Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}/attrs'\n method set to 'POST'\n Append Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'vehicle-attribute-to-add-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entities/{id}/attrs" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/EntityAttributes/AppendEntityAttributes", + "robotfile": "010_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/010_04.json b/doc/files/ContextInformation/Provision/010_04.json new file mode 100644 index 0000000000000000000000000000000000000000..310e64c2df513f4db25483aa739678e952d56664 --- /dev/null +++ b/doc/files/ContextInformation/Provision/010_04.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/010_04", + "test_objective": "Check that you can append entity attributes", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.3" + ], + "pics_selection": "", + "keywords": [ + "Append Attributes With Params", + "Create Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "010_04_01 Append entity attributes and ignore existing multi-attribute instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_04_01", + "doc": "Check that you can append entity attributes", + "tags": [ + "ea-append", + "5_6_3" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Append Attributes With Params", + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes With Parameters with Response Status Code set to 204 and\n ${expectation_filename} with Check Response Body Content and\n Query Parameter: expectation_filename set to 'expectation_response_body' and\n Query Parameter: response_body set to '' and\n Query Parameter: additional_ignored_path set to 'root\\\\['notUpdated'\\\\]\\\\[0\\\\]\\\\['reason'\\\\]' and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}/attrs?options=${options}'\n method set to 'POST'\n Append entity attributes with parameters: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'vehicle-attribute-to-add-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: options set to 'noOverwrite'\n}", + "http_verb": "POST", + "endpoint": "entities/{id}/attrs?options=${options}" + }, + { + "name": "010_04_02 Append entity attributes with a new multi-attribute instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_04_02", + "doc": "Check that you can append entity attributes", + "tags": [ + "ea-append", + "5_6_3" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Append Attributes With Params", + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes With Parameters with Response Status Code set to 204 and\n ${expectation_filename} with Check Response Body Content and\n Query Parameter: expectation_filename set to 'expectation_response_body' and\n Query Parameter: response_body set to '' and\n Query Parameter: additional_ignored_path set to 'root\\\\['notUpdated'\\\\]\\\\[0\\\\]\\\\['reason'\\\\]' and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}/attrs?options=${options}'\n method set to 'POST'\n Append entity attributes with parameters: and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'vehicle-speed-different-datasetid-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: options set to 'noOverwrite'\n}", + "http_verb": "POST", + "endpoint": "entities/{id}/attrs?options=${options}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/AppendEntityAttributes", + "robotfile": "010_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/010_05.json b/doc/files/ContextInformation/Provision/010_05.json new file mode 100644 index 0000000000000000000000000000000000000000..37db679d78b72be5f5b0770786f5435cf6e0316e --- /dev/null +++ b/doc/files/ContextInformation/Provision/010_05.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/010_05", + "test_objective": "Check that you cannot append entity attributes with invalid/missing id or invalid request body", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.3" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "010_05_01 Append entity attributes with invalid entity fragments", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_05_01", + "doc": "Check that you cannot append entity attributes with invalid entity fragments", + "tags": [ + "5_6_3", + "ea-append" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes with Response Status Code set to 400 and\n Append Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Append Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}/attrs'\n method set to 'POST'\n Append Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'invalid-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entities/{id}/attrs" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/EntityAttributes/AppendEntityAttributes", + "robotfile": "010_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/011_01.json b/doc/files/ContextInformation/Provision/011_01.json new file mode 100644 index 0000000000000000000000000000000000000000..4fcaa02264060e236897ca761e20c09683f4f3e1 --- /dev/null +++ b/doc/files/ContextInformation/Provision/011_01.json @@ -0,0 +1,73 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/011_01", + "test_objective": "Check that you can update entity attributes", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.2" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Delete Initial Entities", + "Initialize Test" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "011_01_01 Check that you can update existing attributes with no datasetId", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_01_01", + "doc": "Check that you can update entity attributes", + "tags": [ + "ea-update", + "5_6_2" + ], + "setup": "Initialize Test", + "teardown": "Delete Initial Entities", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Update Entity Attributes with Check Response Body Content and\n Query Parameter: expectation_filename set to 'expectation_resp_filename' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}' and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'vehicle-speed-two-datasetid-01-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_01_02 Check that you can update existing attributes with the datasetId", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_01_02", + "doc": "Check that you can update entity attributes", + "tags": [ + "ea-update", + "5_6_2" + ], + "setup": "Initialize Test", + "teardown": "Delete Initial Entities", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Update Entity Attributes with Check Response Body Content and\n Query Parameter: expectation_filename set to 'expectation_resp_filename' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}' and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'vehicle-speed-two-datasetid-02-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_01_03 Check that you can update only some attributes while unknown are ignored", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_01_03", + "doc": "Check that you can update entity attributes", + "tags": [ + "ea-update", + "5_6_2" + ], + "setup": "Initialize Test", + "teardown": "Delete Initial Entities", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Update Entity Attributes with Check Response Body Content and\n Query Parameter: expectation_filename set to 'expectation_resp_filename' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}' and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'vehicle-speed-two-datasetid-03-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes", + "robotfile": "011_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/011_02.json b/doc/files/ContextInformation/Provision/011_02.json new file mode 100644 index 0000000000000000000000000000000000000000..1817dff3ede04a37cb60735f5e04eaf3e19d58c9 --- /dev/null +++ b/doc/files/ContextInformation/Provision/011_02.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/011_02", + "test_objective": "Check that you cannot update entity attributes with invalid/missing id or invalid request body", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.2" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Initialize Environment", + "Delete Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "011_02_01 Update an attribute if the Entity Id is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_02_01", + "doc": "Check that you cannot update entity attributes with invalid/missing id or invalid request body", + "tags": [ + "ea-update", + "5_6_2" + ], + "setup": "Initialize Environment", + "teardown": "Delete Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 400 and\n Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${EMPTY}' and\n Query Parameter: fragment_filename set to 'vehicle-speed-two-datasetid-01-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_02_02 Update an attribute if the Entity Id is not a valid URI", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_02_02", + "doc": "Check that you cannot update entity attributes with invalid/missing id or invalid request body", + "tags": [ + "ea-update", + "5_6_2" + ], + "setup": "Initialize Environment", + "teardown": "Delete Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 400 and\n Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to 'thisisaninvaliduri' and\n Query Parameter: fragment_filename set to 'vehicle-speed-two-datasetid-01-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes", + "robotfile": "011_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/011_03.json b/doc/files/ContextInformation/Provision/011_03.json new file mode 100644 index 0000000000000000000000000000000000000000..007b5ef96ec4f8aae6f768233702bc4e580a8784 --- /dev/null +++ b/doc/files/ContextInformation/Provision/011_03.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/011_03", + "test_objective": "Check that you cannot update entity attributes if the entity id or attributes are not known to the system", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Entities" + ], + "teardown": "Delete Initial Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "011_03_01 Update entity attributes when the entity id is not known to the system", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_03_01", + "doc": "Check that you cannot update entity attributes if the entity id or attributes are not known to the system", + "tags": [ + "5_6_2", + "ea-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 404 and\n Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'vehicle-speed-two-datasetid-01-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes", + "robotfile": "011_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/011_04.json b/doc/files/ContextInformation/Provision/011_04.json new file mode 100644 index 0000000000000000000000000000000000000000..1f8af27636fcd0367dbe01438d31d7594dd45391 --- /dev/null +++ b/doc/files/ContextInformation/Provision/011_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/011_04", + "test_objective": "Check that you cannot update entity attributes with invalid request body", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.2" + ], + "pics_selection": "", + "keywords": [ + "Update entity attributes with invalid entity fragments", + "Initialize Environment" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "011_04_01 Update entity attributes with invalid entity fragments", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_04_01", + "doc": "Check that you cannot update an attribute if the entity fragment is invalid", + "tags": [ + "ea-update", + "5_6_2" + ], + "setup": "Initialize Environment", + "teardown": null, + "template": "Update entity attributes with invalid entity fragments", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 400 and\n Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to '${fragment_filename}' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes", + "robotfile": "011_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/012_01.json b/doc/files/ContextInformation/Provision/012_01.json new file mode 100644 index 0000000000000000000000000000000000000000..2625f86c26f701837e7134efb3a18c7554fd42cd --- /dev/null +++ b/doc/files/ContextInformation/Provision/012_01.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/012_01", + "test_objective": "Check that you can perform a partial update on an entity attribute", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.4" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Initiate Test Case", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n and an attribute with an id set to ${atrId}\n}", + "test_cases": [ + { + "name": "012_01_01 Check that you can partially update an attribute", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_01_01", + "doc": "Check that you can perform a partial update on an entity attribute", + "tags": [ + "ea-partial-update", + "5_6_4" + ], + "setup": "Initiate Test Case", + "teardown": "Delete Initial Entities", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'isParked' and\n Query Parameter: fragment_filename set to 'vehicle-isparked-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_01_02 Check that you can partially update an attribute by specifying the datasetId", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_01_02", + "doc": "Check that you can perform a partial update on an entity attribute", + "tags": [ + "ea-partial-update", + "5_6_4" + ], + "setup": "Initiate Test Case", + "teardown": "Delete Initial Entities", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'speed' and\n Query Parameter: fragment_filename set to 'vehicle-speed-equal-datasetid-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate", + "robotfile": "012_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/012_02.json b/doc/files/ContextInformation/Provision/012_02.json new file mode 100644 index 0000000000000000000000000000000000000000..f19a1f8e73b95e938caa39eb0067ba762c3527ab --- /dev/null +++ b/doc/files/ContextInformation/Provision/012_02.json @@ -0,0 +1,89 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/012_02", + "test_objective": "Check that you cannot perform a partial update on an entity attribute with invalid/missing ids", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.4" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "012_02_01 Make a partial attribute update if the Entity Id is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_02_01", + "doc": "Check that you cannot perform a partial update on an entity attribute with invalid/missing ids", + "tags": [ + "ea-partial-update", + "5_6_4" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 400 and\n Partial Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Partial Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${EMPTY}' and\n Query Parameter: AttributeId set to 'speed' and\n Query Parameter: fragment_filename set to 'vehicle-speed-equal-datasetid-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_02_02 Make a partial attribute update if the Entity Id is not a valid URI", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_02_02", + "doc": "Check that you cannot perform a partial update on an entity attribute with invalid/missing ids", + "tags": [ + "ea-partial-update", + "5_6_4" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 400 and\n Partial Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Partial Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to 'thisisaninvaliduri' and\n Query Parameter: AttributeId set to 'speed' and\n Query Parameter: fragment_filename set to 'vehicle-speed-equal-datasetid-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_02_03 Make a partial attribute update if the Attribute type does not match", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_02_03", + "doc": "Check that you cannot perform a partial update on an entity attribute with invalid/missing ids", + "tags": [ + "ea-partial-update", + "5_6_4" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 400 and\n Partial Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Partial Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${valid_entity_id}' and\n Query Parameter: AttributeId set to 'speed' and\n Query Parameter: fragment_filename set to 'vehicle-speed-equal-datasetid-different-type-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_02_04 Make a partial attribute update if the entity fragment is empty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_02_04", + "doc": "Check that you cannot perform a partial update on an entity attribute with invalid/missing ids", + "tags": [ + "ea-partial-update", + "5_6_4" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 400 and\n Partial Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Partial Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${valid_entity_id}' and\n Query Parameter: AttributeId set to 'speed' and\n Query Parameter: fragment_filename set to 'empty-fragment.json' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate", + "robotfile": "012_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/012_03.json b/doc/files/ContextInformation/Provision/012_03.json new file mode 100644 index 0000000000000000000000000000000000000000..ae5e3e0ba302c31b4f7e43885b91844e75407ab9 --- /dev/null +++ b/doc/files/ContextInformation/Provision/012_03.json @@ -0,0 +1,89 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/012_03", + "test_objective": "Check that you cannot perform a partial update on an entity attribute if the entity id or attribute is not known to the system", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.4" + ], + "pics_selection": "", + "keywords": [ + "Partial Update Attributes", + "Create Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "012_03_01 Partial update when the Entity Id is not known to the system", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_03_01", + "doc": "Check that you cannot perform a partial update on an entity attribute if the entity id or attribute is not known to the system", + "tags": [ + "ea-partial-update", + "5_6_4" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Partial Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 404 and\n Partial Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Partial Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${not_found_entity_id}' and\n Query Parameter: AttributeId set to 'speed' and\n Query Parameter: fragment_filename set to 'vehicle-isparked-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_03_02 Partial update when no default instance and no datasetId specified", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_03_02", + "doc": "Check that you cannot perform a partial update on an entity attribute if the entity id or attribute is not known to the system", + "tags": [ + "ea-partial-update", + "5_6_4" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Partial Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 404 and\n Partial Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Partial Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${valid_entity_id}' and\n Query Parameter: AttributeId set to 'speed' and\n Query Parameter: fragment_filename set to 'vehicle-speed-no-datasetid-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_03_03 Partial update when no instance with the datasetId specified", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_03_03", + "doc": "Check that you cannot perform a partial update on an entity attribute if the entity id or attribute is not known to the system", + "tags": [ + "ea-partial-update", + "5_6_4" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Partial Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 404 and\n Partial Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Partial Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${valid_entity_id}' and\n Query Parameter: AttributeId set to 'speed' and\n Query Parameter: fragment_filename set to 'vehicle-speed-unknown-datasetid-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_03_04 Partial update when the Attribute Name does not exist in the entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_03_04", + "doc": "Check that you cannot perform a partial update on an entity attribute if the entity id or attribute is not known to the system", + "tags": [ + "ea-partial-update", + "5_6_4" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Partial Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 404 and\n Partial Update Entity Attributes with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Partial Update Entity Attributes with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${valid_entity_id}' and\n Query Parameter: AttributeId set to 'isParked2' and\n Query Parameter: fragment_filename set to 'vehicle-isparked-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate", + "robotfile": "012_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/013_01.json b/doc/files/ContextInformation/Provision/013_01.json new file mode 100644 index 0000000000000000000000000000000000000000..5234a8e86731865b2eadad26a2fd5e1f82d2596d --- /dev/null +++ b/doc/files/ContextInformation/Provision/013_01.json @@ -0,0 +1,70 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/013_01", + "test_objective": "Check that you can delete an attribute from an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Attributes", + "Delete Initial Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "013_01_01 Delete an attribute with the default instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_01_01", + "doc": "Check that you can delete an attribute from an entity", + "tags": [ + "ea-delete", + "5_6_5" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Delete Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Delete Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to '${deleteAll}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "013_01_02 Delete an attribute with the datasetId", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_01_02", + "doc": "Check that you can delete an attribute from an entity", + "tags": [ + "ea-delete", + "5_6_5" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Delete Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Delete Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to '${deleteAll}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "013_01_03 Delete all target attribute instances", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_01_03", + "doc": "Check that you can delete an attribute from an entity", + "tags": [ + "ea-delete", + "5_6_5" + ], + "setup": null, + "teardown": "Delete Initial Entities", + "template": "Delete Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Delete Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to '${deleteAll}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute", + "robotfile": "013_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/013_02.json b/doc/files/ContextInformation/Provision/013_02.json new file mode 100644 index 0000000000000000000000000000000000000000..28b4b159d1321d8441b8c39175c987fb64351a8a --- /dev/null +++ b/doc/files/ContextInformation/Provision/013_02.json @@ -0,0 +1,74 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/013_02", + "test_objective": "Check that you cannot delete an attribute from an entity with invalid/missing ids", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Attributes", + "Create Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "013_02_01 Delete an attribute if the Entity Id is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_02_01", + "doc": "Check that you cannot delete an attribute from an entity with invalid/missing ids", + "tags": [ + "ea-delete", + "5_6_5" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Delete Attributes", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Entity Attributes with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${EMPTY}' and\n Query Parameter: attributeId set to 'speed' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "013_02_02 Delete an attribute if the Entity Id is not a valid URI", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_02_02", + "doc": "Check that you cannot delete an attribute from an entity with invalid/missing ids", + "tags": [ + "ea-delete", + "5_6_5" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Delete Attributes", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Entity Attributes with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to 'thisIsAnInvalidURI' and\n Query Parameter: attributeId set to 'speed' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "013_02_03 Delete an attribute if the Attribute Name is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_02_03", + "doc": "Check that you cannot delete an attribute from an entity with invalid/missing ids", + "tags": [ + "ea-delete", + "5_6_5" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Delete Attributes", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Entity Attributes with Response Status Code set to 405\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${valid_entity_id}' and\n Query Parameter: attributeId set to '${EMPTY}' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute", + "robotfile": "013_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/013_03.json b/doc/files/ContextInformation/Provision/013_03.json new file mode 100644 index 0000000000000000000000000000000000000000..0a1e8492ea0627f0b6064e69f9e52c20c75f74dd --- /dev/null +++ b/doc/files/ContextInformation/Provision/013_03.json @@ -0,0 +1,73 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/013_03", + "test_objective": "Check that you cannot delete an attribute from an entity with invalid/missing ids", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Attributes", + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "013_03_01 Delete an attribute when the Entity Id is not known to the system", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_03_01", + "doc": "Check that you cannot delete an attribute from an entity with invalid/missing ids", + "tags": [ + "ea-delete", + "5_6_5" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Delete Attributes", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Entity Attributes with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${not_found_entity_id}' and\n Query Parameter: attributeId set to 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to 'false'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "013_03_02 Delete an attribute when the Entity does not contain the target attribute id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_03_02", + "doc": "Check that you cannot delete an attribute from an entity with invalid/missing ids", + "tags": [ + "ea-delete", + "5_6_5" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Delete Attributes", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Entity Attributes with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${valid_entity_id}' and\n Query Parameter: attributeId set to 'notFound' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to 'false'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "013_03_03 Delete an attribute when the Entity does not contain the target attribute with same datasetId", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_03_03", + "doc": "Check that you cannot delete an attribute from an entity with invalid/missing ids", + "tags": [ + "ea-delete", + "5_6_5" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Delete Attributes", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Entity Attributes with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${valid_entity_id}' and\n Query Parameter: attributeId set to 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to 'false'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute", + "robotfile": "013_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/014_01.json b/doc/files/ContextInformation/Provision/014_01.json new file mode 100644 index 0000000000000000000000000000000000000000..681f9fa436e9af3c6882b79f3a9eeb6e724bc5b1 --- /dev/null +++ b/doc/files/ContextInformation/Provision/014_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/014_01", + "test_objective": "Check that you can add a simple temporal attribute to a temporal representation of an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.12", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.12" + ], + "pics_selection": "", + "keywords": [ + "Delete Temporal Entity" + ], + "teardown": "Delete Temporal Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "014_01_01 Add an attribute to a temporal entity with simple temporal properties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/014_01_01", + "doc": "Check that you can add a simple temporal attribute to a temporal representation of an entity", + "tags": [ + "5_6_12", + "tea-append" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 201 and\n Append Attribute To Temporal Entity with Response Status Code set to 204 and\n Retrieve Temporal Representation Of Entity with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs'\n method set to 'POST'\n Append Attribute to Temporal Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-representation-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/AddAttributes", + "robotfile": "014_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/014_02.json b/doc/files/ContextInformation/Provision/014_02.json new file mode 100644 index 0000000000000000000000000000000000000000..664ce732ee69616e413b47c781784081013ea8a9 --- /dev/null +++ b/doc/files/ContextInformation/Provision/014_02.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/014_02", + "test_objective": "Check that an error is raised if you add an attribute to a temporal entity with invalid content", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.12", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.12" + ], + "pics_selection": "", + "keywords": [ + "Add Attribute To Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "014_02_01 Add an attribute to a temporal representation of an entity with an empty entity id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/014_02_01", + "doc": "Check that an error is raised if you add a temporal entity attribute with a non-existing/invalid EntityId", + "tags": [ + "tea-append", + "5_6_12" + ], + "setup": null, + "teardown": null, + "template": "Add Attribute To Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 201 and\n Append Attribute To Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs'\n method set to 'POST'\n Append Attribute to Temporal Entity and\n Query Parameter: id set to '${EMPTY}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-representation-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs" + }, + { + "name": "014_02_02 Add an attribute to a temporal representation of an entity with an invalid entity id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/014_02_02", + "doc": "Check that an error is raised if you add a temporal entity attribute with a non-existing/invalid EntityId", + "tags": [ + "tea-append", + "5_6_12" + ], + "setup": null, + "teardown": null, + "template": "Add Attribute To Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 201 and\n Append Attribute To Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs'\n method set to 'POST'\n Append Attribute to Temporal Entity and\n Query Parameter: id set to 'thisIsAninvalidId' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-representation-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/AddAttributes", + "robotfile": "014_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/014_03.json b/doc/files/ContextInformation/Provision/014_03.json new file mode 100644 index 0000000000000000000000000000000000000000..32ea1f708a88969db338406488c44bb93f748d1f --- /dev/null +++ b/doc/files/ContextInformation/Provision/014_03.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/014_03", + "test_objective": "Check that an error is raised if you add an attribute to a non-existent entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.12", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.12" + ], + "pics_selection": "", + "keywords": [ + "Delete Temporal Entity" + ], + "teardown": "Delete Temporal Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "014_03_01 Add Attribute To Temporal Entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/014_03_01", + "doc": "Check that an error is raised if you add an attribute to a non-existent entity", + "tags": [ + "5_6_12", + "tea-append" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 201 and\n Append Attribute To Temporal Entity with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs'\n method set to 'POST'\n Append Attribute to Temporal Entity and\n Query Parameter: id set to '${not_found_temporal_entity_representation_id}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-representation-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/AddAttributes", + "robotfile": "014_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/014_04.json b/doc/files/ContextInformation/Provision/014_04.json new file mode 100644 index 0000000000000000000000000000000000000000..95c7401a762ca57278ed8cc1a3cabb09cb4a73d4 --- /dev/null +++ b/doc/files/ContextInformation/Provision/014_04.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/014_04", + "test_objective": "Check that an error is raised if you add a temporal entity attribute with empty/invalid content", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.12", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.12" + ], + "pics_selection": "", + "keywords": [ + "Add an Attribute To a Temporal Entity From File", + "Initialize Test Case" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "014_04_01 Add an attribute to a temporal representation of an entity with invalid content", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/014_04_01", + "doc": "Check that an error is raised if you add a temporal entity attribute with empty/invalid content", + "tags": [ + "tea-append", + "5_6_12" + ], + "setup": "Initialize Test Case", + "teardown": null, + "template": "Add an Attribute To a Temporal Entity From File", + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Attribute To Temporal Entity with Response Status Code set to 400 and\n Append Attribute To Temporal Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Append Attribute To Temporal Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs'\n method set to 'POST'\n Append Attribute to Temporal Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-representation-invalid-json-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs" + }, + { + "name": "014_04_02 Add an attribute to a temporal representation of an entity with empty content", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/014_04_02", + "doc": "Check that an error is raised if you add a temporal entity attribute with empty/invalid content", + "tags": [ + "tea-append", + "5_6_12" + ], + "setup": "Initialize Test Case", + "teardown": null, + "template": "Add an Attribute To a Temporal Entity From File", + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Attribute To Temporal Entity with Response Status Code set to 400 and\n Append Attribute To Temporal Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Append Attribute To Temporal Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs'\n method set to 'POST'\n Append Attribute to Temporal Entity and\n Query Parameter: id set to '${temporal_entity_representation_id}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-representation-empty-json-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/AddAttributes", + "robotfile": "014_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/015_01.json b/doc/files/ContextInformation/Provision/015_01.json new file mode 100644 index 0000000000000000000000000000000000000000..131d2e6716286268d831eda49eaeb95f5736fea2 --- /dev/null +++ b/doc/files/ContextInformation/Provision/015_01.json @@ -0,0 +1,71 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_01", + "test_objective": "Check that you can delete an attribute of a temporal representation of an entity with simple temporal properties", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.13", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.13" + ], + "pics_selection": "", + "keywords": [ + "Delete Attribute From A Temporal Entity", + "Initialize Setup", + "Delete Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "015_01_01 Delete an attribute from a temporal representation of an entity without deleteAll/datasetId", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_01_01", + "doc": "Check that you can delete an attribute of a temporal representation of an entity with simple temporal properties", + "tags": [ + "tea-delete", + "5_6_13" + ], + "setup": "Initialize Setup", + "teardown": "Delete Temporal Entity", + "template": "Delete Attribute From A Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Attribute From Temporal Entity with Response Status Code set to 204 and\n Retrieve Temporal Representation Of Entity with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Attribute From Temporal Entity: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'fuelLevel' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: datasetId set to '${datasetid}' and\n Query Parameter: deleteAll set to '${deleteall}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "015_01_02 Delete an attribute from a temporal representation of an entity with datasetId", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_01_02", + "doc": "Check that you can delete an attribute of a temporal representation of an entity with simple temporal properties", + "tags": [ + "tea-delete", + "5_6_13" + ], + "setup": "Initialize Setup", + "teardown": "Delete Temporal Entity", + "template": "Delete Attribute From A Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Attribute From Temporal Entity with Response Status Code set to 204 and\n Retrieve Temporal Representation Of Entity with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Attribute From Temporal Entity: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'fuelLevel' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: datasetId set to '${datasetid}' and\n Query Parameter: deleteAll set to '${deleteall}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "015_01_03 Delete an attribute from a temporal representation of an entity with deleteAll", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_01_03", + "doc": "Check that you can delete an attribute of a temporal representation of an entity with simple temporal properties", + "tags": [ + "tea-delete", + "5_6_13" + ], + "setup": "Initialize Setup", + "teardown": "Delete Temporal Entity", + "template": "Delete Attribute From A Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Attribute From Temporal Entity with Response Status Code set to 204 and\n Retrieve Temporal Representation Of Entity with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Attribute From Temporal Entity: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'fuelLevel' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: datasetId set to '${datasetid}' and\n Query Parameter: deleteAll set to '${deleteall}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute", + "robotfile": "015_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/015_02.json b/doc/files/ContextInformation/Provision/015_02.json new file mode 100644 index 0000000000000000000000000000000000000000..5cfa718914677f0010f4af21e81a49458484f5d5 --- /dev/null +++ b/doc/files/ContextInformation/Provision/015_02.json @@ -0,0 +1,73 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_02", + "test_objective": "Check that an error is raised if you delete an attribute to temporal entity with an unknown/invalid Entity/Attribute Id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.13", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.13" + ], + "pics_selection": "", + "keywords": [ + "Delete attribute from temporal entity with unknow entity/attribute id", + "Create Temporal Entity", + "Delete Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n and an attribute with an id set to ${atrId}\n}", + "test_cases": [ + { + "name": "015_02_01 Delete an attribute to a temporal representation of an entity with a missing entity id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_02_01", + "doc": "Check that an error is raised if you delete an attribute to temporal entity with an unknown/invalid Entity/Attribute Id", + "tags": [ + "tea-delete", + "5_6_13" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Temporal Entity", + "template": "Delete attribute from temporal entity with unknow entity/attribute id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Attribute From Temporal Entity with Response Status Code set to 400 and\n Delete Attribute From Temporal Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Delete Attribute From Temporal Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Attribute From Temporal Entity: and\n Query Parameter: entityId set to '${EMPTY}' and\n Query Parameter: attributeId set to 'speed' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "015_02_02 Delete an attribute to a temporal representation of an entity with an invalid entity id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_02_02", + "doc": "Check that an error is raised if you delete an attribute to temporal entity with an unknown/invalid Entity/Attribute Id", + "tags": [ + "tea-delete", + "5_6_13" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Temporal Entity", + "template": "Delete attribute from temporal entity with unknow entity/attribute id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Attribute From Temporal Entity with Response Status Code set to 400 and\n Delete Attribute From Temporal Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Delete Attribute From Temporal Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Attribute From Temporal Entity: and\n Query Parameter: entityId set to 'invalidId' and\n Query Parameter: attributeId set to 'speed' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "015_02_03 Delete an attribute to a temporal representation of an entity with an invalid attribute id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_02_03", + "doc": "Check that an error is raised if you delete an attribute to temporal entity with an unknown/invalid Entity/Attribute Id", + "tags": [ + "tea-delete", + "5_6_13" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Temporal Entity", + "template": "Delete attribute from temporal entity with unknow entity/attribute id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Attribute From Temporal Entity with Response Status Code set to 400 and\n Delete Attribute From Temporal Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Delete Attribute From Temporal Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Attribute From Temporal Entity: and\n Query Parameter: entityId set to '${valid_temporal_entity_id}' and\n Query Parameter: attributeId set to 'invalid(Name' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute", + "robotfile": "015_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/015_03.json b/doc/files/ContextInformation/Provision/015_03.json new file mode 100644 index 0000000000000000000000000000000000000000..75dfd73098e88b74f7b34bc6847c2a2ad47dd4a9 --- /dev/null +++ b/doc/files/ContextInformation/Provision/015_03.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_03", + "test_objective": "Check that an error is raised if you delete a temporal entity with an unknown EntityId/Attribute Id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.13", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.13" + ], + "pics_selection": "", + "keywords": [ + "Delete An Attribute", + "Create Id", + "Delete Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "015_03_01 Delete an attribute to a temporal entity if the entity id does not exist", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_03_01", + "doc": "Check that an error is raised if you delete a temporal entity with an unknown EntityId/Attribute Id", + "tags": [ + "tea-delete", + "5_6_13" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Delete An Attribute", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Attribute From Temporal Entity with Response Status Code set to 404 and\n Delete Attribute From Temporal Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Delete Attribute From Temporal Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Attribute From Temporal Entity: and\n Query Parameter: entityId set to '${unknown_temporal_entity_id}' and\n Query Parameter: attributeId set to 'fuelLevel' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "015_03_02 Delete an attribute to a temporal entity if the entity does not contain the target attribute", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/015_03_02", + "doc": "Check that an error is raised if you delete a temporal entity with an unknown EntityId/Attribute Id", + "tags": [ + "tea-delete", + "5_6_13" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Delete An Attribute", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Attribute From Temporal Entity with Response Status Code set to 404 and\n Delete Attribute From Temporal Entity with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Delete Attribute From Temporal Entity with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Attribute From Temporal Entity: and\n Query Parameter: entityId set to '${valid_temporal_entity_id}' and\n Query Parameter: attributeId set to 'notExistingAttribute' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute", + "robotfile": "015_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/016_01.json b/doc/files/ContextInformation/Provision/016_01.json new file mode 100644 index 0000000000000000000000000000000000000000..b652c642711070de788f437d9a5ec052877ee2a9 --- /dev/null +++ b/doc/files/ContextInformation/Provision/016_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_01", + "test_objective": "Check that you can modify an attribute instance in temporal representation of an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.14", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.14" + ], + "pics_selection": "", + "keywords": [ + "Delete Intitial Temporal Representation Of Entity" + ], + "teardown": "Delete Intitial Temporal Representation Of Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "016_01_01 Modify attribute instance in temporal representation of an entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_01_01", + "doc": "Check that you can partially update an attribute instance of a temporal representation of an entity", + "tags": [ + "5_6_14", + "tea-partial-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 201 and\n Modify Attribute Instance From Temporal Entity with Response Status Code set to 204 and\n Retrieve Temporal Representation Of Entity with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities'\n method set to 'POST'\n Create or Update Temporal Representation of Entity Selecting Content Type: and\n Query Parameter: temporal_entity_representation_id set to '${temporal_entity_representation_id}' and\n Query Parameter: filename set to 'vehicle-temporal-representation-sample.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: accept set to '${EMPTY}'\n}", + "http_verb": "POST", + "endpoint": "temporal/entities" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance", + "robotfile": "016_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/016_02.json b/doc/files/ContextInformation/Provision/016_02.json new file mode 100644 index 0000000000000000000000000000000000000000..20aeedda033d1a667e3bf09d2d90f9619327c912 --- /dev/null +++ b/doc/files/ContextInformation/Provision/016_02.json @@ -0,0 +1,122 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_02", + "test_objective": "Check that you cannot modify an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.14", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.14" + ], + "pics_selection": "", + "keywords": [ + "Modify Attribute Instance Temporal Entity", + "Create Id", + "Delete Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "016_02_01 Modify attribute instance in temporal representation of an entity if the entity id is not valid", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_02_01", + "doc": "Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-partial-update", + "5_6_14" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Modify Attribute Instance Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Modify Attribute Instance From Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'PATCH'\n Modify Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to 'invalidId' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-modify-attribute-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "PATCH", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "016_02_02 Modify attribute instance in temporal representation of an entity if the entity id is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_02_02", + "doc": "Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-partial-update", + "5_6_14" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Modify Attribute Instance Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Modify Attribute Instance From Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'PATCH'\n Modify Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${EMPTY}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-modify-attribute-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "PATCH", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "016_02_03 Modify attribute instance in temporal representation of an entity if the instance id is not valid", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_02_03", + "doc": "Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-partial-update", + "5_6_14" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Modify Attribute Instance Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Modify Attribute Instance From Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'PATCH'\n Modify Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-modify-attribute-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "PATCH", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "016_02_04 Modify attribute instance in temporal representation of an entity if the instance id is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_02_04", + "doc": "Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-partial-update", + "5_6_14" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Modify Attribute Instance Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Modify Attribute Instance From Temporal Entity with Response Status Code set to 405\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'PATCH'\n Modify Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-modify-attribute-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "PATCH", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "016_02_05 Modify attribute instance in temporal representation of an entity if the attribute name is not a valid name", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_02_05", + "doc": "Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-partial-update", + "5_6_14" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Modify Attribute Instance Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Modify Attribute Instance From Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'PATCH'\n Modify Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-modify-attribute-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "PATCH", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "016_02_06 Modify attribute instance in temporal representation of an entity if the attribute name is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_02_06", + "doc": "Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-partial-update", + "5_6_14" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Modify Attribute Instance Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Modify Attribute Instance From Temporal Entity with Response Status Code set to 405\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'PATCH'\n Modify Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-modify-attribute-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "PATCH", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + } + ], + "permutations": [ + "when", + "then" + ], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance", + "robotfile": "016_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/016_03.json b/doc/files/ContextInformation/Provision/016_03.json new file mode 100644 index 0000000000000000000000000000000000000000..9eacd7f3a760e218647fc4d6fea1b40b50f10892 --- /dev/null +++ b/doc/files/ContextInformation/Provision/016_03.json @@ -0,0 +1,73 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_03", + "test_objective": "Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not found", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.14", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.14" + ], + "pics_selection": "", + "keywords": [ + "Modify Attribute Instance Temporal Entity", + "Create Id", + "Delete Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "016_03_01 Modify attribute instance in temporal representation of an entity if the entity with given id is not found", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_03_01", + "doc": "Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not found", + "tags": [ + "tea-partial-update", + "5_6_14" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Modify Attribute Instance Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Modify Attribute Instance From Temporal Entity with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'PATCH'\n Modify Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${unknown_temporal_entity_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-modify-attribute-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "PATCH", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "016_03_02 Modify attribute instance in temporal representation of an entity if the target attribute is not found", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_03_02", + "doc": "Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not found", + "tags": [ + "tea-partial-update", + "5_6_14" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Modify Attribute Instance Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Modify Attribute Instance From Temporal Entity with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'PATCH'\n Modify Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-modify-attribute-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "PATCH", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "016_03_03 Modify attribute instance in temporal representation of an entity if the target attribute instance is not found", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/016_03_03", + "doc": "Check that you cannot partially modify attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not found", + "tags": [ + "tea-partial-update", + "5_6_14" + ], + "setup": "Create Id", + "teardown": "Delete Temporal Entity", + "template": "Modify Attribute Instance Temporal Entity", + "then": "then {\n the SUT sends a valid Response for the operation:\n Modify Attribute Instance From Temporal Entity with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'PATCH'\n Modify Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: fragment_filename set to 'vehicle-temporal-modify-attribute-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "PATCH", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance", + "robotfile": "016_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/017_01.json b/doc/files/ContextInformation/Provision/017_01.json new file mode 100644 index 0000000000000000000000000000000000000000..9f8a83372570fecc8610a10f9eab94df474c39a1 --- /dev/null +++ b/doc/files/ContextInformation/Provision/017_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_01", + "test_objective": "Check that you can delete an attribute instance in temporal representation of an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.15", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.15" + ], + "pics_selection": "", + "keywords": [ + "Delete Temporal Entity" + ], + "teardown": "Delete Temporal Entity", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "017_01_01 Delete an attribute instance in temporal representation of an entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_01_01", + "doc": "Check that you can delete an attribute instance in temporal representation of an entity", + "tags": [ + "5_6_15", + "tea-instance-delete" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Or Update Temporal Representation Of Entity Selecting Content Type with Response Status Code set to 201 and\n Delete Attribute Instance From Temporal Entity with Response Status Code set to 204 and\n Retrieve Temporal Representation Of Entity with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/speed/{instanceId}'\n method set to 'DELETE'\n Delete Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'speed' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/speed/{instanceId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance", + "robotfile": "017_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/017_02.json b/doc/files/ContextInformation/Provision/017_02.json new file mode 100644 index 0000000000000000000000000000000000000000..26fe5e09ee8448458be01808aba0c879eac5ce45 --- /dev/null +++ b/doc/files/ContextInformation/Provision/017_02.json @@ -0,0 +1,105 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_02", + "test_objective": "Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.15", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.15" + ], + "pics_selection": "", + "keywords": [ + "Delete attribute instance", + "Create Temporal Entity", + "Delete Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n and an attribute with an id set to ${atrId}\n}", + "test_cases": [ + { + "name": "017_02_01 Delete an attribute instance in temporal representation of an entity if the entity id is not valid", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_02_01", + "doc": "Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-instance-delete", + "5_6_15" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Temporal Entity", + "template": "Delete attribute instance", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Attribute Instance From Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'DELETE'\n Delete Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to 'invalidId' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "017_02_02 Delete an attribute instance in temporal representation of an entity if the entity id is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_02_02", + "doc": "Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-instance-delete", + "5_6_15" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Temporal Entity", + "template": "Delete attribute instance", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Attribute Instance From Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'DELETE'\n Delete Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${EMPTY}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "017_02_03 Delete an attribute instance in temporal representation of an entity if the instance id is not valid", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_02_03", + "doc": "Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-instance-delete", + "5_6_15" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Temporal Entity", + "template": "Delete attribute instance", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Attribute Instance From Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'DELETE'\n Delete Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "017_02_04 Delete an attribute instance in temporal representation of an entity if the attribute name is not a valid name", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_02_04", + "doc": "Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-instance-delete", + "5_6_15" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Temporal Entity", + "template": "Delete attribute instance", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Attribute Instance From Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'DELETE'\n Delete Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "017_02_05 Delete an attribute instance in temporal representation of an entity if the attribute name is not present", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_02_05", + "doc": "Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "tags": [ + "tea-instance-delete", + "5_6_15" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Temporal Entity", + "template": "Delete attribute instance", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Attribute Instance From Temporal Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'DELETE'\n Delete Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance", + "robotfile": "017_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/017_03.json b/doc/files/ContextInformation/Provision/017_03.json new file mode 100644 index 0000000000000000000000000000000000000000..65e268291bcf61f614e118763c494a64ef4d4000 --- /dev/null +++ b/doc/files/ContextInformation/Provision/017_03.json @@ -0,0 +1,73 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_03", + "test_objective": "Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not right", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.15", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.6.15" + ], + "pics_selection": "", + "keywords": [ + "Delete An Attribute Instance", + "Create Id", + "Delete Initial Temporal Representation Of Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "017_03_01 Delete an attribute instance in temporal representation of an entity if the entity with given id is not found", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_03_01", + "doc": "Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not found", + "tags": [ + "tea-instance-delete", + "5_6_15" + ], + "setup": "Create Id", + "teardown": "Delete Initial Temporal Representation Of Entity", + "template": "Delete An Attribute Instance", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Attribute Instance From Temporal Entity with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'DELETE'\n Delete Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${unknown_temporal_entity_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "017_03_02 Delete an attribute instance in temporal representation of an entity if the target attribute is not found", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_03_02", + "doc": "Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not found", + "tags": [ + "tea-instance-delete", + "5_6_15" + ], + "setup": "Create Id", + "teardown": "Delete Initial Temporal Representation Of Entity", + "template": "Delete An Attribute Instance", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Attribute Instance From Temporal Entity with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'DELETE'\n Delete Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + }, + { + "name": "017_03_03 Delete an attribute instance in temporal representation of an entity if the target attribute instance is not found", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/TEA/017_03_03", + "doc": "Check that you cannot delete an attribute instance in temporal representation of an entity if the EntityId/AttributeId/InstanceId is not found", + "tags": [ + "tea-instance-delete", + "5_6_15" + ], + "setup": "Create Id", + "teardown": "Delete Initial Temporal Representation Of Entity", + "template": "Delete An Attribute Instance", + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Attribute Instance From Temporal Entity with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}'\n method set to 'DELETE'\n Delete Attribute Instance from Temporal Entity: and\n Query Parameter: temporal_entity_id set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to '${attributeId}' and\n Query Parameter: instanceId set to '${instanceId}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "temporal/entities/{temporal_entity_id}/attrs/{attributeId}/{instanceId}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance", + "robotfile": "017_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/028_01.json b/doc/files/ContextInformation/Subscription/028_01.json new file mode 100644 index 0000000000000000000000000000000000000000..9d5d377dc74a9f3953a357e3ed3ffab89bdcba17 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/028_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/028_01", + "test_objective": "Check that you can create a subscription", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.1" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "028_01_01 Create Subscription", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/028_01_01", + "doc": "Check that you can create a subscription", + "tags": [ + "5_8_1", + "sub-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Subscription with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscriptions/subscription-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/CreateSubscription", + "robotfile": "028_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/028_02.json b/doc/files/ContextInformation/Subscription/028_02.json new file mode 100644 index 0000000000000000000000000000000000000000..7320713546fd5a6c3d8bb1ad97e5b379afd62a47 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/028_02.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/028_02", + "test_objective": "Check that you cannot create a subscription with an invalid request", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.1" + ], + "pics_selection": "", + "keywords": [ + "Create Subscription With Invalid Request" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "028_02_01 InvalidJson", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/028_02_01", + "doc": "Check that you cannot create a subscription with an invalid request", + "tags": [ + "sub-create", + "5_8_1" + ], + "setup": null, + "teardown": null, + "template": "Create Subscription With Invalid Request", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription From File with Response Status Code set to 400 and\n Create Subscription From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/InvalidRequest' and\n Create Subscription From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Create Subscription Request with Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscription-invalid-json-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + }, + { + "name": "028_02_02 EmptyJson", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/028_02_02", + "doc": "Check that you cannot create a subscription with an invalid request", + "tags": [ + "sub-create", + "5_8_1" + ], + "setup": null, + "teardown": null, + "template": "Create Subscription With Invalid Request", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription From File with Response Status Code set to 400 and\n Create Subscription From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Subscription From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Create Subscription Request with Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscription-empty-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Subscription/CreateSubscription", + "robotfile": "028_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/028_03.json b/doc/files/ContextInformation/Subscription/028_03.json new file mode 100644 index 0000000000000000000000000000000000000000..b9c49e57acc0e2960721d985be1a26da60d4341e --- /dev/null +++ b/doc/files/ContextInformation/Subscription/028_03.json @@ -0,0 +1,54 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/028_03", + "test_objective": "Check that you cannot create a subscription with an invalid/empty id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.1" + ], + "pics_selection": "", + "keywords": [ + "Create Subscription With Invalid/Empty Id", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "028_03_01 InvalidId", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/028_03_01", + "doc": "Check that you cannot create a subscription with an invalid/empty id", + "tags": [ + "sub-create", + "5_8_1" + ], + "setup": null, + "teardown": null, + "template": "Create Subscription With Invalid/Empty Id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription with Response Status Code set to 400 and\n Create Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscriptions/subscription-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + }, + { + "name": "028_03_02 EmptyId", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/028_03_02", + "doc": "Check that you cannot create a subscription with an invalid/empty id", + "tags": [ + "sub-create", + "5_8_1" + ], + "setup": null, + "teardown": null, + "template": "Create Subscription With Invalid/Empty Id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription with Response Status Code set to 400 and\n Create Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscriptions/subscription-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/CreateSubscription", + "robotfile": "028_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/028_04.json b/doc/files/ContextInformation/Subscription/028_04.json new file mode 100644 index 0000000000000000000000000000000000000000..22fcf02aaf437747262daacba46fed0287a3db0b --- /dev/null +++ b/doc/files/ContextInformation/Subscription/028_04.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/028_04", + "test_objective": "Check that you cannot create a subscription with an existing id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.1" + ], + "pics_selection": "", + "keywords": [ + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "028_04_01 Create a subscription with an id known to the system", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/028_04_01", + "doc": "Check that you cannot create a subscription with an existing id", + "tags": [ + "5_8_1", + "sub-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription with Response Status Code set to 409 and\n Create Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/AlreadyExists' and\n Create Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscriptions/subscription-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/CreateSubscription", + "robotfile": "028_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/028_05.json b/doc/files/ContextInformation/Subscription/028_05.json new file mode 100644 index 0000000000000000000000000000000000000000..3931ff5eeb2bbbbc316487f0ef3610ccdd7b48e6 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/028_05.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/028_05", + "test_objective": "Check that you cannot create a subscription with invalid throttling", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.1" + ], + "pics_selection": "", + "keywords": [ + "Create Subscription With Invalid Throttling" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "028_05_01 ThrottlingAndTimeIntervalConjunction", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/028_05_01", + "doc": "Check that you cannot create a subscription with invalid throttling", + "tags": [ + "sub-create", + "5_8_1" + ], + "setup": null, + "teardown": null, + "template": "Create Subscription With Invalid Throttling", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription From File with Response Status Code set to 400 and\n Create Subscription From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Subscription From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Create Subscription Request with Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscription-invalid-throttling-timeInterval-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + }, + { + "name": "028_05_02 NegativeThrottling", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/028_05_02", + "doc": "Check that you cannot create a subscription with invalid throttling", + "tags": [ + "sub-create", + "5_8_1" + ], + "setup": null, + "teardown": null, + "template": "Create Subscription With Invalid Throttling", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription From File with Response Status Code set to 400 and\n Create Subscription From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Subscription From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Create Subscription Request with Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscription-invalid-negative-throttling-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Subscription/CreateSubscription", + "robotfile": "028_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_01.json b/doc/files/ContextInformation/Subscription/029_01.json new file mode 100644 index 0000000000000000000000000000000000000000..1365a18e00345eb2ddc5d6d6346daf88979f9a56 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_01.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_01", + "test_objective": "Check that you cannot update a subscription: If the Subscription id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [ + "Update Subscription With Non present Or Invalid Id" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_01_01 NotPresentId", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_01_01", + "doc": "Check that you cannot update a subscription: If the Subscription id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised", + "tags": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": "Update Subscription With Non present Or Invalid Id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 405 and\n Update Subscription with Response Body containing the type '${EMPTY}' and\n Update Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + }, + { + "name": "029_01_02 InvalidId", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_01_02", + "doc": "Check that you cannot update a subscription: If the Subscription id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised", + "tags": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": "Update Subscription With Non present Or Invalid Id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 400 and\n Update Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Update Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_02.json b/doc/files/ContextInformation/Subscription/029_02.json new file mode 100644 index 0000000000000000000000000000000000000000..7c3cc63f3762636b4830267a92e29796b2ac6bd6 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_02.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_02", + "test_objective": "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", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_02_01 Update Unknown Subscription", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_02_01", + "doc": "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": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 404 and\n Update Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Update Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_03.json b/doc/files/ContextInformation/Subscription/029_03.json new file mode 100644 index 0000000000000000000000000000000000000000..00b7127be04211149f6bc8c42e066a64b1e28296 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_03.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_03", + "test_objective": "Check that you cannot update a subscription: If the data types and restriction are not met by the Subscription Fragment, then an error of type BadRequestData shall be raised", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_03_01 Update Subscription With Invalid Fragment", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_03_01", + "doc": "Check that you cannot update a subscription: If the data types and restriction are not met by the Subscription Fragment, then an error of type BadRequestData shall be raised", + "tags": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 400 and\n Update Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Update Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-invalid-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_04.json b/doc/files/ContextInformation/Subscription/029_04.json new file mode 100644 index 0000000000000000000000000000000000000000..65656cba49ef997983a27cf0eb5cc07941e60c2f --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_04", + "test_objective": "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", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_04_01 Update Subscription With Null Mandatory Properties", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_04_01", + "doc": "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": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 400 and\n Update Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Update Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-null-properties-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_05.json b/doc/files/ContextInformation/Subscription/029_05.json new file mode 100644 index 0000000000000000000000000000000000000000..d78e291b961188112be50705f860ea055d258b22 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_05.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_05", + "test_objective": "Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_05_01 Update Subscription With Term to Uri Expansion with Context", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_05_01", + "doc": "Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed", + "tags": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 204 and\n Retrieve Subscription with Response Body containing the same content defined in file 'subscriptions/expectations/subscription-vehicle-sample.jsonld' with subscription id '${subscription_id}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Link'] contain the context 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-vehicle-entities-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + }, + { + "name": "029_05_02 Update Subscription With Term to Uri Expansion without Context", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_05_02", + "doc": "Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed", + "tags": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 204 and\n Retrieve Subscription with Response Body containing the same content defined in file 'subscriptions/expectations/subscription-vehicle-expanded-types-sample.jsonld' with subscription id '${subscription_id}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Link'] contain the context 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-vehicle-entities-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_06.json b/doc/files/ContextInformation/Subscription/029_06.json new file mode 100644 index 0000000000000000000000000000000000000000..af9661f423b630586c3e19bb378c7589a2818563 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_06.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_06", + "test_objective": "Check that you can update a subscription: The implementation shall modify the target Subscription", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_06_01 Update Subscription", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_06_01", + "doc": "Check that you can update a subscription: The implementation shall modify the target Subscription", + "tags": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 204 and\n Retrieve Subscription with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Link'] contain the context 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_07.json b/doc/files/ContextInformation/Subscription/029_07.json new file mode 100644 index 0000000000000000000000000000000000000000..8d0133d92fd67a4a17db8d6ffb6bb6b43b72a4a6 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_07.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_07", + "test_objective": "Check that you can update a subscription: If isActive is equal to true 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\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [ + "Activate Paused Subscription With isActive Member", + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_07_01 ActiveTrue", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_07_01", + "doc": "Check that you can update a subscription: If isActive is equal to true 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": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": "Activate Paused Subscription With isActive Member", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 204 and\n Retrieve Subscription with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'status' and\n Query Parameter: response_body set to 'response1.json()' and\n Query Parameter: expected_attribute_value set to 'active'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-isActive-true-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_08.json b/doc/files/ContextInformation/Subscription/029_08.json new file mode 100644 index 0000000000000000000000000000000000000000..7e10a5ad22f7aa9406f3ca847d77673675f96393 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_08.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_08", + "test_objective": "Check that you can update a subscription: If isActive is equal to true and expiresAt corresponds to a DateTime in the future, then status shall be updated to \"active\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [ + "Activate Paused Subscription With isActive And ExpiresAt Members", + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_08_01 ActiveTrueExpiresAt", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_08_01", + "doc": "Check that you can update a subscription: If isActive is equal to true and expiresAt corresponds to a DateTime in the future, then status shall be updated to \"active\"", + "tags": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": "Activate Paused Subscription With isActive And ExpiresAt Members", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 204 and\n Retrieve Subscription with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'status' and\n Query Parameter: response_body set to 'response1.json()' and\n Query Parameter: expected_attribute_value set to 'active'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_08" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_09.json b/doc/files/ContextInformation/Subscription/029_09.json new file mode 100644 index 0000000000000000000000000000000000000000..a0a1d90bfee7e48ff2fcd43686cd06a4a4074956 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_09.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_09", + "test_objective": "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\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_09_01 Update Subscription Status To Paused", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_09_01", + "doc": "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": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 204 and\n Retrieve Subscription with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'status' and\n Query Parameter: response_body set to 'response1.json()' and\n Query Parameter: expected_attribute_value set to 'paused'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-isActive-false-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_09" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_10.json b/doc/files/ContextInformation/Subscription/029_10.json new file mode 100644 index 0000000000000000000000000000000000000000..31d61e31e2f8c4cec70366b56d910a5ea6a3cad3 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_10.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_10", + "test_objective": "Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future, then status shall be updated to \"active\", if and only if the previous value of status was \"expired\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_10_01 Activate Expired Subscription", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_10_01", + "doc": "Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future, then status shall be updated to \"active\", if and only if the previous value of status was \"expired\"", + "tags": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 204 and\n Retrieve Subscription with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'status' and\n Query Parameter: response_body set to 'response1.json()' and\n Query Parameter: expected_attribute_value set to 'active'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file '${subscription_update_fragment_file_path}'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_10" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/029_11.json b/doc/files/ContextInformation/Subscription/029_11.json new file mode 100644 index 0000000000000000000000000000000000000000..0fceb80bf8e735749f384375fdacfb5078396d09 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/029_11.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/029_11", + "test_objective": "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", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.2" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "029_11_01 Update Subscription With ExpiresAt In The Past", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_11_01", + "doc": "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": [ + "5_8_2", + "sub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Subscription with Response Status Code set to 400 and\n Update Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Update Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'PATCH'\n Request Update Subscription and \nHeader['Content-Type'] set to 'application/json' and\nPayload defined in file 'subscriptions/fragments/subscription-expiresAt-update-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/UpdateSubscription", + "robotfile": "029_11" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/030_01.json b/doc/files/ContextInformation/Subscription/030_01.json new file mode 100644 index 0000000000000000000000000000000000000000..d7c80d4d3902792d722a8ea4be95689c93ff6391 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/030_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/030_01", + "test_objective": "Check that you cannot retrieve a subscription if the subscription Id is not a valid URI, then an error of type BadRequestData shall be raised", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.3" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Subscription With Invalid Id" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "030_01_01 InvalidId", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/030_01_01", + "doc": "Check that you cannot retrieve a subscription: If the subscription Id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised", + "tags": [ + "5_8_3", + "sub-retrieve" + ], + "setup": null, + "teardown": null, + "template": "Retrieve Subscription With Invalid Id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Subscription with Response Status Code set to 400 and\n Retrieve Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Retrieve Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{id}'\n method set to 'GET'\n Subscription Retrieve with the following data: and\n Query Parameter: id set to 'InvalidUri'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/RetrieveSubscription", + "robotfile": "030_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/030_02.json b/doc/files/ContextInformation/Subscription/030_02.json new file mode 100644 index 0000000000000000000000000000000000000000..216727830d2e9d0a87c8e7ecda8797d93c739f7c --- /dev/null +++ b/doc/files/ContextInformation/Subscription/030_02.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/030_02", + "test_objective": "Check that you cannot retrieve a subscription: If the identifier provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.3" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "030_02_01 Retrieve Unknown Subscription", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/030_02_01", + "doc": "Check that you cannot retrieve a subscription: If the identifier provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised", + "tags": [ + "5_8_3", + "sub-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Subscription with Response Status Code set to 404 and\n Retrieve Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Retrieve Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{id}'\n method set to 'GET'\n Subscription Retrieve with the following data: and\n Query Parameter: id set to 'urn:ngsi-ld:Subscription:unknowSubscription'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/RetrieveSubscription", + "robotfile": "030_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/030_03.json b/doc/files/ContextInformation/Subscription/030_03.json new file mode 100644 index 0000000000000000000000000000000000000000..fe35856a547707c120fea7acda0bb9847797b978 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/030_03.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/030_03", + "test_objective": "Check that you can retrieve a subscription", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.3" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "030_03_01 Retrieve Subscription", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/030_03_01", + "doc": "Check that you can retrieve a subscription", + "tags": [ + "5_8_3", + "sub-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Subscription with Response Status Code set to 200 and\n Retrieve Subscription with Response Body containing the same content defined in file 'subscriptions/expectations/subscriptions-030-03-expectation.json' with subscription id '${subscription_id}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{id}'\n method set to 'GET'\n Subscription Retrieve with the following data: and\n Query Parameter: id set to '${subscription_id}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/RetrieveSubscription", + "robotfile": "030_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/031_01.json b/doc/files/ContextInformation/Subscription/031_01.json new file mode 100644 index 0000000000000000000000000000000000000000..1e3423cfba51657ee931521a7f93f00ad235a12d --- /dev/null +++ b/doc/files/ContextInformation/Subscription/031_01.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/031_01", + "test_objective": "Check that you can query a list of subscriptions", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.4" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "Delete Initial Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "031_01_01 Query Subscriptions", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/031_01_01", + "doc": "Check that you can query a list of subscriptions", + "tags": [ + "5_8_4", + "sub-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Subscriptions with Response Status Code set to 200 and\n Query Subscriptions with Response containing:\n * file set to 'subscriptions/expectations/subscriptions-031-01-expectation.json'\n * id set to '${subscription_ids}'\n * response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'GET'\n Query Subscription Request with data: and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/QuerySubscriptions", + "robotfile": "031_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/031_02.json b/doc/files/ContextInformation/Subscription/031_02.json new file mode 100644 index 0000000000000000000000000000000000000000..834e05028ea4dde37aa1bc28d2552025ab55381c --- /dev/null +++ b/doc/files/ContextInformation/Subscription/031_02.json @@ -0,0 +1,74 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/031_02", + "test_objective": "Check that you can query a list of subscriptions: Pagination logic shall be in place", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.4" + ], + "pics_selection": "", + "keywords": [ + "Query Subscriptions With Limit And Page Parameters", + "Setup Initial Subscriptions", + "Delete Initial Subscriptions" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id} \n}", + "test_cases": [ + { + "name": "031_02_01 Query Second Subscription", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/031_02_01", + "doc": "Check that you can query a list of subscriptions: Pagination logic shall be in place", + "tags": [ + "5_8_4", + "sub-query" + ], + "setup": "Setup Initial Subscriptions", + "teardown": "Delete Initial Subscriptions", + "template": "Query Subscriptions With Limit And Page Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Subscriptions with Response Status Code set to 200 and\n Query Subscriptions with Response Body containing a list of entities equal to '${expectation_subscription_number}' of type 'Subscription' with response set to '${response.json()}' and\n Query Subscriptions with Response header with 'Prev' header equal to ';rel=\"next\";type=\"application/ld+json\"' and with 'Next' header equal to '${response.headers}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'GET'\n Query Subscription Request with data: and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: limit set to '${1}' and\n Query Parameter: offset set to '${1}' and\n Query Parameter: accept set to 'application/ld+json'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/" + }, + { + "name": "031_02_02 Query Last Subscription", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/031_02_02", + "doc": "Check that you can query a list of subscriptions: Pagination logic shall be in place", + "tags": [ + "5_8_4", + "sub-query" + ], + "setup": "Setup Initial Subscriptions", + "teardown": "Delete Initial Subscriptions", + "template": "Query Subscriptions With Limit And Page Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Subscriptions with Response Status Code set to 200 and\n Query Subscriptions with Response Body containing a list of entities equal to '${expectation_subscription_number}' of type 'Subscription' with response set to '${response.json()}' and\n Query Subscriptions with Response header with 'Prev' header equal to '${EMPTY}' and with 'Next' header equal to '${response.headers}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'GET'\n Query Subscription Request with data: and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: limit set to '${1}' and\n Query Parameter: offset set to '${2}' and\n Query Parameter: accept set to 'application/ld+json'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/" + }, + { + "name": "031_02_03 Query All Subscriptions", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/031_02_03", + "doc": "Check that you can query a list of subscriptions: Pagination logic shall be in place", + "tags": [ + "5_8_4", + "sub-query" + ], + "setup": "Setup Initial Subscriptions", + "teardown": "Delete Initial Subscriptions", + "template": "Query Subscriptions With Limit And Page Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Subscriptions with Response Status Code set to 200 and\n Query Subscriptions with Response Body containing a list of entities equal to '${expectation_subscription_number}' of type 'Subscription' with response set to '${response.json()}' and\n Query Subscriptions with Response header with 'Prev' header equal to '${EMPTY}' and with 'Next' header equal to '${response.headers}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'GET'\n Query Subscription Request with data: and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: limit set to '${15}' and\n Query Parameter: offset set to '${0}' and\n Query Parameter: accept set to 'application/ld+json'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Subscription/QuerySubscriptions", + "robotfile": "031_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/032_01.json b/doc/files/ContextInformation/Subscription/032_01.json new file mode 100644 index 0000000000000000000000000000000000000000..ddb2b395f4f1c53b4334165a91a8e1d6757f17ff --- /dev/null +++ b/doc/files/ContextInformation/Subscription/032_01.json @@ -0,0 +1,56 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/032_01", + "test_objective": "Check that you cannot delete a subscription: If the subscription Id is not present or it is not a valid URI, then an error shall be raised", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Subscription With Non present Or Invalid Id" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "032_01_01 NotPresentId", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/032_01_01", + "doc": "Check that you cannot delete a subscription: If the subscription Id is not present or it is not a valid URI, then an error shall be raised", + "tags": [ + "5_8_5", + "sub-delete" + ], + "setup": null, + "teardown": null, + "template": "Delete Subscription With Non present Or Invalid Id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Subscription with Response Status Code set to 405 and\n Delete Subscription with Response Body containing the type '${EMPTY}' and\n Delete Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'DELETE'\n Delete Subscription with id set to '${EMPTY}'\n}", + "http_verb": "DELETE", + "endpoint": "subscriptions/{subscription_id}" + }, + { + "name": "032_01_02 InvalidId", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/032_01_02", + "doc": "Check that you cannot delete a subscription: If the subscription Id is not present or it is not a valid URI, then an error shall be raised", + "tags": [ + "5_8_5", + "sub-delete" + ], + "setup": null, + "teardown": null, + "template": "Delete Subscription With Non present Or Invalid Id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Subscription with Response Status Code set to 400 and\n Delete Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Delete Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'DELETE'\n Delete Subscription with id set to 'InvalidUri'\n}", + "http_verb": "DELETE", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Subscription/DeleteSubscription", + "robotfile": "032_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/032_02.json b/doc/files/ContextInformation/Subscription/032_02.json new file mode 100644 index 0000000000000000000000000000000000000000..0940713dfbaaf3d680678fb4642ecb46e300fb45 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/032_02.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/032_02", + "test_objective": "Check that you cannot delete a subscription: If the subscription id provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "032_02_01 Delete Unknown Subscription", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/032_02_01", + "doc": "Check that you cannot delete a subscription: If the subscription id provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised", + "tags": [ + "5_8_5", + "sub-delete" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Subscription with Response Status Code set to 404 and\n Delete Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Delete Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'DELETE'\n Delete Subscription with id set to 'urn:ngsi-ld:Subscription:unknowSubscription'\n}", + "http_verb": "DELETE", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/DeleteSubscription", + "robotfile": "032_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/032_03.json b/doc/files/ContextInformation/Subscription/032_03.json new file mode 100644 index 0000000000000000000000000000000000000000..d3b1b4df3904a170807cf5a304572ba09c4c0827 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/032_03.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/032_03", + "test_objective": "Check that you can delete a subscription", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.5" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "032_03_01 Delete Subscription", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/032_03_01", + "doc": "Check that you can delete a subscription", + "tags": [ + "5_8_5", + "sub-delete" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Subscription with Response Status Code set to 204 and\n Retrieve Subscription with Response Status Code set to ${response1.status_code}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{subscription_id}'\n method set to 'DELETE'\n Delete Subscription with id set to '${subscription_id}'\n}", + "http_verb": "DELETE", + "endpoint": "subscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/DeleteSubscription", + "robotfile": "032_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_01.json b/doc/files/ContextInformation/Subscription/046_01.json new file mode 100644 index 0000000000000000000000000000000000000000..071cbf6e562ffda5370bab7f45f3c8c59a0edf4f --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_01.json @@ -0,0 +1,42 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_01", + "test_objective": "Check that a notification is only sent if and only if the status is active", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Test", + "Add Initial Entity", + "Setup Initial Subscriptions", + "After Test", + "Delete Initial Subscriptions", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_01_01 Check that a notification is only sent if status is active", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_01_01", + "doc": "Check that a notification is only sent if and only if the status is active", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '10' seconds and\n Notification received Notification data: '${notification}[subscriptionId]' equal to '${subscription_id}' and\n Notification received Notification data: '${notification}[data][0][id]' equal to '${entity_id}' and\n Notification received Notification data: '${notification}[data][0][airQualityLevel][value]' equal to '${5}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'airQualityLevel-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_02.json b/doc/files/ContextInformation/Subscription/046_02.json new file mode 100644 index 0000000000000000000000000000000000000000..79698d74645296cfb83dd308711caa8f232b78ab --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_02.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_02", + "test_objective": "If a Subscription defines a timeInterval member, a Notification shall be sent periodically, when the time interval (in seconds) specified in such value field is reached, regardless of Attribute changes.", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Test", + "Setup Initial Subscriptions", + "After Test", + "Delete Initial Subscriptions", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_02_01 Check that a notification is sent on the timeInterval", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_02_01", + "doc": "If a Subscription defines a timeInterval member, a Notification shall be sent periodically, when the time interval (in seconds) specified in such value field is reached, regardless of Attribute changes.", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '15' seconds and\n Notification received After waiting '15' seconds and\n Notification received Notification data: '${notification}[subscriptionId]' equal to '${subscription_id}' and\n Notification received Notification data: '${notification}[data][0][id]' equal to '${entity_id}' and\n Notification received Notification data: '${notification}[data][0][name][value]' equal to 'Eiffel Tower' and\n Notification received The dictionary `${notification}' should contain the key 'data' and\n Notification received The variable `${notification}[data]' should not be '${EMPTY}' and\n Notification received The expression `'${notification}[data][0][airQualityLevel][value]'=='4.0' or '${notification}[data][0][airQualityLevel][value]'=='4'' should be True\n}", + "when": "The client at ${endpoint} receives a valid Notification containing a subscription with id set to ${subscriptionId} \n and status equals 'active'\n and timeInterval is set to '${timeInterval}'\n and watchedAttributes is 'Empty'\n and q is 'Empty'\n and geoQ is 'Empty'\n and with subscription.entity with type 'Building'\n and notification.endpoint.accept is 'application/json'\n \n When the timeinterval is reached at ${timeInterval} seconds\n the SUT needs to send out a notification to the client \n sends a notification to the client every ${timeInterval} seconds", + "http_verb": "", + "endpoint": "" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_03.json b/doc/files/ContextInformation/Subscription/046_03.json new file mode 100644 index 0000000000000000000000000000000000000000..a2bcfc3ce064e8e57e67d7809ed8ba0465a2e8e4 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_03.json @@ -0,0 +1,42 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_03", + "test_objective": "A notification with all subscribed Entities will be included if query or geoquery are not defined.", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Test", + "Setup Initial Subscriptions", + "After Test", + "Delete Initial Subscriptions", + "Add Initial Entity", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_03_01 Check that a notification is sent with all entities", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_03_01", + "doc": "A notification with all subscribed Entities will be included if query or geoquery are not defined.", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '5' seconds and\n Notification received Notification data: '${notification}[subscriptionId]' equal to '${subscription_id}' and\n Notification received Notification data: '${notification}[data][0][id]' equal to '${entity_id}' and\n Notification received Notification data: '${notification}[data][0][name][value]' equal to 'Eiffel Tower' and\n Notification received The dictionary `${notification}' should contain the key 'data' and\n Notification received The variable `${notification}[data]' should not be '${EMPTY}' and\n Notification received The expression `'${notification}[data][0][airQualityLevel][value]'=='5.0' or '${notification}[data][0][airQualityLevel][value]'=='5'' should be True\n}", + "when": "The client at ${endpoint} receives a valid Notification containing a subscription with id set to ${subscriptionId} \n and status equals 'active'\n and timeInterval is set to '${timeInterval}'\n and watchedAttributes is 'Empty'\n and q is 'Empty'\n and geoQ is 'Empty'\n and with subscription.entity with type 'Building'\n and notification.endpoint.accept is 'application/json'\n \n When the timeinterval is reached at ${timeInterval} seconds\n the SUT needs to send out a notification to the client \n sends a notification to the client every ${timeInterval} seconds", + "http_verb": "", + "endpoint": "" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_04.json b/doc/files/ContextInformation/Subscription/046_04.json new file mode 100644 index 0000000000000000000000000000000000000000..2883f38f2a35c2137f1c16ca397a20c6354ffa6a --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_04.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_04", + "test_objective": "If a Subscription does not define a timeInterval member, the notification shall be sent whenever there is a change in the watched Attributes. The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Test", + "Setup Initial Subscriptions", + "After Test", + "Delete Initial Subscriptions", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_04_01 Check that a notification is sent with all entities", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_04_01", + "doc": "The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '5' seconds and\n Notification received Notification data: '${notification}[subscriptionId]' equal to '${subscription_id}' and\n Notification received Notification data: '${notification}[data][0][id]' equal to '${entity_id}' and\n Notification received Notification data: '${notification}[data][0][airQualityLevel][value]' equal to '${5}' and\n Notification received Notification data: '${notification}[data][0][name][value]' equal to 'Eiffel Tower' and\n Notification received The dictionary `${notification}' should contain the key 'data' and\n Notification received The variable `${notification}[data]' should not be '${EMPTY}'\n}", + "when": "The client at ${endpoint} receives a valid Notification containing a subscription with id set to ${subscriptionId} \n and status equals 'active'\n and timeInterval is set to '${timeInterval}'\n and watchedAttributes is 'Empty'\n and q is 'Empty'\n and geoQ is 'Empty'\n and with subscription.entity with type 'Building'\n and notification.endpoint.accept is 'application/json'\n \n When the timeinterval is reached at ${timeInterval} seconds\n the SUT needs to send out a notification to the client \n sends a notification to the client every ${timeInterval} seconds", + "http_verb": "", + "endpoint": "" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_05.json b/doc/files/ContextInformation/Subscription/046_05.json new file mode 100644 index 0000000000000000000000000000000000000000..26c22b272bfe0c4e4fe12ff263e1926805953141 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_05.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_05", + "test_objective": "If a Subscription does not define a timeInterval member, the notification shall be sent whenever there is a change in the watched Attributes and the entity matches the q parameter. The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Test", + "Setup Initial Subscriptions", + "After Test", + "Delete Initial Subscriptions", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_05_01 Check that a notification is sent with all entities", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_05_01", + "doc": "The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '5' seconds and\n Notification received Notification data: '${notification}[subscriptionId]' equal to '${subscription_id}' and\n Notification received Notification data: '${notification}[data][0][id]' equal to '${entity_id}' and\n Notification received Notification data: '${notification}[data][0][name][value]' equal to 'Eiffel Tower' and\n Notification received The dictionary `${notification}' should contain the key 'data' and\n Notification received The variable `${notification}[data]' should not be '${EMPTY}' and\n Notification received The expression `'${notification}[data][0][airQualityLevel][value]'=='5.0' or '${notification}[data][0][airQualityLevel][value]'=='5'' should be True\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'airQualityLevel-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_06.json b/doc/files/ContextInformation/Subscription/046_06.json new file mode 100644 index 0000000000000000000000000000000000000000..82b54629c779cccaf2d4578cbe8108de66f46349 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_06.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_06", + "test_objective": "If a Subscription does not define a timeInterval member, the notification shall be sent whenever an entity matches the query defined in the subscription. The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Setup Server And Subscriptions", + "Delete Server And Subscriptions" + ], + "teardown": "Delete Server And Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_06_01 Check that a notification is sent with all matching entities", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_06_01", + "doc": "only the subscribed Entities matching the query and watched attributes shall be included.", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '10' seconds and\n Notification received Notification data: '${notification}[subscriptionId]' equal to '${subscription_id}' and\n Notification received Notification data: '${notification}[data][0][id]' equal to '${entity_id}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'building-location-attribute.jsonld'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_07.json b/doc/files/ContextInformation/Subscription/046_07.json new file mode 100644 index 0000000000000000000000000000000000000000..462151ecdf53ed005a08e2284f65edfd5cb3bed4 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_07.json @@ -0,0 +1,74 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_07", + "test_objective": "Check that a notification is only sent if and only if the status is active", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Suite", + "Setup Initial Subscriptions", + "After Test", + "After Suite" + ], + "teardown": "After Suite", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id} \n}", + "test_cases": [ + { + "name": "046_07_01 Check notification structure", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_07_01", + "doc": "The structure of the notification message shall be as mandated by clause 5.3. Valid notification with attributes as stated above", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": "Setup Initial Subscriptions", + "teardown": "After Test", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '5' seconds\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to '${fragment_filename}' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "046_07_02 Check correct attributes are included", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_07_02", + "doc": "The structure of the notification message shall be as mandated by clause 5.3. The Entity Attributes included (Properties or Relationships) shall be those specified by the notification.attributes member in the Subscription data type (clause 5.2.12).", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": "Setup Initial Subscriptions", + "teardown": "After Test", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '5' seconds and\n Notification received The dictionary `${notification}[data][0]' should contain the key 'airQualityLevel'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to '${fragment_filename}' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "046_07_03 Check URI expansion is observed", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_07_03", + "doc": "The structure of the notification message shall be as mandated by clause 5.3. URI expansion shall be observed (clause 5.5.7).", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": "Setup Initial Subscriptions", + "teardown": "After Test", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '5' seconds and\n Notification received The dictionary `${notification}[data][0]' should contain the key 'https://ngsi-ld-test-suite/context#airQualityLevel'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to '${fragment_filename}' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_08.json b/doc/files/ContextInformation/Subscription/046_08.json new file mode 100644 index 0000000000000000000000000000000000000000..b459a48b132fc6208ff55ad65b81df1e6b5f916e --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_08.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_08", + "test_objective": "Check that a notification is only sent if and only if the status is active", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Suite", + "Setup Initial Subscriptions", + "After Test", + "After Suite" + ], + "teardown": "After Suite", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id} \n}", + "test_cases": [ + { + "name": "046_08_01 Check that a notification is sent with all attributes", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_08_01", + "doc": "The structure of the notification message shall be as mandated by clause 5.3.1. The absence of the notification.attributes member of a Subscription means that all Entity Attributes shall be included. All attributes are included", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": "Setup Initial Subscriptions", + "teardown": "After Test", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '5' seconds and\n Notification received Notification data: '${notification}[subscriptionId]' equal to '${subscription_id}' and\n Notification received Notification data: '${notification}[data][0][id]' equal to '${entity_id}' and\n Notification received Notification data: '${notification}[data][0][name][value]' equal to 'Eiffel Tower' and\n Notification received The dictionary `${notification}' should contain the key 'data' and\n Notification received The dictionary `${notification}[data][0]' should contain the key 'almostFull' and\n Notification received The dictionary `${notification}[data][0]' should contain the key 'airQualityLevel' and\n Notification received The dictionary `${notification}[data][0]' should contain the key 'subCategory' and\n Notification received The variable `${notification}[data]' should not be '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'airQualityLevel-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "046_08_02 Check that a notification is sent with all attributes in simplified format", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_08_02", + "doc": "The structure of the notification message shall be as mandated by clause 5.3.1. The absence of the notification.attributes member of a Subscription means that all Entity Attributes shall be included If the notification.format member value is \"keyValues\" then a simplified representation of the entities (as mandated by clause 4.5.3) shall be provided", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": "Setup Initial Subscriptions", + "teardown": "After Test", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '5' seconds and\n Notification received Notification data: '${notification}[subscriptionId]' equal to '${subscription_id}' and\n Notification received Notification data: '${notification}[data][0][id]' equal to '${entity_id}' and\n Notification received Notification data: '${notification}[data][0][name]' equal to 'Eiffel Tower' and\n Notification received The dictionary `${notification}' should contain the key 'data' and\n Notification received The variable `${notification}[data]' should not be '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'airQualityLevel-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_08" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_09.json b/doc/files/ContextInformation/Subscription/046_09.json new file mode 100644 index 0000000000000000000000000000000000000000..b4ac464f56e87ad8a9530f7d81d196419a2c08a9 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_09.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_09", + "test_objective": "A Notification shall be sent (as mandated by each concrete binding and including any optional endpoint.receiverInfo defined by clause 5.2.22) to the endpoint specified by the endpoint.uri member of the notification structure defined by clause 5.2.14", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Test", + "Setup Initial Subscriptions", + "After Test", + "Delete Initial Subscriptions", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_09_01 Check that a notification is sent to the endpoint", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_09_01", + "doc": "A Notification shall be sent (as mandated by each concrete binding and including any optional endpoint.receiverInfo defined by clause 5.2.22) to the endpoint specified by the endpoint.uri member of the notification structure defined by clause 5.2.1", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '10' seconds and\n Notification received The dictionary `${headers}' should contain the key 'X-Additional-Key'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to '${fragment_filename}' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_09" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_10.json b/doc/files/ContextInformation/Subscription/046_10.json new file mode 100644 index 0000000000000000000000000000000000000000..ddcd0ea213472f76b0a00ad3819a76bde8451d78 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_10.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_10", + "test_objective": "The Notification content shall be JSON by default.", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Test", + "Setup Initial Subscriptions", + "After Test", + "Delete Initial Subscriptions", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_10_01 Check that the notification is sent as JSON", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_10_01", + "doc": "The Notification shall be sent as JSON", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '10' seconds\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to '${fragment_filename}' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_10" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_11.json b/doc/files/ContextInformation/Subscription/046_11.json new file mode 100644 index 0000000000000000000000000000000000000000..3b2672b7259578ce66834792c38f904f899bf1db --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_11.json @@ -0,0 +1,42 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_11", + "test_objective": "A Notification shall be sent (as mandated by each concrete binding and including any optional endpoint.info defined by clause 5.2.22) to the endpoint specified by the endpoint.uri member of the notification structure defined by clause 5.2.14", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Test", + "Setup Initial Subscriptions", + "Add Initial Entity", + "After Test", + "Delete Initial Subscriptions", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_11_01 Check that timesSent is increased by one", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_11_01", + "doc": "The notification.timesSent member shall be incremented by one.", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '10' seconds and\n Notification received Notification data: '${response.json()}[notification][timesSent]' equal to '${1}' and\n Retrieve Subscription received The dictionary `${response.json()}[notification]' should contain the key 'timesSent'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{id}'\n method set to 'GET'\n Subscription Retrieve with the following data: and\n Query Parameter: id set to '${subscription_id}' and\n Query Parameter: accept set to 'application/ld+json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_11" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_12.json b/doc/files/ContextInformation/Subscription/046_12.json new file mode 100644 index 0000000000000000000000000000000000000000..27f3def598abd0f993df4a05a92b23f9b652fb1e --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_12.json @@ -0,0 +1,42 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_12", + "test_objective": "A Notification shall be sent (as mandated by each concrete binding and including any optional endpoint.info defined by clause 5.2.22) to the endpoint specified by the endpoint.uri member of the notification structure defined by clause 5.2.14", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions", + "Before Test", + "After Test", + "Add Initial Entity", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_12_01 Check that lastNotification is updated", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_12_01", + "doc": "The status, lastNotification and lastSuccess members shall be updated with expected value and dates. This test will check these formats.", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '10' seconds and\n Notification received Notification data: '${notification_info}[0][status]' equal to 'ok' and\n Notification received The dictionary `${notification_info}[0]' should contain the key 'status' and\n Notification received The dictionary `${notification_info}[0]' should contain the key 'lastNotification' and\n Notification received The dictionary `${notification_info}[0]' should contain the key 'lastSuccess'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{id}'\n method set to 'GET'\n Subscription Retrieve with the following data: and\n Query Parameter: id set to '${subscription_id}' and\n Query Parameter: accept set to 'application/ld+json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_12" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_13.json b/doc/files/ContextInformation/Subscription/046_13.json new file mode 100644 index 0000000000000000000000000000000000000000..05648962a40a7d197a83a03a2377feee72fd2f3d --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_13.json @@ -0,0 +1,42 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_13", + "test_objective": "If the response to the notification request is different than 200 OK then implementations shall: Update notification.lastFailure with a timestamp representing the current date and time, update notification.status to \"failed\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscription", + "Delete Initial Subscription", + "Add Initial Entity", + "Delete Initial Entity", + "Before Test", + "After Test" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_13_01 Check that lastFailure and status are updated if a notification could not be sent", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_13_01", + "doc": "If the response to the notification request is different than 200 OK then implementations shall: Update notification.lastFailure with a timestamp representing the current date and time, update notification.status to \"failed\"", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Notification data: '${notification_info}[0][status]' equal to 'failed' and\n Notification received The dictionary `${notification_info}[0]' should contain the key 'status' and\n Notification received The dictionary `${notification_info}[0]' should contain the key 'lastFailure'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/{id}'\n method set to 'GET'\n Subscription Retrieve with the following data: and\n Query Parameter: id set to '${subscription_id}' and\n Query Parameter: accept set to 'application/ld+json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "subscriptions/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_13" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_14.json b/doc/files/ContextInformation/Subscription/046_14.json new file mode 100644 index 0000000000000000000000000000000000000000..ecc4b7a157b70c61572546e94e7086facb416dfe --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_14.json @@ -0,0 +1,42 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_14", + "test_objective": "The Notification content shall be JSON-LD when endpoint.accept is set to JSON-LD", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Subscriptions", + "Delete Initial Subscriptions", + "Before Test", + "After Test", + "Add Initial Entity", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_14_01 Check that a notification is sent as JSON-LD", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_14_01", + "doc": "The Notification content shall be JSON-LD when endpoint.accept is set to 'application/ld+json'", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Notification with The dictionary `${notification}[data][0]' should contain the key '@context'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to '${fragment_filename}' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_14" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_15.json b/doc/files/ContextInformation/Subscription/046_15.json new file mode 100644 index 0000000000000000000000000000000000000000..39a82438d11afd3c680c4fa8e37ea86c75a02f00 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_15.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_15", + "test_objective": "If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet.", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Before Test", + "Setup Initial Subscriptions", + "After Test", + "Delete Initial Subscriptions", + "Delete Initial Entity" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_15_01 Check that a notification is not sent if the throttling has not elapsed yet", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_15_01", + "doc": "If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet.", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '10' seconds and\n Notification received Waiting for no Notification data and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'airQualityLevel-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_15" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/036_01.json b/doc/files/ContextSource/Discovery/036_01.json new file mode 100644 index 0000000000000000000000000000000000000000..2d250319851588911a2693988b82d237c2238b61 --- /dev/null +++ b/doc/files/ContextSource/Discovery/036_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/036_01", + "test_objective": "Check that you cannot retrieve a Context Source Registration, if the context source registration id is not a valid URI", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.1" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Context Source Registration With An Invalid Id" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "036_01_01 Invalid Id", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/036_01_01", + "doc": "Check that you cannot retrieve a Context Source Registration, if the context source registration id is not a valid URI", + "tags": [ + "5_10_1", + "csr-retrieve" + ], + "setup": null, + "teardown": null, + "template": "Retrieve Context Source Registration With An Invalid Id", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Context Source Registration with Response Status Code set to 400 and\n Retrieve Context Source Registration with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Retrieve Context Source Registration with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n method set to 'GET'\n Retrieve Context Source Registration with data: and\n Query Parameter: context source registration id set to 'invalidUri'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations/{context_source_registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Discovery/RetrieveContextSourceRegistration", + "robotfile": "036_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/036_02.json b/doc/files/ContextSource/Discovery/036_02.json new file mode 100644 index 0000000000000000000000000000000000000000..7fdb0c225974febeacb0ee10202086a8dbb7b811 --- /dev/null +++ b/doc/files/ContextSource/Discovery/036_02.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/036_02", + "test_objective": "Check that you cannot retrieve a Context Source Registration, if the NGSI-LD endpoint does not know about the target context source registration, because there is no existing context source registration whose id (URI) is equivalent", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.1" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "036_02_01 Retrieve Unknown Context Source Registration", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/036_02_01", + "doc": "Check that you cannot retrieve a Context Source Registration, if the NGSI-LD endpoint does not know about the target context source registration, because there is no existing context source registration whose id (URI) is equivalent", + "tags": [ + "5_10_1", + "csr-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Context Source Registration with Response Status Code set to 404 and\n Retrieve Context Source Registration with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Retrieve Context Source Registration with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n method set to 'GET'\n Retrieve Context Source Registration with data: and\n Query Parameter: context source registration id set to 'urn:ngsi-ld:ContextSourceRegistration:unknowRegistration'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations/{context_source_registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Discovery/RetrieveContextSourceRegistration", + "robotfile": "036_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/036_03.json b/doc/files/ContextSource/Discovery/036_03.json new file mode 100644 index 0000000000000000000000000000000000000000..c26feed2107eb02b3ac22c0ea75a5bbaabb0a973 --- /dev/null +++ b/doc/files/ContextSource/Discovery/036_03.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/036_03", + "test_objective": "Check that you can retrieve a Context Source Registration. Term to URI expansion of Attribute names shall be observed.", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.1" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration", + "Delete Created Context Source Registration" + ], + "teardown": "Delete Created Context Source Registration", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "036_03_01 Retrieve Context Source Registration With Default Core Context", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/036_03_01", + "doc": "Check that you can retrieve a Context Source Registration. Term to URI expansion of Attribute names shall be observed.", + "tags": [ + "5_10_1", + "csr-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Context Source Registration with Response Status Code set to 200 and\n Retrieve Context Source Registration with Response containing:\n * file set to 'csourceRegistrations/expectations/context-source-registration-expanded-format.json'\n * id set to '${context_source_registration_id}'\n * response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n method set to 'GET'\n Retrieve Context Source Registration with data: and\n Query Parameter: context source registration id set to '${context_source_registration_id}'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations/{context_source_registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Discovery/RetrieveContextSourceRegistration", + "robotfile": "036_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/036_04.json b/doc/files/ContextSource/Discovery/036_04.json new file mode 100644 index 0000000000000000000000000000000000000000..ecb8262c05d8a18ae7dd9529ac84854167e63c39 --- /dev/null +++ b/doc/files/ContextSource/Discovery/036_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/036_04", + "test_objective": "Check that you can retrieve a Context Source Registration", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.1", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.1" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration", + "Delete Created Context Source Registration" + ], + "teardown": "Delete Created Context Source Registration", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "036_04_01 Retrieve Context Source Registration", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/036_04_01", + "doc": "Check that you can retrieve a Context Source Registration", + "tags": [ + "5_10_1", + "csr-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Context Source Registration with Response Status Code set to 200 and\n Retrieve Context Source Registration with Response containing:\n * file set to 'csourceRegistrations/expectations/context-source-registration.json'\n * id set to '${context_source_registration_id}'\n * response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n method set to 'GET'\n Retrieve Context Source Registration with data: and\n Query Parameter: context source registration id set to '${context_source_registration_id}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations/{context_source_registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Discovery/RetrieveContextSourceRegistration", + "robotfile": "036_04" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/036_05.json b/doc/files/ContextSource/Discovery/036_05.json new file mode 100644 index 0000000000000000000000000000000000000000..ffafda1785d6d838e567d3483f7e28e4ca879800 --- /dev/null +++ b/doc/files/ContextSource/Discovery/036_05.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/036_05", + "test_objective": "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", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Review JSON-LD resolution when retrieving a context source registration", + "Setup Initial Context Source Registration", + "Delete Created Context Source Registration" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "test_cases": [ + { + "name": "036_05_01 EmptyJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/036_05_01", + "doc": "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": [ + "6_3_5", + "csr-retrieve" + ], + "setup": "Setup Initial Context Source Registration", + "teardown": "Delete Created Context Source Registration", + "template": "Review JSON-LD resolution when retrieving a context source registration", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Context Source Registration with Response Status Code set to 200 and\n Retrieve Context Source Registration with Response containing:\n * file set to 'csourceRegistrations/expectations/context-source-registration-expanded-format.json'\n * id set to '${context_source_registration_id}'\n * response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n method set to 'GET'\n Retrieve Context Source Registration with data: and\n Query Parameter: context source registration id set to '${context_source_registration_id}' and\n Query Parameter: context set to '${EMPTY}'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations/{context_source_registration_id}" + }, + { + "name": "036_05_02 CreationTimeJsonLdContext", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/036_05_02", + "doc": "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": [ + "6_3_5", + "csr-retrieve" + ], + "setup": "Setup Initial Context Source Registration", + "teardown": "Delete Created Context Source Registration", + "template": "Review JSON-LD resolution when retrieving a context source registration", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Context Source Registration with Response Status Code set to 200 and\n Retrieve Context Source Registration with Response containing:\n * file set to 'csourceRegistrations/expectations/context-source-registration.json'\n * id set to '${context_source_registration_id}'\n * response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n method set to 'GET'\n Retrieve Context Source Registration with data: and\n Query Parameter: context source registration id set to '${context_source_registration_id}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations/{context_source_registration_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextSource/Discovery/RetrieveContextSourceRegistration", + "robotfile": "036_05" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_01.json b/doc/files/ContextSource/Discovery/037_01.json new file mode 100644 index 0000000000000000000000000000000000000000..a82a652afa2ab14569995bfc0f603ef60da2816e --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_01.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_01", + "test_objective": "Check that you can query context source registrations if at least one of list of Entity Types or list of Attribute names is present", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [ + "Query A Context Source Registration", + "Setup Initial Context Source Registrations", + "Delete Created Context Source Registrations" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a list of Context Source Registrations (CSRs) providing latest information about some entities\n}", + "test_cases": [ + { + "name": "037_01_01 With list of entity types", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_01_01", + "doc": "Check that you can query context source registrations if at least one of list of Entity Types or list of Attribute names is present", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registrations", + "teardown": "Delete Created Context Source Registrations", + "template": "Query A Context Source Registration", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_01_02 With list of attribute names", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_01_02", + "doc": "Check that you can query context source registrations if at least one of list of Entity Types or list of Attribute names is present", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registrations", + "teardown": "Delete Created Context Source Registrations", + "template": "Query A Context Source Registration", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: attrs set to 'name'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_02.json b/doc/files/ContextSource/Discovery/037_02.json new file mode 100644 index 0000000000000000000000000000000000000000..301245e49c8c918b8bc053a2c358e5e67117d30f --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_02.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_02", + "test_objective": "Check that you cannot query context source registrations, if neither Entity types nor Attribute names are provided, an error of type 400 shall be raised.", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "037_02_01 Query Context Source Registrations Without Entity Types and Attribute Names", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_02_01", + "doc": "Check that you cannot query context source registrations, if neither Entity types nor Attribute names are provided, an error of type 400 shall be raised.", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 400 and\n Query Context Source Registrations with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Context Source Registrations with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_03.json b/doc/files/ContextSource/Discovery/037_03.json new file mode 100644 index 0000000000000000000000000000000000000000..67ff1c1ca2c727507a032d163d8c703a23386831 --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_03.json @@ -0,0 +1,87 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_03", + "test_objective": "Check that you cannot query context source registrations, if the list of Entity identifiers includes a URI which it is not valid, or the query, geo-query or temporal query are not syntactically valid", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [ + "Query Context Source Registration With Invalid Query Param" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "037_03_01 Invalid URI", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_03_01", + "doc": "Check that you cannot query context source registrations, if the list of Entity identifiers includes a URI which it is not valid, or the query, geo-query or temporal query are not syntactically valid", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": null, + "template": "Query Context Source Registration With Invalid Query Param", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 400 and\n Query Context Source Registrations with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Context Source Registrations with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: id set to 'invalidUri'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_03_02 Invalid Query", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_03_02", + "doc": "Check that you cannot query context source registrations, if the list of Entity identifiers includes a URI which it is not valid, or the query, geo-query or temporal query are not syntactically valid", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": null, + "template": "Query Context Source Registration With Invalid Query Param", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 400 and\n Query Context Source Registrations with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Context Source Registrations with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: q set to '(invalidQuery'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_03_03 Invalid GeoQuery", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_03_03", + "doc": "Check that you cannot query context source registrations, if the list of Entity identifiers includes a URI which it is not valid, or the query, geo-query or temporal query are not syntactically valid", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": null, + "template": "Query Context Source Registration With Invalid Query Param", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 400 and\n Query Context Source Registrations with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Context Source Registrations with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: georel set to 'within'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_03_04 Invalid Temporal Query", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_03_04", + "doc": "Check that you cannot query context source registrations, if the list of Entity identifiers includes a URI which it is not valid, or the query, geo-query or temporal query are not syntactically valid", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": null, + "template": "Query Context Source Registration With Invalid Query Param", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 400 and\n Query Context Source Registrations with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Context Source Registrations with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: timerel set to 'before'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_04.json b/doc/files/ContextSource/Discovery/037_04.json new file mode 100644 index 0000000000000000000000000000000000000000..6154795ef7aca645186c65a3bba2b6855d5d1247 --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_04", + "test_objective": "Check that you can query context source registrations. If a JSON-LD context is not provided, then all the query terms shall be resolved against the default JSON-LD @context", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration", + "Delete Created Context Source Registration" + ], + "teardown": "Delete Created Context Source Registration", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "037_04_01 Query Context Source Registrations Without Context", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_04_01", + "doc": "Check that you can query context source registrations. If a JSON-LD context is not provided, then all the query terms shall be resolved against the default JSON-LD @context", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: id set to '${context_source_registration_id}' and\n Query Parameter: type set to 'https://ngsi-ld-test-suite/context#Building'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_04" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_05.json b/doc/files/ContextSource/Discovery/037_05.json new file mode 100644 index 0000000000000000000000000000000000000000..b0c56e2763fa34f97f58a239d9083bee12381d15 --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_05.json @@ -0,0 +1,54 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_05", + "test_objective": "Check that you can query context source registrations matching EntityInfo of RegistrationInfo", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [ + "Query Context Source Registration Matching EntityInfo of RegistrationInfo", + "Delete Created Context Source Registration" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "037_05_01 Registration With EntityInfo Matching The Query", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_05_01", + "doc": "Check that you can query context source registrations matching EntityInfo of RegistrationInfo", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": "Delete Created Context Source Registration", + "template": "Query Context Source Registration Matching EntityInfo of RegistrationInfo", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'OffStreetParking' and\n Query Parameter: idPattern set to '.*downtown$'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_05_02 Registration Without EntityInfo", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_05_02", + "doc": "Check that you can query context source registrations matching EntityInfo of RegistrationInfo", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": "Delete Created Context Source Registration", + "template": "Query Context Source Registration Matching EntityInfo of RegistrationInfo", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'OffStreetParking' and\n Query Parameter: idPattern set to '.*downtown$'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_05" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_06.json b/doc/files/ContextSource/Discovery/037_06.json new file mode 100644 index 0000000000000000000000000000000000000000..d17fa84d45db861b17b3348153ddedef3b2da4e9 --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_06.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_06", + "test_objective": "Check that you can query context source registrations matching property and relationship names of RegistrationInfo", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [ + "Query Context Source Registration Matching Properties And Relationships Of RegistrationInfo", + "Setup Initial Context Source Registration", + "Delete Created Context Source Registration" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "test_cases": [ + { + "name": "037_06_01 Query With Matching Properties And Relationships", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_06_01", + "doc": "Check that you can query context source registrations matching property and relationship names of RegistrationInfo", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registration", + "teardown": "Delete Created Context Source Registration", + "template": "Query Context Source Registration Matching Properties And Relationships Of RegistrationInfo", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: attrs set to 'name,locatedAt'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_06_02 Query Without Properties And Relationships", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_06_02", + "doc": "Check that you can query context source registrations matching property and relationship names of RegistrationInfo", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registration", + "teardown": "Delete Created Context Source Registration", + "template": "Query Context Source Registration Matching Properties And Relationships Of RegistrationInfo", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: attrs set to '${EMPTY}'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_06" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_07.json b/doc/files/ContextSource/Discovery/037_07.json new file mode 100644 index 0000000000000000000000000000000000000000..6ee6113d454bb02e39642e7046ab2963420fa936 --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_07.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_07", + "test_objective": "Check that you can query context source registrations. If present, the geoquery is matched against the GeoProperty programmatic parameter identified in the geoquery", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [ + "Query Context Source Registration Matching Geoquery", + "Setup Initial Context Source Registration", + "Delete Created Context Source Registration" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "test_cases": [ + { + "name": "037_07_01 Near Point", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_07_01", + "doc": "Check that you can query context source registrations. If present, the geoquery is matched against the GeoProperty programmatic parameter identified in the geoquery", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registration", + "teardown": "Delete Created Context Source Registration", + "template": "Query Context Source Registration Matching Geoquery", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: georel set to 'near;maxDistance==2000' and\n Query Parameter: geometry set to 'Point' and\n Query Parameter: coordinates set to '[-8.503,41.202]' and\n Query Parameter: geoproperty set to '${EMPTY}'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_07_02 Within Polygon", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_07_02", + "doc": "Check that you can query context source registrations. If present, the geoquery is matched against the GeoProperty programmatic parameter identified in the geoquery", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registration", + "teardown": "Delete Created Context Source Registration", + "template": "Query Context Source Registration Matching Geoquery", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: georel set to 'within' and\n Query Parameter: geometry set to 'Polygon' and\n Query Parameter: coordinates set to '[[-13.503,47.202],[6.541, 52.961],[20.37,44.653],[9.46,32.57],[-15.23,21.37]]' and\n Query Parameter: geoproperty set to 'location'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_07" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_08.json b/doc/files/ContextSource/Discovery/037_08.json new file mode 100644 index 0000000000000000000000000000000000000000..7e0bafd8d4d508b94182a1f8993420535fe4b876 --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_08.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_08", + "test_objective": "Check that you can query context source registrations. If no temporal query is present, only Context Source Registrations for Context Sources providing latest information are considered", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration", + "Delete Created Context Source Registration" + ], + "teardown": "Delete Created Context Source Registration", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "037_08_01 Query Context Source Registration Without Temporal Query", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_08_01", + "doc": "Check that you can query context source registrations. If no temporal query is present, only Context Source Registrations for Context Sources providing latest information are considered", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Vehicle'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_08" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_09.json b/doc/files/ContextSource/Discovery/037_09.json new file mode 100644 index 0000000000000000000000000000000000000000..28889eade603ea25caae0fe1431ce8e8422b7c33 --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_09.json @@ -0,0 +1,88 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_09", + "test_objective": "Check that you can query context source registrations. If present, the temporal query is matched against the observationInterval or the managementInterval", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [ + "Query Context Source Registration Matching Temporal Query", + "Delete Created Context Source Registrations" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "037_09_01 Observation Interval With observedAt", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_09_01", + "doc": "Check that you can query context source registrations. If present, the temporal query is matched against the observationInterval or the managementInterval", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": "Delete Created Context Source Registrations", + "template": "Query Context Source Registration Matching Temporal Query", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: timeproperty set to 'observedAt' and\n Query Parameter: timerel set to 'before' and\n Query Parameter: timeAt set to '2021-08-01T22:00:00Z'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_09_02 Observation Interval Without timeproperty", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_09_02", + "doc": "Check that you can query context source registrations. If present, the temporal query is matched against the observationInterval or the managementInterval", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": "Delete Created Context Source Registrations", + "template": "Query Context Source Registration Matching Temporal Query", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: timeproperty set to '${EMPTY}' and\n Query Parameter: timerel set to 'before' and\n Query Parameter: timeAt set to '2021-08-01T22:00:00Z'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_09_03 Management Interval With createdAt", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_09_03", + "doc": "Check that you can query context source registrations. If present, the temporal query is matched against the observationInterval or the managementInterval", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": "Delete Created Context Source Registrations", + "template": "Query Context Source Registration Matching Temporal Query", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: timeproperty set to 'createdAt' and\n Query Parameter: timerel set to 'before' and\n Query Parameter: timeAt set to '2021-08-01T22:00:00Z'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_09_04 Management Interval With modifiedAt", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_09_04", + "doc": "Check that you can query context source registrations. If present, the temporal query is matched against the observationInterval or the managementInterval", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": null, + "teardown": "Delete Created Context Source Registrations", + "template": "Query Context Source Registration Matching Temporal Query", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: timeproperty set to 'modifiedAt' and\n Query Parameter: timerel set to 'before' and\n Query Parameter: timeAt set to '2021-08-01T22:00:00Z'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_09" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_10.json b/doc/files/ContextSource/Discovery/037_10.json new file mode 100644 index 0000000000000000000000000000000000000000..3373dd1ae94adb3e31b17e5df77c5aaeba492588 --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_10.json @@ -0,0 +1,57 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_10", + "test_objective": "Check that you can query context source registrations. If present, the conditions specified by the context source query match the respective Context Source Properties", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [ + "Query Context Source Registration With Query Params", + "Setup Initial Context Source Registrations", + "Delete Created Context Source Registrations" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a list of Context Source Registrations (CSRs) providing latest information about some entities\n}", + "test_cases": [ + { + "name": "037_10_01 With list of Entity Ids", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_10_01", + "doc": "Check that you can query context source registrations. If present, the conditions specified by the context source query match the respective Context Source Properties", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registrations", + "teardown": "Delete Created Context Source Registrations", + "template": "Query Context Source Registration With Query Params", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: id set to '${first_context_source_registration_id},${third_context_source_registration_id}'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_10_02 With NGSI-LD Query", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_10_02", + "doc": "Check that you can query context source registrations. If present, the conditions specified by the context source query match the respective Context Source Properties", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registrations", + "teardown": "Delete Created Context Source Registrations", + "template": "Query Context Source Registration With Query Params", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Notification with Response body set to list of all matching Context Source Registrations resolved against the default JSON-LD context\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: q set to 'csourceProperty1==\"aValue\"'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_10" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Discovery/037_11.json b/doc/files/ContextSource/Discovery/037_11.json new file mode 100644 index 0000000000000000000000000000000000000000..0f38d5889275ab211e2a10ae3b3547c64da0841f --- /dev/null +++ b/doc/files/ContextSource/Discovery/037_11.json @@ -0,0 +1,74 @@ +{ + "tp_id": "TP/NGSI-LD/CS/DISC/037_11", + "test_objective": "Check that you can query context source registrations with providing page and limit parameters, pagination logic shall be in place as mandated by clause 5.5.9.", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.10.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.10.2" + ], + "pics_selection": "", + "keywords": [ + "Query Context Source Registration With Limit And Offset Parameters", + "Setup Initial Context Source Registrations", + "Delete Created Context Source Registrations" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a list of Context Source Registrations (CSRs) providing latest information about some entities\n}", + "test_cases": [ + { + "name": "037_11_01 Query Second Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_11_01", + "doc": "Check that you can query context source registrations with providing page and limit parameters, pagination logic shall be in place as mandated by clause 5.5.9.", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registrations", + "teardown": "Delete Created Context Source Registrations", + "template": "Query Context Source Registration With Limit And Offset Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Query Context Source Registrations with Response Body containing a list of entities equal to '${1}' of type 'ContextSourceRegistration' with response set to '${response.json()}' and\n Query Context Source Registrations with Response header with 'Prev' header equal to ';rel=\"next\";type=\"application/ld+json\"' and with 'Next' header equal to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: limit set to '${1}' and\n Query Parameter: offset set to '${2}'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_11_02 Query Last Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_11_02", + "doc": "Check that you can query context source registrations with providing page and limit parameters, pagination logic shall be in place as mandated by clause 5.5.9.", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registrations", + "teardown": "Delete Created Context Source Registrations", + "template": "Query Context Source Registration With Limit And Offset Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Query Context Source Registrations with Response Body containing a list of entities equal to '${1}' of type 'ContextSourceRegistration' with response set to '${response.json()}' and\n Query Context Source Registrations with Response header with 'Prev' header equal to '${EMPTY}' and with 'Next' header equal to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: limit set to '${2}' and\n Query Parameter: offset set to '${2}'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + }, + { + "name": "037_11_03 Query All Subscriptions", + "permutation_tp_id": "TP/NGSI-LD/CS/DISC/037_11_03", + "doc": "Check that you can query context source registrations with providing page and limit parameters, pagination logic shall be in place as mandated by clause 5.5.9.", + "tags": [ + "5_10_2", + "csr-query" + ], + "setup": "Setup Initial Context Source Registrations", + "teardown": "Delete Created Context Source Registrations", + "template": "Query Context Source Registration With Limit And Offset Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registrations with Response Status Code set to 200 and\n Query Context Source Registrations with Response Body containing a list of entities equal to '${2}' of type 'ContextSourceRegistration' with response set to '${response.json()}' and\n Query Context Source Registrations with Response header with 'Prev' header equal to '${EMPTY}' and with 'Next' header equal to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'GET'\n Retrieve Temporal Representation of Entity and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: type set to 'Building' and\n Query Parameter: limit set to '${15}' and\n Query Parameter: offset set to '${0}'\n}", + "http_verb": "GET", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextSource/Discovery/QueryContextSourceRegistrations", + "robotfile": "037_11" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_01_01.json b/doc/files/ContextSource/Registration/033_01_01.json new file mode 100644 index 0000000000000000000000000000000000000000..053574567f3309a73a00e408bf67bb3c96095220 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_01_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_01_01", + "test_objective": "Check that you can create a context source registration with specific ID and expiration date", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Context Source Registrations" + ], + "teardown": "Delete Created Context Source Registrations", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_01_01 Create Context Source Registration With Specific Date Expiration Date", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_01_01", + "doc": "Check that you can create a context source registration with specific ID and expiration date", + "tags": [ + "5_9_2", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Retrieve Context Source Registration with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${registration_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_01_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_01_02.json b/doc/files/ContextSource/Registration/033_01_02.json new file mode 100644 index 0000000000000000000000000000000000000000..e00e099399e47a53b0837bd527d6053b841c3286 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_01_02.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_01_02", + "test_objective": "Check that you can create a context source registration that never expires", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Context Source Registrations" + ], + "teardown": "Delete Created Context Source Registrations", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_01_02 Create Context Source Registration That Never Expires", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_01_02", + "doc": "Check that you can create a context source registration that never expires", + "tags": [ + "5_9_2", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Create Context Source Registration With Return with Response Header: Location containing $${registration_id} and\n Retrieve Context Source Registration with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${registration_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_01_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_01_03.json b/doc/files/ContextSource/Registration/033_01_03.json new file mode 100644 index 0000000000000000000000000000000000000000..ea4a3ea25cd9106e560b79414481bf1c23c12493 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_01_03.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_01_03", + "test_objective": "Check that you can create a context source registration without specifying an ID", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Context Source Registrations" + ], + "teardown": "Delete Created Context Source Registrations", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_01_03 Create Context Source Registration Without Specifying an ID", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_01_03", + "doc": "Check that you can create a context source registration without specifying an ID", + "tags": [ + "5_9_2", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Retrieve Context Source Registration with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_01_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_02.json b/doc/files/ContextSource/Registration/033_02.json new file mode 100644 index 0000000000000000000000000000000000000000..14ad917156bef22efd61b75019499498eef531d6 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_02.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_02", + "test_objective": "Check that you cannot create a context source with invalid content", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.2" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_02_01 Create a context source registration with invalid JSON file", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_02_01", + "doc": "Create a context source registration with invalid JSON file", + "tags": [ + "5_9_2", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration with Response Status Code set to 400 and\n Create Context Source Registration with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Context Source Registration with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Create Context Source Registration Request with Content-Type set to 'application/ld+json' and payload set to '${subscription_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_03.json b/doc/files/ContextSource/Registration/033_03.json new file mode 100644 index 0000000000000000000000000000000000000000..dd088e3f34e5611648b20fd8b4a98023603622ba --- /dev/null +++ b/doc/files/ContextSource/Registration/033_03.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_03", + "test_objective": "Check that you cannot create a context source registration that already exists", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Context Source Registrations", + "Create New Context Source Registration" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "test_cases": [ + { + "name": "033_03_01 Create a context source registration that already exists", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_03_01", + "doc": "Check that you cannot create a context source registration that already exists", + "tags": [ + "5_9_2", + "csr-create" + ], + "setup": "Create New Context Source Registration", + "teardown": "Delete Created Context Source Registrations", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 409 and\n Create Context Source Registration With Return with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_04.json b/doc/files/ContextSource/Registration/033_04.json new file mode 100644 index 0000000000000000000000000000000000000000..2950b63128f68541da7e80ccd557e23c51005744 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_04.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_04", + "test_objective": "Check that the @context is obtained from a Link Header if the Content-Type header is \"application/json\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Context Source Registrations" + ], + "teardown": "Delete Created Context Source Registrations", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_04_01 Create one context source registration using a provided Link header with JSON content type with Context", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_04_01", + "doc": "Check that the @context is obtained from a Link Header if the Content-Type header is \"application/json\"", + "tags": [ + "6_3_5", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Retrieve Context Source Registration with Response Body containing the key '['information'][0]['entities'][0]['type']', with the value 'Building'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + }, + { + "name": "033_04_02 Create one context source registration using a provided Link header with JSON content type without Context", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_04_02", + "doc": "Check that the @context is obtained from a Link Header if the Content-Type header is \"application/json\"", + "tags": [ + "6_3_5", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Retrieve Context Source Registration with Response Body containing the key '['information'][0]['entities'][0]['type']', with the value 'https://ngsi-ld-test-suite/context#Building'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_04" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_05.json b/doc/files/ContextSource/Registration/033_05.json new file mode 100644 index 0000000000000000000000000000000000000000..66e4181fee05ecac660ac2c8efb288463f9234a5 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_05.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_05", + "test_objective": "Check that the default @context is used if the Content-Type header is \"application/json\" and the Link header does not contain a JSON-LD @context", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Context Source Registrations" + ], + "teardown": "Delete Created Context Source Registrations", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_05_01 Create one context source registration using the default context with JSON content type with Context", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_05_01", + "doc": "Check that the default @context is used if the Content-Type header is \"application/json\" and the Link header does not contain a JSON-LD @context and retrieve the information with ngsild context", + "tags": [ + "6_3_5", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Retrieve Context Source Registration with Response Body containing the key '['information'][0]['entities'][0]['type']', with the value 'ngsi-ld:default-context/Building'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + }, + { + "name": "033_05_02 Create one context source registration using the default context with JSON content type without Context", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_05_02", + "doc": "Check that the default @context is used if the Content-Type header is \"application/json\" and the Link header does not contain a JSON-LD @context and retrieve the information without ngsild context", + "tags": [ + "6_3_5", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Retrieve Context Source Registration with Response Body containing the key '['information'][0]['entities'][0]['type']', with the value 'Building'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_05" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_06.json b/doc/files/ContextSource/Registration/033_06.json new file mode 100644 index 0000000000000000000000000000000000000000..e112c212222897a0c058939b60f145c1c56767e3 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_06.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_06", + "test_objective": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/json\" and the request payload body (as JSON) contains a \"@context\" term", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_06_01 Create one context source registration containing a JSON-LD @context with a JSON content type", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_06_01", + "doc": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/json\" and the request payload body (as JSON) contains a \"@context\" term", + "tags": [ + "6_3_5", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 400 and\n Create Context Source Registration With Return with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Context Source Registration With Return with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_06" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_07.json b/doc/files/ContextSource/Registration/033_07.json new file mode 100644 index 0000000000000000000000000000000000000000..d73c52538f99d30d9a09e7c46400ddfc0d6d5427 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_07.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_07", + "test_objective": "Check that the @context is obtained from the request payload body itself if the Content-Type header is \"application/ld+json\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Context Source Registrations" + ], + "teardown": "Delete Created Context Source Registrations", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_07_01 Create one context source registration using a JSON-LD @context obtained from the request payload with Context", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_07_01", + "doc": "Check that the @context is obtained from the request payload body itself if the Content-Type header is \"application/ld+json\" and retrieve the information with ngsild context", + "tags": [ + "6_3_5", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Retrieve Context Source Registration with Response Body containing the key '['information'][0]['entities'][0]['type']', with the value 'Vehicle'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + }, + { + "name": "033_07_02 Create one context source registration using a JSON-LD @context obtained from the request payload without Context", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_07_02", + "doc": "Check that the @context is obtained from the request payload body itself if the Content-Type header is \"application/ld+json\" and retrieve the information without ngsild context", + "tags": [ + "6_3_5", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Retrieve Context Source Registration with Response Body containing the key '['information'][0]['entities'][0]['type']', with the value 'https://ngsi-ld-test-suite/context#Vehicle'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_07" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_08.json b/doc/files/ContextSource/Registration/033_08.json new file mode 100644 index 0000000000000000000000000000000000000000..c8d3de2e11dabe9dce473f3d2329c6f3b5f94c99 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_08.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_08", + "test_objective": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and the request payload body does not contain a @context term", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_08_01 Create one context source registration not containing a JSON-LD @context with a JSON-LD content type", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_08_01", + "doc": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and the request payload body does not contain a @context term", + "tags": [ + "6_3_5", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 400 and\n Create Context Source Registration With Return with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Context Source Registration With Return with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_08" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_09.json b/doc/files/ContextSource/Registration/033_09.json new file mode 100644 index 0000000000000000000000000000000000000000..bddb1401ef266974e59dc9e530cfc4883a13b03b --- /dev/null +++ b/doc/files/ContextSource/Registration/033_09.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_09", + "test_objective": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and a JSON-LD Link header is present in the incoming HTTP request", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_09_01 Create one context source registration with a Link header and a JSON-LD content type", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_09_01", + "doc": "Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is \"application/ld+json\" and a JSON-LD Link header is present in the incoming HTTP request", + "tags": [ + "6_3_5", + "csr-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 400 and\n Create Context Source Registration With Return with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Context Source Registration With Return with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_09" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/033_10.json b/doc/files/ContextSource/Registration/033_10.json new file mode 100644 index 0000000000000000000000000000000000000000..4abc3f9f32d4014ffd828f5034bc23e1abf111b7 --- /dev/null +++ b/doc/files/ContextSource/Registration/033_10.json @@ -0,0 +1,53 @@ +{ + "tp_id": "TP/NGSI-LD/CS/CSR/033_10", + "test_objective": "Check that you cannot create a context source with invalid content", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "6.3.5" + ], + "pics_selection": "", + "keywords": [ + "Create Context Source With Invalid Content" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "033_10_01 Create a context source registration with a different data structure than CSourceRegistration data type", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_10_01", + "doc": "Check that you cannot create a context source with invalid content", + "tags": [ + "csr-create", + "6_3_5" + ], + "setup": null, + "teardown": null, + "template": "Create Context Source With Invalid Content", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 400 and\n Create Context Source Registration With Return with Response Header: Location containing $${registration_id}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + }, + { + "name": "033_10_02 Create a context source registration with a date in the past", + "permutation_tp_id": "TP/NGSI-LD/CS/CSR/033_10_02", + "doc": "Check that you cannot create a context source with invalid content", + "tags": [ + "csr-create", + "6_3_5" + ], + "setup": null, + "teardown": null, + "template": "Create Context Source With Invalid Content", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 400 and\n Create Context Source Registration With Return with Response Header: Location containing $${registration_id}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: '${updated_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/RegisterContextSource", + "robotfile": "033_10" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/034_01.json b/doc/files/ContextSource/Registration/034_01.json new file mode 100644 index 0000000000000000000000000000000000000000..0662d55b3824a749828aca404726cdec5d508eb9 --- /dev/null +++ b/doc/files/ContextSource/Registration/034_01.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REG/034_01", + "test_objective": "Check that you can update a context source registration by id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.3" + ], + "pics_selection": "", + "keywords": [ + "Update A Context Source", + "Delete Updated Context Source Registration", + "Initialize the Test Case" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "test_cases": [ + { + "name": "034_01_01 Update a context source registration by id", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/034_01_01", + "doc": "Check that you can update a context source registration by id", + "tags": [ + "5_9_3", + "csr-update" + ], + "setup": "Initialize the Test Case", + "teardown": "Delete Updated Context Source Registration", + "template": "Update A Context Source", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration With Return with Response Status Code set to 204 and\n Retrieve Context Source Registration with Response Body containing the key '['endpoint']', with the value 'http://my.new.csource.org:1026'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with id set to '${registration_id}' and registration update fragment set to '${registration_update_fragment}' and content-type set to 'application/json'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/UpdateContextSourceRegistration", + "robotfile": "034_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/034_02.json b/doc/files/ContextSource/Registration/034_02.json new file mode 100644 index 0000000000000000000000000000000000000000..7cf68cb546d78bcd0fd1051ee4c8b918357f0a7d --- /dev/null +++ b/doc/files/ContextSource/Registration/034_02.json @@ -0,0 +1,73 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REG/034_02", + "test_objective": "Check that you cannot update a context source registration under some conditions", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.3" + ], + "pics_selection": "", + "keywords": [ + "Update A Context Source", + "Create Initial Context Source Registration", + "Delete Initial Context Source Registration" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "test_cases": [ + { + "name": "034_02_01 Update a context source registration by id if the Id is not a valid URI", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/034_02_01", + "doc": "Check that you cannot update a context source registration under some conditions", + "tags": [ + "csr-update", + "5_9_3" + ], + "setup": "Create Initial Context Source Registration", + "teardown": "Delete Initial Context Source Registration", + "template": "Update A Context Source", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration With Return with Response Status Code set to 400 and\n Update Context Source Registration With Return with Response reason set to 'Bad Request' and\n Update Context Source Registration With Return with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with id set to 'invalidURI' and registration update fragment set to '${fragment_with_id}' and content-type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{registration_id}" + }, + { + "name": "034_02_02 Update a context source registration if the request body is not of the same data type", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/034_02_02", + "doc": "Check that you cannot update a context source registration under some conditions", + "tags": [ + "csr-update", + "5_9_3" + ], + "setup": "Create Initial Context Source Registration", + "teardown": "Delete Initial Context Source Registration", + "template": "Update A Context Source", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration With Return with Response Status Code set to 400 and\n Update Context Source Registration With Return with Response reason set to 'Bad Request' and\n Update Context Source Registration With Return with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with id set to '${valid_registration_id}' and registration update fragment set to '${fragment_with_id}' and content-type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{registration_id}" + }, + { + "name": "034_02_03 Update a context source registration if you attempt to remove a mandatory property", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/034_02_03", + "doc": "Check that you cannot update a context source registration under some conditions", + "tags": [ + "csr-update", + "5_9_3" + ], + "setup": "Create Initial Context Source Registration", + "teardown": "Delete Initial Context Source Registration", + "template": "Update A Context Source", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration With Return with Response Status Code set to 400 and\n Update Context Source Registration With Return with Response reason set to 'Bad Request' and\n Update Context Source Registration With Return with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with id set to '${valid_registration_id}' and registration update fragment set to '${fragment_with_id}' and content-type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{registration_id}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextSource/Registration/UpdateContextSourceRegistration", + "robotfile": "034_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/034_03.json b/doc/files/ContextSource/Registration/034_03.json new file mode 100644 index 0000000000000000000000000000000000000000..0ee6265171c169c1d3ec1be175b4fc91ce22bf47 --- /dev/null +++ b/doc/files/ContextSource/Registration/034_03.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REG/034_03", + "test_objective": "Check that you cannot update a context source registration by id if the id is not known to the system", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.3" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "034_03_01 Update a context source registration by id if the id is not known to the system", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/034_03_01", + "doc": "Check that you cannot update a context source registration by id if the id is not known to the system", + "tags": [ + "5_9_3", + "csr-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration With Return with Response Status Code set to 404 and\n Update Context Source Registration With Return with Response reason set to 'Not Found' and\n Update Context Source Registration With Return with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with id set to '${registration_id}' and registration update fragment set to '${fragment_with_id}' and content-type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/UpdateContextSourceRegistration", + "robotfile": "034_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/034_04.json b/doc/files/ContextSource/Registration/034_04.json new file mode 100644 index 0000000000000000000000000000000000000000..20c777a389df6ebb044f71a2ef3c9058709e2a4b --- /dev/null +++ b/doc/files/ContextSource/Registration/034_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REG/034_04", + "test_objective": "Check that you cannot update a context source registration under some conditions", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.3" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Context Source Registration", + "Delete Initial Context Source Registration" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "test_cases": [ + { + "name": "034_04_01 Update a context source registration if the request body is invalid", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/034_04_01", + "doc": "Check that you cannot update a context source registration if the request body is invalid", + "tags": [ + "5_9_3", + "csr-update" + ], + "setup": "Create Initial Context Source Registration", + "teardown": "Delete Initial Context Source Registration", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration From File with Response Status Code set to 400 and\n Update Context Source Registration From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Update Context Source Registration From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with CSR Id set to '${registration_id}' and subscription update from file 'context-source-registration-invalid-json-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{context_source_registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/UpdateContextSourceRegistration", + "robotfile": "034_04" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/034_05.json b/doc/files/ContextSource/Registration/034_05.json new file mode 100644 index 0000000000000000000000000000000000000000..6b33de7e45956bc2c664b00327bd25b215b1c94a --- /dev/null +++ b/doc/files/ContextSource/Registration/034_05.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REG/034_05", + "test_objective": "Check that you can update a context source registration by id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.3" + ], + "pics_selection": "", + "keywords": [ + "Update A Context Source", + "Delete Updated Context Source Registration", + "Initialize the Test Case" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "test_cases": [ + { + "name": "034_05_01 Update a context source registration to never expire", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/034_05_01", + "doc": "Check that you can update a context source registration by id", + "tags": [ + "5_9_3", + "csr-update" + ], + "setup": "Initialize the Test Case", + "teardown": "Delete Updated Context Source Registration", + "template": "Update A Context Source", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration With Return with Response Status Code set to 204 and\n Retrieve Context Source Registration with Check that response body does not contain the key '$.expiresAt'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with id set to '${registration_id}' and registration update fragment set to '${registration_update_fragment}' and content-type set to 'application/json'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/UpdateContextSourceRegistration", + "robotfile": "034_05" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/034_06.json b/doc/files/ContextSource/Registration/034_06.json new file mode 100644 index 0000000000000000000000000000000000000000..af0989b7ae446ec0473205a847c193a363382097 --- /dev/null +++ b/doc/files/ContextSource/Registration/034_06.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REG/034_06", + "test_objective": "Check that you cannot update a context source registration if the Id is not present", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.3" + ], + "pics_selection": "", + "keywords": [ + "Update A Context Source", + "Create Initial Context Source Registration", + "Delete Initial Context Source Registration" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "test_cases": [ + { + "name": "034_06_01 Update a context source registration by id if the Id is not present", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/034_06_01", + "doc": "Check that you cannot update a context source registration under some conditions", + "tags": [ + "csr-update", + "5_9_3" + ], + "setup": "Create Initial Context Source Registration", + "teardown": "Delete Initial Context Source Registration", + "template": "Update A Context Source", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration With Return with Response Status Code set to 405 and\n Update Context Source Registration With Return with Response reason set to 'Method Not Allowed' and\n Update Context Source Registration With Return with Response does not contain a body\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with id set to '${EMPTY}' and registration update fragment set to '${fragment_with_id}' and content-type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/UpdateContextSourceRegistration", + "robotfile": "034_06" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/035_01.json b/doc/files/ContextSource/Registration/035_01.json new file mode 100644 index 0000000000000000000000000000000000000000..862796196171383915ddcdb1a372f96f65d87e6a --- /dev/null +++ b/doc/files/ContextSource/Registration/035_01.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REG/035_01", + "test_objective": "Check that you can delete a context source registration by id", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.4" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "035_01_01 Delete a context source registration by id", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/035_01_01", + "doc": "Check that you can delete a context source registration by id", + "tags": [ + "5_9_4", + "csr-delete" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration With Return with Response Status Code set to 201 and\n Delete Context Source Registration With Return with Response Status Code set to 204 and\n Retrieve Context Source Registration with Response Status Code set to ${response1.status_code}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'DELETE'\n Delete Context Source Registration with id set to '${registration_id}'\n}", + "http_verb": "DELETE", + "endpoint": "csourceRegistrations/{registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/DeleteContextSourceRegistration", + "robotfile": "035_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/035_02.json b/doc/files/ContextSource/Registration/035_02.json new file mode 100644 index 0000000000000000000000000000000000000000..731ac71f426c0383759fe8c5c0b41a66b83ae567 --- /dev/null +++ b/doc/files/ContextSource/Registration/035_02.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REG/035_02", + "test_objective": "Check that you cannot delete a context source registration under some conditions", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.4" + ], + "pics_selection": "", + "keywords": [ + "Delete A Context Source", + "Delete Created Context Source Registrations", + "Create Initial Context Source Registration" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT contains a Context Source Registration \n with id equal to ${context_source_registration_id}\n and payload set to ${context_source_registration_payload_file_path}\n}", + "test_cases": [ + { + "name": "035_02_01 Delete a Context Source Registration if the Id is not present", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/035_02_01", + "doc": "Check that you cannot delete a context source registration under some conditions", + "tags": [ + "5_9_4", + "csr-delete" + ], + "setup": "Create Initial Context Source Registration", + "teardown": "Delete Created Context Source Registrations", + "template": "Delete A Context Source", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Context Source Registration With Return with Response Status Code set to 405 and\n Delete Context Source Registration With Return with Response Body containing the type '${EMPTY}' and\n Delete Context Source Registration With Return with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'DELETE'\n Delete Context Source Registration with id set to '${EMPTY}'\n}", + "http_verb": "DELETE", + "endpoint": "csourceRegistrations/{registration_id}" + }, + { + "name": "035_02_02 Delete a Context Source Registration if the Id is not a valid URI", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/035_02_02", + "doc": "Check that you cannot delete a context source registration under some conditions", + "tags": [ + "5_9_4", + "csr-delete" + ], + "setup": "Create Initial Context Source Registration", + "teardown": "Delete Created Context Source Registrations", + "template": "Delete A Context Source", + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Context Source Registration With Return with Response Status Code set to 400 and\n Delete Context Source Registration With Return with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Delete Context Source Registration With Return with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'DELETE'\n Delete Context Source Registration with id set to 'invalidURI'\n}", + "http_verb": "DELETE", + "endpoint": "csourceRegistrations/{registration_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextSource/Registration/DeleteContextSourceRegistration", + "robotfile": "035_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/Registration/035_03.json b/doc/files/ContextSource/Registration/035_03.json new file mode 100644 index 0000000000000000000000000000000000000000..0d2b6622cdf58cff89ba8e4ea3fd6110402c397c --- /dev/null +++ b/doc/files/ContextSource/Registration/035_03.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REG/035_03", + "test_objective": "Check that you cannot delete a context source registration by id if the id is not known to the system", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.9.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.9.4" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "035_03_01 Delete a context source registration by id", + "permutation_tp_id": "TP/NGSI-LD/CS/REG/035_03_01", + "doc": "Check that you cannot delete a context source registration by id if the id is not known to the system", + "tags": [ + "5_9_4", + "csr-delete" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Context Source Registration With Return with Response Status Code set to 404 and\n Delete Context Source Registration With Return with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{registration_id}'\n method set to 'DELETE'\n Delete Context Source Registration with id set to '${registration_id}'\n}", + "http_verb": "DELETE", + "endpoint": "csourceRegistrations/{registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/Registration/DeleteContextSourceRegistration", + "robotfile": "035_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/038_01.json b/doc/files/ContextSource/RegistrationSubscription/038_01.json new file mode 100644 index 0000000000000000000000000000000000000000..5577c37f9ae0c56747fa12c1ae0de74d21f1294d --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/038_01.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/038_01", + "test_objective": "Check that you can create a minimal context source registration subscription", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.2" + ], + "pics_selection": "", + "keywords": [ + "Generate Random Ids For Context Source Registration Subscriptions", + "Delete Created Context Source Registration Subscriptions" + ], + "teardown": "Delete Created Context Source Registration Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "038_01_01 Create Context Source Registration Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_01_01", + "doc": "Check that you can create a minimal context source registration subscription", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 201 and\n Create Context Source Registration Subscription with Response Header: Location containing $${subscription_id} and\n Retrieve Context Source Registration Subscription with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys and\n Retrieve Context Source Registration Subscription with The dictionary `${response1.json()}' might contain the key 'lastNotification' and\n Retrieve Context Source Registration Subscription with The dictionary `${response1.json()}' might contain the key 'lastFailure' and\n Retrieve Context Source Registration Subscription with The dictionary `${response1.json()}' might contain the key 'lastSuccess' and\n Retrieve Context Source Registration Subscription with The dictionary `${response1.json()}' might contain the key 'timesSent'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription", + "robotfile": "038_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/038_02.json b/doc/files/ContextSource/RegistrationSubscription/038_02.json new file mode 100644 index 0000000000000000000000000000000000000000..888112f1ba1fce0cc53f792a409e20f7f8521492 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/038_02.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/038_02", + "test_objective": "Check that you can create a context source registration subscription without providing an id and it will be automatically generated", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.2" + ], + "pics_selection": "", + "keywords": [ + "Delete Created Context Source Registration Subscriptions" + ], + "teardown": "Delete Created Context Source Registration Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "038_02_01 Create Context Source Registration Subscription Without An Id", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_02_01", + "doc": "Check that you can create a context source registration subscription without providing an id and it will be automatically generated", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 201 and\n Retrieve Context Source Registration Subscription with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription", + "robotfile": "038_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/038_03.json b/doc/files/ContextSource/RegistrationSubscription/038_03.json new file mode 100644 index 0000000000000000000000000000000000000000..6f871040125c333b585fc2602f596f3d91d1619b --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/038_03.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/038_03", + "test_objective": "Check that you can create a context source registration subscription without providing isActive member and will be active by default", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.2" + ], + "pics_selection": "", + "keywords": [ + "Generate Random Ids For Context Source Registration Subscriptions", + "Delete Created Context Source Registration Subscriptions" + ], + "teardown": "Delete Created Context Source Registration Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "038_03_01 Create Context Source Registration Subscription Without isActive Member", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_03_01", + "doc": "Check that you can create a context source registration subscription without providing isActive member and will be active by default", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 201 and\n Create Context Source Registration Subscription with Response Header: Location containing $${subscription_id} and\n Retrieve Context Source Registration Subscription with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'status' and\n Query Parameter: response_body set to 'response1.json()' and\n Query Parameter: expected_attribute_value set to 'active'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription", + "robotfile": "038_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/038_04.json b/doc/files/ContextSource/RegistrationSubscription/038_04.json new file mode 100644 index 0000000000000000000000000000000000000000..aa2b859b1d9d0c1b408077f2279af5496768302b --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/038_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/038_04", + "test_objective": "Check that you can create a context source registration subscription with isActive member set to false and it's initial status will be set to \"paused\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.2" + ], + "pics_selection": "", + "keywords": [ + "Generate Random Ids For Context Source Registration Subscriptions", + "Delete Created Context Source Registration Subscriptions" + ], + "teardown": "Delete Created Context Source Registration Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "038_04_01 Create Inactive Context Source Registration Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_04_01", + "doc": "Check that you can create a context source registration subscription with isActive member set to false and it's initial status will be set to \"paused\"", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 201 and\n Create Context Source Registration Subscription with Response Header: Location containing $${subscription_id} and\n Retrieve Context Source Registration Subscription with Check that the payload body contains a boolean attribute with name 'expected_attribute_name=isActive' and value 'expected_attribute_value=False and\n Retrieve Context Source Registration Subscription with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'status' and\n Query Parameter: response_body set to 'response1.json()' and\n Query Parameter: expected_attribute_value set to 'paused'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription", + "robotfile": "038_04" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/038_05.json b/doc/files/ContextSource/RegistrationSubscription/038_05.json new file mode 100644 index 0000000000000000000000000000000000000000..beba14053f93bbd08e4ab74c0df8cc8d0c719063 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/038_05.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/038_05", + "test_objective": "Check that you can create a context source registration subscription with an expiresAt member and when it is due the status of the subscription changes to \"expired\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.2" + ], + "pics_selection": "", + "keywords": [ + "Generate Random Ids For Context Source Registration Subscriptions", + "Delete Created Context Source Registration Subscriptions" + ], + "teardown": "Delete Created Context Source Registration Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "038_05_01 Create Context Source Registration Subscription With expiresAt Member", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_05_01", + "doc": "Check that you can create a context source registration subscription with an expiresAt member and when it is due the status of the subscription changes to \"expired\"", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 201 and\n Create Context Source Registration Subscription with Response Header: Location containing $${subscription_id} and\n Retrieve Context Source Registration Subscription with Check that the dictionary contains the key 'key=expiresAt' with type DateTime and value set to 'expected value=${expiresAt}' and\n Retrieve Context Source Registration Subscription with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'status' and\n Query Parameter: response_body set to 'response1.json()' and\n Query Parameter: expected_attribute_value set to 'expired'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription", + "robotfile": "038_05" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/038_06.json b/doc/files/ContextSource/RegistrationSubscription/038_06.json new file mode 100644 index 0000000000000000000000000000000000000000..9a9b86a3a26ec417fd1df77391d6fff6a5df1d4f --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/038_06.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/038_06", + "test_objective": "Check that you can create a context source registration subscription without an expiresAt member and it will be considered as perpetual", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.2" + ], + "pics_selection": "", + "keywords": [ + "Generate Random Ids For Context Source Registration Subscriptions", + "Delete Created Context Source Registration Subscriptions" + ], + "teardown": "Delete Created Context Source Registration Subscriptions", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "038_06_01 Create Context Source Registration Subscription Without expiresAt Member", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_06_01", + "doc": "Check that you can create a context source registration subscription without an expiresAt member and it will be considered as perpetual", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 201 and\n Create Context Source Registration Subscription with Response Header: Location containing $${subscription_id} and\n Retrieve Context Source Registration Subscription with Check Response Body containing an Attribute set to and\n Query Parameter: expected_attribute_name set to 'status' and\n Query Parameter: response_body set to 'response1.json()' and\n Query Parameter: expected_attribute_value set to 'active'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription", + "robotfile": "038_06" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/038_07.json b/doc/files/ContextSource/RegistrationSubscription/038_07.json new file mode 100644 index 0000000000000000000000000000000000000000..e5ba028e82d6022f2be3feaf819671124351131a --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/038_07.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/038_07", + "test_objective": "Check that you cannot create a context source registration subscription where another context source registration subscription whose id is equivalent exists", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.2" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Initial Context Source Registration Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "038_07_01 Create Existing Context Source Registration Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_07_01", + "doc": "Check that you cannot create a context source registration subscription where another context source registration subscription whose id is equivalent exists", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Initial Context Source Registration Subscription", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 409 and\n Create Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_ALREADY_EXISTS}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription", + "robotfile": "038_07" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/038_08.json b/doc/files/ContextSource/RegistrationSubscription/038_08.json new file mode 100644 index 0000000000000000000000000000000000000000..95d167e4e6420843743232e41dba4eb13aa0192e --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/038_08.json @@ -0,0 +1,85 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/038_08", + "test_objective": "Check that you cannot create a context source registration subscription If the data types, cardinalities and restrictions expressed by clause 5.2.12 are not met", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.2" + ], + "pics_selection": "", + "keywords": [ + "Create Invalid Context Source Registration Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "038_08_01 WithoutNotification", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_08_01", + "doc": "Check that you cannot create a context source registration subscription If the data types, cardinalities and restrictions expressed by clause 5.2.12 are not met", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": "Create Invalid Context Source Registration Subscription", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 400 and\n Create Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + }, + { + "name": "038_08_02 InvalidType", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_08_02", + "doc": "Check that you cannot create a context source registration subscription If the data types, cardinalities and restrictions expressed by clause 5.2.12 are not met", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": "Create Invalid Context Source Registration Subscription", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 400 and\n Create Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + }, + { + "name": "038_08_03 InvalidQuery", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_08_03", + "doc": "Check that you cannot create a context source registration subscription If the data types, cardinalities and restrictions expressed by clause 5.2.12 are not met", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": "Create Invalid Context Source Registration Subscription", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 400 and\n Create Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + }, + { + "name": "038_08_04 EmptyWatchedAttributes", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_08_04", + "doc": "Check that you cannot create a context source registration subscription If the data types, cardinalities and restrictions expressed by clause 5.2.12 are not met", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": "Create Invalid Context Source Registration Subscription", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 400 and\n Create Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription", + "robotfile": "038_08" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/038_09.json b/doc/files/ContextSource/RegistrationSubscription/038_09.json new file mode 100644 index 0000000000000000000000000000000000000000..6748811d376c7ef1ef2c3806af0260408ba12f97 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/038_09.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/038_09", + "test_objective": "Check that you cannot create a context source registration subscription with an expiration timestamp representing a moment before the current date and time", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.2" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "038_09_01 Create Expired Context Source Registration Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/038_09_01", + "doc": "Check that you cannot create a context source registration subscription with an expiration timestamp representing a moment before the current date and time", + "tags": [ + "5_11_2", + "csrsub-create" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Context Source Registration Subscription with Response Status Code set to 400 and\n Create Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription", + "robotfile": "038_09" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/039_01.json b/doc/files/ContextSource/RegistrationSubscription/039_01.json new file mode 100644 index 0000000000000000000000000000000000000000..c6a334e7fa42b462df762cf79eedf0261e2d5dc2 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/039_01.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/039_01", + "test_objective": "Check that you can update a context source registration subscription", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.3" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscriptions", + "Delete Initial Context Source Registration Subscriptions" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a set of Context Source Registration Subscriptions (CSRSs)\n}", + "test_cases": [ + { + "name": "039_01_01 Update Context Source Registration Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/039_01_01", + "doc": "Check that you can update a context source registration subscription", + "tags": [ + "5_11_3", + "csrsub-update" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Initial Context Source Registration Subscriptions", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration Subscription with Response Status Code set to 204 and\n Update Context Source Registration Subscription with Response does not contain a body and\n Update Context Source Registration Subscription with Response reason set to 'No Content' and\n Retrieve Context Source Registration Subscription with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription with subscription id set to '${subscription_id}' and subscription update fragment set to '${subscription_update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription", + "robotfile": "039_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/039_02.json b/doc/files/ContextSource/RegistrationSubscription/039_02.json new file mode 100644 index 0000000000000000000000000000000000000000..73db9e13ba6d8d9251a6e2d728d92d34de986796 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/039_02.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/039_02", + "test_objective": "Check that you cannot update a context source registration subscription with an invalid URI", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.3" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "039_02_01 Update Context Source Registration Subscription With Invalid Uri", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/039_02_01", + "doc": "Check that you cannot update a context source registration subscription with an invalid URI", + "tags": [ + "5_11_3", + "csrsub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration Subscription with Response Status Code set to 400 and\n Update Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription with subscription id set to 'invalidUri' and subscription update fragment set to '${subscription_update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription", + "robotfile": "039_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/039_03.json b/doc/files/ContextSource/RegistrationSubscription/039_03.json new file mode 100644 index 0000000000000000000000000000000000000000..2d7b050c2ea2cfd57100b46d3fc3ab8706801c45 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/039_03.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/039_03", + "test_objective": "Check that you cannot update an unknown context source registration subscription", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.3" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "039_03_01 Update Unknown Context Source Registration Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/039_03_01", + "doc": "Check that you cannot update an unknown context source registration subscription", + "tags": [ + "5_11_3", + "csrsub-update" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration Subscription with Response Status Code set to 404 and\n Update Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_RESOURCE_NOT_FOUND}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription with subscription id set to 'urn:ngsi-ld:Subscription:unknowSubscription' and subscription update fragment set to '${subscription_update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription", + "robotfile": "039_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/039_04.json b/doc/files/ContextSource/RegistrationSubscription/039_04.json new file mode 100644 index 0000000000000000000000000000000000000000..77004d5d570af278f40d684c4e6c08071a325248 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/039_04.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/039_04", + "test_objective": "Check that you cannot update a context source registration subscription with a fragment that does not meet the data types and restrictions expressed by clause 5.2.12", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.3" + ], + "pics_selection": "", + "keywords": [ + "Update Context Source Registration Subscription With Invalid Fragment", + "Setup Initial Context Source Registration Subscriptions", + "Delete Initial Context Source Registration Subscriptions" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a set of Context Source Registration Subscriptions (CSRSs)\n}", + "test_cases": [ + { + "name": "039_04_01 InvalidType", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/039_04_01", + "doc": "Check that you cannot update a context source registration subscription with a fragment that does not meet the data types and restrictions expressed by clause 5.2.12", + "tags": [ + "5_11_3", + "csrsub-update" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Initial Context Source Registration Subscriptions", + "template": "Update Context Source Registration Subscription With Invalid Fragment", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration Subscription with Response Status Code set to 400 and\n Update Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription with subscription id set to '${subscription_id}' and subscription update fragment set to '${subscription_update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + }, + { + "name": "039_04_02 InvalidNotification", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/039_04_02", + "doc": "Check that you cannot update a context source registration subscription with a fragment that does not meet the data types and restrictions expressed by clause 5.2.12", + "tags": [ + "5_11_3", + "csrsub-update" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Initial Context Source Registration Subscriptions", + "template": "Update Context Source Registration Subscription With Invalid Fragment", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration Subscription with Response Status Code set to 400 and\n Update Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription with subscription id set to '${subscription_id}' and subscription update fragment set to '${subscription_update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription", + "robotfile": "039_04" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/039_05.json b/doc/files/ContextSource/RegistrationSubscription/039_05.json new file mode 100644 index 0000000000000000000000000000000000000000..07f28243dd248d1989ce8076078ae723993a3580 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/039_05.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/039_05", + "test_objective": "Check that you cannot update a context source registration subscription with an invalid request body (invalid JSON document)", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.3", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.3" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscriptions", + "Delete Initial Context Source Registration Subscriptions" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a set of Context Source Registration Subscriptions (CSRSs)\n}", + "test_cases": [ + { + "name": "039_05_01 Update Context Source Registration Subscription With Invalid JSON Fragment", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/039_05_01", + "doc": "Check that you cannot update a context source registration subscription with an invalid request body (invalid JSON document)", + "tags": [ + "5_11_3", + "csrsub-update" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Initial Context Source Registration Subscriptions", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Context Source Registration Subscription From File with Response Status Code set to 400 and\n Update Context Source Registration Subscription From File with Response Body containing the type 'problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription from file with subscription id set to '${subscription_id}' and subscription update fragment set to 'csourceSubscriptions/fragments/subscription-update-invalid-json-sample.json'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription", + "robotfile": "039_05" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/040_01.json b/doc/files/ContextSource/RegistrationSubscription/040_01.json new file mode 100644 index 0000000000000000000000000000000000000000..43c2dba440f090ec986a6ee50ed237e025c9eaf0 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/040_01.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/040_01", + "test_objective": "Check that you can retrieve a context source registration subscription", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.4" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "040_01_01 Retrieve Context Source Registration Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/040_01_01", + "doc": "Check that you can retrieve a context source registration subscription", + "tags": [ + "5_11_4", + "csrsub-retrieve" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration Subscription", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Context Source Registration Subscription with Response Status Code set to 200 and\n Retrieve Context Source Registration Subscription with Response reason set to 'OK' and\n Retrieve Context Source Registration Subscription with The response headers Link is set to 'expected_link_header=${expected link header}' and\n Retrieve Context Source Registration Subscription with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'expectation_payload' and\n Query Parameter: 'response_body' set to 'response.json()' and\n Query Parameter: 'ignored_keys' set to 'ignored_attributes' list of keys and\n Retrieve Context Source Registration Subscription with The dictionary `${response.json()}' might contain the key 'lastNotification' and\n Retrieve Context Source Registration Subscription with The dictionary `${response.json()}' might contain the key 'lastFailure' and\n Retrieve Context Source Registration Subscription with The dictionary `${response.json()}' might contain the key 'lastSuccess' and\n Retrieve Context Source Registration Subscription with The dictionary `${response.json()}' might contain the key 'timesSent'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'GET'\n Retrieve Context Source Registration Subscription with data: and\n Query Parameter: subscription id set to '${subscription_id}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription", + "robotfile": "040_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/040_02.json b/doc/files/ContextSource/RegistrationSubscription/040_02.json new file mode 100644 index 0000000000000000000000000000000000000000..88036ffc8a4e9c3ad76f98b2fd4e2d7e3685ced8 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/040_02.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/040_02", + "test_objective": "Check that you cannot retrieve a context source registration subscription with an invalid URI, an error of type BadRequestData shall be raised", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.4" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "040_02_01 Retrieve Context Source Registration Subscription With An Invalid Id", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/040_02_01", + "doc": "Check that you cannot retrieve a context source registration subscription with an invalid URI, an error of type BadRequestData shall be raised", + "tags": [ + "5_11_4", + "csrsub-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Context Source Registration Subscription with Response Status Code set to 400 and\n Retrieve Context Source Registration Subscription with Response reason set to 'Bad Request' and\n Retrieve Context Source Registration Subscription with Response Header: Content-Type set to application/json and\n Retrieve Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_BAD_REQUEST_DATA}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'GET'\n Retrieve Context Source Registration Subscription with data: and\n Query Parameter: subscription id set to 'invalidUri'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription", + "robotfile": "040_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/040_03.json b/doc/files/ContextSource/RegistrationSubscription/040_03.json new file mode 100644 index 0000000000000000000000000000000000000000..90ba05c28dcac410e219d2a0921e2acb91593a4d --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/040_03.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/040_03", + "test_objective": "Check that you cannot retrieve an unknown context source registration subscription, an error of type ResourceNotFound shall be raised", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.4", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.4" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "040_03_01 Retrieve Unknown Context Source Registration Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/040_03_01", + "doc": "Check that you cannot retrieve an unknown context source registration subscription, an error of type ResourceNotFound shall be raised", + "tags": [ + "5_11_4", + "csrsub-retrieve" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Context Source Registration Subscription with Response Status Code set to 404 and\n Retrieve Context Source Registration Subscription with Response reason set to 'Not Found' and\n Retrieve Context Source Registration Subscription with Response Header: Content-Type set to application/json and\n Retrieve Context Source Registration Subscription with Response Body containing the type 'problem_type=${ERROR_TYPE_RESOURCE_NOT_FOUND}' and Response Body Title is a string and is not ${EMPTY} and Response Body Detail is a string and is not ${EMPTY} and Response Boty Title is not equal to Response Body Detail\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'GET'\n Retrieve Context Source Registration Subscription with data: and\n Query Parameter: subscription id set to 'urn:ngsi-ld:Subscription:unknowSubscription'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription", + "robotfile": "040_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/041_01.json b/doc/files/ContextSource/RegistrationSubscription/041_01.json new file mode 100644 index 0000000000000000000000000000000000000000..b6d4be4bd6b5c566d66556594287e050a7b600b5 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/041_01.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/041_01", + "test_objective": "Check that you can query context source registration subscriptions", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.5" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscriptions", + "Delete Created Context Source Registration Subscriptions" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a set of Context Source Registration Subscriptions (CSRSs)\n}", + "test_cases": [ + { + "name": "041_01_01 Query Context Source Registration Subscriptions", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/041_01_01", + "doc": "Check that you can query context source registration subscriptions", + "tags": [ + "5_11_5", + "csrsub-query" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Created Context Source Registration Subscriptions", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registration Subscriptions with Response Status Code set to 200 and\n Query Context Source Registration Subscriptions with Response containing:\n * file set to 'csourceSubscriptions/expectations/subscriptions-035-01-expectation.json'\n * id set to '${subscription_ids}'\n * response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions", + "robotfile": "041_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/041_02.json b/doc/files/ContextSource/RegistrationSubscription/041_02.json new file mode 100644 index 0000000000000000000000000000000000000000..d598284644c62591f8f02cad7866c2be3ffe2fb0 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/041_02.json @@ -0,0 +1,74 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/041_02", + "test_objective": "Check that you can query context source registration subscriptions with a limit parameter and it will be the maximum number of subscriptions to be retrieved", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.5" + ], + "pics_selection": "", + "keywords": [ + "Query Context Source Registration Subscriptions With Limit Parameter", + "Setup Initial Context Source Registration Subscriptions", + "Delete Created Context Source Registration Subscriptions" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a set of Context Source Registration Subscriptions (CSRSs)\n}", + "test_cases": [ + { + "name": "041_02_01 Query One Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/041_02_01", + "doc": "Check that you can query context source registration subscriptions with a limit parameter and it will be the maximum number of subscriptions to be retrieved", + "tags": [ + "5_11_5", + "csrsub-query" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Created Context Source Registration Subscriptions", + "template": "Query Context Source Registration Subscriptions With Limit Parameter", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registration Subscriptions with Response Status Code set to 200 and\n Query Context Source Registration Subscriptions with Response Body containing a list of entities equal to '${1}' of type 'Subscription' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: limit set to '${1}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + }, + { + "name": "041_02_02 Query Two Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/041_02_02", + "doc": "Check that you can query context source registration subscriptions with a limit parameter and it will be the maximum number of subscriptions to be retrieved", + "tags": [ + "5_11_5", + "csrsub-query" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Created Context Source Registration Subscriptions", + "template": "Query Context Source Registration Subscriptions With Limit Parameter", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registration Subscriptions with Response Status Code set to 200 and\n Query Context Source Registration Subscriptions with Response Body containing a list of entities equal to '${2}' of type 'Subscription' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: limit set to '${2}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + }, + { + "name": "041_02_03 Query All Subscriptions", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/041_02_03", + "doc": "Check that you can query context source registration subscriptions with a limit parameter and it will be the maximum number of subscriptions to be retrieved", + "tags": [ + "5_11_5", + "csrsub-query" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Created Context Source Registration Subscriptions", + "template": "Query Context Source Registration Subscriptions With Limit Parameter", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registration Subscriptions with Response Status Code set to 200 and\n Query Context Source Registration Subscriptions with Response Body containing a list of entities equal to '${3}' of type 'Subscription' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: limit set to '${15}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions", + "robotfile": "041_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/041_03.json b/doc/files/ContextSource/RegistrationSubscription/041_03.json new file mode 100644 index 0000000000000000000000000000000000000000..b958bcbe02d9a66da80d7ccf349d4ab30aa3eacc --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/041_03.json @@ -0,0 +1,74 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/041_03", + "test_objective": "Check that you can query context source registration subscriptions with providing page and limit parameters for pagination", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.5" + ], + "pics_selection": "", + "keywords": [ + "Query Context Source Registration Subscriptions With Limit And Page Parameters", + "Setup Initial Context Source Registration Subscriptions", + "Delete Created Context Source Registration Subscriptions" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a set of Context Source Registration Subscriptions (CSRSs)\n}", + "test_cases": [ + { + "name": "041_03_01 Query Second Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/041_03_01", + "doc": "Check that you can query context source registration subscriptions with providing page and limit parameters for pagination", + "tags": [ + "5_11_5", + "csrsub-query" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Created Context Source Registration Subscriptions", + "template": "Query Context Source Registration Subscriptions With Limit And Page Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registration Subscriptions with Response Status Code set to 200 and\n Query Context Source Registration Subscriptions with Response Body containing a list of entities equal to '${1}' of type 'Subscription' with response set to '${response.json()}' and\n Query Context Source Registration Subscriptions with Response header with 'Prev' header equal to ';rel=\"next\";type=\"application/ld+json\"' and with 'Next' header equal to '${response.headers}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: limit set to '${1}' and\n Query Parameter: page set to '${2}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + }, + { + "name": "041_03_02 Query Last Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/041_03_02", + "doc": "Check that you can query context source registration subscriptions with providing page and limit parameters for pagination", + "tags": [ + "5_11_5", + "csrsub-query" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Created Context Source Registration Subscriptions", + "template": "Query Context Source Registration Subscriptions With Limit And Page Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registration Subscriptions with Response Status Code set to 200 and\n Query Context Source Registration Subscriptions with Response Body containing a list of entities equal to '${1}' of type 'Subscription' with response set to '${response.json()}' and\n Query Context Source Registration Subscriptions with Response header with 'Prev' header equal to '${EMPTY}' and with 'Next' header equal to '${response.headers}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: limit set to '${2}' and\n Query Parameter: page set to '${2}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + }, + { + "name": "041_03_03 Query All Subscriptions", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/041_03_03", + "doc": "Check that you can query context source registration subscriptions with providing page and limit parameters for pagination", + "tags": [ + "5_11_5", + "csrsub-query" + ], + "setup": "Setup Initial Context Source Registration Subscriptions", + "teardown": "Delete Created Context Source Registration Subscriptions", + "template": "Query Context Source Registration Subscriptions With Limit And Page Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registration Subscriptions with Response Status Code set to 200 and\n Query Context Source Registration Subscriptions with Response Body containing a list of entities equal to '${3}' of type 'Subscription' with response set to '${response.json()}' and\n Query Context Source Registration Subscriptions with Response header with 'Prev' header equal to '${EMPTY}' and with 'Next' header equal to '${response.headers}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n Query Parameter: limit set to '${15}' and\n Query Parameter: page set to '${1}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions", + "robotfile": "041_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/041_04.json b/doc/files/ContextSource/RegistrationSubscription/041_04.json new file mode 100644 index 0000000000000000000000000000000000000000..91af96dd0e752818d44faa68c1f426ebbb22b01d --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/041_04.json @@ -0,0 +1,71 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/041_04", + "test_objective": "Check that you cannot query context source registration subscriptions with invalid page and limit parameters", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.5" + ], + "pics_selection": "", + "keywords": [ + "Query Context Source Registration Subscriptions With Invalid Limit And Page Parameters" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "041_04_01 Invalid Limit", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/041_04_01", + "doc": "Check that you cannot query context source registration subscriptions with invalid page and limit parameters", + "tags": [ + "5_11_5", + "csrsub-query" + ], + "setup": null, + "teardown": null, + "template": "Query Context Source Registration Subscriptions With Invalid Limit And Page Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registration Subscriptions with Response Status Code set to 400 and\n Query Context Source Registration Subscriptions with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Context Source Registration Subscriptions with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: limit set to '${-5}' and\n Query Parameter: page set to '${2}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + }, + { + "name": "041_04_02 Invalid Page", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/041_04_02", + "doc": "Check that you cannot query context source registration subscriptions with invalid page and limit parameters", + "tags": [ + "5_11_5", + "csrsub-query" + ], + "setup": null, + "teardown": null, + "template": "Query Context Source Registration Subscriptions With Invalid Limit And Page Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registration Subscriptions with Response Status Code set to 400 and\n Query Context Source Registration Subscriptions with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Context Source Registration Subscriptions with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: limit set to '${2}' and\n Query Parameter: page set to '${-3}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + }, + { + "name": "041_04_03 Invalid Limit And Page", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/041_04_03", + "doc": "Check that you cannot query context source registration subscriptions with invalid page and limit parameters", + "tags": [ + "5_11_5", + "csrsub-query" + ], + "setup": null, + "teardown": null, + "template": "Query Context Source Registration Subscriptions With Invalid Limit And Page Parameters", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Context Source Registration Subscriptions with Response Status Code set to 400 and\n Query Context Source Registration Subscriptions with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Context Source Registration Subscriptions with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'GET'\n Query Context Source Registration Subscriptions and\n Query Parameter: limit set to '${0}' and\n Query Parameter: page set to '${0}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions", + "robotfile": "041_04" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/042_01.json b/doc/files/ContextSource/RegistrationSubscription/042_01.json new file mode 100644 index 0000000000000000000000000000000000000000..8a8e6d08f21a523d3c013482de4c14a0d806c115 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/042_01.json @@ -0,0 +1,37 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/042_01", + "test_objective": "Check that you can delete a context source registration subscription", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.6" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "042_01_01 Delete Context Source Registration Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/042_01_01", + "doc": "Check that you can delete a context source registration subscription", + "tags": [ + "5_11_6", + "csrsub-delete" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Context Source Registration Subscription with Response Status Code set to 204 and\n Retrieve Context Source Registration Subscription with Response Status Code set to ${response1.status_code}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'DELETE'\n Delete Context Source Registration Subscription with id set to '${subscription_id}'\n}", + "http_verb": "DELETE", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription", + "robotfile": "042_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/042_02.json b/doc/files/ContextSource/RegistrationSubscription/042_02.json new file mode 100644 index 0000000000000000000000000000000000000000..8bf07a32b7d867fabe720f4407f1ff879505b5c9 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/042_02.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/042_02", + "test_objective": "Check that you cannot delete a context source registration subscription with an invalid URI", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.6" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "042_02_01 Delete Context Source Registration Subscription With Invalid Uri", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/042_02_01", + "doc": "Check that you cannot delete a context source registration subscription with an invalid URI", + "tags": [ + "5_11_6", + "csrsub-delete" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Context Source Registration Subscription with Response Status Code set to 400 and\n Delete Context Source Registration Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Delete Context Source Registration Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'DELETE'\n Delete Context Source Registration Subscription with id set to 'invalidUri'\n}", + "http_verb": "DELETE", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription", + "robotfile": "042_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/042_03.json b/doc/files/ContextSource/RegistrationSubscription/042_03.json new file mode 100644 index 0000000000000000000000000000000000000000..aa2d9bc4dc6a96243de9c807029da9912759d254 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/042_03.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/042_03", + "test_objective": "Check that you cannot delete an unknown context source registration subscription", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.6", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.6" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "042_03_01 Delete Unknown Context Source Registration Subscription With Invalid Uri", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/042_03_01", + "doc": "Check that you cannot delete an unknown context source registration subscription", + "tags": [ + "5_11_6", + "csrsub-delete" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Context Source Registration Subscription with Response Status Code set to 404 and\n Delete Context Source Registration Subscription with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound' and\n Delete Context Source Registration Subscription with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'DELETE'\n Delete Context Source Registration Subscription with id set to 'urn:ngsi-ld:Subscription:unknowSubscription'\n}", + "http_verb": "DELETE", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription", + "robotfile": "042_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_01.json b/doc/files/ContextSource/RegistrationSubscription/047_01.json new file mode 100644 index 0000000000000000000000000000000000000000..93ab9ed403c40e974e5cd67c5ce86c8c31bd02df --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_01.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_01", + "test_objective": "Check that if the created context source registration subscription defines a timeInterval member, a cSourceNotification will be sent periodically, initially on subscription and when the time interval is reached", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "Delete Created Context Source Registration And Subscription", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "047_01_01 Receive cSourceNotification Periodically And Initially On Subscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_01_01", + "doc": "Check that if the created context source registration subscription defines a timeInterval member, a cSourceNotification will be sent periodically, initially on subscription and when the time interval is reached", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '15' seconds\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_01" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_02.json b/doc/files/ContextSource/RegistrationSubscription/047_02.json new file mode 100644 index 0000000000000000000000000000000000000000..c405b7248012b543341466795db0d4b4c14d2b8f --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_02.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_02", + "test_objective": "Check that if the created context source registration subscription does not define a timeInterval member, a cSourceNotification, with the appropriate trigger reason in the \"triggerReason\" member, will be sent initially on subscription and whenever there is a change of a matching Context Source Registration", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Context Source Registration and Context Source Registration Subscription", + "Delete Created Context Source Registration And Context Source Registration Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration (CSR1) providing latest information about some entities\n and the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_02_01 Receive cSourceNotification Initially On Subscription And Whenever There Is A Change Of A Matching Context Source Registration", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_02_01", + "doc": "Check that if the created context source registration subscription does not define a timeInterval member, a cSourceNotification, with the appropriate trigger reason in the \"triggerReason\" member, will be sent initially on subscription and whenever there is a change of a matching Context Source Registration", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Create Initial Context Source Registration and Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Context Source Registration Subscription", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'updated' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with CSR Id set to '${context_source_registration_id}' and subscription update fragment set to '${update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{context_source_registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_02" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_03.json b/doc/files/ContextSource/RegistrationSubscription/047_03.json new file mode 100644 index 0000000000000000000000000000000000000000..817b160894d56ea73b93710a7c689265270b8844 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_03.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_03", + "test_objective": "Check that instead of providing the original context source registration, implementations should return context source registration information relevant for the subscription, in particular only matching RegistrationInfo elements", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_03_01 Receive cSourceNotification With Relevant Information", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_03_01", + "doc": "Check that instead of providing the original context source registration, implementations should return context source registration information relevant for the subscription, in particular only matching RegistrationInfo elements", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to 'expected_notification_data_entities' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Create Context Source Registration Request with Content-Type set to 'application/ld+json' and payload set to '${context_source_registration_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_03" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_04.json b/doc/files/ContextSource/RegistrationSubscription/047_04.json new file mode 100644 index 0000000000000000000000000000000000000000..7f32eb37bd22a66fe44c3e18c479348e89e5f5eb --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_04", + "test_objective": "The structure of the csource notification message shall be as mandated by clause 5.3.2", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_04_01 Receive cSourceNotification With Compliant Structure", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_04_01", + "doc": "The structure of the csource notification message shall be as mandated by clause 5.3.2", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Create Context Source Registration Request with Content-Type set to 'application/ld+json' and payload set to '${context_source_registration_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_04" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_05.json b/doc/files/ContextSource/RegistrationSubscription/047_05.json new file mode 100644 index 0000000000000000000000000000000000000000..682659b16ca21f38fb8d6b48fed1431b34804022 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_05.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_05", + "test_objective": "Check that if a cSourceNotification is sent successfully to the \"endpoint\" member, the \"notification.timesSent\" member shall be incremented by one and the \"notification.lastSuccess\" and \"notification.lastNotification\" members shall be updated with the current timestamp and the status of the context source registration subscription shall be updated to \"ok\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_05_01 If A cSourceNotification Is Successfully Sent The Notification Member Shall Be Updated", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_05_01", + "doc": "Check that if a cSourceNotification is sent successfully to the \"endpoint\" member, the \"notification.timesSent\" member shall be incremented by one and the \"notification.lastSuccess\" and \"notification.lastNotification\" members shall be updated with the current timestamp and the status of the context source registration subscription shall be updated to \"ok\"", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Context Source Registration Subscription with Response containing:\n * Notification expectation file path set to 'notifications/expectations/1-timesSent-ok.json'\n * Expected Additional Members set to '${expected_notification_additional_members}'\n * Response Body set to '${response.json()}'\n\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'GET'\n Retrieve Context Source Registration Subscription with data: and\n Query Parameter: subscription id set to '${subscription_id}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_05" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_06.json b/doc/files/ContextSource/RegistrationSubscription/047_06.json new file mode 100644 index 0000000000000000000000000000000000000000..05cfa6750d051b7e436afd9b47a3f6c6b8707f7f --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_06.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_06", + "test_objective": "Check that if a cSourceNotification is not sent successfully, the \"notification.timesSent\" member shall be incremented by one and the notification.lastFailure\" and \"notification.lastNotification\" members shall be updated with the current timestamp and the status of the context source registration subscription shall be updated to \"failed\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_06_01 If A cSourceNotification Is Not Successfully Sent The Notification Member Shall Be Updated", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_06_01", + "doc": "Check that if a cSourceNotification is not sent successfully, the \"notification.timesSent\" member shall be incremented by one and the notification.lastFailure\" and \"notification.lastNotification\" members shall be updated with the current timestamp and the status of the context source registration subscription shall be updated to \"failed\"", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Context Source Registration Subscription with Response containing:\n * Notification expectation file path set to 'notifications/expectations/1-timesSent-failed.json'\n * Expected Additional Members set to '${expected_notification_additional_members}'\n * Response Body set to '${response.json()}'\n\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'GET'\n Retrieve Context Source Registration Subscription with data: and\n Query Parameter: subscription id set to '${subscription_id}'\n}", + "http_verb": "GET", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_06" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_07.json b/doc/files/ContextSource/RegistrationSubscription/047_07.json new file mode 100644 index 0000000000000000000000000000000000000000..6dac13941d3ab7820ce600ca18b52fcac5613a88 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_07.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_07", + "test_objective": "Check that a cSourceNotification shall only be sent if and only if the status of the corresponding subscription is active, neither paused or expired", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Do Not Receive cSourceNotification If Subscription Status Is Not Active", + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_07_01 PausedSubscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_07_01", + "doc": "Check that a cSourceNotification shall only be sent if and only if the status of the corresponding subscription is active, neither paused or expired", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": "Do Not Receive cSourceNotification If Subscription Status Is Not Active", + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for no Notification data and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription with subscription id set to '${subscription_id}' and subscription update fragment set to '${subscription_update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + }, + { + "name": "047_07_02 ExpiredSubscription", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_07_02", + "doc": "Check that a cSourceNotification shall only be sent if and only if the status of the corresponding subscription is active, neither paused or expired", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": "Do Not Receive cSourceNotification If Subscription Status Is Not Active", + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for no Notification data and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription with subscription id set to '${subscription_id}' and subscription update fragment set to '${subscription_update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_07" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_08.json b/doc/files/ContextSource/RegistrationSubscription/047_08.json new file mode 100644 index 0000000000000000000000000000000000000000..699b06db54b0843fced8cfdc7d978790a1348c78 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_08.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_08", + "test_objective": "Check if a context source registration subscription does not define a temporalQ member, a CsourceNotification will be triggered from matching context source registrations for context sources providing latest information", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Context Source Registration and Context Source Registration Subscription", + "Delete Created Context Source Registration And Context Source Registration Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration (CSR1) providing latest information about some entities\n and the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_08_01 Receive cSourceNotification For Matching Context Source Registrations Providing Latest Information", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_08_01", + "doc": "Check if a context source registration subscription does not define a temporalQ member, a CsourceNotification will be triggered from matching context source registrations for context sources providing latest information", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Create Initial Context Source Registration and Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Context Source Registration Subscription", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'updated' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with CSR Id set to '${context_source_registration_id}' and subscription update fragment set to '${update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{context_source_registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_08" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_09.json b/doc/files/ContextSource/RegistrationSubscription/047_09.json new file mode 100644 index 0000000000000000000000000000000000000000..470a2c0c60fed1474319cabcfd316020f92a8cdb --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_09.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_09", + "test_objective": "Check if a context source registration subscription defines an \"entities\" member, a CsourceNotification will be triggered from context source registrations with information member matching the described \"entities\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Context Source Registration And Context Source Registration Subscription", + "Delete Created Context Source Registration And Context Source Registration Subscription" + ], + "teardown": "Delete Created Context Source Registration And Context Source Registration Subscription", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "047_09_01 Receive cSourceNotification For No Longer Matching Context Source Registrations Providing Latest Information", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_09_01", + "doc": "Check if a context source registration subscription defines an \"entities\" member, a CsourceNotification will be triggered from context source registrations with information member matching the described \"entities\"", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'noLongerMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations/{context_source_registration_id}'\n method set to 'PATCH'\n Update Context Source Registration with CSR Id set to '${context_source_registration_id}' and subscription update fragment set to '${update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceRegistrations/{context_source_registration_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_09" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_10.json b/doc/files/ContextSource/RegistrationSubscription/047_10.json new file mode 100644 index 0000000000000000000000000000000000000000..7e7361bf7c446c980e968422f0f15c8c2d61fe96 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_10.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_10", + "test_objective": "Check if a context source registration subscription defines temporalQ member with timeproperty observedAt, the temporal query is matched against the observationInterval of matching context source registrations", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_10_01 Receive cSourceNotification For Matching Context Source Registrations On Observation Interval", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_10_01", + "doc": "Check if a context source registration subscription defines temporalQ member with timeproperty observedAt, the temporal query is matched against the observationInterval of matching context source registrations", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Create Context Source Registration Request with Content-Type set to 'application/ld+json' and payload set to '${context_source_registration_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_10" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_11.json b/doc/files/ContextSource/RegistrationSubscription/047_11.json new file mode 100644 index 0000000000000000000000000000000000000000..a123f8d0a3c7218cfbf48cd8811793b34e6eee24 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_11.json @@ -0,0 +1,54 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_11", + "test_objective": "Check if a context source registration subscription defines temporalQ member with timeproperty createdAt or modifiedAt, the temporal query is matched against the managementInterval of matching context source registrations", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Receive cSourceNotification For Matching Context Source Registrations On Management Interval", + "Delete Created Context Source Registrations" + ], + "teardown": "Stop Local Server", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "047_11_01 CreatedAt", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_11_01", + "doc": "Check if a context source registration subscription defines temporalQ member with timeproperty createdAt or modifiedAt, the temporal query is matched against the managementInterval of matching context source registrations", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": null, + "teardown": "Delete Created Context Source Registrations", + "template": "Receive cSourceNotification For Matching Context Source Registrations On Management Interval", + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + }, + { + "name": "047_11_02 ModifiedAt", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_11_02", + "doc": "Check if a context source registration subscription defines temporalQ member with timeproperty createdAt or modifiedAt, the temporal query is matched against the managementInterval of matching context source registrations", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": null, + "teardown": "Delete Created Context Source Registrations", + "template": "Receive cSourceNotification For Matching Context Source Registrations On Management Interval", + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions'\n method set to 'POST'\n Create Context Source Registration Subscription with filename set to '${subscription_payload}', accept set to '${EMPTY}', and content-type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "csourceSubscriptions" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_11" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_12.json b/doc/files/ContextSource/RegistrationSubscription/047_12.json new file mode 100644 index 0000000000000000000000000000000000000000..b534313d8a20fdb737a12b4cae5d4e1542a72d6e --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_12.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_12", + "test_objective": "Check if a context source registrations subscription defines entities member and watchedAttributes member, a CsourceNotification will be triggered from context source registrations with information member matching the described \"entities\" and \"attributes\"", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_12_01 Receive cSourceNotification For Matching Context Source Registrations On Watched Attributes", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_12_01", + "doc": "Check if a context source registrations subscription defines entities member and watchedAttributes member, a CsourceNotification will be triggered from context source registrations with information member matching the described \"entities\" and \"attributes\"", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Create Context Source Registration Request with Content-Type set to 'application/ld+json' and payload set to '${context_source_registration_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_12" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_13.json b/doc/files/ContextSource/RegistrationSubscription/047_13.json new file mode 100644 index 0000000000000000000000000000000000000000..958d298460cce4520f19602883a43194ca7df346 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_13.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_13", + "test_objective": "Check if a context source registrations subscription does not define watchedAttributes member, a CsourceNotification will be triggered from context source registrations with information member matching all attributes of the described entities", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_13_01 Receive cSourceNotification For Matching Context Source Registrations On Any watchedAttribute", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_13_01", + "doc": "Check if a context source registrations subscription does not define watchedAttributes member, a CsourceNotification will be triggered from context source registrations with information member matching all attributes of the described entities", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Create Context Source Registration Request with Content-Type set to 'application/ld+json' and payload set to '${context_source_registration_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_13" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_14.json b/doc/files/ContextSource/RegistrationSubscription/047_14.json new file mode 100644 index 0000000000000000000000000000000000000000..be0566f787406cfa8c2c26b01c9c5c8d0c2b5c04 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_14.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_14", + "test_objective": "Check if a context source registrations subscription defines a geoQ member, a CsourceNotification will be triggered from matching context source registrations with a matching location member", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_14_01 Receive cSourceNotification For Matching Context Source Registrations On Location", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_14_01", + "doc": "Check if a context source registrations subscription defines a geoQ member, a CsourceNotification will be triggered from matching context source registrations with a matching location member", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Create Context Source Registration Request with Content-Type set to 'application/ld+json' and payload set to '${context_source_registration_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_14" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_15.json b/doc/files/ContextSource/RegistrationSubscription/047_15.json new file mode 100644 index 0000000000000000000000000000000000000000..2516acf15c0245fc1a0c0e307b147467bef08ec5 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_15.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_15", + "test_objective": "Check if a context source registrations subscription does not define a geoproperty in the geoQ member, a CsourceNotification will be triggered from matching context source registrations with a matching location member", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Context Source Registration Subscription", + "Delete Created Context Source Registration And Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_15_01 Receive cSourceNotification For Matching Context Source Registrations On Location As Default", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_15_01", + "doc": "Check if a context source registrations subscription does not define a geoproperty in the geoQ member, a CsourceNotification will be triggered from matching context source registrations with a matching location member", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Setup Initial Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registration And Subscription", + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'expected_context_source_registration_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceRegistrations'\n method set to 'POST'\n Create Context Source Registration Request with Content-Type set to 'application/ld+json' and payload set to '${context_source_registration_payload}'\n}", + "http_verb": "POST", + "endpoint": "csourceRegistrations" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_15" +} \ No newline at end of file diff --git a/doc/files/ContextSource/RegistrationSubscription/047_16.json b/doc/files/ContextSource/RegistrationSubscription/047_16.json new file mode 100644 index 0000000000000000000000000000000000000000..2c6919213e59801bb0b990e6e9166731a5ab3149 --- /dev/null +++ b/doc/files/ContextSource/RegistrationSubscription/047_16.json @@ -0,0 +1,71 @@ +{ + "tp_id": "TP/NGSI-LD/CS/REGSUB/047_16", + "test_objective": "Check if you update a context source registration subscription, a CsourceNotification will be sent with all currently matching context source registrations", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.11.7", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "5.11.7" + ], + "pics_selection": "", + "keywords": [ + "Receive cSourceNotification For Newly Matching Context Source Registrations", + "Create Initial Context Source Registrations And Context Source Registration Subscription", + "Delete Created Context Source Registrations And Context Source Registration Subscription" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing a list of Context Source Registrations (CSRs) providing latest information about some entities\n and the SUT containing a Context Source Registration Subscription (CSRS1)\n}", + "test_cases": [ + { + "name": "047_16_01 MatchFirstContextSourceRegistration", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_16_01", + "doc": "Check if you update a context source registration subscription, a CsourceNotification will be sent with all currently matching context source registrations", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Create Initial Context Source Registrations And Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registrations And Context Source Registration Subscription", + "template": "Receive cSourceNotification For Newly Matching Context Source Registrations", + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'notification_csr_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription with subscription id set to '${subscription_id}' and subscription update fragment set to '${subscription_update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + }, + { + "name": "047_16_02 MatchSecondContextSourceRegistration", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_16_02", + "doc": "Check if you update a context source registration subscription, a CsourceNotification will be sent with all currently matching context source registrations", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Create Initial Context Source Registrations And Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registrations And Context Source Registration Subscription", + "template": "Receive cSourceNotification For Newly Matching Context Source Registrations", + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'notification_csr_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription with subscription id set to '${subscription_id}' and subscription update fragment set to '${subscription_update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + }, + { + "name": "047_16_03 MatchBothContextSourceRegistrations", + "permutation_tp_id": "TP/NGSI-LD/CS/REGSUB/047_16_03", + "doc": "Check if you update a context source registration subscription, a CsourceNotification will be sent with all currently matching context source registrations", + "tags": [ + "5_11_7", + "csrsub-notification" + ], + "setup": "Create Initial Context Source Registrations And Context Source Registration Subscription", + "teardown": "Delete Created Context Source Registrations And Context Source Registration Subscription", + "template": "Receive cSourceNotification For Newly Matching Context Source Registrations", + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received Waiting for Notification and validate it and\n Query Parameter: expected_subscription_id set to 'subscription_id' and\n Query Parameter: expected_context_source_registration_ids set to 'notification_csr_ids' and\n Query Parameter: expected_trigger_reason set to 'newlyMatching' and\n Query Parameter: expected_notification_data_entities set to '${EMPTY}' and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/csourceSubscriptions/{subscription_id}'\n method set to 'PATCH'\n Update Context Source Registration Subscription with subscription id set to '${subscription_id}' and subscription update fragment set to '${subscription_update_fragment}'\n}", + "http_verb": "PATCH", + "endpoint": "csourceSubscriptions/{subscription_id}" + } + ], + "permutations": [], + "robotpath": "ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour", + "robotfile": "047_16" +} \ No newline at end of file diff --git a/doc/generateDocumentationData.py b/doc/generateDocumentationData.py new file mode 100644 index 0000000000000000000000000000000000000000..c33d4a12c13443e3480356a99501ec2c96ce045b --- /dev/null +++ b/doc/generateDocumentationData.py @@ -0,0 +1,61 @@ +from analysis.generaterobotdata import GenerateRobotData +from json import dump +from sys import argv +from os.path import dirname, exists +from os import makedirs, walk + + +def create_json_of_robotfile(robot_file_to_be_processed: str, computestatistics: bool=False): + # TODO: ApiUtils.resource -> 'Delete Context Source Registration Subscription' added 'url=' as parameter + folder_test_suites = dirname(dirname(__file__)) + + folder_result_path = f'{folder_test_suites}/doc/results' + result_file = f'{folder_result_path}/{robot_file_to_be_processed}.json' + robot_path_to_be_processed, robot_file = find_robot_file(basedir=folder_test_suites, + filename=robot_file_to_be_processed) + + # Check that the folder '/results' exists and if not, create it + if not exists(folder_result_path): + makedirs(folder_result_path) + + if computestatistics: + try: + data = GenerateRobotData(robot_file=robot_file, execdir=folder_test_suites) + data.parse_robot() + info = data.get_info() + info["error_while_autogenerating"] = "no error" + except Exception as e: + print("WHILE GENERATING ROBOT DATA:", e) + info = dict() + info["error_while_parsing"] = True + info["error_while_autogenerating"] = str(e) + info["robotfile"] = robot_file_to_be_processed + if(robot_path_to_be_processed.startswith("/")): + robot_path_to_be_processed = robot_path_to_be_processed[1:] + info["robotpath"] = robot_path_to_be_processed + else: + data = GenerateRobotData(robot_file=robot_file, execdir=folder_test_suites) + data.parse_robot() + info = data.get_info() + + with open(result_file, 'w') as fp: + dump(obj=info, indent=2, fp=fp) + + return info + + +def find_robot_file(basedir: str, filename: str): + filename = f'{filename}.robot' + for root, dirs, files in walk(basedir): + if filename in files: + return root.replace(f'{basedir}/TP/NGSI-LD', ''), f'{root}/{filename}' + + return None, None + + +if __name__ == "__main__": + # Call with the folder below /TP/NGSI-LD which contains the robot file with name args[0] + args = argv[1:] + robot_file_tbp = args[0] + resulting_json = create_json_of_robotfile(robot_file_tbp) + print("Correctly exiting") diff --git a/doc/statisticsDocumentationData.py b/doc/statisticsDocumentationData.py new file mode 100644 index 0000000000000000000000000000000000000000..35b53130a091ab4e678f4d440b9a2de6e8f0dce2 --- /dev/null +++ b/doc/statisticsDocumentationData.py @@ -0,0 +1,201 @@ +from generateDocumentationData import create_json_of_robotfile +from os.path import dirname +from os import walk +import requests +import json +import re + +if __name__ == "__main__": + basedir = dirname(dirname(__file__)) + statistics = dict() + testcases = [] + number_of_failures = 0 + number_of_all_testcases = 0 + number_of_successes = 0 + ROBOT_FILE_EXTENSION = ".robot" + BASE_URL_OF_FORGE="https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/blob/tests-up-to-1_5/TP/NGSI-LD/" + + fullpath = basedir+"/TP/NGSI-LD" + for root, dirs, files in walk(fullpath): + for filename in files: + if filename.endswith(ROBOT_FILE_EXTENSION): + number_of_all_testcases += 1 + name_of_test_case = filename[:-len(ROBOT_FILE_EXTENSION)] + json_of_test_case = create_json_of_robotfile(name_of_test_case, True) + statistics[name_of_test_case] = dict() + strippedpath = root[len(fullpath)+1:] + statistics[name_of_test_case]["path"] = strippedpath + if "error_while_parsing" in json_of_test_case and json_of_test_case["error_while_parsing"]: + statistics[name_of_test_case]["failed"] = True + number_of_failures += 1 + # we create a dummy entry in the "sub" test_cases, which has a "permutation_tp_id" equal to the robotfile + # We do not forget to add a trailing slash that will be removed later, and a tail _XX which will + # allow matching from the googlesheet? + json_of_test_case["test_cases"] = [{"permutation_tp_id":"/"+json_of_test_case["robotfile"]+"_XX"}] + else: + statistics[name_of_test_case]["failed"] = False + number_of_successes += 1 + # we add it here because Fernando's code does not, in case of successfull parsing + json_of_test_case["error_while_parsing"] = False + # establish the right configuration + if json_of_test_case["robotpath"].startswith("ContextSource"): + json_of_test_case["config_id"] = "CF_05" + else: + json_of_test_case["config_id"] = "CF_01" + # upgrade the version and add the reference in square brackets + json_of_test_case["reference"] = re.sub(r"V1.3.1 \[\]", "version 1.5.1 [1]", json_of_test_case["reference"]) + # now for each permutation inside this test case, create the permutation's correct parent_release + if "test_cases" in json_of_test_case: + # grab everything that is a permutation_body inside the "sub" test_cases, + for permutation_body in json_of_test_case["test_cases"]: + # default parent release + parent_release = "v1.3.1" + for tag in permutation_body["tags"]: + if tag.startswith('since_'): + parts = tag.split('_') + # the suffix + parent_release = parts[-1] + permutation_body["permutation_parent_release"] = parent_release + else: + print("NO PERMUTATIONS in TESTCASE??? " + json_of_test_case["tp_id"]) + exit(1) + testcases.append(json_of_test_case) + + print() + print() + print() + print("THE FOLLOWING TESTCASES FAILED PARSING:") + for testcasename, testcaseresult in statistics.items(): + if testcaseresult["failed"]: + print(testcasename+" "+testcaseresult["path"]) + + print(f"Out of {number_of_all_testcases} testcases, {number_of_failures} of them failed to be correctly parsed.") + + with open("testcases.json", 'w') as fp: + json.dump(obj=testcases, indent=2, fp=fp) + + # determine the structure/schema of a successfully parsed testcase + permutation_template = {} + for testcase in testcases: + if testcase["error_while_parsing"] == False: + permutation_metadata_template = {} + # everything that is at the top level shall be extracted + for key, value in testcase.items(): + if key != "test_cases": + if type(key) is str: + permutation_metadata_template[key] = "UNKNOWN" + elif type(key) is list: + permutation_metadata_template[key] = [] + elif type(key) is int: + permutation_metadata_template[key] = 0 + elif type(key) is float: + permutation_metadata_template[key] = 0.0 + elif type(key) is dict: + permutation_metadata_template[key] = {} + else: + print("UNKNOWN type") + exit(1) + if "test_cases" in testcase: + # everything that is a permutation_body inside the "sub" test_cases, + # shall rise on its own existenz and be joined with its permutation_metadata + for permutation_body in testcase["test_cases"]: + permutation_body_template = {} # new object, not changing permutation_body + if "permutation_tp_id" in permutation_body: + permutation_body_template["stripped_permutation_tp_id"] = "UNKNOWN" + permutation_body_template["robotlink"] = "UNKNOWN" + for key, value in permutation_body.items(): + if type(key) is str: + permutation_body_template[key] = "UNKNOWN" + elif type(key) is list: + permutation_body_template[key] = [] + elif type(key) is int: + permutation_body_template[key] = 0 + elif type(key) is float: + permutation_body_template[key] = 0.0 + elif type(key) is dict: + permutation_body_template[key] = {} + else: + print("UNKNOWN BODY type") + exit(1) + # we use the unpacking python operator ** that strips the container dict from both + permutation_template = {**permutation_metadata_template, **permutation_body_template} + else: + print("NO PERMUTATION TP ID") + exit(1) + else: + print("TEMPLATE PARSING NOT FAILED, BUT no permutations??") + exit(1) + if permutation_template != {}: + break + + print() + print("Typical template:") + print(permutation_template) + + # unpack all permutations of testcases that are under the same .robot file + permutations = [] + for testcase in testcases: + #print("--parsing "+testcase["robotfile"]) + permutation_metadata = {} + # everything that is at the top level shall be extracted + for key, value in testcase.items(): + if key != "test_cases": + permutation_metadata[key] = value + # start creating HTML link to robot file in repo + fullurl = BASE_URL_OF_FORGE + permutation_metadata["robotpath"] + "/" + permutation_metadata["robotfile"] + ROBOT_FILE_EXTENSION + if "test_cases" in testcase: + # everything that is a permutation_body inside the "sub" test_cases, + # shall rise on its own existenz and be joined with its permutation_metadata + for permutation_body in testcase["test_cases"]: + if "permutation_tp_id" in permutation_body: + ptpid = permutation_body["permutation_tp_id"] + if "then" not in permutation_body: + print(" no then in " + ptpid) + if "when" not in permutation_body: + print(" no when in " + ptpid) + #print("::: "+ptpid) + # strip from beginning up to including the last "/" + permutation_body["stripped_permutation_tp_id"] = ptpid[ptpid.rindex("/")+1:] + # use the stripped_permutation_tp_id as text of the link + permutation_body["robotlink"] = "" + permutation_body["stripped_permutation_tp_id"] + "" + # So basically we append to the permutations a new dict that is the | union merge of the + # items of the template merged with the items of the concatenation of {**permutation_metadata, **permutation_body} + # For this last concatenation we use the unpacking python operator ** that strips the container dict from both + #permutations.append(dict(permutation_template.items() | {**permutation_metadata, **permutation_body}.items())) + a = {**permutation_metadata, **permutation_body} + unpacked_testcase = {**permutation_template, **a} + # Perform a check on the clauses that must be equal to the + # clauses extracted from tags + if "clauses" not in unpacked_testcase: + print("NO EXTRACTED CLAUSES in " + ptpid) + exit(1) + if len(unpacked_testcase["clauses"]) > 1: + print("MULTIPLE CLAUSES in " + ptpid) + permutations.append(unpacked_testcase) + else: + print("NO PERMUTATION TP ID") + exit(1) + else: + # there is no "sub" test_cases, it likely is a failed parsing + if testcase["error_while_parsing"] == False: + print("PARSING NOT FAILED, BUT no permutations??") + exit(1) + + + + + + with open("permutations.json", 'w') as fp: + json.dump(obj=permutations, indent=2, fp=fp) + + # The URL of the REST endpoint of the NoSQL database + dburl = 'http://ec2-18-153-159-20.eu-central-1.compute.amazonaws.com:5555/fromrobot' + requests.delete(dburl) + # Set the appropriate headers for JSON, if required by the endpoint + headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + # Include any other headers the API requires + } + # Make the POST request + response = requests.post(dburl, data=json.dumps(permutations), headers=headers) diff --git a/doc/tests/__init__.py b/doc/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/doc/tests/test_CheckTests.py b/doc/tests/test_CheckTests.py new file mode 100644 index 0000000000000000000000000000000000000000..e151767e2b3955e78f5f609227f98263da46e41d --- /dev/null +++ b/doc/tests/test_CheckTests.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +from re import findall +from unittest import TestCase +from os.path import dirname, join, basename, splitext +from os import walk + + +class TestCheckTests(TestCase): + # 6 passed + def setUp(self) -> None: + folder_test_suites = dirname(dirname(dirname(__file__))) + self.robot_files = list() + self.test_lines = list() + + self.search_files_by_extension( + directory=f'{folder_test_suites}/TP/NGSI-LD', + extension='robot') + + self.search_lines_by_string_and_extension( + directory=f'{folder_test_suites}/doc/tests', + extension='py', + string='def test') + + self.robots = [splitext(basename(x))[0] for x in self.robot_files] + tests = [TestCheckTests.extract_number_test(string=x[1]) for x in self.test_lines] + self.tests = [x for x in tests if x != ''] + + def search_files_by_extension(self, directory, extension): + for root, _, filenames in walk(directory): + for filename in filenames: + if filename.endswith(extension): + self.robot_files.append(join(root, filename)) + + def search_lines_by_string_and_extension(self, directory, extension, string): + for root, _, filenames in walk(directory): + for filename in filenames: + if filename.endswith(extension): + file_path = join(root, filename) + with open(file_path, 'r') as file: + for line in file: + if string in line: + self.test_lines.append((file_path, line.strip())) + + @staticmethod + def extract_number_test(string: str) -> str: + match = findall(pattern=r"[a-zA-Z ]+_([0-9_]+)", string=string) + if len(match) == 1: + return match[0] + else: + return '' + + def test_number_files_equal_number_tests(self): + print("checking") + number_robot_files = len(self.robot_files) + number_test_lines = len(self.test_lines) - 4 + assert number_robot_files == number_test_lines, \ + (f"The number of robot files '{number_robot_files}' " + f"is not the same as number of test cases '{number_test_lines}'") + + def test_specific_robot_file_has_a_test(self): + check = [item for item in self.robots if item not in self.tests] + check = [item for item in self.robot_files if any(string in item for string in check)] + + assert len(check) == 0, f"The following robot files are missing from unittest:\n '{check}'" + + def test_that_all_tests_have_the_corresponding_robot_files(self): + check = [item for item in self.tests if item not in self.robots] + check = [item for item in self.test_lines if any(string in item[1] for string in check)] + + assert len(check) == 0, f"The following unit tests are missing their robot files:\n '{check}'" diff --git a/doc/tests/test_CommonBehaviours.py b/doc/tests/test_CommonBehaviours.py new file mode 100644 index 0000000000000000000000000000000000000000..80ffd362a0c33e701b4a2305716a09e1ec6ea61e --- /dev/null +++ b/doc/tests/test_CommonBehaviours.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +from unittest import TestCase +from doc.analysis.generaterobotdata import GenerateRobotData +from json import load, dump +from deepdiff import DeepDiff +from os.path import dirname, exists +from os import listdir, remove, makedirs + + +class TestCommonBehaviours(TestCase): + # 6 passed + @classmethod + def setUpClass(cls): + TestCommonBehaviours.folder_test_suites = dirname(dirname(dirname(__file__))) + folder_results = f'{TestCommonBehaviours.folder_test_suites}/doc/results' + + # Check that the folder '/results' exists and if not, create it + if not exists(folder_results): + makedirs(folder_results) + else: + # Delete the /results folder + [remove(f'{folder_results}/{x}') for x in listdir(folder_results) if x.startswith('out')] + + def setUp(self) -> None: + self.folder_test_suites = dirname(dirname(dirname(__file__))) + + def common_function(self, robot_file, expected_value, difference_file): + data = GenerateRobotData(robot_file=robot_file, + execdir=self.folder_test_suites) + data.parse_robot() + obtained_response = data.get_info() + + with open(expected_value, 'r') as file: + expected_response = load(file) + + result = DeepDiff(t1=obtained_response, t2=expected_response, ignore_order=True) + + if len(result) != 0: + # There are some differences + with open(difference_file, 'w') as fp: + dump(obj=obtained_response, indent=2, fp=fp) + + assert False, f'They are some difference between the expected and obtained dictionaries: \n {result}' + + def test_043_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/CommonBehaviours/043_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_043_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_044_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyMergePatchJson/044_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/CommonBehaviours/044_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_044_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_044_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyMergePatchJson/044_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/CommonBehaviours/044_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_044_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_045_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyGETWithoutAccept/045_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/CommonBehaviours/045_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_045_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_048_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyUnsupportedMediaType/048_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/CommonBehaviours/048_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_048_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_049_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyNotAcceptableMediaType/049_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/CommonBehaviours/049_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_049_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_049_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyNotAcceptableMediaType/049_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/CommonBehaviours/049_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_049_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) diff --git a/doc/tests/test_ContextInformation_Consumption.py b/doc/tests/test_ContextInformation_Consumption.py new file mode 100644 index 0000000000000000000000000000000000000000..fc7bc65dabd370479120970ff3423a2123326a37 --- /dev/null +++ b/doc/tests/test_ContextInformation_Consumption.py @@ -0,0 +1,463 @@ +#!/usr/bin/env python +from unittest import TestCase +from doc.analysis.generaterobotdata import GenerateRobotData +from json import load, dump +from deepdiff import DeepDiff +from os.path import dirname, exists +from os import listdir, remove, makedirs + + +class TestCIConsumptions(TestCase): + # 58 passed + @classmethod + def setUpClass(cls): + TestCIConsumptions.folder_test_suites = dirname(dirname(dirname(__file__))) + folder_results = f'{TestCIConsumptions.folder_test_suites}/doc/results' + + # Check that the folder '/results' exists and if not, create it + if not exists(folder_results): + makedirs(folder_results) + else: + # Delete the /results folder + [remove(f'{folder_results}/{x}') for x in listdir(folder_results) if x.startswith('out')] + + def setUp(self) -> None: + self.folder_test_suites = dirname(dirname(dirname(__file__))) + + def common_function(self, robot_file, expected_value, difference_file): + data = GenerateRobotData(robot_file=robot_file, + execdir=self.folder_test_suites) + data.parse_robot() + obtained_response = data.get_info() + + with open(expected_value, 'r') as file: + expected_response = load(file) + + result = DeepDiff(t1=obtained_response, t2=expected_response, ignore_order=True) + + if len(result) != 0: + # There are some differences + with open(difference_file, 'w') as fp: + dump(obj=obtained_response, indent=2, fp=fp) + + assert False, f'They are some difference between the expected and obtained dictionaries: \n {result}' + + def test_027_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributeInformation/027_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/027_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_027_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_027_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributeInformation/027_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/027_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_027_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_025_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableAttributes/025_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/025_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_025_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_022_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypes/022_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/022_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_022_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_026_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveDetailsOfAvailableAttributes/026_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/026_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_026_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_023_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveDetailsOfAvailableEntityTypes/023_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/023_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_023_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_024_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypeInformation/024_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/024_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_024_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_024_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Discovery/RetrieveAvailableEntityTypeInformation/024_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/024_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_024_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_01_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_01_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_01_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_01_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_01_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_01_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_01_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_01_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_01_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_01_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_01_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_01_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_01_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_01_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_01_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_02_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_02_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_02_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_02_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_02_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_02_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_02_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_02_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_02_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_02_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_02_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_02_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_02_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_02_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_02_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_03_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_03_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_03_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_03_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_03_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_03_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_03_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_03_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_03_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_03_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_03_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_03_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_03_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_03_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_03_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_01_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_01_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_01_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_01_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_01_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_01_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_01_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_01_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_01_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_03_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_03_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_03_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_03_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_03_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_03_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_03_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_03_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_11(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_11.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_11.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_11.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_12(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_12.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_12.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_12.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_13(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_13.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_13.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_13.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_021_14(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_14.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_14.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_021_14.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_020_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/020_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_020_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) diff --git a/doc/tests/test_ContextInformation_Provision.py b/doc/tests/test_ContextInformation_Provision.py new file mode 100644 index 0000000000000000000000000000000000000000..9159720b86a16e2c908be428fd186ebb319482a1 --- /dev/null +++ b/doc/tests/test_ContextInformation_Provision.py @@ -0,0 +1,526 @@ +#!/usr/bin/env python +from unittest import TestCase +from doc.analysis.generaterobotdata import GenerateRobotData +from json import load, dump +from deepdiff import DeepDiff +from os.path import dirname, exists +from os import listdir, remove, makedirs + + +class TestCIProvision(TestCase): + # 16 failed, 53 passed + @classmethod + def setUpClass(cls): + TestCIProvision.folder_test_suites = dirname(dirname(dirname(__file__))) + folder_results = f'{TestCIProvision.folder_test_suites}/doc/results' + + # Check that the folder '/results' exists and if not, create it + if not exists(folder_results): + makedirs(folder_results) + else: + # Delete the /results folder + [remove(f'{folder_results}/{x}') for x in listdir(folder_results) if x.startswith('out')] + + def setUp(self) -> None: + self.folder_test_suites = dirname(dirname(dirname(__file__))) + + def common_function(self, robot_file, expected_value, difference_file): + data = GenerateRobotData(robot_file=robot_file, + execdir=self.folder_test_suites) + data.parse_robot() + obtained_response = data.get_info() + + with open(expected_value, 'r') as file: + expected_response = load(file) + + result = DeepDiff(t1=obtained_response, t2=expected_response, ignore_order=True) + + if len(result) != 0: + # There are some differences + with open(difference_file, 'w') as fp: + dump(obj=obtained_response, indent=2, fp=fp) + + assert False, f'They are some difference between the expected and obtained dictionaries: \n {result}' + + def test_003_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/003_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_003_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_003_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/003_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_003_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_003_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/003_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_003_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_003_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/003_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_003_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_003_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/003_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_003_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_003_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/003_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_003_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_003_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/003_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_003_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_003_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/003_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_003_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_003_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/003_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_003_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_006_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/006_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_006_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_006_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/006_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_006_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_006_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/006_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_006_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_005_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/005_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_005_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_005_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/005_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_005_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_005_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/005_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_005_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_005_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/005_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_005_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_004_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/004_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_004_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_004_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/004_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_004_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_004_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/004_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_004_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_004_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/004_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_004_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_004_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/004_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_004_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_004_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/004_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_004_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_001_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_001_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_001_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_001_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_001_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_001_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_001_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_001_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_001_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_002_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/002_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_002_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_002_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/002_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_002_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_002_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/002_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_002_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_010_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/010_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_010_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_010_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/010_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_010_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_010_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/010_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_010_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_010_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/010_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_010_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_010_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/010_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_010_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_013_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/013_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_013_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_013_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/013_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_013_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_013_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/013_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_013_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_012_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/012_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_012_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_012_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/012_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_012_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_012_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/012_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_012_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_011_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/011_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_011_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_011_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/011_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_011_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_011_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/011_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_011_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_011_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/011_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_011_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_007_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/007_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_007_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_007_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/007_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_007_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_007_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/007_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_007_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_009_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/009_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_009_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_009_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/009_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_009_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_009_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/DeleteTemporalRepresentationOfEntity/009_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/009_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_009_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_008_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/UpdateTemporalRepresentationOfEntity/008_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/008_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_008_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_014_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/014_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_014_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_014_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/014_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_014_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_014_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/014_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_014_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_014_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/AddAttributes/014_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/014_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_014_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_015_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/015_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_015_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_015_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/015_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_015_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_015_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttribute/015_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/015_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_015_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_017_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/017_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_017_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_017_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/017_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_017_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_017_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/017_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_017_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_016_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/016_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_016_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_016_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/016_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_016_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_016_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/016_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_016_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) diff --git a/doc/tests/test_ContextInformation_Subscription.py b/doc/tests/test_ContextInformation_Subscription.py new file mode 100644 index 0000000000000000000000000000000000000000..097a4a0a71db20fe54b3f209d0f85c86a7a5fd33 --- /dev/null +++ b/doc/tests/test_ContextInformation_Subscription.py @@ -0,0 +1,322 @@ +#!/usr/bin/env python +from unittest import TestCase +from doc.analysis.generaterobotdata import GenerateRobotData +from json import load, dump +from deepdiff import DeepDiff +from os.path import dirname, exists +from os import listdir, remove, makedirs + + +class TestCISubscription(TestCase): + # 8 failed, 28 passed + @classmethod + def setUpClass(cls): + TestCISubscription.folder_test_suites = dirname(dirname(dirname(__file__))) + folder_results = f'{TestCISubscription.folder_test_suites}/doc/results' + + # Check that the folder '/results' exists and if not, create it + if not exists(folder_results): + makedirs(folder_results) + else: + # Delete the /results folder + [remove(f'{folder_results}/{x}') for x in listdir(folder_results) if x.startswith('out')] + + def setUp(self) -> None: + self.folder_test_suites = dirname(dirname(dirname(__file__))) + + def common_function(self, robot_file, expected_value, difference_file): + data = GenerateRobotData(robot_file=robot_file, + execdir=self.folder_test_suites) + data.parse_robot() + obtained_response = data.get_info() + + with open(expected_value, 'r') as file: + expected_response = load(file) + + result = DeepDiff(t1=obtained_response, t2=expected_response, ignore_order=True) + + if len(result) != 0: + # There are some differences + with open(difference_file, 'w') as fp: + dump(obj=obtained_response, indent=2, fp=fp) + + assert False, f'They are some difference between the expected and obtained dictionaries: \n {result}' + + def test_028_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_028_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_028_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_028_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_028_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_028_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_028_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_028_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_028_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_028_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_032_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/032_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_032_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_032_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/032_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_032_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_032_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/032_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_032_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_11(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_11.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_11.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_11.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_12(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_12.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_12.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_12.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_13(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_13.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_13.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_13.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_14(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_14.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_14.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_14.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_15(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_15.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_15.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_031_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/031_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_031_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_031_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/031_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_031_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_030_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/030_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_030_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_030_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/030_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_030_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_030_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/030_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_030_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_029_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_029_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_029_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_029_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_029_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_029_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + print("WARNING, (029_06) there is a important miss alignment with the documentation") + + def test_029_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_029_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_029_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + print("WARNING, (029_09) there is a important miss alignment with the documentation") + + def test_029_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + print("WARNING, (029_10) there is a important miss alignment with the documentation") + + def test_029_11(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/029_11.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_029_11.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) diff --git a/doc/tests/test_ContextSource_Discovery.py b/doc/tests/test_ContextSource_Discovery.py new file mode 100644 index 0000000000000000000000000000000000000000..83ad07e8cdffd49ae538d7ce30fcf878cfdc7116 --- /dev/null +++ b/doc/tests/test_ContextSource_Discovery.py @@ -0,0 +1,156 @@ +#!/usr/bin/env python +from unittest import TestCase +from doc.analysis.generaterobotdata import GenerateRobotData +from json import load, dump +from deepdiff import DeepDiff +from os.path import dirname, exists +from os import listdir, remove, makedirs + + +class TestCSRegistration(TestCase): + # 2 failed, 33 passed + @classmethod + def setUpClass(cls): + TestCSRegistration.folder_test_suites = dirname(dirname(dirname(__file__))) + folder_results = f'{TestCSRegistration.folder_test_suites}/doc/results' + + # Check that the folder '/results' exists and if not, create it + if not exists(folder_results): + makedirs(folder_results) + else: + # Delete the /results folder + [remove(f'{folder_results}/{x}') for x in listdir(folder_results) if x.startswith('out')] + + def setUp(self) -> None: + self.folder_test_suites = dirname(dirname(dirname(__file__))) + + def common_function(self, robot_file, expected_value, difference_file): + data = GenerateRobotData(robot_file=robot_file, + execdir=self.folder_test_suites) + data.parse_robot() + obtained_response = data.get_info() + + with open(expected_value, 'r') as file: + expected_response = load(file) + + result = DeepDiff(t1=obtained_response, t2=expected_response, ignore_order=True) + + if len(result) != 0: + # There are some differences + with open(difference_file, 'w') as fp: + dump(obj=obtained_response, indent=2, fp=fp) + + assert False, f'They are some difference between the expected and obtained dictionaries: \n {result}' + + def test_037_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_037_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_037_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_037_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_037_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_037_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_037_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_037_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_037_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_037_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_037_11(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_11.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/037_11.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_037_11.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_036_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/036_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_036_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_036_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/036_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_036_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_036_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/036_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_036_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_036_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/036_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_036_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_036_05(self): + # self.fail("(036_05) Test Suite with Test Template, not yet implemented") + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Discovery/RetrieveContextSourceRegistration/036_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Discovery/036_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_036_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) diff --git a/doc/tests/test_ContextSource_Registration.py b/doc/tests/test_ContextSource_Registration.py new file mode 100644 index 0000000000000000000000000000000000000000..3a9ddef3e9c5800c2c3f3c12ee4fe23f6dd637e3 --- /dev/null +++ b/doc/tests/test_ContextSource_Registration.py @@ -0,0 +1,190 @@ +#!/usr/bin/env python +from unittest import TestCase +from doc.analysis.generaterobotdata import GenerateRobotData +from json import load, dump +from deepdiff import DeepDiff +from os.path import dirname, exists +from os import listdir, remove, makedirs + + +class TestCSRegistration(TestCase): + # 2 failed, 33 passed + @classmethod + def setUpClass(cls): + TestCSRegistration.folder_test_suites = dirname(dirname(dirname(__file__))) + folder_results = f'{TestCSRegistration.folder_test_suites}/doc/results' + + # Check that the folder '/results' exists and if not, create it + if not exists(folder_results): + makedirs(folder_results) + else: + # Delete the /results folder + [remove(f'{folder_results}/{x}') for x in listdir(folder_results) if x.startswith('out')] + + def setUp(self) -> None: + self.folder_test_suites = dirname(dirname(dirname(__file__))) + + def common_function(self, robot_file, expected_value, difference_file): + data = GenerateRobotData(robot_file=robot_file, + execdir=self.folder_test_suites) + data.parse_robot() + obtained_response = data.get_info() + + with open(expected_value, 'r') as file: + expected_response = load(file) + + result = DeepDiff(t1=obtained_response, t2=expected_response, ignore_order=True) + + if len(result) != 0: + # There are some differences + with open(difference_file, 'w') as fp: + dump(obj=obtained_response, indent=2, fp=fp) + + assert False, f'They are some difference between the expected and obtained dictionaries: \n {result}' + + def test_033_01_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_01_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_01_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_01_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_01_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_01_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_01_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_01_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_01_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_033_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/033_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_033_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_035_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/035_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_035_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_035_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/035_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_035_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_035_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/035_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_035_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_034_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/034_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_034_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_034_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/034_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_034_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_034_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/034_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_034_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_034_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/034_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_034_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_034_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/034_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_034_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_034_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/Registration/034_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_034_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) diff --git a/doc/tests/test_ContextSource_RegistrationSubscription.py b/doc/tests/test_ContextSource_RegistrationSubscription.py new file mode 100644 index 0000000000000000000000000000000000000000..316a3204bfdc918d9a1a3fe19f94fe32cb9fed78 --- /dev/null +++ b/doc/tests/test_ContextSource_RegistrationSubscription.py @@ -0,0 +1,323 @@ +#!/usr/bin/env python +from unittest import TestCase +from doc.analysis.generaterobotdata import GenerateRobotData +from json import load, dump +from deepdiff import DeepDiff +from os.path import dirname, exists +from os import listdir, remove, makedirs + + +class TestCSRegistrationSubscription(TestCase): + # 14 failed, 26 passed + @classmethod + def setUpClass(cls): + TestCSRegistrationSubscription.folder_test_suites = dirname(dirname(dirname(__file__))) + folder_results = f'{TestCSRegistrationSubscription.folder_test_suites}/doc/results' + + # Check that the folder '/results' exists and if not, create it + if not exists(folder_results): + makedirs(folder_results) + else: + # Delete the /results folder + [remove(f'{folder_results}/{x}') for x in listdir(folder_results) if x.startswith('out')] + + def setUp(self) -> None: + self.folder_test_suites = dirname(dirname(dirname(__file__))) + + def common_function(self, robot_file, expected_value, difference_file): + data = GenerateRobotData(robot_file=robot_file, + execdir=self.folder_test_suites) + data.parse_robot() + obtained_response = data.get_info() + + with open(expected_value, 'r') as file: + expected_response = load(file) + + result = DeepDiff(t1=obtained_response, t2=expected_response, ignore_order=True) + + if len(result) != 0: + # There are some differences + with open(difference_file, 'w') as fp: + dump(obj=obtained_response, indent=2, fp=fp) + + assert False, f'They are some difference between the expected and obtained dictionaries: \n {result}' + + def test_038_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/038_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_038_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_038_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/038_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_038_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_038_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/038_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_038_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_038_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/038_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_038_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_038_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/038_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_038_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_038_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/038_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_038_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_038_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/038_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_038_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_038_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/038_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_038_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_038_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/038_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_038_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_042_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/042_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_042_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_042_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/042_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_042_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_042_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/DeleteContextSourceRegistrationSubscription/042_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/042_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_042_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_11(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_11.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_11.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_11.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_12(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_12.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_12.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_12.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_13(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_13.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_13.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_13.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_14(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_14.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_14.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_14.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_15(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_15.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_15.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_15.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_047_16(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/ContextSourceRegistrationSubscriptionNotificationBehaviour/047_16.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/047_16.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_047_16.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_041_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/041_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_041_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_041_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/041_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_041_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_041_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/041_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_041_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_041_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/QueryContextSourceRegistrationSubscriptions/041_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/041_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_041_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_040_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/040_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_040_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_040_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/040_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_040_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_040_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/RetrieveContextSourceRegistrationSubscription/040_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/040_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_040_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_039_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/039_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_039_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_039_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/039_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_039_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_039_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/039_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_039_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_039_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/039_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_039_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_039_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextSource/RegistrationSubscription/UpdateContextSourceRegistrationSubscription/039_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextSource/RegistrationSubscription/039_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_039_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) diff --git a/libraries/ErrorListener.py b/libraries/ErrorListener.py new file mode 100644 index 0000000000000000000000000000000000000000..2e6ae719fe798ec1d33cb4542c5315edaebf266d --- /dev/null +++ b/libraries/ErrorListener.py @@ -0,0 +1,211 @@ +from os.path import join, splitext, exists +from os import getcwd, remove +from re import compile, match, MULTILINE +from json import loads, dumps +from http import HTTPStatus +from convertMD import Markdown +from githubIssue import GitHubIssue +from robot.running.context import EXECUTION_CONTEXTS + + +def __get_header__(dictionary: dict, key: str) -> str: + result = str() + try: + result = f' {key}: {dictionary["headers"][key]}\n' + return result + except KeyError: + pass + + +def __get_status_meaning__(status_code): + try: + status = HTTPStatus(status_code) + return status.phrase + except ValueError: + return "Unknown status code" + + +def __is_string_dict__(string: str) -> bool: + try: + json_object = loads(string) + if isinstance(json_object, dict): + return True + except ValueError: + pass + return False + + +def __flatten_concatenation__(matrix): + flat_list = [] + for row in matrix: + if isinstance(row, str): + flat_list.append(row) + else: + flat_list += row + + return flat_list + + +def __get_body__(dictionary: dict): + result = str() + if dictionary is None: + result = ' No body\n' + else: + result = dumps(dictionary, indent=2) + result = (result.replace('\n', '\n ') + .replace("{", " {") + .replace("[", " [") + '\n') + + return result + + +class ErrorListener: + ROBOT_LISTENER_API_VERSION = 2 + + def __init__(self, filename='errors.log'): + self.filename_md = None + self.filename_log = None + self.cwd = None + self.outfile = None + self.previous_content = str() + self.filename = filename + + self.max_length_suite = 150 + self.max_length_case = 80 + self.tests = list() + self.suite_name = str() + self.rx_dict = { + 'variables': compile('^\${.*$|^\&{.*$|^\@{.*'), + 'http_verbs': compile('^GET.*(Request|Response).*$|' + '^HEAD.*(Request|Response).*$|' + '^POST.*(Request|Response).*$|' + '^PUT.*(Request|Response).*$|' + '^DELETE.*(Request|Response).*$|' + '^CONNECT.*(Request|Response).*$|' + '^OPTIONS.*(Request|Response).*$|' + '^TRACE.*(Request|Response).*$|' + '^PATCH.*(Request|Response).*$', MULTILINE), + 'length_log': compile('^Length is \d+$') + } + + def generate_file_path(self): + if self.outfile is None: + # This is the first time that we execute the test therefore we configure the filenames + ns = EXECUTION_CONTEXTS.current + output_dir = ns.variables.current.store.data['OUTPUT_DIR'] + + basename = splitext(self.filename)[0] + self.filename_log = join(output_dir, self.filename) + self.filename_md = join(output_dir, f'{basename}.md') + + self.cwd = getcwd() + self.outfile = open(self.filename_log, 'w') + + # Check if a previous version of the markdown file exists in the folder, then we delete it in order + # not to append to this file + if exists(self.filename_md): + remove(self.filename_md) + + def start_suite(self, name, attrs): + self.generate_file_path() + + self.suite_name = attrs['source'].replace(self.cwd, '')[1:].replace('.robot', '').replace('/', ".") + + if attrs['doc'] != '': + self.outfile.write(f'{"=" * self.max_length_suite}\n') + self.outfile.write(f'{self.suite_name} :: {attrs["doc"]}\n') + self.outfile.write(f'{"=" * self.max_length_suite}\n') + + def start_test(self, name, attrs): + self.tests.append(f"\n\n{name}\n") + self.tests.append(f'{"=" * self.max_length_case}\n') + + def end_test(self, name, attrs): + if attrs['status'] != 'PASS': + flat_list = __flatten_concatenation__(matrix=self.tests) + [self.outfile.write(x) for x in flat_list if x is not None] + self.tests.clear() + + def end_suite(self, name, attrs): + self.outfile.write('\n\n\n') + self.outfile.close() + + try: + # If there was an error, generate the markdown content and upload an issue in the corresponding + # GitHub Repository + md = Markdown(filename=self.filename_log, previous_content=self.previous_content) + md.get_names() + # md.generate_md() + self.previous_content = md.save_file(filename=self.filename_md) + + # Check if we have defined the GitHub parameters in the variables.py file, if this is the case upload + # gh = GitHubIssue(issue_title=f'{attrs["longname"]} - {attrs["doc"]}', issue_content=md.get_markdown()) + + # gh.create_issues() + except KeyError as err: + print(f'\n[ERROR] Unexpected {err=}, {type(err)=} in TC {self.suite_name}\n\n') + except IndexError as err: + print(f'\n[ERROR] Unexpected {err=}, {type(err)=} in TC {self.suite_name}\n\n') + except Exception as err: + print(f'\n[ERROR] Unexpected {err=}, {type(err)=} in TC {self.suite_name}\n\n') + + # We need to reopen the file in case that we are executing several TCs + self.outfile = open(self.filename_log, 'a') + + def log_message(self, msg): + if (not match(pattern=self.rx_dict['variables'], string=msg['message']) and + not match(pattern=self.rx_dict['http_verbs'], string=msg['message'])): + self.tests.append(self.__get_message__(msg["message"])) + + def close(self): + self.outfile.write('\n\n\n') + self.outfile.close() + + def __get_message__(self, message: str) -> str: + result = str() + if message == 'Request ->': + result = f'\n\nRequest:\n{"-" * self.max_length_case}\n' + elif message == 'Response ->': + result = f'\n\nResponse:\n{"-" * self.max_length_case}\n' + elif __is_string_dict__(string=message): + result = self.__generate_pretty_output__(data=message) + elif message[0] == '\n': + # This is the title of a test case operation + result = message + elif message == 'Dictionary comparison failed with -> ': + result == None + elif match(pattern=self.rx_dict['length_log'], string=message) is None: + result = f'\nMismatch:\n{"-" * self.max_length_case}\n{message}\n' + + return result + + def __generate_pretty_output__(self, data: str) -> list: + data = loads(data) + + output = list() + + received_header_keys = data['headers'].keys() + + if 'User-Agent' in received_header_keys: + # User-Agent is a Request Header, therefore we generate the request header + output.append(f' {data["method"]} {data["url"]}\n') + + [output.append(__get_header__(dictionary=data, key=x)) for x in list(received_header_keys)] + + output.append('\n') + + output.append(__get_body__(dictionary=data['body'])) + else: + # This is a Response header + # robotframework-requests is based on python request, so it is using HTTP/1.1 + output.append(f' HTTP/1.1 {data["status_code"]} {__get_status_meaning__(data["status_code"])}\n') + + [output.append(__get_header__(dictionary=data, key=x)) for x in list(received_header_keys)] + + output.append(f' Date: REGEX(. *)\n') + + output.append('\n') + + output.append(__get_body__(dictionary=data['body'])) + + return output diff --git a/libraries/assertionUtils.py b/libraries/assertionUtils.py new file mode 100644 index 0000000000000000000000000000000000000000..edb706103142318e38b1f61e03d4241d563694b5 --- /dev/null +++ b/libraries/assertionUtils.py @@ -0,0 +1,118 @@ +from re import compile +from dataclasses import dataclass +import dateTimeUtils +from deepdiff import DeepDiff +from deepdiff.helper import CannotCompare +from prettydiff import get_annotated_lines_from_diff, diff_json, Flag +from robot.api import logger + + +@dataclass +class Theme: + added: str + removed: str + reset: str + + +def wrap_context_to_list(context): + if type(context) is str: + return [context] + else: + return context + + +core_context_pattern = compile(r'https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v\d\.\d.jsonld') + + +class AnyCoreContextVersionOperator: + def match(self, level) -> bool: + return level.path().endswith("['@context']") + + def give_up_diffing(self, level, diff_instance) -> bool: + actual_context = wrap_context_to_list(level.t2) + return len(actual_context) == 1 and core_context_pattern.match(actual_context[0]) is not None + + +class StringOrSingleListContextOperator: + def match(self, level) -> bool: + # The context can be at the root of the element to check... or deeper when we have list of elements + # So match on the end of the path + return level.path().endswith("['@context']") + + def give_up_diffing(self, level, diff_instance) -> bool: + expected_context = wrap_context_to_list(level.t1) + actual_context = wrap_context_to_list(level.t2) + return expected_context == actual_context + + +class TemporalPropertyOperator: + def match(self, level) -> bool: + return (level.path().endswith("['createdAt']") + or level.path().endswith("['modifiedAt']") + or level.path().endswith("['observedAt']") + or level.path().endswith("['deletedAt']")) + + def give_up_diffing(self, level, diff_instance) -> bool: + expected_datetime = dateTimeUtils.parse_ngsild_date(level.t1) + actual_datetime = dateTimeUtils.parse_ngsild_date(level.t2) + return actual_datetime is not None and expected_datetime == actual_datetime + + +def compare_func(x, y, level=None): + try: + return x['id'] == y['id'] + except Exception: + raise CannotCompare() from None + + +def compare_dictionaries_ignoring_keys(expected, actual, exclude_regex_paths, ignore_core_context_version=False, + group_by=None): + """Function exposed as a keyword to compare two dictionaries + :param expected: expected dictionary + :param actual: actual dictionary + :param exclude_regex_paths: list of regex paths of keys to be ignored + :param ignore_core_context_version: whether any core context version is allowed in the results + :param group_by: a key to group the results, useful for lists of results + """ + + if group_by is not None and ignore_core_context_version: + res = DeepDiff(expected, actual, exclude_regex_paths=exclude_regex_paths, ignore_order=True, verbose_level=1, + iterable_compare_func=compare_func, + custom_operators=[AnyCoreContextVersionOperator(), TemporalPropertyOperator()], + group_by=group_by) + elif group_by is not None: + res = DeepDiff(expected, actual, exclude_regex_paths=exclude_regex_paths, ignore_order=True, verbose_level=1, + iterable_compare_func=compare_func, + custom_operators=[StringOrSingleListContextOperator(), TemporalPropertyOperator()], + group_by=group_by) + elif ignore_core_context_version: + res = DeepDiff(expected, actual, exclude_regex_paths=exclude_regex_paths, ignore_order=True, verbose_level=1, + iterable_compare_func=compare_func, + custom_operators=[AnyCoreContextVersionOperator(), TemporalPropertyOperator()]) + else: + res = DeepDiff(expected, actual, exclude_regex_paths=exclude_regex_paths, ignore_order=True, verbose_level=1, + iterable_compare_func=compare_func, + custom_operators=[StringOrSingleListContextOperator(), TemporalPropertyOperator()]) + + if len(res) > 0: + output_pretty_diff(expected, actual, Theme(added="", removed="", reset="")) + + return res + + +def output_pretty_diff(a, b, theme, indent_size: int = 2): + logger.info("Dictionary comparison failed with -> ", also_console=True) + lines = get_annotated_lines_from_diff(diff_json(a, b)) + + msg = "" + for line in lines: + if Flag.ADDED in line.flags: + flags = f"{theme.added}+ " + elif Flag.REMOVED in line.flags: + flags = f"{theme.removed}- " + else: + flags = f"{theme.reset} " + + msg = msg + flags + " " * (indent_size * line.indent) + line.s + "\n" + + logger.info(msg, also_console=True) diff --git a/libraries/convertMD.py b/libraries/convertMD.py new file mode 100644 index 0000000000000000000000000000000000000000..5fb39483f5452093e1fb2afb101981823952ee66 --- /dev/null +++ b/libraries/convertMD.py @@ -0,0 +1,114 @@ +from re import compile, match, findall, MULTILINE +from difflib import SequenceMatcher + + +def get_string_difference(string1: str, string2: str) -> str: + differ = SequenceMatcher(None, string1, string2) + differences = differ.get_opcodes() + diff_string = "" + + for tag, i1, i2, j1, j2 in differences: + if tag == 'delete' or tag == 'replace': + diff_string += string1[i1:i2] + elif tag == 'insert' or tag == 'replace': + diff_string += string2[j1:j2] + + return diff_string + + +class Markdown: + def __init__(self, filename: str, previous_content: str): + # Read the content of the input file + with open(filename, 'r') as file: + self.content = file.read() + file.close() + + # Initial previous content + if previous_content != '': + # If there was a previous content in the file, take the difference to do the process + self.content = get_string_difference(string1=previous_content, string2=self.content) + + self.data = { + "suite": str(), + "cases": list(), + "steps": list() + } + + self.markdown_content = str() + + def get_names(self): + pattern1 = compile('^(\S+.*)$', MULTILINE) + + aux = findall(pattern=pattern1, string=self.content) + + special_lines = ['Response:', 'Request:', 'Mismatch:', f'{"=" * 150}', f'{"=" * 80}', f'{"-" * 80}'] + xs = [x for x in aux if x not in special_lines] + + prefixes_to_remove = ["Item ", "+ ", "- ", "Value of ", "HTTP status code", "HTTPError:", "AttributeError:"] + xs = [item for item in xs if not any(item.startswith(prefix) for prefix in prefixes_to_remove)] + + # Get the name of the Test Suite + self.data["suite"] = xs[0] + + # Get the names of the Test Cases + try: + pattern = r"\d{3}\w+" + self.data["cases"] = [item for item in xs if match(pattern, item)] + except IndexError as err: + print(f'\n[ERROR] Unexpected {err=}, {type(err)=} in TC {self.suite_name}\n\n') + + # Get the rest of values -> Steps + # Get items from listA not present in listB and not equal to exclude_string + self.data['steps'] = [item for item in xs if item not in self.data['cases'] and item != self.data['suite']] + self.data['steps'] = list(set(self.data['steps'])) + + def generate_md(self): + # Replace the title of the Test Suite + self.markdown_content = self.content + self.markdown_content = ( + self.markdown_content.replace(f'{"=" * 150}\n{self.data["suite"]}\n{"=" * 150}', f'# {self.data["suite"]}')) + + # Replace the name of the Test Cases + for x in self.data['cases']: + self.markdown_content = ( + self.markdown_content.replace(f'{x}\n{"=" * 80}\n', f'```\n## {x}\n')) + + # Replace Request, Response, and Mismatch + self.markdown_content = (self.markdown_content.replace(f'Request:\n{"-" * 80}', '#### Request:\n```') + .replace(f'Response:\n{"-" * 80}', '```\n\n#### Response:\n```') + .replace(f'Mismatch:\n{"-" * 80}', '```\n\n#### Mismatch:\n```')) + + # Replace the name of the steps + for x in self.data['steps']: + self.markdown_content = ( + self.markdown_content.replace(f'{x}\n', f'```\n### {x}\n')) + + # Final steps, correct the code style for the title of the Test Cases + # Define patterns and replacement strings + index = True + for x in self.data['cases']: + if index: + self.markdown_content = ( + self.markdown_content.replace(f'```\n## {x}\n\n```\n', f'## {x}\n\n')) + index = False + else: + self.markdown_content = ( + self.markdown_content.replace(f'```\n## {x}\n\n```\n', f'```\n## {x}\n\n')) + + # If the final number of "```" is odd, means that we need to close the last code section + # this is a workaround to close the last section of code if this is keep open + count = self.markdown_content.count("```") + if count % 2 == 1: + print(True) + self.markdown_content = f"{self.markdown_content}\n```" + + def save_file(self, filename: str): + # Write the Markdown content to the output file + with open(filename, 'a') as file: + file.write(self.markdown_content) + file.close() + + return self.content + + def get_markdown(self) -> str: + return self.markdown_content diff --git a/libraries/dateTimeUtils.py b/libraries/dateTimeUtils.py new file mode 100644 index 0000000000000000000000000000000000000000..973a5de97e578eab550a67ba9c152e04ee214267 --- /dev/null +++ b/libraries/dateTimeUtils.py @@ -0,0 +1,40 @@ +from datetime import datetime +import re + + +def is_date(date, format): + """Function exposed as a keyword to check whether the string can be interpreted as a date of given format + :param date: string to check for date + :param format: date format + """ + try: + datetime.strptime(date, format) + return True + except ValueError: + return False + + +def parse_ngsild_date(date_string): + """Function used in checks to assert if a received date is compliant with the NGSI-LD format + :param date_string: string to check for date + """ + try: + # timestamp with milliseconds separated by a comma (v1.3+) + match = re.match(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2},\d{1,6}Z", date_string) + if match: + return datetime.strptime(date_string, "%Y-%m-%dT%H:%M:%S,%fZ") + + # timestamp with milliseconds separated by a dot (v1.4+) + match = re.match(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{1,6}Z", date_string) + if match: + return datetime.strptime(date_string, "%Y-%m-%dT%H:%M:%S.%fZ") + + # timestamp without milliseconds + match = re.match(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z", date_string) + if match: + return datetime.strptime(date_string, "%Y-%m-%dT%H:%M:%SZ") + + # unknown timestamp format + return None + except ValueError: + return None diff --git a/libraries/githubIssue.py b/libraries/githubIssue.py new file mode 100644 index 0000000000000000000000000000000000000000..8163a660d060861cf546d32218013de6983fb927 --- /dev/null +++ b/libraries/githubIssue.py @@ -0,0 +1,148 @@ +from requests import post, get +from re import finditer +from json import loads + +try: + from resources.variables import github_owner, github_broker_repo, github_token +except ImportError: + # Some of the variables were not defiled, therefore we cannot execute the operation + classError = True +else: + classError = False + + +class GitHubIssue: + def __init__(self, issue_title: str, issue_content: str): + if classError: + # There is some GitHub parameters not defined, therefore this function does not effect + print("\nSome GitHub parameters were not defined in variables.py") + print("Expected parameters: github_owner, github_broker_repo, github_token") + return + else: + # Get the values of the parameter from the variables.py file + # GitHub repository details + self.url_create = f'https://api.github.com/repos/{github_owner}/{github_broker_repo}/issues' + + self.issue_title = issue_title + self.issue_content = issue_content + + self.test_cases = list() + self.test_cases_title = list() + + def create_issues(self): + if classError: + # There is some GitHub parameters not defined, therefore this function does not effect + print("\nSome GitHub parameters were not defined in variables.py") + print("Expected parameters: github_owner, github_broker_repo, github_token") + return + else: + # Request body, the issue content need to be split into the different Test Cases in order to prevent + # body maximum of 65536 characters + self.generate_test_cases_info() + + for i in range(0, len(self.test_cases_title)): + # We need to check that the issue was not already created previously + # if the issue is created previously and still open we do not create again, + # other case, we create the issue + + # Obtain the extended title of the issue + issue_title = f'{self.issue_title} {self.test_cases_title[i]}' + + # Check the issue + if self.check_duplicate_issue(issue_title=issue_title): + print('\nDuplicate issue found!') + else: + self.create_issue(body=self.test_cases[i]) + + def create_issue(self, body: str): + if classError: + # There is some GitHub parameters not defined, therefore this function does not effect + print("\nSome GitHub parameters were not defined in variables.py") + print("Expected parameters: github_owner, github_broker_repo, github_token") + return + else: + # Issue details + # Data of the issue + data = { + 'title': self.issue_title, + 'body': body + } + + # Request headers + headers = { + 'Accept': 'application/vnd.github.v3+json', + 'Authorization': f'Token {github_token}' + } + + # Send POST request to create the issue + response = post(url=self.url_create, headers=headers, json=data) + + # Check the response status code + if response.status_code == 201: + print('\nIssue created successfully.') + else: + print('\nFailed to create the issue.') + print(f'Response: {response.status_code} - {response.text}') + + def generate_test_cases_info(self): + if classError: + # There is some GitHub parameters not defined, therefore this function does not effect + print("\nSome GitHub parameters were not defined in variables.py") + print("Expected parameters: github_owner, github_broker_repo, github_token") + return + else: + pattern = r'##\s*[0-9]{3}_[0-9]{2}_[0-9]{2}.*\n' # Split on one or more non-word characters + + count = int() + indexes = list() + + match = None + for match in finditer(pattern, self.issue_content): + count += 1 + indexes.append(match.start()) + + if match: + title = self.issue_content[0:indexes[0]] + else: + raise KeyError("Search unsuccessful. It was expected the the name of the Test Cases start with " + "_
_
, where d is a digit, e.g., 027_01_01") + + # Get the list of Test Cases + for i in range(1, len(indexes) + 1): + self.test_cases_title.append(f'({self.issue_content[indexes[i-1]+3:indexes[i-1]+12]})') + + if i < len(indexes): + self.test_cases.append(self.issue_content[indexes[i-1]:indexes[i]]) + else: + self.test_cases.append(self.issue_content[indexes[i-1]:]) + + self.test_cases = [f'{title}\n\n{x}' for x in self.test_cases] + + def check_duplicate_issue(self, issue_title): + if classError: + # There is some GitHub parameters not defined, therefore this function does not effect + print("\nSome GitHub parameters were not defined in variables.py") + print("Expected parameters: github_owner, github_broker_repo, github_token") + return + else: + # Generate the URL of the query + url = f'repo:{github_owner}/{github_broker_repo} is:issue is:open in:title "{issue_title}"' + + # Make the API request + response = get( + 'https://api.github.com/search/issues', + params={'q': url} + ) + + # Check the response status code + if response.status_code == 200: + # Parse the JSON response + data = response.json() + + # Check if any issues were found + if data['total_count'] > 0: + return True # Duplicate issue found + else: + raise Exception(loads(response.text)['errors'][0]['message']) + + return False # No duplicate issue found diff --git a/libraries/logUtils.py b/libraries/logUtils.py new file mode 100644 index 0000000000000000000000000000000000000000..c796a1896a2009e61da985ac7b1a7eae81bef1fa --- /dev/null +++ b/libraries/logUtils.py @@ -0,0 +1,59 @@ +from __future__ import unicode_literals +from __future__ import division +from json import dumps, JSONDecodeError, loads +from robot.api import logger +from robot.api.deco import keyword + + +@keyword(name="Output", tags=("I/O",)) +def output(response, description, console=True): + """*Request and response are output to terminal and file (in JSON).* + :param response: response to a request + :param description: explains what request is being made + :param console: If false, the JSON is not written to terminal. Default is true. + """ + + try: + if response.request.body is None: + request_body = response.request.body + else: + request_body = loads(response.request.body) + except JSONDecodeError: + request_body = response.request.body + + try: + response_body = response.json() + except JSONDecodeError: + response_body = None + + request_json = {'method': response.request.method, 'url': response.request.url, + 'headers': dict(response.request.headers), 'body': request_body} + response_json = {'url': response.url, 'headers': dict(response.headers), 'status_code': response.status_code, + 'reason': response.reason, 'body': response_body} + + pretty_request_json = dumps(request_json, indent=4, sort_keys=False, separators=(",", ": ")) + pretty_response_json = dumps(response_json, indent=4, sort_keys=False, separators=(",", ": ")) + + logger.info("\n" + description, also_console=True) + logger.info("Request ->", also_console=True) + logger.info(pretty_request_json, also_console=True) + logger.info("Response ->", also_console=True) + logger.info(pretty_response_json, also_console=True) + + +@keyword(name="Output Notification", tags=("I/O",)) +def output_notification(body, headers, description, console=True): + """*Body and headers of the notification are output to terminal and file (in JSON).* + :param body: body of the notification received + :param headers: headers of the notification received + :param description: explains what request is being made + :param console: If false, the JSON is not written to terminal. Default is true. + """ + + request_json = {'headers': dict(headers), 'body': body} + + pretty_request_json = dumps(request_json, indent=4, sort_keys=False, separators=(",", ": ")) + + logger.info("\n" + description, also_console=True) + logger.info("Notification ->", also_console=True) + logger.info(pretty_request_json, also_console=True) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..4e4f899eef26fe570dbe1c7120198c8a51339e34 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[tool.robotidy] +diff = true +configure = [ + "SplitTooLongLine: split_on_every_arg = True" +] + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..7599dc9eac2dbacaedcadd6caf0d37e80c18a4c3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +# python3.11 project +robotframework==6.1.1 +robotframework-jsonlibrary==0.5 +robotframework-requests==0.9.6 +deepdiff==6.7.1 +prettydiff==0.1.0 +robotframework-httpctrl==0.3.1 +robotframework-tidy==4.9.0 diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource new file mode 100755 index 0000000000000000000000000000000000000000..6f3d9d02437f1bba87c0efffc3107a4f0f453bd8 --- /dev/null +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -0,0 +1,271 @@ +*** Settings *** +Variables ${EXECDIR}/resources/variables.py +Library ${EXECDIR}/libraries/logUtils.py +Library Collections +Library OperatingSystem +Library RequestsLibrary + + +*** Variables *** +${ATTRIBUTES_ENDPOINT_PATH} attributes +${ENTITIES_ENDPOINT_PATH} entities/ +${ENTITY_OPERATIONS_QUERY_ENDPOINT_PATH} entityOperations/query +${ENTITIES_TYPES_ENDPOINT_PATH} types + +${CONTENT_TYPE_JSON} application/json +${CONTENT_TYPE_LD_JSON} application/ld+json +${CONTENT_TYPE_GEOJSON} application/geo+json + +${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 + +${response} ${EMPTY} + + +*** Keywords *** +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} + ... ${georel}=${EMPTY} + ... ${coordinates}=${EMPTY} + ... ${geometry}=${EMPTY} + ... ${count}=${EMPTY} + ... ${q}=${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 + IF ${accept_length}>0 + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + IF ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + IF '${geoproperty}'!='' + Set To Dictionary ${params} geoproperty=${geoproperty} + END + IF ${options_length}>0 + Set To Dictionary ${params} options=${options} + END + IF ${entity_ids_length}>0 + Set To Dictionary ${params} id=${entity_ids} + END + IF ${entity_types_length}>0 + Set To Dictionary ${params} type=${entity_types} + END + IF '${limit}'!='' Set To Dictionary ${params} limit=${limit} + IF '${entity_id_pattern}'!='' + Set To Dictionary ${params} idPattern=${entity_id_pattern} + END + IF '${georel}'!='' Set To Dictionary ${params} georel=${georel} + IF '${coordinates}'!='' + Set To Dictionary ${params} coordinates=${coordinates} + END + IF '${geometry}'!='' + Set To Dictionary ${params} geometry=${geometry} + END + IF '${count}'!='' Set To Dictionary ${params} count=${count} + IF '${q}'!='' Set To Dictionary ${params} q=${q} + + ${response}= GET + ... url=${url}/${ENTITIES_ENDPOINT_PATH} + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Query Entities + RETURN ${response} + +Query Entities Via POST + [Arguments] + ... ${entity_id}=${EMPTY} + ... ${entity_type}=${EMPTY} + ... ${content_type}=${CONTENT_TYPE_JSON} + ... ${accept}=${CONTENT_TYPE_JSON} + ... ${context}=${EMPTY} + ... ${attrs}=${EMPTY} + ... ${entity_id_pattern}=${EMPTY} + ... ${geometry_property}=${EMPTY} + &{headers}= Create Dictionary + Set To Dictionary ${headers} Content-Type ${content_type} + Set To Dictionary ${headers} Accept ${accept} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + &{body}= Create Dictionary + Set To Dictionary ${body} type=Query + &{entities}= Create Dictionary + IF '${entity_id}'!='' + Set To Dictionary ${entities} id=${entity_id} + END + IF '${entity_type}'!='' + Set To Dictionary ${entities} type=${entity_type} + END + IF '${entity_id_pattern}'!='' + Set To Dictionary ${entities} idPattern=${entity_id_pattern} + END + ${entities_length}= Get Length ${entities} + IF ${entities_length}>0 + ${entities_list}= Create List ${entities} + Set To Dictionary ${body} entities=${entities_list} + END + ${attrs_length}= Get Length ${attrs} + IF ${attrs_length}>0 Set To Dictionary ${body} attrs=${attrs} + IF '${geometry_property}'!='' + Set To Dictionary ${body} geometryProperty=${geometry_property} + END + ${response}= POST + ... url=${url}/${ENTITY_OPERATIONS_QUERY_ENDPOINT_PATH} + ... json=${body} + ... headers=${headers} + ... expected_status=any + Output ${response} Query Entities Via POST + RETURN ${response} + +Query Entity + [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 + IF ${accept_length}>0 + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + IF ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + IF '${geoproperty}'!='' + Set To Dictionary ${params} geoproperty=${geoproperty} + END + IF ${options_length}>0 + Set To Dictionary ${params} options=${options} + END + + ${response}= GET + ... url=${url}/${ENTITIES_ENDPOINT_PATH}${id} + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Query Entity + RETURN ${response} + +Retrieve Attribute + [Arguments] ${attribute_name} ${context}=${EMPTY} ${accept}=${EMPTY} + + &{headers}= Create Dictionary + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= GET + ... url=${url}/${ATTRIBUTES_ENDPOINT_PATH}/${attribute_name} + ... headers=${headers} + ... expected_status=any + Output ${response} Retrieve Attribute + RETURN ${response} + +Retrieve Attributes + [Arguments] ${context}=${EMPTY} ${details}=false ${accept}=${EMPTY} + + &{headers}= Create Dictionary + &{params}= Create Dictionary + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + Set To Dictionary ${params} details=${details} + ${response}= GET + ... url=${url}/${ATTRIBUTES_ENDPOINT_PATH} + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Retrieve Attributes + RETURN ${response} + +Retrieve Entity by Id + [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} + ${headers}= Create Dictionary + Set To Dictionary ${headers} Accept ${accept} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= GET url=${url}/${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} expected_status=any + Output ${response} Retrieve Entity by Id + RETURN ${response} + +Retrieve Entity Type + [Arguments] ${type} ${context}=${EMPTY} ${accept}=${EMPTY} + + &{headers}= Create Dictionary + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= GET + ... url=${url}/${ENTITIES_TYPES_ENDPOINT_PATH}/${type} + ... headers=${headers} + ... expected_status=any + Output ${response} Retrieve Entity Type + RETURN ${response} + +Retrieve Entity Types + [Arguments] ${context}=${EMPTY} ${details}=false ${accept}=${EMPTY} + + &{headers}= Create Dictionary + &{params}= Create Dictionary + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + Set To Dictionary ${params} details=${details} + ${response}= GET + ... url=${url}/${ENTITIES_TYPES_ENDPOINT_PATH}/ + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Retrieve Entity Types + RETURN ${response} diff --git a/resources/ApiUtils/ContextInformationProvision.resource b/resources/ApiUtils/ContextInformationProvision.resource new file mode 100755 index 0000000000000000000000000000000000000000..86ae646174403b0914df6c10b329b639f166ccc9 --- /dev/null +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -0,0 +1,249 @@ +*** Settings *** +Variables ${EXECDIR}/resources/variables.py +Library ${EXECDIR}/libraries/logUtils.py +Library RequestsLibrary +Library OperatingSystem +Library Collections +Library JSONLibrary + + +*** Variables *** +${BATCH_CREATE_ENDPOINT_PATH} entityOperations/create +${BATCH_DELETE_ENDPOINT_PATH} entityOperations/delete +${BATCH_UPDATE_ENDPOINT_PATH} entityOperations/update +${BATCH_UPSERT_ENDPOINT_PATH} entityOperations/upsert +&{BATCH_OPERATION_ENDPOINT_MAPPING} &{EMPTY} + ... create=${BATCH_CREATE_ENDPOINT_PATH} + ... delete=${BATCH_DELETE_ENDPOINT_PATH} + ... update=${BATCH_UPDATE_ENDPOINT_PATH} + ... upsert=${BATCH_UPSERT_ENDPOINT_PATH} + +${ENTITIES_ENDPOINT_PATH} entities/ + +${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} https://uri.etsi.org/ngsi-ld/errors/BadRequestData +${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} https://uri.etsi.org/ngsi-ld/errors/LdContextNotAvailable +${ERROR_TYPE_ALREADY_EXISTS} https://uri.etsi.org/ngsi-ld/errors/AlreadyExists +${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 + +${response} ${EMPTY} + + +*** Keywords *** +Append Entity Attributes + [Arguments] ${id} ${fragment_filename} ${content_type} + &{headers}= Create Dictionary Content-Type=${content_type} + ${file_content}= Get File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} + ${response}= POST + ... url=${url}/${ENTITIES_ENDPOINT_PATH}${id}/attrs/ + ... data=${file_content} + ... headers=${headers} + ... expected_status=any + Output ${response} Append Entity Attributes + RETURN ${response} + +Append Entity Attributes With Parameters + [Arguments] ${id} ${fragment_filename} ${content_type} ${options} + &{headers}= Create Dictionary Content-Type=${content_type} + ${fragment_payload}= Load JSON From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} + ${response}= POST + ... url=${url}/${ENTITIES_ENDPOINT_PATH}${id}/attrs/?options=${options} + ... json=${fragment_payload} + ... headers=${headers} + ... expected_status=any + Output ${response} Append Entity Attributes With Parameters + RETURN ${response} + +Batch Create Entities + [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} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= POST + ... url=${url}/${BATCH_CREATE_ENDPOINT_PATH} + ... json=@{entities_to_be_created} + ... headers=${headers} + ... expected_status=any + Output ${response} Batch Create Entities + RETURN ${response} + +Batch Delete Entities + [Arguments] ${entities_ids_to_be_deleted} ${teardown}=False + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST + ... url=${url}/${BATCH_DELETE_ENDPOINT_PATH} + ... json=@{entities_ids_to_be_deleted} + ... headers=${headers} + ... expected_status=any + Output ${response} Batch Delete Entities + RETURN ${response} + +Batch Request Entities From File + [Arguments] ${batchOperation} ${filename} + ${file_content}= Get File ${EXECDIR}/data/entities/${filename} + ${endpoint_url}= Get From Dictionary ${BATCH_OPERATION_ENDPOINT_MAPPING} ${batchOperation} + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST + ... url=${url}/${endpoint_url} + ... data=${file_content} + ... headers=${headers} + ... expected_status=any + Output ${response} Batch Request Entities From File + RETURN ${response} + +Batch Update Entities + [Arguments] @{entities_to_be_updated} ${overwrite_option}=${EMPTY} + @{params}= Create List + IF '${overwrite_option}'!='' + Append To List ${params} options=${overwrite_option} + END + ${params_as_string}= Catenate SEPARATOR=& @{params} + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST + ... url=${url}/${BATCH_UPDATE_ENDPOINT_PATH}?${params_as_string} + ... json=@{entities_to_be_updated} + ... headers=${headers} + ... expected_status=any + Output ${response} Batch Update Entities + RETURN ${response} + +Batch Upsert Entities + [Arguments] @{entities_to_be_upserted} ${update_option}=replace + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST + ... url=${url}/${BATCH_UPSERT_ENDPOINT_PATH}?options=${update_option} + ... json=@{entities_to_be_upserted} + ... headers=${headers} + ... expected_status=any + Output ${response} Batch Upsert Entities + RETURN ${response} + +Create Entity + [Arguments] ${filename} ${entity_id} + ${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=application/ld+json + ${response}= POST + ... url=${url}/${ENTITIES_ENDPOINT_PATH} + ... json=${entity} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Entity + RETURN ${response} + +Create Entity Selecting Content Type + [Arguments] ${filename} ${entity_id} ${content_type} ${context}=${EMPTY} ${accept}=${EMPTY} + ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${filename} + ${entity}= Update Value To JSON ${entity_payload} $..id ${entity_id} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${accept}'!='${EMPTY}' + Set To Dictionary ${headers} Accept=${accept} + END + IF '${context}'!='${EMPTY}' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= POST + ... url=${url}/${ENTITIES_ENDPOINT_PATH} + ... json=${entity} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Entity Selecting Content Type + RETURN ${response} + +Create Entity From File + [Arguments] ${filename} + ${file_content}= Get File ${EXECDIR}/data/entities/${filename} + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST + ... url=${url}/${ENTITIES_ENDPOINT_PATH} + ... data=${file_content} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Entity From File + RETURN ${response} + +Delete Entity Attributes + [Arguments] ${entityId} ${attributeId} ${datasetId} ${deleteAll} ${context}=${EMPTY} + &{headers}= Create Dictionary Content-Type=${CONTENT_TYPE_JSON} + IF '${context}'!='${EMPTY}' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + @{params}= Create List + IF '${datasetId}'!='' + Append To List ${params} datasetId=${datasetId} + END + IF '${deleteAll}'!='' + Append To List ${params} deleteAll=${deleteAll} + END + ${params_as_string}= Catenate SEPARATOR=& @{params} + ${response}= DELETE + ... url=${url}/${ENTITIES_ENDPOINT_PATH}${entityId}/attrs/${attributeId}?${params_as_string} + ... headers=${headers} + ... expected_status=any + Output ${response} Delete Entity Attributes + RETURN ${response} + +Delete Entity by Id + [Arguments] ${id} + ${response}= DELETE + ... url=${url}/${ENTITIES_ENDPOINT_PATH}${id} + ... expected_status=any + Output ${response} Delete Entity by Id + RETURN ${response} + +Partial Update Entity Attributes + [Arguments] + ... ${entityId} + ... ${attributeId} + ... ${fragment_filename} + ... ${content_type} + ... ${accept}=${EMPTY} + ... ${context}=${EMPTY} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${fragment_payload}= Load JSON From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} + ${response}= PATCH + ... url=${url}/${ENTITIES_ENDPOINT_PATH}${entityId}/attrs/${attributeId} + ... json=${fragment_payload} + ... headers=${headers} + ... expected_status=any + Output ${response} Partial Update Entity Attributes + RETURN ${response} + +Update Entity Attributes + [Arguments] ${id} ${fragment_filename} ${content_type} + &{headers}= Create Dictionary Content-Type=${content_type} + ${file_content}= Get File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} + ${response}= PATCH + ... url=${url}/${ENTITIES_ENDPOINT_PATH}${id}/attrs/ + ... data=${file_content} + ... headers=${headers} + ... expected_status=any + Output ${response} Update Entity Attributes + RETURN ${response} diff --git a/resources/ApiUtils/ContextInformationSubscription.resource b/resources/ApiUtils/ContextInformationSubscription.resource new file mode 100755 index 0000000000000000000000000000000000000000..268e90a8831d8166105e18abb2ce35de49c7fb78 --- /dev/null +++ b/resources/ApiUtils/ContextInformationSubscription.resource @@ -0,0 +1,180 @@ +*** Settings *** +Variables ${EXECDIR}/resources/variables.py +Library ${EXECDIR}/libraries/logUtils.py +Library Collections +Library JSONLibrary +Library OperatingSystem +Library RequestsLibrary + + +*** Variables *** +${SUBSCRIPTION_ENDPOINT_PATH} subscriptions/ + +${CONTENT_TYPE_JSON} application/json +${CONTENT_TYPE_LD_JSON} application/ld+json + +${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 + +${response} ${EMPTY} + + +*** Keywords *** +Create Subscription + [Arguments] + ... ${subscription_id} + ... ${filename_path} + ... ${content_type} + ... ${accept}=${EMPTY} + ... ${context}=${EMPTY} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${subscription_payload}= Load JSON From File ${EXECDIR}/data/${filename_path} + ${subscription}= Update Value To JSON ${subscription_payload} $..id ${subscription_id} + ${response}= POST + ... url=${url}/${SUBSCRIPTION_ENDPOINT_PATH} + ... json=${subscription} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Subscription + RETURN ${response} + +Create Subscription From File + [Arguments] ${filename} + ${file_content}= Get File ${EXECDIR}/data/subscriptions/${filename} + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST + ... url=${url}/${SUBSCRIPTION_ENDPOINT_PATH} + ... data=${file_content} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Subscription From File + RETURN ${response} + +Create Subscription From Subscription Payload + [Arguments] + ... ${subscription_payload} + ... ${content_type}=${CONTENT_TYPE_LD_JSON} + ... ${accept}=${EMPTY} + ... ${context}=${EMPTY} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= POST + ... url=${url}/${SUBSCRIPTION_ENDPOINT_PATH} + ... json=${subscription_payload} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Subscription From Subscription Payload + RETURN ${response} + +Delete Subscription + [Arguments] ${subscription_id} + ${response}= DELETE + ... url=${url}/${SUBSCRIPTION_ENDPOINT_PATH}${subscription_id} + ... expected_status=any + Output ${response} Delete Subscription + RETURN ${response} + +Query Subscriptions + [Arguments] ${context}=${EMPTY} ${limit}=${EMPTY} ${offset}=${EMPTY} ${accept}=${EMPTY} + + &{headers}= Create Dictionary + &{params}= Create Dictionary + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + IF '${limit}'!='' Set To Dictionary ${params} limit=${limit} + IF '${offset}'!='' Set To Dictionary ${params} offset=${offset} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + + ${response}= GET + ... url=${url}/${SUBSCRIPTION_ENDPOINT_PATH} + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Query Subscriptions + RETURN ${response} + +Retrieve Subscription + [Arguments] ${id} ${accept}=${EMPTY} ${context}=${EMPTY} ${content_type}=${CONTENT_TYPE_JSON} + + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + + ${response}= GET + ... url=${url}/${SUBSCRIPTION_ENDPOINT_PATH}${id} + ... headers=${headers} + ... expected_status=any + Output ${response} Retrieve Subscription + RETURN ${response} + +Update Subscription + [Arguments] + ... ${subscription_id} + ... ${fragment_filename} + ... ${content_type} + ... ${accept}=${EMPTY} + ... ${context}=${EMPTY} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${subscription_update_fragment}= Load JSON From File ${EXECDIR}/data/${fragment_filename} + ${response}= PATCH + ... url=${url}/${SUBSCRIPTION_ENDPOINT_PATH}${subscription_id} + ... json=${subscription_update_fragment} + ... headers=${headers} + ... expected_status=any + Output ${response} Update Subscription + RETURN ${response} + +Update Subscription With Payload + [Arguments] ${subscription_id} ${payload} ${content_type} ${accept}=${EMPTY} ${context}=${EMPTY} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= PATCH + ... url=${url}/${SUBSCRIPTION_ENDPOINT_PATH}${subscription_id} + ... json=${payload} + ... headers=${headers} + ... expected_status=any + Output ${response} Update Subscription With Payload + RETURN ${response} diff --git a/resources/ApiUtils/ContextSourceDiscovery.resource b/resources/ApiUtils/ContextSourceDiscovery.resource new file mode 100755 index 0000000000000000000000000000000000000000..160f66f9cd5a7ff9334fbc14c4717522c25199a9 --- /dev/null +++ b/resources/ApiUtils/ContextSourceDiscovery.resource @@ -0,0 +1,157 @@ +*** Settings *** +Variables ${EXECDIR}/resources/variables.py +Library ${EXECDIR}/libraries/logUtils.py +Library Collections +Library RequestsLibrary + + +*** Variables *** +${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations + +${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/errors/BadRequestData +${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound + +${response} ${EMPTY} + + +*** Keywords *** +Query Context Source Registrations + [Arguments] + ... ${context}=${EMPTY} + ... ${id}=${EMPTY} + ... ${type}=${EMPTY} + ... ${idPattern}=${EMPTY} + ... ${attrs}=${EMPTY} + ... ${q}=${EMPTY} + ... ${csf}=${EMPTY} + ... ${georel}=${EMPTY} + ... ${geometry}=${EMPTY} + ... ${coordinates}=${EMPTY} + ... ${geoproperty}=${EMPTY} + ... ${timeproperty}=${EMPTY} + ... ${timerel}=${EMPTY} + ... ${timeAt}=${EMPTY} + ... ${limit}=${EMPTY} + ... ${offset}=${EMPTY} + ... ${accept}=${EMPTY} + + &{headers}= Create Dictionary + &{params}= Create Dictionary + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + IF '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} + IF '${id}'!='' Set To Dictionary ${params} id=${id} + IF '${type}'!='' Set To Dictionary ${params} type=${type} + IF '${idPattern}'!='' + Set To Dictionary ${params} idPattern=${idPattern} + END + IF '${attrs}'!='' Set To Dictionary ${params} attrs=${attrs} + IF '${q}'!='' Set To Dictionary ${params} q=${q} + IF '${csf}'!='' Set To Dictionary ${params} csf=${csf} + IF '${georel}'!='' Set To Dictionary ${params} georel=${georel} + IF '${geometry}'!='' + Set To Dictionary ${params} geometry=${geometry} + END + IF '${coordinates}'!='' + Set To Dictionary ${params} coordinates=${coordinates} + END + IF '${geoproperty}'!='' + Set To Dictionary ${params} geoproperty=${geoproperty} + END + IF '${timeproperty}'!='' + Set To Dictionary ${params} timeproperty=${timeproperty} + END + IF '${timerel}'!='' + Set To Dictionary ${params} timerel=${timerel} + END + IF '${timeAt}'!='' Set To Dictionary ${params} timeAt=${timeAt} + IF '${limit}'!='' Set To Dictionary ${params} limit=${limit} + IF '${offset}'!='' Set To Dictionary ${params} offset=${offset} + + ${response}= GET + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Query Context Source Registrations + RETURN ${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} + ... ${offset}=${EMPTY} + ... ${accept}=${EMPTY} + + &{headers}= Create Dictionary + &{params}= Create Dictionary + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + IF '${id}'!='' Set To Dictionary ${params} id=${id} + IF '${type}'!='' Set To Dictionary ${params} type=${type} + IF '${attrs}'!='' Set To Dictionary ${params} attrs=${attrs} + IF '${q}'!='' Set To Dictionary ${params} q=${q} + IF '${georel}'!='' Set To Dictionary ${params} georel=${georel} + IF '${geometry}'!='' + Set To Dictionary ${params} geometry=${geometry} + END + IF '${coordinates}'!='' + Set To Dictionary ${params} coordinates=${coordinates} + END + IF '${geoproperty}'!='' + Set To Dictionary ${params} geoproperty=${geoproperty} + END + IF '${timeproperty}'!='' + Set To Dictionary ${params} timeproperty=${timeproperty} + END + IF '${timerel}'!='' + Set To Dictionary ${params} timerel=${timerel} + END + IF '${timeAt}'!='' Set To Dictionary ${params} timeAt=${timeAt} + IF '${limit}'!='' Set To Dictionary ${params} limit=${limit} + IF '${offset}'!='' Set To Dictionary ${params} offset=${offset} + + ${response}= GET + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Query Context Source Registrations + RETURN ${response} + +Retrieve Context Source Registration + [Arguments] ${context_source_registration_id} ${context}=${EMPTY} ${accept}=${EMPTY} + + &{headers}= Create Dictionary + IF '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= GET + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} + ... headers=${headers} + ... expected_status=any + Output ${response} Retrieve Context Source Registration + RETURN ${response} diff --git a/resources/ApiUtils/ContextSourceRegistration.resource b/resources/ApiUtils/ContextSourceRegistration.resource new file mode 100755 index 0000000000000000000000000000000000000000..7aa5176bdbbe8572942d5b00830efdfa5e54ab10 --- /dev/null +++ b/resources/ApiUtils/ContextSourceRegistration.resource @@ -0,0 +1,99 @@ +*** Settings *** +Variables ${EXECDIR}/resources/variables.py +Library ${EXECDIR}/libraries/logUtils.py +Library Collections +Library OperatingSystem +Library RequestsLibrary + + +*** Variables *** +${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations + +${CONTENT_TYPE_JSON} application/json +${CONTENT_TYPE_LD_JSON} application/ld+json + +${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/errors/BadRequestData +${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound + +${response} ${EMPTY} + + +*** Keywords *** +Create Context Source Registration + [Arguments] ${context_source_registration_payload} + + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} + ... json=${context_source_registration_payload} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Context Source Registration + RETURN ${response} + +Create Context Source Registration With Return + [Arguments] ${payload} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${accept}=${EMPTY} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept=${context} + END + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= POST + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} + ... json=${payload} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Context Source Registration + RETURN ${response} + +Delete Context Source Registration + [Arguments] ${context_source_registration_id} + + ${response}= DELETE url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} + Output ${response} Delete Context Source Registration + RETURN ${response} + +Delete Context Source Registration With Return + [Arguments] ${registration_id} + ${response}= DELETE + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} + ... expected_status=any + Output ${response} Delete Context Source Registration + RETURN ${response} + +Update Context Source Registration + [Arguments] ${context_source_registration_id} ${update_fragment} + + ${response}= PATCH + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} + ... json=${update_fragment} + ... expected_status=any + Output ${response} Update Context Source Registration + RETURN ${response} + +Update Context Source Registration From File + [Arguments] ${context_source_registration_id} ${filename} + + ${file_content}= Get File ${EXECDIR}/data/csourceRegistrations/${filename} + ${response}= PATCH + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${context_source_registration_id} + ... data=${file_content} + ... expected_status=any + Output ${response} Update Context Source Registration From File + RETURN ${response} + +Update Context Source Registration With Return + [Arguments] ${registration_id} ${fragment} ${content_type} ${accept}=${EMPTY} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} + ${response}= PATCH + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH}/${registration_id} + ... json=${fragment} + ... headers=${headers} + ... expected_status=any + Output ${response} Update Context Source Registration + RETURN ${response} diff --git a/resources/ApiUtils/ContextSourceRegistrationSubscription.resource b/resources/ApiUtils/ContextSourceRegistrationSubscription.resource new file mode 100755 index 0000000000000000000000000000000000000000..46e67e9815a707554401bdae2faf1c6dbbca2bd7 --- /dev/null +++ b/resources/ApiUtils/ContextSourceRegistrationSubscription.resource @@ -0,0 +1,104 @@ +*** Settings *** +Variables ${EXECDIR}/resources/variables.py +Library ${EXECDIR}/libraries/logUtils.py +Library Collections +Library OperatingSystem +Library RequestsLibrary + + +*** Variables *** +${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions + +${CONTENT_TYPE_JSON} application/json +${CONTENT_TYPE_LD_JSON} application/ld+json + +${ERROR_TYPE_ALREADY_EXISTS} https://uri.etsi.org/ngsi-ld/errors/AlreadyExists +${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 + +${response} ${EMPTY} + + +*** Keywords *** +Create Context Source Registration Subscription + [Arguments] ${subscription_payload} ${accept}=${EMPTY} ${content_type}=${CONTENT_TYPE_LD_JSON} + + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + ${response}= POST + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} + ... json=${subscription_payload} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Context Source Registration Subscription + RETURN ${response} + +Delete Context Source Registration Subscription + [Arguments] ${subscription_id} + + ${response}= DELETE + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}/${subscription_id} + Output ${response} Delete Context Source Registration Subscription + RETURN ${response} + +Query Context Source Registration Subscriptions + [Arguments] ${context}=${EMPTY} ${limit}=${EMPTY} ${page}=${EMPTY} ${accept}=${EMPTY} + + &{headers}= Create Dictionary + &{params}= Create Dictionary + IF '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + IF '${limit}'!='' Set To Dictionary ${params} limit=${limit} + IF '${page}'!='' Set To Dictionary ${params} page=${page} + + ${response}= GET + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Query Context Source Registration Subscriptions + RETURN ${response} + +Retrieve Context Source Registration Subscription + [Arguments] ${subscription_id} ${context}=${EMPTY} ${accept}=${CONTENT_TYPE_JSON} + + &{headers}= Create Dictionary + Set To Dictionary ${headers} Accept ${accept} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= GET + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}/${subscription_id} + ... headers=${headers} + ... expected_status=any + Output ${response} Retrieve Context Source Registration Subscription + RETURN ${response} + +Update Context Source Registration Subscription + [Arguments] ${subscription_id} ${subscription_update_fragment} + + ${response}= PATCH + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}/${subscription_id} + ... json=${subscription_update_fragment} + ... expected_status=any + Output ${response} Update Context Source Registration Subscription + RETURN ${response} + +Update Context Source Registration Subscription From File + [Arguments] ${subscription_id} ${file_path} + ${file_content}= Get File ${EXECDIR}/data/${file_path} + ${response}= PATCH + ... url=${url}/${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH}/${subscription_id} + ... data=${file_content} + ... expected_status=any + Output ${response} Update Context Source Registration Subscription From File + RETURN ${response} diff --git a/resources/ApiUtils/TemporalContextInformationConsumption.resource b/resources/ApiUtils/TemporalContextInformationConsumption.resource new file mode 100755 index 0000000000000000000000000000000000000000..983a2be222c0e30e8c90cef133bbf445d3b9367e --- /dev/null +++ b/resources/ApiUtils/TemporalContextInformationConsumption.resource @@ -0,0 +1,221 @@ +*** Settings *** +Variables ${EXECDIR}/resources/variables.py +Library ${EXECDIR}/libraries/logUtils.py +Library Collections +Library JSONLibrary +Library RequestsLibrary + + +*** Variables *** +${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporal/entities +${TEMPORAL_ENTITY_OPERATIONS_ENDPOINT_PATH} temporal/entityOperations + +${CONTENT_TYPE_JSON} application/json + +${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/errors/BadRequestData +${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound + +${response} ${EMPTY} + + +*** Keywords *** +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} + ... ${accept}=${EMPTY} + ... ${options}=${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 + IF '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + IF ${entity_types_length}>0 + Set To Dictionary ${params} type=${entity_types} + END + IF ${entity_ids_length}>0 + Set To Dictionary ${params} id=${entity_ids} + END + IF '${timerel}'!='' + Set To Dictionary ${params} timerel=${timerel} + END + IF '${timeAt}'!='' Set To Dictionary ${params} timeAt=${timeAt} + IF ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + IF '${lastN}'!='' Set To Dictionary ${params} lastN=${lastN} + IF '${entity_id_pattern}'!='' + Set To Dictionary ${params} idPattern=${entity_id_pattern} + END + IF '${ngsild_query}'!='' + Set To Dictionary ${params} q=${ngsild_query} + END + IF '${csf}'!='' Set To Dictionary ${params} csf=${csf} + IF '${georel}'!='' Set To Dictionary ${params} georel=${georel} + IF '${geometry}'!='' + Set To Dictionary ${params} geometry=${geometry} + END + IF '${coordinates}'!='' + Set To Dictionary ${params} coordinates=${coordinates} + END + IF '${geoproperty}'!='' + Set To Dictionary ${params} geoproperty=${geoproperty} + END + IF '${limit}'!='' Set To Dictionary ${params} limit=${limit} + IF '${options}'!='' + Set To Dictionary ${params} options=${options} + END + + ${response}= GET + ... url=${temporal_api_url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH} + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Query Temporal Representation Of Entities + RETURN ${response} + +Query Temporal Representation Of Entities Via Post + [Arguments] ${query_file_name} ${content_type}=${CONTENT_TYPE_JSON} ${context}=${EMPTY} + ${headers}= Create Dictionary + Set To Dictionary ${headers} Content-Type ${content_type} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${query_payload}= Load JSON From File ${EXECDIR}/data/temporalEntities/${query_file_name} + ${response}= POST + ... url=${temporal_api_url}/${TEMPORAL_ENTITY_OPERATIONS_ENDPOINT_PATH}/query + ... json=${query_payload} + ... headers=${headers} + ... expected_status=any + Output ${response} Query Temporal Representation Of Entities Via Post + RETURN ${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 + IF '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + IF ${entity_types_length}>0 + Set To Dictionary ${params} type=${entity_types} + END + IF ${entity_ids_length}>0 + Set To Dictionary ${params} id=${entity_ids} + END + IF '${timerel}'!='' + Set To Dictionary ${params} timerel=${timerel} + END + IF '${timeAt}'!='' Set To Dictionary ${params} timeAt=${timeAt} + IF ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + IF '${lastN}'!='' Set To Dictionary ${params} lastN=${lastN} + IF '${entity_id_pattern}'!='' + Set To Dictionary ${params} idPattern=${entity_id_pattern} + END + IF '${ngsild_query}'!='' + Set To Dictionary ${params} q=${ngsild_query} + END + IF '${csf}'!='' Set To Dictionary ${params} csf=${csf} + IF '${georel}'!='' Set To Dictionary ${params} georel=${georel} + IF '${geometry}'!='' + Set To Dictionary ${params} geometry=${geometry} + END + IF '${coordinates}'!='' + Set To Dictionary ${params} coordinates=${coordinates} + END + IF '${geoproperty}'!='' + Set To Dictionary ${params} geoproperty=${geoproperty} + END + IF '${limit}'!='' Set To Dictionary ${params} limit=${limit} + + ${response}= GET + ... url=${temporal_api_url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH} + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Query Temporal Representation Of Entities + RETURN ${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} + ... ${accept}=${EMPTY} + ${attrs_length}= Get Length ${attrs} + ${options_length}= Get Length ${options} + &{headers}= Create Dictionary + &{params}= Create Dictionary + + IF '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + IF ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + IF ${options_length}>0 + Set To Dictionary ${params} options=${options} + END + IF '${timerel}'!='' + Set To Dictionary ${params} timerel=${timerel} + END + IF '${timeAt}'!='' Set To Dictionary ${params} timeAt=${timeAt} + IF '${endTimeAt}'!='' + Set To Dictionary ${params} endTimeAt=${endTimeAt} + END + IF '${lastN}'!='' Set To Dictionary ${params} lastN=${lastN} + + ${response}= GET + ... url=${temporal_api_url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} + ... headers=${headers} + ... params=${params} + ... expected_status=any + Output ${response} Retrieve Temporal Representation Of Entity + RETURN ${response} diff --git a/resources/ApiUtils/TemporalContextInformationProvision.resource b/resources/ApiUtils/TemporalContextInformationProvision.resource new file mode 100755 index 0000000000000000000000000000000000000000..db80955d077772d1354409086b36325ebebeb799 --- /dev/null +++ b/resources/ApiUtils/TemporalContextInformationProvision.resource @@ -0,0 +1,166 @@ +*** Settings *** +Variables ${EXECDIR}/resources/variables.py +Library ${EXECDIR}/libraries/logUtils.py +Library Collections +Library JSONLibrary +Library OperatingSystem +Library RequestsLibrary + + +*** Variables *** +${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporal/entities + +${CONTENT_TYPE_JSON} application/json +${CONTENT_TYPE_LD_JSON} application/ld+json + +${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 + +${response} ${EMPTY} + + +*** Keywords *** +Append Attribute To Temporal Entity + [Arguments] ${temporal_entity_id} ${fragment_filename} ${content_type} + &{headers}= Create Dictionary Content-Type=${content_type} + ${file_content}= Get File ${EXECDIR}/data/temporalEntities/fragments/${fragment_filename} + ${response}= POST + ... url=${url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_id}/attrs + ... data=${file_content} + ... headers=${headers} + ... expected_status=any + Output ${response} Append Attribute To Temporal Entity + RETURN ${response} + +Create Or Update Temporal Representation Of Entity Selecting 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} + IF '${accept}'!='' + Set To Dictionary ${headers} Accept ${accept} + END + ${response}= POST + ... url=${url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH}/ + ... json=${temporal_entity_representation} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Or Update Temporal Representation Of Entity Selecting Content Type + RETURN ${response} + +Create Temporal Representation Of Entity + [Arguments] ${filename} ${temporal_entity_representation_id} + ${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=application/ld+json + ${response}= POST + ... url=${url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH} + ... json=${temporal_entity_representation} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Temporal Representation Of Entity + RETURN ${response} + +Create Temporal Representation Of Entity Selecting Content Type + [Arguments] ${filename} ${content_type} + ${file_content}= Get File ${EXECDIR}/data/temporalEntities/${filename} + &{headers}= Create Dictionary Content-Type=${content_type} + ${response}= POST + ... url=${url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH} + ... data=${file_content} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Temporal Representation Of Entity Selecting Content Type + RETURN ${response} + +Delete Attribute From Temporal Entity + [Arguments] + ... ${entityId} + ... ${attributeId} + ... ${content_type} + ... ${datasetId} + ... ${deleteAll} + ... ${context}=${EMPTY} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + @{params}= Create List + IF '${datasetId}'!='' + Append To List ${params} datasetId=${datasetId} + END + IF '${deleteAll}'!='' + Append To List ${params} deleteAll=${deleteAll} + END + ${params_as_string}= Catenate SEPARATOR=& @{params} + ${response}= DELETE + ... url=${url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${entityId}/attrs/${attributeId}?${params_as_string} + ... headers=${headers} + ... expected_status=any + Output ${response} Delete Attribute From Temporal Entity + RETURN ${response} + +Delete Attribute Instance From Temporal Entity + [Arguments] ${temporal_entity_id} ${attributeId} ${instanceId} ${content_type} ${context}=${EMPTY} + &{headers}= Create Dictionary + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= DELETE + ... url=${url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_id}/attrs/${attributeId}/${instanceId} + ... headers=${headers} + ... expected_status=any + Output ${response} Delete Attribute Instance From Temporal Entity + RETURN ${response} + +Delete Temporal Representation Of Entity + [Arguments] ${temporal_entity_representation_id} + + ${response}= DELETE + ... url=${url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} + ... expected_status=any + Output ${response} Delete Temporal Representation Of Entity + RETURN ${response} + +Delete Temporal Representation Of Entity With Returning Response + [Arguments] ${temporal_entity_representation_id} + ${response}= DELETE + ... url=${url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} + ... expected_status=any + Output ${response} Delete Temporal Representation Of Entity + RETURN ${response} + +Modify Attribute Instance From Temporal Entity + [Arguments] + ... ${temporal_entity_id} + ... ${attributeId} + ... ${instanceId} + ... ${fragment_filename} + ... ${content_type} + ... ${context}=${EMPTY} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${fragment_payload}= Load JSON From File ${EXECDIR}/data/temporalEntities/fragments/${fragment_filename} + ${response}= PATCH + ... url=${url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_id}/attrs/${attributeId}/${instanceId} + ... json=${fragment_payload} + ... headers=${headers} + ... expected_status=any + Output ${response} Modify Attribute Instance From Temporal Entity + RETURN ${response} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource new file mode 100755 index 0000000000000000000000000000000000000000..f3af151f4cc61b6d980a8b9a0b9cf6f2c5e38f84 --- /dev/null +++ b/resources/AssertionUtils.resource @@ -0,0 +1,539 @@ +*** Settings *** +Library ${EXECDIR}/libraries/assertionUtils.py +Library RequestsLibrary +Library Collections +Library JSONLibrary +Library String +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource + + +*** Variables *** +${id_regex_expr}= root\\['id'\\] +${instance_id_regex_expr}= root\\[.*\\]\\['instanceId'\\] +${notification_timestamps_regex_expr}= root\\['last.*'\\] +${notification_endpoint_uri_regex_expr}= root\\['endpoint'\\]\\['uri'\\] +${context_regex_expr}= root\\['@context'\\] +${status_regex_expr}= root\\['status'\\] +${lastfailure_regex_expr}= root\\['lastFailure'\\] +${lastNotification_regex_expr}= root\\['lastNotification'\\] +${timesFailed_regex_expr}= root\\['timesFailed'\\] +${timesSent_regex_expr}= root\\['timesSent'\\] +${is_active_expr}= root\\['isActive'\\] + + +*** Keywords *** +Check Response Status Code + [Arguments] ${expected_status_code} ${response_status_code} + ${response_status_code}= convert to string ${response_status_code} + Should Be Equal + ... ${expected_status_code} + ... ${response_status_code} + ... HTTP status code comparison failed with (expected, actual) -> + +Check Response Body Containing Array Of URIs set to + [Arguments] ${expected_entities_ids} ${response_body} + Lists Should Be Equal ${expected_entities_ids} ${response_body} ignore_order=True + +Check Response Body Content + [Arguments] ${expectation_filename} ${response_body} ${additional_ignored_path}=${EMPTY} + ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/expectations/${expectation_filename} + ${all_ignored_paths}= Create List ${instance_id_regex_expr} ${additional_ignored_path} + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${entity_payload} + ... ${response_body} + ... ${all_ignored_paths} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Headers Containing Content-Type set to + [Arguments] ${expected_content_type_content} ${response_headers} + Should Be Equal ${response_headers['Content-Type']} ${expected_content_type_content} + +Check Response Header is Empty + [Arguments] ${response_headers} + Dictionaries Should Be Equal ${response_headers} {} + +Check Response Headers Link Not Empty + [Arguments] ${response_headers} + Should Not Be Empty ${response_headers['Link']} + +Check Response Headers Link set to + [Arguments] ${response_headers} ${expected_link_header} + Should Be Equal ${response_headers['Link']} ${expected_link_header} + +# Since Http headers names are case-insensitive (from Http specification) +# We check both Location and location headers + +Check Response Headers Containing URI set to + [Arguments] ${expected_entity_id} ${response_headers} + + IF 'Location' in ${response_headers} + Should Contain + ... ${response_headers['Location']} + ... ${expected_entity_id} + ... ignore_order=True + END + +Check Response Headers Containing NGSILD-Results-Count Equals To + [Arguments] ${expected_result_count} ${response_headers} + Should Be Equal ${response_headers['NGSILD-Results-Count']} ${expected_result_count} + +# 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_headers} + + ${location_header}= Set Variable If + ... 'Location' in ${response_headers} + ... ${response_headers['Location']} + ${id}= Fetch From Right ${location_header} / + Should Not Be Empty ${id} + RETURN ${id} + +Check Response Body Containing an Attribute set to + [Arguments] ${expected_attribute_name} ${response_body} ${expected_attribute_value}=${EMPTY} + Should Not Be Empty ${response_body['${expected_attribute_name}']} + IF '${expected_attribute_value}'!='' + Should Be Equal ${response_body['${expected_attribute_name}']} ${expected_attribute_value} + END + +Check Response Body Containing a Boolean Attribute set to + [Arguments] ${expected_attribute_name} ${response_body} ${expected_attribute_value} + Dictionary Should Contain Key ${response_body} ${expected_attribute_name} + IF '${expected_attribute_value}'=='True' + Should Be True ${response_body['${expected_attribute_name}']} + ELSE + IF '${expected_attribute_value}'=='False' + Should Not Be True ${response_body['${expected_attribute_name}']} + ELSE + Fail Unexpected boolean value, only True/False are allowed, received ${expected_attribute_value} + END + END + +Check Response Body Containing Batch Operation Result + [Arguments] ${expected_batch_operation_result} ${response_body} + @{expected_successful_entities_ids}= Get From Dictionary ${expected_batch_operation_result} success + @{expected_failed_entities_ids}= Get From Dictionary ${expected_batch_operation_result} errors + @{response_errors}= Get From Dictionary ${response_body} errors + + ${expected_failed_entities_ids_length}= Get Length ${expected_failed_entities_ids} + ${response_errors_length}= Get Length ${response_errors} + + Lists Should Be Equal ${expected_successful_entities_ids} ${response_body['success']} ignore_order=True + Should be Equal as Integers ${expected_failed_entities_ids_length} ${response_errors_length} + FOR ${response_error} IN @{response_errors} + List Should Contain Value ${expected_failed_entities_ids} ${response_error['entityId']} + Should Not Be Empty ${response_error['error']} + END + +Check Response Body Containing Entity element + [Arguments] ${expectation_filename} ${entity_id} ${response_body} ${ignore_core_context_version}=False + ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/expectations/${expectation_filename} + ${entity}= Update Value To JSON ${entity_payload} $..id ${entity_id} + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${entity} + ... ${response_body} + ... ${instance_id_regex_expr} + ... ${ignore_core_context_version} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing List Containing Entity Elements + [Arguments] + ... ${expectation_filename} + ... ${entities_ids} + ... ${response_body} + ... ${ignore_core_context_version}=False + FOR ${entity_id} IN @{entities_ids} + ${entity}= Get Value From JSON ${response_body} $[?(@.id=='${entity_id}')] + Check Response Body Containing Entity element + ... ${expectation_filename} + ... ${entity_id} + ... ${entity}[0] + ... ${ignore_core_context_version} + END + +Check Response Body Containing List Containing Entity Elements With Different Types + [Arguments] + ... ${filename} + ... ${entities_representation_ids} + ... ${response_body} + ... ${ignore_core_context_version}=False + ${entities_representation_payload}= Load JSON From File ${EXECDIR}/data/entities/expectations/${filename} + ${index}= Set Variable 0 + FOR ${entity_representation_id} IN @{entities_representation_ids} + ${entities_representation_payload}= Update Value To JSON + ... ${entities_representation_payload} + ... $.[${index}]..id + ... ${entity_representation_id} + ${index}= Evaluate ${index} + 1 + END + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${entities_representation_payload} + ... ${response_body} + ... ${instance_id_regex_expr} + ... ${ignore_core_context_version} + ... group_by=id + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing EntityTemporal element + [Arguments] ${filename} ${temporal_entity_representation_id} ${response_body} + ${temporal_entity_representation_payload}= Load JSON From File + ... ${EXECDIR}/data/temporalEntities/expectations/${filename} + ${temporal_entity_representation}= Update Value To JSON + ... ${temporal_entity_representation_payload} + ... $..id + ... ${temporal_entity_representation_id} + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${temporal_entity_representation} + ... ${response_body} + ... ${instance_id_regex_expr} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing List Containing EntityTemporal elements + [Arguments] ${filename} ${temporal_entities_representation_ids} ${response_body} + ${temporal_entities_representation_payload}= Load JSON From File + ... ${EXECDIR}/data/temporalEntities/expectations/${filename} + ${index}= Set Variable 0 + FOR ${temporal_entity_representation_id} IN @{temporal_entities_representation_ids} + ${temporal_entities_representation_payload}= Update Value To JSON + ... ${temporal_entities_representation_payload} + ... $.[${index}]..id + ... ${temporal_entity_representation_id} + ${index}= Evaluate ${index} + 1 + END + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${temporal_entities_representation_payload} + ... ${response_body} + ... ${instance_id_regex_expr} + ... group_by=id + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing Subscription element + [Arguments] ${expectation_filename} ${subscription_id} ${response_body} + ${subscription_payload}= Load JSON From File ${EXECDIR}/data/${expectation_filename} + ${subscription}= Update Value To JSON ${subscription_payload} $..id ${subscription_id} + ${ignored_keys}= Create List ${context_regex_expr} + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${subscription} + ... ${response_body} + ... ${ignored_keys} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing List Containing Subscription elements + [Arguments] ${expectation_file_path} ${subscription_ids} ${response_body} + ${subscription_payload}= Load JSON From File ${EXECDIR}/data/${expectation_file_path} + ${index}= Set Variable 0 + FOR ${subscription_id} IN @{subscription_ids} + ${subscription_payload}= Update Value To JSON + ... ${subscription_payload} + ... $.[${index}]..id + ... ${subscription_id} + ${index}= Evaluate ${index} + 1 + END + ${ignored_keys}= Create List ${context_regex_expr} + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${subscription_payload} + ... ${response_body} + ... ${ignored_keys} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +# Since response body can be a json object if it contains one element +# A check on the response body type is needed + +Check Response Body Containing Number Of Entities + [Arguments] ${expected_entity_type} ${expected_length} ${response_body} + + ${response_body_length}= Get Length ${response_body} + ${is_list}= Run Keyword Evaluate type(${response_body})==list + + IF ${is_list} + Should Be Equal ${response_body_length} ${expected_length} + ELSE + Should Be Equal ${1} ${expected_length} + END + + FOR ${index} IN RANGE ${expected_length} + IF ${is_list} + Should Be Equal ${response_body[${index}]['type']} ${expected_entity_type} + END + END + IF ${is_list} is ${FALSE} + Should Be Equal ${response_body['type']} ${expected_entity_type} + END + +Check Response Body Containing Context Source Registration element + [Arguments] ${expectation_filename} ${context_source_registration_id} ${response_body} + ${context_source_registration_payload}= Load JSON From File ${EXECDIR}/data/${expectation_filename} + ${context_source_registration}= Update Value To JSON + ... ${context_source_registration_payload} + ... $.id + ... ${context_source_registration_id} + ${ignored_keys}= Create List ${context_regex_expr} + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${context_source_registration} + ... ${response_body} + ... ${ignored_keys} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing EntityTypeList element + [Arguments] ${expectation_filename} ${response_body} + ${entity_type_list_payload}= Load JSON From File ${EXECDIR}/data/${expectation_filename} + ${ignored_keys}= Create List ${id_regex_expr} + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${entity_type_list_payload} + ... ${response_body} + ... ${ignored_keys} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing EntityType element + [Arguments] ${expectation_filename} ${response_body} + ${entity_type_payload}= Load JSON From File ${EXECDIR}/data/${expectation_filename} + ${ignored_keys}= Create List + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${entity_type_payload} + ... ${response_body} + ... ${ignored_keys} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing EntityTypeInfo element + [Arguments] ${expectation_filename} ${response_body} + ${entity_type_info_payload}= Load JSON From File ${EXECDIR}/data/${expectation_filename} + ${ignored_keys}= Create List + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${entity_type_info_payload} + ... ${response_body} + ... ${ignored_keys} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing AttributeList element + [Arguments] ${expectation_filename} ${response_body} + ${attribute_list_payload}= Load JSON From File ${EXECDIR}/data/${expectation_filename} + ${ignored_keys}= Create List ${id_regex_expr} + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${attribute_list_payload} + ... ${response_body} + ... ${ignored_keys} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing Attribute element + [Arguments] ${expectation_filename} ${response_body} + ${attribute_payload}= Load JSON From File ${EXECDIR}/data/${expectation_filename} + ${ignored_keys}= Create List + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${attribute_payload} + ... ${response_body} + ... ${ignored_keys} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Containing List Containing Context Source Registrations elements + [Arguments] ${expectation_file_path} ${expected_context_source_registrations_ids} ${response_body} + ${expected_context_source_registrations_payload}= Load JSON From File + ... ${EXECDIR}/data/${expectation_file_path} + ${index}= Set Variable 0 + FOR ${expected_context_source_registration_id} IN @{expected_context_source_registrations_ids} + ${expected_context_source_registrations_payload}= Update Value To JSON + ... ${expected_context_source_registrations_payload} + ... $.[${index}].id + ... ${expected_context_source_registration_id} + ${index}= Evaluate ${index} + 1 + END + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${expected_context_source_registrations_payload} + ... ${response_body} + ... ${EMPTY} + ... group_by=id + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Response Body Type When Using Session Request + [Arguments] ${response_body} ${type} + Should Be Equal ${response_body['type']} ${type} + +Check Response Body Containing ProblemDetails Element Containing Type Element set to + [Arguments] ${response_body} ${type} + Should Be Equal ${response_body['type']} ${type} + +Check Response Body Title When Using Session Request + [Arguments] ${response_body} + Should Not Be Empty ${response_body['title']} + +Check Response Body Containing ProblemDetails Element Containing Title Element + [Arguments] ${response_body} + Should Not Be Empty ${response_body['title']} + +Check Response Body Containing ProblemDetails Element + [Arguments] ${response_body} ${problem_type} + Should Not Be Empty ${response_body['title']} + Should Not Be Empty ${response_body['detail']} + Should Be String ${response_body['title']} + Should Be String ${response_body['detail']} + Should Not Be Equal ${response_body['title']} ${response_body['detail']} + Should Be Equal ${response_body['type']} ${problem_type} + +Check Response Does Not Contain Body + [Arguments] ${response} + Should Not Contain ${response} body + +Check Response Reason set to + [Arguments] ${response_reason} ${reason} + Should Be Equal ${response_reason} ${reason} + +Check RL Response Body Containing ProblemDetails Element Containing Type Element set to + [Arguments] ${response_body} ${type} + ${json_response_body}= Set Variable ${response_body} + + Should Be Equal ${json_response_body['type']} ${type} + +Check RL Response Body Containing ProblemDetails Element Containing Title Element + [Arguments] ${response_body} + ${json_response_body}= Set Variable ${response_body} + Should Not Be Empty ${json_response_body['title']} + +Check JSON Value In Response Body + [Arguments] ${json_path_expr} ${value_to_check} ${response_body} + Should Be Equal As Strings ${response_body${json_path_expr}} ${value_to_check} + +Check JSON Value Not In Response Body + [Arguments] ${json_path_expr} ${response_body} + Should Not Have Value In Json ${response_body} ${json_path_expr} + +Check NotificationParams + [Arguments] ${filename} ${expected_additional_members} ${response_body} + + ${expected_notification}= Load JSON From File ${EXECDIR}/data/${filename} + ${ignored_keys}= Create List ${notification_timestamps_regex_expr} ${notification_endpoint_uri_regex_expr} + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${expected_notification} + ... ${response_body['notification']} + ... ${ignored_keys} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + + FOR ${expected_additional_member} IN @{expected_additional_members} + Should Not Be Empty ${response_body['notification']['${expected_additional_member}']} + END + +Check Pagination Prev And Next Headers + [Arguments] ${prev_link} ${next_link} ${response_headers} + ${expected_links}= Create List ${prev_link} ${next_link} + IF '${prev_link}'!='' and '${next_link}'!='' + Lists Should Be Equal + ... ${response_headers['Link'].replace(" ", "").split(',')} + ... ${expected_links} + ... ignore_order=True + END + IF '${prev_link}'!='' and '${next_link}'=='' + Should Be Equal ${response_headers['Link']} ${prev_link} + END + IF '${prev_link}'=='' and '${next_link}'!='' + Should Be Equal ${response_headers['Link']} ${next_link} + END + +Check Resource Set To + [Arguments] ${expected_resource} ${response_body} ${ignored_keys}=${None} ${group_by}=${None} + + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${expected_resource} + ... ${response_body} + ... ${ignored_keys} + ... group_by=${group_by} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + +Check Created Resource Set To + [Arguments] ${created_resource} ${response_body} ${ignored_keys}=${None} + + Check Resource Set To ${created_resource} ${response_body} ${ignored_keys} + +Check Created Resources Set To + [Arguments] ${expected_resources} ${response_body} ${ignored_keys}=${None} + + Check Resource Set To ${expected_resources} ${response_body} ${ignored_keys} group_by=id + +Check Updated Resource Set To + [Arguments] ${updated_resource} ${response_body} ${ignored_keys}=${None} + + Check Resource Set To ${updated_resource} ${response_body} ${ignored_keys} + +Check Updated Resources Set To + [Arguments] ${updated_resources} ${response_body} ${ignored_keys}=${None} + + Check Resource Set To ${updated_resources} ${response_body} ${ignored_keys} group_by=id + +Check SUT Not Containing Resource + [Arguments] ${response_status} + ${response_status_string}= convert to string ${response_status} + Should Be Equal ${response_status_string} 404 + +Check SUT Not Containing Resources + [Arguments] ${response_body} + Should Be Empty ${response_body} + +Check Retrieving Context Source Registration + [Arguments] ${registration_id} ${context} ${accept} ${registration_payload} + ${response}= Retrieve Context Source Registration + ... context_source_registration_id=${registration_id} + ... context=${context} + ... accept=${accept} + ${ignored_attributes}= Create List ${status_regex_expr} @context + Check Updated Resource Set To ${registration_payload} ${response.json()} ${ignored_attributes} + +Check Dictionary Might Contain Additional Members of the NotificationParams + # Check the Additional Members 5.2.14.2 in the NotificationParams data structure + [Arguments] ${dictionary} ${key} + Log Dictionary Might Contain Key with a specific type + Log Dictionary: ${dictionary} + Log Key: ${key} + + ${value}= Evaluate $dictionary.get($key) + + IF '${value}' != '' and '${value}' != 'None' + IF "${key}" == "lastNotification" or "${key}" == "lastFailure" or "${key}" == "lastSuccess" or "${key}" == "expiresAt" + # Need to check that there is a DateTime value + ${type date}= Parse Ngsild Date ${dictionary}[${key}] + Should Not Be Equal + ... ${type date} + ... ${None} + ... The Additional Member ${key} contains a value (${value}) that it is not in DateTime format + END + IF "${key}" == "timesSent" or "${key}" == "throttling" or "${key}" == "timeInterval" + # Need to check that there is a Integer value + ${type int}= Evaluate type(${dictionary}[${key}]).__name__ + Should Be Equal + ... ${type int} + ... int + ... The Additonal Member ${key} contains a value (${value}) that it is not in Number format + END + IF "${key}" == "isActive" + # Need to check that there is a Boolean balue + ${type bool}= Evaluate type(${dictionary}[${key}]).__name__ + Should Be Equal + ... ${type bool} + ... bool + ... The Additonal Member ${key} contains a value (${value}) that it is not in Boolean format + END + IF "${key}" == "subscriptionName" or "${key}" == "description" or "${key}" == "q" or "${key}" == "csf" or "${key}" == "status" + # Need to check that there is a Boolean balue + ${type string}= Evaluate type(${dictionary}[${key}]).__name__ + Should Be Equal + ... ${type string} + ... str + ... The Additonal Member ${key} contains a value (${value}) that it is not in String format + END + ELSE + Log The key '${key}' is not present in the dictionary + END + +Check Response Body Contains DateTime Value + [Arguments] ${dictionary} ${key} ${expected value} + Dictionary Should Contain Key ${dictionary} ${key} + + ${obtained value}= Evaluate $dictionary.get($key) + ${date}= Parse Ngsild Date ${dictionary}[${key}] + + Should Not Be Equal + ... ${date} + ... ${None} + ... The key (${key}) contains a value (${obtained value}) that it is not in DateTime format + + Should Be Equal + ... ${expected value} + ... ${obtained value} + ... The expected value (${expected value}) is not the same as the obtained value (${obtained value}) diff --git a/resources/HttpUtils.resource b/resources/HttpUtils.resource new file mode 100755 index 0000000000000000000000000000000000000000..b150ea68af153b75592964f19df796e90991851c --- /dev/null +++ b/resources/HttpUtils.resource @@ -0,0 +1,11 @@ +*** Settings *** +Variables ./variables.py +Library Collections + + +*** Keywords *** +Fetch Id From Response Location Header + [Arguments] ${response_headers} + Dictionary Should Contain Key ${response_headers} Location msg=HTTP Headers do not contain key 'Location' + ${id}= Get From Dictionary ${response_headers} Location + RETURN ${id} diff --git a/resources/JsonUtils.resource b/resources/JsonUtils.resource new file mode 100644 index 0000000000000000000000000000000000000000..3e3d80148255ccc2920847ca7ca5f4b5a7cae86c --- /dev/null +++ b/resources/JsonUtils.resource @@ -0,0 +1,90 @@ +*** Settings *** +Library String +Library DateTime +Library JSONLibrary +Variables ${EXECDIR}/resources/variables.py + + +*** Variables *** +${date_format}= %Y-%m-%dT%H:%M:%SZ +${notification_server_url}= http://${notification_server_host}:${notification_server_port}/notify +${context_source_url}= http://${context_source_host}:${context_source_port} + + +*** Keywords *** +Load Entity + [Arguments] ${entity_file_name} ${entity_id} + + ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${entity_file_name} + ${entity}= Update Value To JSON ${entity_payload} $.id ${entity_id} + RETURN ${entity} + +Load Test Sample + [Arguments] ${test_sample_file_path} ${test_sample_id}=${EMPTY} + + ${test_sample_payload}= Load JSON From File ${EXECDIR}/data/${test_sample_file_path} + ${test_sample}= Update Value To JSON ${test_sample_payload} $.id ${test_sample_id} + + IF '${test_sample_id}'=='' + Delete Object From JSON ${test_sample} $.id + END + RETURN ${test_sample} + +Load Subscription Sample With Reachable Endpoint + [Arguments] + ... ${subscription_file_path} + ... ${subscription_id}=${EMPTY} + ... ${notification_endpoint_uri}=${notification_server_url} + + ${subscription_payload}= Load Test Sample ${subscription_file_path} ${subscription_id} + ${subscription}= Update Value To JSON + ... ${subscription_payload} + ... $..notification['endpoint']['uri'] + ... ${notification_endpoint_uri} + RETURN ${subscription} + +Set Entity Id In Subscription + [Arguments] ${subscription_payload} ${entity_id} + ${dict}= Create Dictionary id=${entity_id} + ${subscription}= Add Object To JSON ${subscription_payload} $..entities[0] ${dict} + RETURN ${subscription} + +Load Context Source Registration Sample With Reachable Context Source + [Arguments] + ... ${context_source_registration_file_path} + ... ${context_source_registration_id}=${EMPTY} + ... ${context_source_endpoint_uri}=${context_source_url} + + ${context_source_registration_payload}= Load Test Sample + ... ${context_source_registration_file_path} + ... ${context_source_registration_id} + ${context_source_registration}= Update Value To JSON + ... ${context_source_registration_payload} + ... $..endpoint + ... ${context_source_endpoint_uri} + RETURN ${context_source_registration} + +Remove Entity Type + [Arguments] ${entity} + + ${invalid_entity}= Delete Object From JSON ${entity} $..type + RETURN ${invalid_entity} + +Generate Random Entity Id + [Arguments] ${id_prefix} + + ${random_id}= Generate Random String 16 [NUMBERS] + ${entity_id}= Catenate ${id_prefix}${random_id} + RETURN ${entity_id} + +Create Batch Operation Result + [Arguments] ${success} ${errors} + + &{batch_operation_result}= Create Dictionary success=${success} errors=${errors} + RETURN &{batch_operation_result} + +Upsert Element In Entity + [Arguments] ${initial_entity} ${fragment} ${jsonPath}=$ + + ${updated_entity}= Add Object To JSON ${initial_entity} ${jsonPath} ${fragment} + RETURN ${updated_entity} diff --git a/resources/MockServerUtils.resource b/resources/MockServerUtils.resource new file mode 100644 index 0000000000000000000000000000000000000000..82ef9dc0b068a77e89e8b9f8cd8569753d2de7de --- /dev/null +++ b/resources/MockServerUtils.resource @@ -0,0 +1,24 @@ +*** Settings *** +Documentation Mock http server for subscriber + +Library HttpCtrl.Server +Variables ${EXECDIR}/resources/variables.py + + +*** Keywords *** +Start Context Source Mock Server + # Initialize HTTP Client And Server + Start Server ${context_source_host} ${context_source_port} + +Wait for redirected request + [Arguments] ${timeout}=${5} + # HTTP server receives it and checks incoming request for correctness + # .. "Wait For Request" + # .... This call is blocked until HTTP request arrives or timeout. + # .... Further detaills: https://annoviko.github.io/robotframework-httpctrl/server.html#Wait%20For%20Request + Wait For Request ${timeout} + Reply By 200 + +Stop Context Source Mock Server + # Terminate HTTP Server + Stop Server diff --git a/resources/NotificationUtils.resource b/resources/NotificationUtils.resource new file mode 100644 index 0000000000000000000000000000000000000000..38f546ad81e7ff7e30c5d638247b9494dbfd128b --- /dev/null +++ b/resources/NotificationUtils.resource @@ -0,0 +1,107 @@ +*** Settings *** +Documentation Check Notification Behaviour + +Library BuiltIn +Library Collections +Library HttpCtrl.Server +Library ${EXECDIR}/libraries/assertionUtils.py +Library ${EXECDIR}/libraries/dateTimeUtils.py +Variables ${EXECDIR}/resources/variables.py + + +*** Variables *** +${notification_type} ContextSource Notfication +${date_format} %Y-%m-%dT%H:%M:%SZ +${date_format_with_millis} %Y-%m-%dT%H:%M:%S.%fZ + + +*** Keywords *** +Start Local Server + [Arguments] ${host}=${notification_server_host} ${port}=${notification_server_port} + # Initialize HTTP Client And Server + Start Server ${host} ${port} + +Wait for notification + [Arguments] ${timeout}=${5} + # HTTP server receives it and checks incoming request for correctness + # .. "Wait For Request" + # .... This call is blocked until HTTP request arrives or timeout. + # .... Further detaills: https://annoviko.github.io/robotframework-httpctrl/server.html#Wait%20For%20Request + Wait For Request ${timeout} + Reply By 200 + + ${notification_payload}= Get Request Body + ${notification_headers}= Get Request Headers + ${notification}= Evaluate json.loads('''${notification_payload}''') json + ${headers}= Convert To Dictionary ${notification_headers} + Output Notification ${notification} ${notification_headers} Wait for notification + RETURN ${notification} ${headers} + +Wait for notification and validate it + [Arguments] + ... ${expected_subscription_id} + ... ${expected_context_source_registration_ids} + ... ${expected_trigger_reason} + ... ${expected_notification_data_entities}=${EMPTY} + ... ${timeout}=${5} + # HTTP server receives it and checks incoming request for correctness + # .. "Wait For Request" + # .... This call is blocked until HTTP request arrives or timeout. + # .... Further detaills: https://annoviko.github.io/robotframework-httpctrl/server.html#Wait%20For%20Request + Wait For Request ${timeout} + Reply By 200 + + ${notification_payload}= Get Request Body + ${notification_headers}= Get Request Headers + ${notification}= Evaluate json.loads('''${notification_payload}''') json + ${notification_data_length}= Get length ${notification}[data] + ${expected_notification_data_entities_length}= Get length ${expected_notification_data_entities} + ${expected_notification_data_length}= Get length ${expected_context_source_registration_ids} + + Output Notification ${notification} ${notification_headers} Wait for notification + Should Be Equal ${notification}[type] ${notification_type} + Should Be Equal ${notification}[subscriptionId] ${expected_subscription_id} + ${is_date}= Is Date ${notification}[notifiedAt] ${date_format} + Should Be True ${is_date} + ${index}= Set Variable 0 + FOR ${expected_context_source_registration_id} IN @{expected_context_source_registration_ids} + List Should Contain Value + ... ${expected_context_source_registration_ids} + ... ${notification}[data][${index}][@id] + ${index}= Evaluate ${index} + 1 + END + Should Be Equal '${notification_data_length}' '${expected_notification_data_length}' + Should Be Equal ${notification}[triggerReason] ${expected_trigger_reason} + + # TODO Currently we check entities information of the first CSR returned in the notification, find a way to check them all + IF ${expected_notification_data_entities_length}>0 + Check Notification Data Entities + ... ${notification}[data][0][information] + ... ${expected_notification_data_entities} + END + +Wait for no notification + [Arguments] ${timeout}=${5} + # HTTP server receives it and checks incoming request for correctness + # .. "Wait For Request" + # .... This call is blocked until HTTP request arrives or timeout. + # .... Further detaills: https://annoviko.github.io/robotframework-httpctrl/server.html#Wait%20For%20Request + Wait For No Request ${timeout} + +Check Notification Data Entities + [Arguments] ${notification_data_information} ${expected_notification_data_entities} + + ${notification_data_entities}= Create List + ${index}= Set Variable 0 + FOR ${registration_information} IN @{notification_data_information} + Append To List ${notification_data_entities} ${registration_information}[entities][0][type][0] + END + + Lists Should Be Equal + ... ${expected_notification_data_entities} + ... ${notification_data_entities} + ... ignore_order=True + +Stop Local Server + # Terminate HTTP Server + Stop Server diff --git a/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld b/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..7422524377fde3f1cd844c93e86f491b807f46d8 --- /dev/null +++ b/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld @@ -0,0 +1,6 @@ +{ + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + ] +} diff --git a/resources/jsonld-contexts/ngsi-ld-test-suite.jsonld b/resources/jsonld-contexts/ngsi-ld-test-suite.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..c4a5bfbf965ff0ce736385f2507822ca2ca6832b --- /dev/null +++ b/resources/jsonld-contexts/ngsi-ld-test-suite.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "Building": "https://ngsi-ld-test-suite/context#Building", + "Vehicle": "https://ngsi-ld-test-suite/context#Vehicle", + "OffStreetParking": "https://ngsi-ld-test-suite/context#OffStreetParking", + "airQualityLevel": "https://ngsi-ld-test-suite/context#airQualityLevel", + "almostFull": "https://ngsi-ld-test-suite/context#almostFull", + "brandName": "https://ngsi-ld-test-suite/context#brandName", + "fuelLevel": "https://ngsi-ld-test-suite/context#fuelLevel", + "name": "https://ngsi-ld-test-suite/context#name", + "source": "https://ngsi-ld-test-suite/context#source", + "speed": "https://ngsi-ld-test-suite/context#speed", + "subCategory": "https://ngsi-ld-test-suite/context#subCategory" + } +} + diff --git a/resources/variables.py b/resources/variables.py new file mode 100644 index 0000000000000000000000000000000000000000..1ecd8144e9b49d886a0ef95a826d6e5035a11299 --- /dev/null +++ b/resources/variables.py @@ -0,0 +1,12 @@ +url = 'http://localhost:8080/ngsi-ld/v1' +temporal_api_url = 'http://localhost:8080/ngsi-ld/v1' +ngsild_test_suite_context = 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' +notification_server_host = '0.0.0.0' +notification_server_port = 8085 +context_source_host = '0.0.0.0' +context_source_port = 8086 + +# GitHub repository details +# github_owner = 'your_github_username' +# github_broker_repo = 'context_broker_repository' +# github_token = 'your_github_token' diff --git a/scripts/apiutils.py b/scripts/apiutils.py new file mode 100644 index 0000000000000000000000000000000000000000..4e9b54571ad77bd74b2a329d946c8daf187f740a --- /dev/null +++ b/scripts/apiutils.py @@ -0,0 +1,122 @@ +from os.path import dirname, join, abspath +from os import walk +from pprint import PrettyPrinter + + +def get_list_files(root_dir: str) -> list: + # Recursively traverse the directory structure + my_list = list() + for root, dirs, files in walk(root_dir): + for file in files: + if file.endswith('.resource'): + my_list.append(join(root, file)) + + for new_folder in dirs: + new_folder = join(root_dir, new_folder) + _ = get_list_files(root_dir=new_folder) + + return my_list + + +def find_index(lst, item): + try: + index = lst.index(item) + return index + except ValueError: + return -1 + + +def generate_data_original_apiutils(data: list): + search_variables = '*** Variables ***\n' + search_keywords = '*** Keywords ***\n' + + index_variables = find_index(data, search_variables) + index_keywords = find_index(data, search_keywords) + + v = data[index_variables + 1:index_keywords] + k = data[index_keywords + 1:] + + v = list(filter(lambda x: x != '\n', v)) + k = list(filter(lambda x: not x.startswith(' '), k)) + k = list(filter(lambda x: x != '\n', k)) + + return v, k + + +def find_duplicates(lst: list): + duplicates = set() + unique_elements = set() + + for item in lst: + if item in unique_elements: + duplicates.add(item) + else: + unique_elements.add(item) + + return list(duplicates) + + +def read_resource_file(filename: str): + with open(filename) as f: + contents = f.readlines() + + variables, keywords = generate_data_original_apiutils(data=contents) + + variables = list(set(transform_spaces(lst=variables))) + + d_v = find_duplicates(variables) + d_k = find_duplicates(keywords) + + if len(d_v) != 0: + print(f'Duplicates: {d_v}') + + if len(d_k) != 0: + print(f'Duplicates: {d_k}') + + return variables, keywords + + +def transform_spaces(lst): + transformed_list = [] + for item in lst: + transformed_item = ' '.join(item.split()) + transformed_list.append(transformed_item) + return transformed_list + + +def read_new_resource_files(folder: str): + file_list = get_list_files(root_dir=folder) + + v = list() + k = list() + for file in file_list: + aux_v, aux_k = read_resource_file(filename=file) + v.append(aux_v) + k.append(aux_k) + + v = list(set([item for sublist in v for item in sublist])) + v = list(set(transform_spaces(lst=v))) + + k = list(set([item for sublist in k for item in sublist])) + + return v, k + + +if __name__ == '__main__': + # Get the folder of the ApiUtils.resources + base_folder = dirname(dirname(abspath(__file__))) + root_folder = base_folder + '/resources/ApiUtils' + + # Extract the variables and keywords from all new ApiUtils.resource + new_v, new_k = ( + read_new_resource_files(folder=root_folder)) + + # Show the information + pp = PrettyPrinter(indent=4) + + print('\n\n\nList of Variables: ') + pp.pprint(new_v) + print('\n\n\n') + print('List of Keywords: ') + pp.pprint(new_k) + print('\n\n\n') diff --git a/scripts/configure.ps1 b/scripts/configure.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..83128c9029294c3c6fc6e5f27630a7fea7f1f7b4 --- /dev/null +++ b/scripts/configure.ps1 @@ -0,0 +1,85 @@ +$choco_version = &{choco --version} 2>&1 +if ($choco_version -is [System.Management.Automation.ErrorRecord]) +{ + powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" + + $env:Path += ";$env:PROGRAMDATA\Chocolatey\bin" +} else { + echo "Chocolatey already installed" +} + +$git_version = &{git --version} 2>&1 +if ($git_version -is [System.Management.Automation.ErrorRecord]) +{ + choco install git -y + $env:Path += ";C:\Program Files\Git\cmd" +} else { + echo "git already installed" +} + +# - Install python if it doesn't exists - +# Define the version of Python to install +$pythonVersion = "3.11.4" + +$python_installed_version = &{python --version} 2>&1 +if ($python_installed_version -is [System.Management.Automation.ErrorRecord]) +{ + + # Define the download URL for the Python installer + $pythonInstallerUrl = "https://www.python.org/ftp/python/$pythonVersion/python-$pythonVersion-amd64.exe" + + # Define the path to download the Python installer + $installerPath = "$env:TEMP\python-$pythonVersion.exe" + + # Download the Python installer + Invoke-WebRequest -Uri $pythonInstallerUrl -OutFile $installerPath + + # Install Python silently with the necessary settings to add it to the PATH + echo "... installing python. This takes some time." + Start-Process -FilePath $installerPath -ArgumentList "/quiet", "InstallAllUsers=1", "PrependPath=1" -Wait + + # Remove the installer + Remove-Item $installerPath + #$env:Path += "C:\Python311\Scripts\;C:\Python311\" + $env:Path = "C:\Program Files\Python311\Scripts;C:\Program Files\Python311;$env:Path" +} else { + echo "python is already installed" +} + + +$python_installed_version = &{python --version} 2>&1 +if ($python_installed_version -is [System.Management.Automation.ErrorRecord]) { + sleep 60 + $python_installed_version = &{python --version} 2>&1 + if ($python_installed_version -is [System.Management.Automation.ErrorRecord]) { + echo "Restart powershell and run this script again. Python not detected" + exit 1 + } +} + +# Install virtualenv - +python -m pip install virtualenv + +$cloned = &{Test-path .\ngsi-ld-test-suite} + +echo "=======================" +echo $cloned +echo "=======================" + +if ( $cloned -eq $false ) { + echo "------------- doing git clone" + # Clone the repo - somehow. + git clone https://forge.etsi.org/rep/cim/ngsi-ld-test-suite.git >$null 2>&1 + cd ngsi-ld-test-suite >$null 2>&1 +} else { + cd ngsi-ld-test-suite + git pull + Remove-Item -force -recurse .\.venv +} + +# Create the virtualenv +virtualenv -ppython3 .venv >$null 2>&1 + +.\.venv\Scripts\activate.bat +pip install -r requirements.txt + diff --git a/scripts/configure.sh b/scripts/configure.sh new file mode 100644 index 0000000000000000000000000000000000000000..0064951876a3fe8ffd9147cf47fd1cf5a553d563 --- /dev/null +++ b/scripts/configure.sh @@ -0,0 +1,246 @@ +#!/bin/bash +# +# Command Line Interface to configure the ETSI NGSI-LD Test Suite (https://forge.etsi.org/rep/cim/ngsi-ld-test-suite) +# For this repository, the commands are merely a convenience script to install the needed services (Python3.11, +# Virtualenv, Pip, and Git. Additionally, the script clones the repository of the tests and create the proper Python +# Virtual Environment for the python project based on the requirements.txt file. +# +# The script will check the OS (MacOS or Ub Ubuntu Linux) and based on it execute the steps to configure the ETSI Test +# Suite. You can start up with the following command: +# +# ./configure.sh +# +# The final steps is the configuration of the ./ngsi-ld-test-suite/resources/variables.py +# (https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/blob/windows11/resources/variables.py) following the README.md +# content (https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/tree/windows11?ref_type=heads), activate the Virtual +# Environment and execute the Robot Tests. + + +# Function to check if a command is available +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + + +# Install Homebrew (macOS) +install_homebrew() { + echo " - Installing Homebrew..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + + if command_exists brew; then + echo " - Brew was installed successfully." + else + echo " - Failed to install Brew." + exit 1 + fi +} + + +# Function to prompt for yes/no confirmation +confirm() { + local prompt="${1:-Are you sure? [Y/n]} " + local default_value="${2:-Y}" + + read -r -p "$prompt" response + response=${response:-$default_value} + response=$(echo "$response" | tr '[:upper:]' '[:lower:]') + + if [[ $response == "y" || $response == "yes" ]]; then + return 1 + elif [[ $response == "n" || $response == "no" ]]; then + return 0 + else + echo "Invalid response. Please enter 'Y' or 'N'." + confirm "$prompt" "$default_value" + fi +} + +# Create the virtualenv .venv, activate, and install python requirements +configure_virtualenv() { + echo "Configuring Python Virtual Environment" + echo " - Cloning the ETSI repository in the current folder" + git clone https://forge.etsi.org/rep/cim/ngsi-ld-test-suite.git >/dev/null 2>/dev/null + + cd ngsi-ld-test-suite || { + echo "Failure, unable to change to the ngsi-ld-test-suite directory, maybe the git clone operation failed..."; + exit 1; + } + + echo " - Creating Python Virtual Environment" + + if [ -d "./.venv" ]; then + echo " - .venv directory already exists" + + # Prompt for confirmation + confirm " Do you want to delete and generate it again? [Y/n]? " "Y" + + # Check the return value + if [ $? -eq 1 ]; then + echo " Deleting previous .venv folder..." + rm -rf -y .venv >/dev/null 2>/dev/null + virtualenv -ppython3.11 .venv >/dev/null 2>/dev/null + else + echo " You declined. Aborting..." + fi + else + virtualenv -ppython3.11 .venv >/dev/null 2>/dev/null + fi + + # Activate the .venv + echo " - Activating .venv" + source .venv/bin/activate >/dev/null 2>/dev/null + + # Install the requirements + echo " - Installing the python requirements from the project" + pip3 install -r requirements.txt >/dev/null 2>/dev/null +} + + +# Configuration script for macOS +execute_macos() { + echo "macOS operating system, installing requirements..." + + # Check if Homebrew is already installed + if ! command_exists brew; then + install_homebrew + else + echo " - Homebrew is already installed." + fi + + # Check if git is already installed + if ! command_exists git; then + echo " - Installing git..." + brew install git --quiet >/dev/null 2>/dev/null + + # Check that git was successfully installed + if command_exists git; then + echo " - Git installed successfully" + else + echo " - Failed to install Git." + exit 1 + fi + else + echo " - Git is already installed." + fi + + # Check if Python 3.11 is already installed + if command_exists python3.11; then + echo " - Python 3.11 is already installed." + else + # Install Python 3.11 for macOS, it includes also the installation of pip3 + echo " - Installing Python 3.11 (with pip) and Virtualenv for macOS..." + brew install python@3.11 virtualenv --quiet >/dev/null 2>/dev/null + + # Check if Python 3.11 was installed successfully + if command_exists python3.11; then + echo " - Python 3.11 was installed successfully on macOS." + else + echo " - Failed to install Python 3.11 on macOS." + exit 1 + fi + + # Check if Pip was installed successfully + if command_exists pip3; then + echo " - Pip3 was installed successfully." + else + echo " - Failed to install Pip3." + exit 1 + fi + + # Check if Virtualenv was installed successfully + if command_exists virtualenv; then + echo " - Virtualenv was installed successfully." + else + echo " - Failed to install Virtualenv." + exit 1 + fi + fi + + echo + + # Create the virtualenv .venv, activate, and install python requirements + configure_virtualenv +} + +# Configuration script for Linux +execute_linux() { + echo "Linux operating system, installing requirements..." + + # Check if git is already installed + if ! command_exists git; then + echo " - Installing Git." + sudo apt-get install -y -qq git >/dev/null 2>/dev/null + + # Check that git was successfully installed + if command_exists git; then + echo " - Git installed successfully." + else + echo " - Failed to install Git." + exit 1 + fi + else + echo " - Git is already installed." + fi + + # Check if Python 3.11 is already installed + if command_exists python3.11; then + echo " - Python 3.11 is already installed." + else + # Install Python 3.11 for Ubuntu + echo " - Installing Python 3.11, Pip, and Virtualenv for Ubuntu..." + sudo add-apt-repository -y ppa:deadsnakes/ppa >/dev/null 2>/dev/null + sudo apt-get update -y -qq >/dev/null 2>/dev/null + sudo apt-get install -y -qq python3.11 python3-pip python3-virtualenv >/dev/null 2>/dev/null + + # Check if Python 3.11 was installed successfully + if command_exists python3.11; then + echo " - Python 3.11 was installed successfully." + else + echo " - Failed to install Python 3.11." + exit 1 + fi + + # Check if Pip was installed successfully + if command_exists pip3; then + echo " - Pip3 was installed successfully." + else + echo " - Failed to install Pip3." + exit 1 + fi + + # Check if Virtualenv was installed successfully + if command_exists virtualenv; then + echo " - Virtualenv was installed successfully." + else + echo " - Failed to install Virtualenv." + exit 1 + fi + + fi + + echo + + # Create the virtualenv .venv, activate, and install python requirements + configure_virtualenv +} + + + +# Determine the operating system +os=$(uname -s) + +# Execute the script based in the OS +if [[ $os == "Darwin" ]]; then + execute_macos + echo + echo "Ready to use..." +elif [[ $os == "Linux" ]]; then + execute_linux + echo + echo "Ready to use..." +else + echo "Unsupported operating system: $os" + exit 1 +fi + +exit 1 diff --git a/scripts/find_tc_using_test_data.py b/scripts/find_tc_using_test_data.py new file mode 100644 index 0000000000000000000000000000000000000000..56fecf5e2d6a5cdb80d1c90a65dee6e867587c09 --- /dev/null +++ b/scripts/find_tc_using_test_data.py @@ -0,0 +1,25 @@ +from os import listdir +from os.path import isdir, dirname, abspath, join +from robot import run + + +def find_test_data_in_tc(dir_name, filename, execute): + for file in listdir(dir_name): + path = dir_name + "/" + file + if isdir(path): + find_test_data_in_tc(path, filename, execute) + else: + if filename in open(path).read(): + if execute == "Y": + run(path) + print(path) + + +if __name__ == '__main__': + # Get the folder of the tests + base_folder = dirname(dirname(abspath(__file__))) + test_suite_folder = join(base_folder, "TP") + + test_data_file = input("Name of test data file to search for: ") + run_matching_tc = input("Run matching Test Cases (Y/N)?: ") + find_test_data_in_tc(dir_name=test_suite_folder, filename=test_data_file, execute=run_matching_tc) diff --git a/scripts/find_unused_test_data.py b/scripts/find_unused_test_data.py new file mode 100644 index 0000000000000000000000000000000000000000..2e00342a8c9c44c0734de021737b831f4bdfdff8 --- /dev/null +++ b/scripts/find_unused_test_data.py @@ -0,0 +1,42 @@ +from os import listdir +from os.path import isfile, isdir, dirname, abspath, join +from colorama import Fore, Style + + +def list_files_in_dir(test_suite_folder, data_folder): + for filename in listdir(data_folder): + aux = join(data_folder, filename) + if isfile(aux): + print(Style.RESET_ALL) + print("Looking at test data file: ", filename) + found = find_test_data_in_tc(dir_name=test_suite_folder, filename=filename) + if not found: + print(Fore.RED + " Usage not found") + + else: + list_files_in_dir(test_suite_folder=test_suite_folder, data_folder=aux) + + +def find_test_data_in_tc(dir_name, filename): + found = False + for file in listdir(dir_name): + path = join(dir_name, file) + if isdir(path): + aux = find_test_data_in_tc(path, filename) + found = aux or found + else: + if filename in open(path).read(): + found = True + print(Fore.GREEN + " Found usage of", filename, "in", path) + + return found + + +if __name__ == '__main__': + # Get the folder of the tests + base_folder = dirname(dirname(abspath(__file__))) + + test_suite_folder = join(base_folder, "TP") + data_folder = join(base_folder, 'data') + + list_files_in_dir(test_suite_folder=test_suite_folder, data_folder=data_folder) diff --git a/scripts/run_tests.ps1 b/scripts/run_tests.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..662e503987f4ce2a7160e98110c2ac7debde5e68 --- /dev/null +++ b/scripts/run_tests.ps1 @@ -0,0 +1,25 @@ +# run all tests +robot --outputdir .\results .\TP\NGSI-LD + +# run all tests with base url overriden +robot --variable url:"URL_HERE" --outputdir .\results . + +# run by specific tag(s) +robot --include mandatory --outputdir .\results . + +# run all the tests for context information +robot --outputdir .\results .\TP\NGSI-LD\ContextInformation + +# run a specific test case +robot --outputdir .\results .\TP\NGSI-LD\ContextInformation\Provision\Entities\CreateEntity\001_01.robot +robot --outputdir .\results --suite 001_01 . + +# run specific test case +robot --outputdir .\results -t "SuccessCases_MinimalEntity" +robot --outputdir .\results -t "SuccessCases_MinimalEntity" .\TP\NGSI-LD\ContextInformation\Provision\Entities\CreateEntity\SuccessCases.robot + +# rerun failed tests +robot --rerunfailedsuites .\results\output.xml --outputdir .\results . + +# stop the suite after a failed test +robot --exitonfailure --outputdir .\results . diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh new file mode 100755 index 0000000000000000000000000000000000000000..29040e13e3a05eb2626f05ccd2842d327a083897 --- /dev/null +++ b/scripts/run_tests.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# run all tests +robot --outputdir ./results ./TP/NGSI-LD + +# run all tests with base url overriden +robot --variable url:"URL_HERE" --outputdir ./results . + +# run by specific tag(s) +robot --include mandatory --outputdir ./results . + +# run all the test suites for context information +robot --outputdir ./results ./TP/NGSI-LD/ContextInformation + +# run a specific test suite +robot --outputdir ./results ./TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_01.robot +robot --outputdir ./results --suite 001_01 . + +# run specific test suite +robot --outputdir ./results -t "InvalidId" TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_01.robot + +# rerun failed test cases +robot --rerunfailedsuites ./results/output.xml --outputdir ./results . + +# stop the suite after a failed test +robot --exitonfailure --outputdir ./results . + +# run specific test suite and generate errors.log file with the output only of the failed test cases +robot --listener libraries/ErrorListener.py --outputdir ./results ./TP/NGSI-LD/CommonBehaviours/043.robot + +# run all test suites and generate errors.log file with the output only of the failed test cases +robot --listener libraries/ErrorListener.py --outputdir ./results . diff --git a/tsm b/tsm new file mode 100755 index 0000000000000000000000000000000000000000..475f55c789c7533fa7a43c8c3f1e60abc3ddaa4f --- /dev/null +++ b/tsm @@ -0,0 +1,600 @@ +#!/usr/bin/env python + +# Documentation +# https://kislyuk.github.io/argcomplete/ +# +# + +# +# Installation +# pip install argcomplete +# activate-global-python-argcomplete +# +# +# In global completion mode, you don’t have to register each argcomplete-capable executable separately. +# Instead, the shell will look for the string PYTHON_ARGCOMPLETE_OK in the first 1024 bytes of any +# executable that it’s running completion for, and if it’s found, follow the rest of the argcomplete +# protocol as described above. +# +# Additionally, completion is activated for scripts run as python