Commit b53cf3c9 authored by Benedetta Arena's avatar Benedetta Arena
Browse files

refactor: centralize all operations for first IOP setup

parent db43d320
Loading
Loading
Loading
Loading
+36 −7
Original line number Diff line number Diff line
@@ -50,19 +50,48 @@ Setup Initial Context Source Registrations
    ${second_entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${second_entity_id}

    Initialize Three Broker IOP Scenario For Query
    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][full_1]
    ...    ${entity_id}
    ...    broker_url=${broker_B_url}
    Check Response Status Code    201    ${response.status_code}

    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][no_location_and_totalspotnumber_2]
    ...    ${second_entity_id}
    ...    broker_url=${broker_B_url}
    Check Response Status Code    201    ${response.status_code}

    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][full_2]
    ...    ${entity_id}
    ...    ${broker_A_url}
    ...    ${broker_B_url}
    ...    ${broker_C_url}
    ...    broker_url=${broker_C_url}
    Check Response Status Code    201    ${response.status_code}

Delete Entities And Delete Registrations
    Delete Three Broker IOP Scenario
    ${registration_id}=    Generate Random CSR Id
    Set Suite Variable    ${registration_id}
    ${registration_payload}=    Prepare Context Source Registration From File
    ...    ${registration_id}
    ...    ${IOP_REGISTRY_URL}[registration][inclusive_2]
    ...    entity_id=${second_entity_id}
    ...    mode=inclusive
    ...    broker_url=${broker_B_url}
    ${response}=    Create Context Source Registration With Return    ${registration_payload}    content_type=${CONTENT_TYPE_LD_JSON}    broker_url=${broker_A_url}
    Check Response Status Code    201    ${response.status_code}

    Initialize IOP CNF 01
    ...    ${broker_A_url}
    ...    ${entity_id}
    ...    inclusive
    ...    ${broker_B_url}
    ...    ${second_entity_id}
    ...    exclusive
    ...    ${broker_C_url}
    ...    ${entity_id}
 No newline at end of file

Delete Entities And Delete Registrations

    @{entities_to_delete}=    Create List    ${entity_id}    ${second_entity_id}
    @{broker_count}=    Create List    ${broker_A_url}    ${broker_B_url}    ${broker_C_url}
    Delete Registrations And Entities
    ...    ${entities_to_delete}
    ...    ${broker_count}
 No newline at end of file
+36 −7
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
Documentation       Three brokers are set up A, B and C. A has two registrations, one inclusive for the entities created in B and one exclusive for the entity created in C. 

Resource            ${EXECDIR}/resources/IOPUtils/InteroperabilityUtils.resource
Variables           ${EXECDIR}/resources/IOPUtils/IOPRegistry.py

Test Setup          Setup Initial Context Source Registrations
Test Teardown       Delete Entities and Delete Registrations
@@ -50,19 +51,47 @@ Setup Initial Context Source Registrations
    ${second_entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${second_entity_id}

    Initialize Three Broker IOP Scenario For Query
    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][full_1]
    ...    ${entity_id}
    ...    broker_url=${broker_B_url}
    Check Response Status Code    201    ${response.status_code}

    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][no_location_and_totalspotnumber_2]
    ...    ${second_entity_id}
    ...    broker_url=${broker_B_url}
    Check Response Status Code    201    ${response.status_code}

    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][full_2]
    ...    ${entity_id}
    ...    ${broker_A_url}
    ...    ${broker_B_url}
    ...    ${broker_C_url}
    ...    broker_url=${broker_C_url}
    Check Response Status Code    201    ${response.status_code}

Delete Entities And Delete Registrations
    Delete Three Broker IOP Scenario
    ${registration_id}=    Generate Random CSR Id
    Set Suite Variable    ${registration_id}
    ${registration_payload}=    Prepare Context Source Registration From File
    ...    ${registration_id}
    ...    ${IOP_REGISTRY_URL}[registration][inclusive_2]
    ...    entity_id=${second_entity_id}
    ...    mode=inclusive
    ...    broker_url=${broker_B_url}
    ${response}=    Create Context Source Registration With Return    ${registration_payload}    content_type=${CONTENT_TYPE_LD_JSON}    broker_url=${broker_A_url}
    Check Response Status Code    201    ${response.status_code}

    Initialize IOP CNF 01
    ...    ${broker_A_url}
    ...    ${entity_id}
    ...    inclusive
    ...    ${broker_B_url}
    ...    ${second_entity_id}
    ...    exclusive
    ...    ${broker_C_url}
    ...    ${entity_id}
 No newline at end of file

Delete Entities And Delete Registrations
    @{entities_to_delete}=    Create List    ${entity_id}    ${second_entity_id}
    @{broker_count}=    Create List    ${broker_A_url}    ${broker_B_url}    ${broker_C_url}
    Delete Registrations And Entities
    ...    ${entities_to_delete}
    ...    ${broker_count}
 No newline at end of file
+20 −8
Original line number Diff line number Diff line
@@ -41,24 +41,36 @@ Setup Initial Context Source Registrations
    ${entity_id2}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id2}

    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][full_1]
    ...    ${entity_id1}
    ...    broker_url=${broker_B_url}
    Check Response Status Code    201    ${response.status_code}

    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][full_2]
    ...    ${entity_id2}
    ...    broker_url=${broker_B_url}
    Check Response Status Code    201    ${response.status_code}

    Initialize Three Broker IOP Scenario For Retrieve
    ...    ${entity_id1}
    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][full_2]
    ...    ${entity_id2}
    ...    ${broker_A_url}
    ...    ${broker_B_url}
    ...    ${broker_C_url}
    ...    broker_url=${broker_C_url}
    Check Response Status Code    201    ${response.status_code}

Delete Entities And Delete Registrations
    Delete Three Broker IOP Scenario
    Initialize IOP CNF 01
    ...    ${broker_A_url}
    ...    ${entity_id1}
    ...    inclusive
    ...    ${broker_B_url}
    ...    ${entity_id2}
    ...    exclusive
    ...    ${broker_C_url}
    ...    ${entity_id2}
 No newline at end of file

Delete Entities And Delete Registrations
    @{entities_to_delete}=    Create List    ${entity_id1}    ${entity_id2}
    @{broker_count}=    Create List    ${broker_A_url}    ${broker_B_url}    ${broker_C_url}
    Delete Registrations And Entities
    ...    ${entities_to_delete}
    ...    ${broker_count}
 No newline at end of file
+21 −7
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
Documentation       Three brokers are set up A, B and C. A has two registrations, one inclusive for the the entity created in B and one exclusive for the entity created in C.

Resource            ${EXECDIR}/resources/IOPUtils/InteroperabilityUtils.resource
Variables           ${EXECDIR}/resources/IOPUtils/IOPRegistry.py

Test Setup          Setup Initial Context Source Registrations
Test Teardown       Delete Entities and Delete Registrations
@@ -40,17 +41,30 @@ Setup Initial Context Source Registrations
    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}

    Initialize Three Broker IOP Scenario For Retrieve
    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][no_location_2]
    ...    ${entity_id}
    ...    broker_url=${broker_B_url}
    Check Response Status Code    201    ${response.status_code}

    ${response}=    Create Entity
    ...    ${IOP_REGISTRY_URL}[parking][full_2]
    ...    ${entity_id}
    ...    ${broker_A_url}
    ...    ${broker_B_url}
    ...    ${broker_C_url}
    ...    broker_url=${broker_C_url}
    Check Response Status Code    201    ${response.status_code}

Delete Entities And Delete Registrations
    Delete Three Broker IOP Scenario
    Initialize IOP CNF 01
    ...    ${broker_A_url}
    ...    ${entity_id}
    ...    inclusive
    ...    ${broker_B_url}
    ...    ${entity_id}
    ...    exclusive
    ...    ${broker_C_url}

Delete Entities And Delete Registrations
    @{entities_to_delete}=    Create List    ${entity_id}
    @{broker_count}=    Create List    ${broker_A_url}    ${broker_B_url}    ${broker_C_url}
    Delete Registrations And Entities
    ...    ${entities_to_delete}
    ...    ${broker_count}
 No newline at end of file
+10 −5
Original line number Diff line number Diff line
@@ -46,13 +46,18 @@ Setup Initial Context Source Registrations
    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}

    Initialize Three Broker IOP Scenario For Create
    ...    ${entity_id}
    Initialize IOP CNF 01
    ...    ${broker_A_url}
    ...    ${entity_id}
    ...    inclusive
    ...    ${broker_B_url}
    ...    ${entity_id}
    ...    exclusive
    ...    ${broker_C_url}

Delete Entities And Delete Registrations
    Delete Three Broker IOP Scenario
    ...    ${broker_A_url}
    ...    ${entity_id}
 No newline at end of file
    @{entities_to_delete}=    Create List    ${entity_id}
    @{broker_count}=    Create List    ${broker_A_url}    ${broker_B_url}    ${broker_C_url}
    Delete Registrations And Entities
    ...    ${entities_to_delete}
    ...    ${broker_count}
 No newline at end of file
Loading