Commit 30672212 authored by kzangeli's avatar kzangeli
Browse files

fix(D011): forwarded queries use pick, the mock sources reply with their own @context

- The forward stubs expected attrs= for the forwarded projection. attrs is
  also an entity SELECTION (an entity with none of the attributes does not
  match), so a broker forwards the projection-only pick= instead
  (TS 104-175 clause 4.21); the stubs now expect pick.
- The mock Context Source replies carried no @context. A forwarded response
  is interpreted with the context that travels with it (TS 104-176 clause
  6.3.5), so 'speed' expanded with core only and was dropped on merge. The
  stub replies now load vehicle-simple-attributes-with-context.json,
  vehicle-simple-attributes-second-with-context.json (new, stub-reply only;
  the shared request fixtures are untouched) and vehicle-speed-attribute.json
  (now with the suite's compound @context; it is used only as a stub reply).
- Query Entities Via POST sent Content-Type application/ld+json with the
  @context in a Link header and none in the body (TS 104-176 clause 6.2.4).
  For ld+json the @context now goes in the body; plain json keeps the Link.
- D011_02_exc: the registration's operations per method - queryBatch for
  POST /entityOperations/query, queryEntity for GET /entities.

All 14 D011 TCs pass against a conformant broker (none passed before); no
other DistributedOperations TC changes.

Co-Authored-By: default avatarClaude Opus 5.5 <noreply@anthropic.com>
parent 43e16bd0
Loading
Loading
Loading
Loading
+1 −1
Changes for TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_01_inc.robot: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ D011_01_01_inc Query The Context Broker With Type
    [Documentation]    Check that if one queries the Context Broker for type, entity with matching type on a Context
    ...    Source gets returned
    [Tags]    since_v1.6.1    dist-ops    core_4_3_3    cf_04    additive-inclusive    core_9_3_2    core_10_4_3
    ${serialized_entity}=    Load Entity As Serialized Array    ${entity_payload_filename}    ${entity_id}
    ${serialized_entity}=    Load Entity As Serialized Array    vehicle-simple-attributes-with-context.json    ${entity_id}
    Set Stub Reply    GET    /ngsi-ld/v1/entities?type=Vehicle    200    ${serialized_entity}

    ${response}=    Query Entities    entity_types=Vehicle    context=${ngsild_test_suite_context}
+1 −1
Changes for TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_02_inc.robot: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ D011_01_02_inc Query The Context Broker With Type And Missing Attribute
    ...    Contrast with D011_01_04, where a local entity also exists but also lacks the queried attribute.
    [Tags]    since_v1.6.1    dist-ops    core_4_3_3    cf_04    additive-inclusive    core_9_3_2    core_10_4_3
    ${empty_response}=    Create Empty Array Result
    Set Stub Reply    GET    /ngsi-ld/v1/entities?attrs=speed&type=Vehicle    200    ${empty_response}
    Set Stub Reply    GET    /ngsi-ld/v1/entities?pick=speed&type=Vehicle    200    ${empty_response}

    ${response}=    Query Entities    entity_types=Vehicle    attrs=speed    context=${ngsild_test_suite_context}

+2 −2
Changes for TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_03_inc.robot: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@ D011_01_03_inc Query The Context Broker With Type And Attribute
    [Documentation]    Check that if one queries for attribute present in an entity on a Context Source, only that
    ...    entity gets returned
    [Tags]    since_v1.6.1    dist-ops    core_4_3_3    cf_04    additive-inclusive    core_9_3_2    core_10_4_3
    ${serialized_entity}=    Load Entity As Serialized Array    ${entity_payload_filename2}    ${second_entity_id}
    Set Stub Reply    GET    /ngsi-ld/v1/entities?attrs=isParked2&type=Vehicle    200    ${serialized_entity}
    ${serialized_entity}=    Load Entity As Serialized Array    vehicle-simple-attributes-second-with-context.json    ${second_entity_id}
    Set Stub Reply    GET    /ngsi-ld/v1/entities?pick=isParked2&type=Vehicle    200    ${serialized_entity}

    ${response}=    Query Entities    entity_types=Vehicle    attrs=isParked2    context=${ngsild_test_suite_context}

+1 −1
Changes for TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_04_inc.robot: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ D011_01_04_inc Query The Context Broker With Type And Attribute In Neither
    ...    returned. Contrast with D011_01_02, where no local entity exists at all.
    [Tags]    since_v1.6.1    dist-ops    core_4_3_3    cf_04    additive-inclusive    core_9_3_2    core_10_4_3
    ${empty_response}=    Create Empty Array Result
    Set Stub Reply    GET    /ngsi-ld/v1/entities?attrs=speed&type=Vehicle    200    ${empty_response}
    Set Stub Reply    GET    /ngsi-ld/v1/entities?pick=speed&type=Vehicle    200    ${empty_response}

    ${response}=    Query Entities    entity_types=Vehicle    attrs=speed    context=${ngsild_test_suite_context}

+1 −1
Changes for TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_05_inc.robot: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ D011_01_05_inc Query The Context Broker With Type
    [Documentation]    Check that entities on the Context Broker and Context Source with the same id get merged and
    ...    returned as one entity
    [Tags]    since_v1.6.1    dist-ops    core_4_3_3    cf_04    additive-inclusive    core_9_3_2    core_10_4_3
    ${serialized_entity}=    Load Entity As Serialized Array    ${entity_payload_filename}    ${entity_id}
    ${serialized_entity}=    Load Entity As Serialized Array    vehicle-simple-attributes-with-context.json    ${entity_id}
    Set Stub Reply    GET    /ngsi-ld/v1/entities?type=Vehicle    200    ${serialized_entity}

    ${response}=    Query Entities    entity_types=Vehicle    context=${ngsild_test_suite_context}
Loading