Commit c61785fb authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

Merge branch 'develop' into testsuitedata

# Conflicts:
#	TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot
#	TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_05.robot
#	TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_05.robot
parents acb092bf db89201e
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -15,27 +15,24 @@ ${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}=    building-minimal-expectation.json
${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
${geometry_property}=       location


*** 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
    @{entities_ids_to_be_compared}=    Create List    ${vehicle_entity_id}    ${parking_entity_id}
    ${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}
    ...    geometry_property=${geometry_property}
    ...    context=${ngsild_test_suite_context}
    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()}
    Check Response Body Content
    ...    expectation_filename=${expectation_filename}
    ...    response_body=${response.json()}


*** Keywords ***
+20 −29
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that the queried entities by id can be returned in a geoJSON format
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}=    building-simple-attributes-simplified-expectation.json
${expectation_filename}=    two-buildings-location-attribute-normalized.geojson
${entity_type}=             https://ngsi-ld-test-suite/context#Building
${accept_header}=           application/geo+json


*** Test Cases ***
019_05_01 Get an entity by id that can be returned in a geoJSON format
    [Documentation]    Check that the queried entities by id can be returned in a geoJSON format
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}
    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}
    @{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}
    ...    accept=${accept_header}
    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 Returning Response    ${first_entity_id}
    Delete Entity by Id Returning Response    ${second_entity_id}
    Delete Entity by Id Returning Response    ${third_entity_id}
+23 −16
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that the queried entity by id can be returned in a geoJSON format
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
${expectation_filename}=    building-simple-attributes-simplified-expectation.json
${options_parameter}=       keyValues
${accept_header}=           application/geo+json


*** Test Cases ***
018_05_01 Get an entity by id that can be returned in a geoJSON format
    [Documentation]    Check that the queried entity by id can be returned in a geoJSON format
*** 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
    [Tags]    e-retrieve    6_3_7
    [Arguments]    ${options}    ${expectation_filename}
    ${response}=    Query Entity
    ...    ${entity_id}
    ...    ${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}
    Check Response Status Code    201    ${response.status_code}
    ${response}=    Query Entity
    ...    id=${entity_id}
    ...    accept=${accept_header}
    ...    options=${options_parameter}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing Entity element    ${expectation_filename}    ${entity_id}    ${response.json()}


*** Keywords ***
Delete Created Entity
    Delete Entity by Id Returning Response    ${entity_id}
+29 −0
Original line number Diff line number Diff line
{
    "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"
        ]
    }
}
+20 −0
Original line number Diff line number Diff line
{
    "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"
        ]
    }
}
Loading