Commit 5608dd74 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

feat: add TCs with more complex geoqueries on Point and Polygon target geometries

parent 71322374
Loading
Loading
Loading
Loading
+97 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can query several entities based on complex geoqueries with Point target geometries

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 Entities
Test Template       Query several entities based on complex geoqueries


*** Variables ***
${building_id_prefix}=      urn:ngsi-ld:Building:


*** Test Cases ***    GEOREL    GEOMETRY    COORDINATES    EXPECTED_COUNT
019_10_01 QueryOnEqualsPoint
    [Documentation]    Check that one can query with an exact point
    [Tags]    e-query    5_7_2    4_10
    equals    Point    [13.3986, 52.5547]    1
019_10_02 QueryOnMaxDistancePoint
    [Documentation]    Check that one can query with a max distance
    [Tags]    e-query    5_7_2    4_10
    near;maxDistance==15000    Point    [13.388930, 52.534473]    2
019_10_03 QueryOnMinDistancePoint
    [Documentation]    Check that one can query with a min distance
    [Tags]    e-query    5_7_2    4_10
    near;minDistance==15000    Point    [13.388930, 52.534473]    1
019_10_04 QueryOnWithinPolygon
    [Documentation]    Check that one can query within a polygon
    [Tags]    e-query    5_7_2    4_10
    within    Polygon    [[[13.1616211,52.5438124],[13.597641,52.4840224],[13.5948944,52.3402782],[13.142395,52.386428],[13.1616211,52.5438124]]]    2
019_10_05 QueryOnDisjointPolygon
    [Documentation]    Check that one can query with a disjoint polygon
    [Tags]    e-query    5_7_2    4_10
    disjoint    Polygon    [[[13.1616211,52.5438124],[13.597641,52.4840224],[13.5948944,52.3402782],[13.142395,52.386428],[13.1616211,52.5438124]]]    1
019_10_06 QueryOnDisjointPoint
    [Documentation]    Check that one can query with a disjoint point
    [Tags]    e-query    5_7_2    4_10
    disjoint    Point    [13.3986, 52.5547]    2
019_10_07 QueryOnContainsPoint
    [Documentation]    Check that one can query with a contains point
    [Tags]    e-query    5_7_2    4_10
    contains    Point    [13.3986, 52.5547]    1
019_10_08 QueryOnIntersectsPoint
    [Documentation]    Check that one can query with an intersects point
    [Tags]    e-query    5_7_2    4_10
    intersects    Point    [13.3986, 52.5547]    1


*** Keywords ***
Query several entities based on complex geoqueries
    [Documentation]    Query with a complex geoquery and check the number of results
    [Arguments]    ${georel}    ${geometry}    ${coordinates}    ${expected_count}

    ${response}=    Query Entities
    ...    entity_types=Building
    ...    context=${ngsild_test_suite_context}
    ...    georel=${georel}
    ...    geometry=${geometry}
    ...    coordinates=${coordinates}
    ...    count=${true}

    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 Entity Id    ${building_id_prefix}
    Set Suite Variable    ${first_entity_id}
    ${create_response1}=    Create Entity Selecting Content Type
    ...    building-location-attribute.jsonld
    ...    ${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
    ...    building-location-attribute-second.jsonld
    ...    ${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
    ...    building-location-attribute-third.jsonld
    ...    ${third_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${create_response3.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}
+88 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can query several entities based on complex geoqueries with Polygon target geometries

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 Entities
Test Template       Query several entities based on complex geoqueries


*** Variables ***
${building_id_prefix}=      urn:ngsi-ld:Building:


*** Test Cases ***    GEOREL    GEOMETRY    COORDINATES    EXPECTED_COUNT
019_11_01 QueryOnEqualsPolygon
    [Documentation]    Check that one can query with an exact polygon
    [Tags]    e-query    5_7_2    4_10
    equals    Polygon    [[[13.2865906,52.5648645],[13.2879639,52.5648645],[13.2797241,52.4988679],[13.477478,52.4712703],[13.5049438,52.5373084],[13.2865906,52.5648645]]]    1
019_11_02 QueryOnIntersectsPolygon
    [Documentation]    Check that one can query with an intersects polygon
    [Tags]    e-query    5_7_2    4_10
    intersects    Polygon    [[[13.3456421,52.4794848],[13.3641815,52.4428773],[13.4177399,52.4730023],[13.3459854,52.479903],[13.3456421,52.4794848]]]    1
019_11_03 QueryOnContainsPolygonMatching
    [Documentation]    Check that one can query with a contains polygon
    [Tags]    e-query    5_7_2    4_10
    contains    Polygon    [[[13.3844376,52.5356966],[13.3844376,52.5356966],[13.381691,52.5123012],[13.4235764,52.5100027],[13.4331894,52.5273425],[13.3844376,52.5356966]]]    1
019_11_04 QueryOnContainsPolygonNotMatching
    [Documentation]    Check that one can query with a contains polygon without matching geometries
    [Tags]    e-query    5_7_2    4_10
    contains    Polygon    [[[13.1369019,52.5198225],[13.1365585,52.5200314],[13.131752,52.4980907],[13.1832504,52.5026887],[13.1369019,52.5198225]]]    0
019_11_05 QueryOnDisjointPolygon
    [Documentation]    Check that one can query with a disjoint polygon
    [Tags]    e-query    5_7_2    4_10
    disjoint    Polygon    [[[13.1369019,52.5198225],[13.1365585,52.5200314],[13.131752,52.4980907],[13.1832504,52.5026887],[13.1369019,52.5198225]]]    2
019_11_06 QueryOnWithinPolygon
    [Documentation]    Check that one can query with a within polygon
    [Tags]    e-query    5_7_2    4_10
    within    Polygon    [[[13.3023834,52.4903066],[13.3027267,52.4905156],[13.2745743,52.465632],[13.3343124,52.4185447],[13.4311295,52.47107],[13.3023834,52.4903066]]]    1
019_11_07 QueryOnOverlapsPolygon
    [Documentation]    Check that one can query with an overlaps polygon
    [Tags]    e-query    5_7_2    4_10
    overlaps    Polygon    [[[13.3456421,52.4794848],[13.3641815,52.4428773],[13.4177399,52.4730023],[13.3459854,52.479903],[13.3456421,52.4794848]]]    1
019_11_08 QueryOnContainsPoint
    [Documentation]    Check that one can query with a contains point
    [Tags]    e-query    5_7_2    4_10
    contains    Point    [13.3442688,52.4650045]    1


*** Keywords ***
Query several entities based on complex geoqueries
    [Documentation]    Query with a complex geoquery and check the number of results
    [Arguments]    ${georel}    ${geometry}    ${coordinates}    ${expected_count}

    ${response}=    Query Entities
    ...    entity_types=Building
    ...    context=${ngsild_test_suite_context}
    ...    georel=${georel}
    ...    geometry=${geometry}
    ...    coordinates=${coordinates}
    ...    count=${true}

    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 Entity Id    ${building_id_prefix}
    Set Suite Variable    ${first_entity_id}
    ${create_response1}=    Create Entity Selecting Content Type
    ...    building-location-polygon.jsonld
    ...    ${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
    ...    building-location-polygon-second.jsonld
    ...    ${second_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${create_response2.status_code}

Delete Entities
    Delete Entity by Id    ${first_entity_id}
    Delete Entity by Id    ${second_entity_id}
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ ${expectation_file}= vehicles-temporal-representation-021-09.json
    near;maxDistance==2000    Point    [-8.503,41.202]    ${EMPTY}    vehicles-temporal-representation-021-09-01.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.jsonld
    within    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.jsonld


*** Keywords ***
+18 −0
Original line number Diff line number Diff line
{
    "id": "urn:ngsi-ld:Building:randomUUID",
    "type": "Building",
    "name": {
        "type": "Property",
        "value": "Berlin Brandenburg International Airport"
    },
    "location": {
        "type": "GeoProperty",
        "value": {
            "type": "Point",
            "coordinates": [13.509818, 52.363457]
        }
    },
    "@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
+18 −0
Original line number Diff line number Diff line
{
    "id": "urn:ngsi-ld:Building:randomUUID",
    "type": "Building",
    "name": {
        "type": "Property",
        "value": "Grunewald"
    },
    "location": {
        "type": "GeoProperty",
        "value": {
            "type": "Point",
            "coordinates": [13.215983, 52.470441]
        }
    },
    "@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
Loading