Commit 9c38c835 authored by kzangeli's avatar kzangeli
Browse files

Merge develop (0174828b) into integration/all-fixes

parents 0661fd99 0174828b
Loading
Loading
Loading
Loading
+75 −0
Changes for TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_34.robot: 75 added lines, 0 removed lines.
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can query entities based on the valueType of their attributes

Resource            ${EXECDIR}/resources/ApiUtils/Common.resource
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 Entities
Test Template       Query entities based on valueType


*** Test Cases ***    Q    EXPECTED_COUNT
019_34_01 QueryOnValueTypeExistence
    [Tags]    e-query    core_10_4_3    core_7_2_3    since_v1.9.1
    name.valueType    1
019_34_02 QueryOnValueTypeEqual
    [Documentation]    Check that one can query on a short-form valueType: as valueType is a vocabulary term (@vocab in the core @context), the Query Term value is expanded with the request @context (String to https://uri.etsi.org/ngsi-ld/default-context/String) before comparison
    [Tags]    e-query    core_10_4_3    core_7_2_3    since_v1.9.1
    name.valueType=="String"    1
019_34_03 QueryOnValueTypeEqualNotMatching
    [Tags]    e-query    core_10_4_3    core_7_2_3    since_v1.9.1
    name.valueType=="Number"    0
019_34_04 QueryOnValueTypeUnequal
    [Documentation]    Check that one can query with the unequal operator on valueType: the second entity has a name attribute without valueType and does not match, as a matching entity shall contain the target element (clause 7.2.3)
    [Tags]    e-query    core_10_4_3    core_7_2_3    since_v1.9.1
    name.valueType!="Number"    1
019_34_05 QueryOnLanguagePropertyValueType
    [Documentation]    Check that one can query on the short-form valueType of a LanguageProperty: the Query Term value is expanded with the request @context (langString to http://www.w3.org/1999/02/22-rdf-syntax-ns#langString) before comparison
    [Tags]    e-query    core_10_4_3    core_7_2_3    since_v1.9.1
    street.valueType=="langString"    1
019_34_06 QueryOnValueTypeEqualExpanded
    [Tags]    e-query    core_10_4_3    core_7_2_3    since_v1.9.1
    name.valueType==https://uri.etsi.org/ngsi-ld/default-context/String    1
019_34_07 QueryOnLanguagePropertyValueTypeEqualExpanded
    [Tags]    e-query    core_10_4_3    core_7_2_3    since_v1.9.1
    street.valueType==http://www.w3.org/1999/02/22-rdf-syntax-ns#langString    1


*** Keywords ***
Query entities based on valueType
    [Documentation]    Check that one can query entities based on the valueType of their attributes
    [Arguments]    ${q}    ${expected_count}

    ${response}=    Query Entities
    ...    entity_ids=${first_entity_id},${second_entity_id}
    ...    q=${q}
    ...    count=true
    ...    context=${ngsild_test_suite_context}

    Check Response Status Code    200    ${response.status_code}
    Check Response Headers Containing NGSILD-Results-Count Equals To    ${expected_count}    ${response.headers}

Setup Initial Entities
    ${first_entity_id}=    Generate Random Building Entity Id
    Set Suite Variable    ${first_entity_id}
    ${create_response1}=    Create Entity Selecting Content Type
    ...    building-value-type.jsonld
    ...    ${first_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${create_response1.status_code}

    ${second_entity_id}=    Generate Random Building Entity Id
    Set Suite Variable    ${second_entity_id}
    ${create_response2}=    Create Entity Selecting Content Type
    ...    building-simple-attributes.jsonld
    ...    ${second_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${create_response2.status_code}

Delete Entities
    Delete Entity    ${first_entity_id}
    Delete Entity    ${second_entity_id}