Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Resource ../../common.robot |
| 3 | Library Collections |
| 4 | Library json |
| 5 | Library OperatingSystem |
| 6 | Library RequestsLibrary |
| 7 | Library HttpLibrary.HTTP |
| 8 | Library String |
| 9 | |
| 10 | |
| 11 | *** Variables *** |
efiacor | 3d202b5 | 2021-03-29 09:25:03 +0100 | [diff] [blame^] | 12 | ${DBC_URI} webapi |
| 13 | ${DBC_URL} http://${DMAAPBC_IP}:8080/${DBC_URI} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 14 | ${LOC} csit-sanfrancisco |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 15 | ${FEED1_DATA} { "feedName":"feed1", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" } |
| 16 | ${FEED2_DATA} { "feedName":"feed2", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" } |
| 17 | ${PUB2_DATA} { "dcaeLocationName": "${LOC}", "username": "pub2", "userpwd": "topSecret123", "feedId": "2" } |
| 18 | ${SUB2_DATA} { "dcaeLocationName": "${LOC}", "username": "sub2", "userpwd": "someSecret123", "deliveryURL": "https://${DMAAPBC_IP}:8443/webapi/noURI", "feedId": "2" } |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 19 | |
| 20 | |
| 21 | *** Test Cases *** |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 22 | (DMAAP-441c1) |
| 23 | [Documentation] Create Feed w no clients POST ${DBC_URI}/feeds endpoint |
efiacor | 3d202b5 | 2021-03-29 09:25:03 +0100 | [diff] [blame^] | 24 | ${resp}= PostCall ${DBC_URL}/feeds ${FEED1_DATA} |
| 25 | Should Be Equal As Integers ${resp.status_code} 200 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 26 | |
| 27 | (DMAAP-441c2) |
| 28 | [Documentation] Create Feed w clients POST ${DBC_URI}/feeds endpoint |
efiacor | 3d202b5 | 2021-03-29 09:25:03 +0100 | [diff] [blame^] | 29 | ${resp}= PostCall ${DBC_URL}/feeds ${FEED2_DATA} |
| 30 | Should Be Equal As Integers ${resp.status_code} 200 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 31 | |
| 32 | (DMAAP-441c3) |
| 33 | [Documentation] Add Publisher to existing feed |
efiacor | 3d202b5 | 2021-03-29 09:25:03 +0100 | [diff] [blame^] | 34 | ${resp}= PostCall ${DBC_URL}/dr_pubs ${PUB2_DATA} |
| 35 | Should Be Equal As Integers ${resp.status_code} 201 |
| 36 | ${JSON}= Evaluate json.loads(r"""${resp.content}""", strict=False) |
| 37 | ${result}= Set Variable ${JSON['pubId']} |
| 38 | Set Suite Variable ${pubId} ${result} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 39 | |
| 40 | (DMAAP-441c4) |
| 41 | [Documentation] Add Subscriber to existing feed |
efiacor | 3d202b5 | 2021-03-29 09:25:03 +0100 | [diff] [blame^] | 42 | ${resp}= PostCall ${DBC_URL}/dr_subs ${SUB2_DATA} |
| 43 | Should Be Equal As Integers ${resp.status_code} 201 |
| 44 | ${JSON}= Evaluate json.loads(r"""${resp.content}""", strict=False) |
| 45 | ${result}= Set Variable ${JSON['subId']} |
| 46 | Set Suite Variable ${subId} ${result} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 47 | |
| 48 | (DMAAP-443) |
| 49 | [Documentation] List existing feeds |
| 50 | Create Session get ${DBC_URL} |
efiacor | 3d202b5 | 2021-03-29 09:25:03 +0100 | [diff] [blame^] | 51 | ${resp}= GET On Session get /feeds |
| 52 | Should Be Equal As Integers ${resp.status_code} 200 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 53 | |
| 54 | (DMAAP-444) |
| 55 | [Documentation] Delete existing subscriber |
efiacor | 3d202b5 | 2021-03-29 09:25:03 +0100 | [diff] [blame^] | 56 | ${resp}= DelCall ${DBC_URL}/dr_subs/${subId} |
| 57 | Should Be Equal As Integers ${resp.status_code} 204 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 58 | |
| 59 | (DMAAP-445) |
| 60 | [Documentation] Delete existing publisher |
efiacor | 3d202b5 | 2021-03-29 09:25:03 +0100 | [diff] [blame^] | 61 | ${resp}= DelCall ${DBC_URL}/dr_pubs/${pubId} |
| 62 | Should Be Equal As Integers ${resp.status_code} 204 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 63 | |
| 64 | |
| 65 | *** Keywords *** |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 66 | PostCall |
| 67 | [Arguments] ${url} ${data} |
| 68 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 69 | ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests |
| 70 | [Return] ${resp} |
| 71 | |
| 72 | DelCall |
| 73 | [Arguments] ${url} |
| 74 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 75 | ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests |
| 76 | [Return] ${resp} |