Commit f71bf777 authored by lopesg's avatar lopesg
Browse files

fixed merge conflicts

parents c58f5c7b c3c89b7b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ Launch the tests with the following command:

```$ robot --outputdir ./results .```   

For more running instructions please consult [scripts/run_tests.sh](https://github.com/easy-global-market/isg-cim-tpdl-demo/blob/rf-demo/scripts/run_tests.sh).
For more running instructions please consult [scripts/run_tests.sh](./scripts/run_tests.sh).

# Frameworks and libraries used in the project

+13 −9
Original line number Diff line number Diff line
@@ -8,20 +8,21 @@ Resource ${EXECDIR}/resources/JsonUtils.resource
${expected_status_code}=  503

${building_id_prefix}=  urn:ngsi-ld:Building:
${building_filename}=  building-minimal-without-context-sample.jsonld 
${building_filename}=  building-unretrievable-context-sample.jsonld 

${subscription_id_prefix}=  urn:ngsi-ld:Subscription:
${subscription_filename}=  csourceSubscriptions/subscription-without-context-sample.jsonld
${subscription_filename}=  subscriptions/subscription-unretrievable-context-sample.jsonld

${tea_id_prefix}=  urn:ngsi-ld:Vehicle:
${tea_filename}=  bus-temporal-representation-without-context-sample.jsonld
${tea_filename}=  bus-temporal-representation-unretrievable-context-sample.jsonld

${registration_id_prefix}=  urn:ngsi-ld:Registration:
${registration_filename}=  csourceRegistrations/context-source-registration-without-context-sample.jsonld   
${registration_filename}=  csourceRegistrations/context-source-registration-unretrievable-context-sample.jsonld   

*** Test Cases *** 
043_01 Create entity
    [Documentation]  Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved (Create entity)
    [Tags]  e-create    5_2_2

    ${entity_id}=  Generate Random Entity Id    ${building_id_prefix}    
    ${request}    ${response}=    Create Entity Selecting Content Type   ${building_filename}      ${entity_id}     ${CONTENT_TYPE_LD_JSON}
@@ -33,6 +34,7 @@ ${registration_filename}= csourceRegistrations/context-source-registration-with

043_02 Create subscription
    [Documentation]  Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved (Create subscription)
    [Tags]  sub-create    5_2_2

    ${subscription_id}=  Generate Random Entity Id    ${subscription_id_prefix}    
    ${response}=    Create Subscription    ${subscription_id}    ${subscription_filename}    ${CONTENT_TYPE_LD_JSON}
@@ -42,9 +44,9 @@ ${registration_filename}= csourceRegistrations/context-source-registration-with

    [Teardown]  Delete Subscription  ${subscription_id}


043_03 Create Temporal Representation of Entities
    [Documentation]  Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved (Create Temporal Representation of Entities)
    [Tags]  te-create    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}    ${tea_filename}     ${CONTENT_TYPE_LD_JSON}
@@ -56,6 +58,7 @@ ${registration_filename}= csourceRegistrations/context-source-registration-with

043_04 Batch entity create
    [Documentation]  Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved (Batch entity create)
    [Tags]  be-create    5_2_2

    ${first_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
@@ -72,13 +75,14 @@ ${registration_filename}= csourceRegistrations/context-source-registration-with

043_05 Create context source registration
    [Documentation]  Verify throwing 503 – LDContextNotAvaliable error if remote JSON-LD @context cannot be retrieved (Create context source registration)
    [Tags]  csr-create    5_2_2
    
    ${registration_id_prefix}=     Generate Random Entity Id    ${registration_id_prefix}
    ${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_prefix}
    ${updated_payload}=    Update Value To Json    ${payload}     $..id   ${registration_id}
    ${request}    ${response}=    Create Context Source Registration With Return  ${updated_payload}
    Check Response Status Code  ${expected_status_code}    ${response['status']}
    Check Response Headers Containing URI set to    ${request['path']}/    ${registration_id}    ${response}

    [Teardown]  Delete Context Source Registration    ${registration_id_prefix}
 No newline at end of file
    [Teardown]  Delete Context Source Registration    ${registration_id}
 No newline at end of file
+9 −9
Original line number Diff line number Diff line
@@ -7,34 +7,34 @@ Resource ${EXECDIR}/resources/JsonUtils.resource
*** Variable ***
${vehicle_id_prefix}=  urn:ngsi-ld:Vehicle:
${vehicle_filename}=  vehicle-simple-attributes-sample.jsonld
${vehicle_fragment}=  vehicle-brandname-fragment.jsonld
${vehicle_fragment}=  vehicle-brandname-fragment.json
${attribute_id}=  brandName

${subscription_id_prefix}=  urn:ngsi-ld:Subscription:
${subscription_filename}=  csourceSubscriptions/subscription-sample.jsonld
${subscription_fragment}=  csourceSubscriptions/fragments/subscription-update-sample.jsonld
${subscription_filename}=  subscriptions/subscription-sample.jsonld
${subscription_fragment}=  subscriptions/fragments/subscription-update-sample.json

*** 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]  mandatory
    [Tags]  ea-partial-update    6_3_4
    ${entity_id}=       Generate Random Entity Id    ${vehicle_id_prefix}    
    ${request}    ${response}=    Create Entity Selecting Content Type    ${vehicle_filename}    ${entity_id}    ${CONTENT_TYPE_LD_JSON}    
    Check Response Status Code  201    ${response['status']}

    ${response}=    Partial Update Entity Attributes    ${entity_id}    ${attribute_id}    ${vehicle_fragment}    ${CONTENT_TYPE_MERGE_PATCH_JSON}
    ${response}=    Partial Update Entity Attributes    ${entity_id}    ${attribute_id}    ${vehicle_fragment}    ${CONTENT_TYPE_MERGE_PATCH_JSON}    context=${ngsild_test_suite_context}
    Check Response Status Code  204    ${response['status']}

    [Teardown]  Delete Entity by Id  ${entity_id}

044_01_02_endpoint /subscriptions/{subscriptionId}       
    [Documentation]  Verify that PATCH HTTP requests can be done with "application/merge-patch+json" as Content-Type 
    [Tags]  mandatory
    [Tags]  sub-update    6_3_4
    ${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']}

    ${response}=    Update Subscription    ${subscription_id}     ${subscription_fragment}    ${CONTENT_TYPE_MERGE_PATCH_JSON}
    ${response}=    Update Subscription    ${subscription_id}     ${subscription_fragment}    ${CONTENT_TYPE_MERGE_PATCH_JSON}    context=${ngsild_test_suite_context}
    Check Response Status Code  204    ${response['status']}

    [Teardown]  Delete Subscription  ${subscription_id}
+22 −12
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ ${building_expectation}= building-simple-attributes-sample-expectation.json
${entity_type}=  https://ngsi-ld-test-suite/context#Building

${subscription_id_prefix}=  urn:ngsi-ld:Subscription:
${subscription_filename}=  csourceSubscriptions/subscription-sample.jsonld
${subscription_filename}=  subscriptions/subscription-sample.jsonld
${subscription_expectation}=  subscription-sample-expectation.json

${registration_id_prefix}=  urn:ngsi-ld:Registration:
@@ -21,40 +21,46 @@ ${registration_type}= Vehicle

${tea_id_prefix}=  urn:ngsi-ld:Vehicle:
${tea_filename}=  vehicle-temporal-representation-sample.jsonld
${tea_expectation}=  vehicle-temporal-representation-expectation.json
${tea_expectation}=  vehicles-temporal-representation-044-02-04-expectation.json
${teatype}=  Vehicle

${content_type}=  application/json

*** Test Cases ***
044_02_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    6_3_4
    ${id}=     Generate Random Entity Id    ${building_id_prefix}
    ${request}    ${response}=    Create Entity Selecting Content Type  ${building_filename}     ${id}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  201    ${response['status']}

    ${request}    ${response}=    Query Entity    ${id}
    ${request}    ${response}=    Query Entity    ${id}    context=${ngsild_test_suite_context}     accept=*/*
    Check Response Status Code  200    ${response['status']}
    Check Response Body Containing Entity element    ${building_expectation}    ${id}    ${response['body']}
    Check Request Containing Accept Header Set To  ${request}    application/json, */* 
    Check Response Headers Containing Content-Type set to  ${response}    ${content_type}
    Check Response Headers Link Not Empty  ${response}

    [Teardown]  Delete Entity by Id Returning Response   ${id}
  

044_02_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    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']}

    ${request}    ${response}=  Retrieve Subscription  ${id}
    ${request}    ${response}=  Retrieve Subscription  ${id}     accept=*/*
    Check Response Status Code  200    ${response['status']}
    Check Response Body Containing One Subscription element    ${subscription_expectation}    ${response['body']}
    Check Request Containing Accept Header Set To  ${request}    application/json, */* 
    Check Response Headers Containing Content-Type set to  ${response}    ${content_type}
    Check Response Headers Link Not Empty  ${response}

    [Teardown]  Delete Subscription  ${id}

044_02_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    6_3_4

    ${registration_id}=     Generate Random Entity Id    ${registration_id_prefix}
    ${payload}=    Load Json From File    ${EXECDIR}/data/${registration_filename}
@@ -62,23 +68,27 @@ ${teatype}= Vehicle
    ${request}    ${response}=    Create Context Source Registration With Return  ${updated_payload}
    Check Response Status Code  201    ${response['status']}

    ${request}    ${response}=  Query Context Source Registrations With Return      id=${registration_id}    type=${registration_type}
    ${request}    ${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']}
    Check Response Body Containing One Registration element  ${registration_expectation}    ${response['body']}
    Check Request Containing Accept Header Set To  ${request}    application/json, */* 
    Check Response Headers Containing Content-Type set to  ${response}    ${content_type}
    Check Response Headers Link Not Empty  ${response}

    [Teardown]  Delete Context Source Registration    ${registration_id}

044_02_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    6_3_4
    
    ${temporal_entity_representation_id}=     Generate Random Entity Id    ${tea_id_prefix}
    Create Temporal Representation Of Entity  ${tea_filename}     ${temporal_entity_representation_id}
    Check Response Status Code  201    ${response['status']}

    ${request}    ${response}=  Query Temporal Representation Of Entities With Return   entity_types=${teatype}    timerel=after    timeAt=2020-08-01T12:05:00Z
    ${request}    ${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']}
    Set Test Variable  ${response}
    Check Response Body Containing EntityTemporal element      ${tea_expectation}    ${temporal_entity_representation_id}
    Check Request Containing Accept Header Set To  ${request}    application/json, */* 
    Check Response Headers Containing Content-Type set to  ${response}    ${content_type}
    Check Response Headers Link Not Empty  ${response}

    [Teardown]  Delete Temporal Representation Of Entity    ${temporal_entity_representation_id}
 No newline at end of file
+16 −9
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource

*** Variable ***
${vehicle_id_prefix}=  urn:ngsi-ld:Vehicle:
${vehicle_filename}=  vehicle-simple-attributes-sample.json
${vehicle_filename}=  vehicle-simple-attributes-sample.jsonld
${vehicle_attribute}=  speed
${vehicle_fragment}=  vehicle-brandname-fragment.jsonld

@@ -20,52 +20,58 @@ ${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 ***
044_03_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    6_3_4

    ${entity_id}=     Generate Random Entity Id    ${vehicle_id_prefix}
    ${request}    ${response}=    Create Entity Selecting Content Type  ${vehicle_filename}     ${entity_id}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  201    ${response['status']}

    ${response}=    Partial Update Entity Attributes    ${entity_id}    ${vehicle_attribute}    ${vehicle_fragment}    ${EMPTY}
    ${response}=    Partial Update Entity Attributes    ${entity_id}    ${vehicle_attribute}    ${vehicle_fragment}    ${content_type}
    Check Response Status Code  415    ${response['status']}

    [Teardown]  Delete Entity by Id Returning Response   ${entity_id}

044_03_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    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']}

    ${response}=  Update Subscription  ${id}     ${subscription_fragment}    ${EMPTY}
    ${response}=  Update Subscription  ${id}     ${subscription_fragment}    ${content_type}
    Check Response Status Code  415    ${response['status']}

    [Teardown]  Delete Subscription  ${id}

044_03_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    6_3_4

    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${request}    ${response}=    Create Entity Selecting Content Type   ${building_filename}      ${entity_id}     ${EMPTY}
    ${request}    ${response}=    Create Entity Selecting Content Type   ${building_filename}      ${entity_id}     ${content_type}
    Check Response Status Code  415    ${response['status']}

    [Teardown]    Delete Entity by Id       ${entity_id}

044_03_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    6_3_4

    ${subscriptions_id}=     Generate Random Entity Id    ${subscription_id_prefix}
    ${response}=  Create Subscription  ${subscriptions_id}    ${subscription_filename}    ${EMPTY}
    ${response}=  Create Subscription  ${subscriptions_id}    ${subscription_filename}    ${content_type}
    Check Response Status Code  415    ${response['status']}

    [Teardown]  Delete Subscription  ${subscriptions_id}

044_03_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    6_3_4

    ${first_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${second_entity_id}=     Generate Random Entity Id    ${building_id_prefix}
@@ -73,7 +79,7 @@ ${building_filename}= building-simple-attributes-sample.jsonld
    ${second_entity}=    Load Entity    ${building_filename}      ${second_entity_id}
    @{entities_to_be_created}=  Create List   ${first_entity}     ${second_entity}

    Batch Create Entities   @{entities_to_be_created}    content_type=${EMPTY}
    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 Set To  415
@@ -82,9 +88,10 @@ ${building_filename}= building-simple-attributes-sample.jsonld

044_03_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    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}    ${tea_filename}     ${EMPTY}
    ${response}=  Create Or Update Temporal Representation Of Entity Selecting Content Type  ${temporal_entity_representation_id}    ${tea_filename}     ${content_type}
    Check Response Status Code  415    ${response['status']}

    [Teardown]    Delete Temporal Representation Of Entity    ${temporal_entity_representation_id}
 No newline at end of file
Loading