blob: 74dda82e9d2518f2af895dcd934a6e6310598321 [file] [log] [blame]
econwar3acb57a2019-01-25 12:05:45 +00001*** Settings ***
2Library OperatingSystem
3Library RequestsLibrary
4Library requests
5Library Collections
6Library String
7Library Process
8
9*** Variables ***
10${TARGET_URL} https://dmaap-dr-prov:8443/
11${CREATE_FEED_DATA} {"name": "CSIT_Test", "version": "v1.0.0", "description": "CSIT_Test", "business_description": "CSIT_Test", "suspend": false, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [], "endpoint_ids": [{"password": "dradmin", "id": "dradmin"}]}}
12${SUBSCRIBE_DATA} {"delivery":{ "url":"http://${DR_SUB_IP}:7070/", "user":"LOGIN", "password":"PASSWORD", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"dmaap-subscriber"}
egernug6f2874b2019-02-06 15:16:54 +000013${FEED_CONTENT_TYPE} application/vnd.dmaap-dr.feed
14${SUBSCRIBE_CONTENT_TYPE} application/vnd.dmaap-dr.subscription
econwar3acb57a2019-01-25 12:05:45 +000015${PUBLISH_FEED_CONTENT_TYPE} application/octet-stream
16${CLI_VERIFY_SUB_RECEIVED_FILE} docker exec subscriber-node /bin/sh -c "ls /opt/app/subscriber/delivery | grep csit_test"
17
18*** Test Cases ***
19Run Feed Creation
20 [Documentation] Feed Creation
21 [Timeout] 1 minute
22 ${resp}= PostCall ${TARGET_URL} ${CREATE_FEED_DATA} ${FEED_CONTENT_TYPE} dradmin
23 log ${TARGET_URL}
24 log ${resp.text}
25 Should Be Equal As Strings ${resp.status_code} 201
26 log 'JSON Response Code:'${resp}
27
28Run Subscribe to Feed
29 [Documentation] Subscribe to Feed
30 [Timeout] 1 minute
31 ${resp}= PostCall ${TARGET_URL}subscribe/1 ${SUBSCRIBE_DATA} ${SUBSCRIBE_CONTENT_TYPE} dradmin
32 log ${TARGET_URL}subscribe/1
33 log ${resp.text}
34 Should Be Equal As Strings ${resp.status_code} 201
35 log 'JSON Response Code:'${resp}
36
37Run Publish to Feed
38 [Documentation] Publish to Feed
39 [Timeout] 1 minute
40 Sleep 10s Behaviour was noticed where feed was not created in time for publish to be sent
41 ${resp}= PutCall ${TARGET_URL}publish/1/csit_test ${CREATE_FEED_DATA} ${PUBLISH_FEED_CONTENT_TYPE} dradmin
42 log ${TARGET_URL}publish/1/csit_test
43 ${redirect_location}= Set Variable ${resp.headers['Location']}
44 log ${redirect_location}
45 ${resp}= PutCall ${redirect_location} ${CREATE_FEED_DATA} ${PUBLISH_FEED_CONTENT_TYPE} dradmin
46 log ${resp.text}
47 Should Be Equal As Strings ${resp.status_code} 204
48 log 'JSON Response Code:'${resp}
49
50Verify Subscriber Received Published File
51 [Documentation] Verify file is delivered on datarouter-subscriber
52 [Timeout] 1 minute
53 Sleep 5s Time to allow subscriber to receive the file
54 ${cli_cmd_output}= Run Process ${CLI_VERIFY_SUB_RECEIVED_FILE} shell=yes
55 Log ${cli_cmd_output.stdout}
56 Should Be Equal As Strings ${cli_cmd_output.rc} 0
57 Should Contain ${cli_cmd_output.stdout} csit_test
58
59*** Keywords ***
60PostCall
61 [Arguments] ${url} ${data} ${content_type} ${user}
egernug6f2874b2019-02-06 15:16:54 +000062 ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user} Content-Type=${content_type}
econwar3acb57a2019-01-25 12:05:45 +000063 ${resp}= Evaluate requests.post('${url}', data='${data}', headers=${headers}, verify=True) requests
64 [Return] ${resp}
65
66PutCall
67 [Arguments] ${url} ${data} ${content_type} ${user}
egernug6f2874b2019-02-06 15:16:54 +000068 ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} Authorization=Basic ZHJhZG1pbjpkcmFkbWlu
econwar3acb57a2019-01-25 12:05:45 +000069 ${resp}= Evaluate requests.put('${url}', data='${data}', headers=${headers}, verify=True, allow_redirects=False) requests
70 [Return] ${resp}
71
72DeleteCall
73 [Arguments] ${url} ${user}
egernug6f2874b2019-02-06 15:16:54 +000074 ${headers}= Create Dictionary X-DMAAP-DR-ON-BEHALF-OF=${user}
econwar3acb57a2019-01-25 12:05:45 +000075 ${resp}= Evaluate requests.delete('${url}', headers=${headers}, verify=True) requests
76 [Return] ${resp}