2 Library OperatingSystem
3 Library RequestsLibrary
9 ${TARGETURL_PUBLISH} http://${DMAAP_MR_IP}:3904/events/TestTopic1
10 ${TARGETURL_TOPICS} http://${DMAAP_MR_IP}:3904/topics
11 ${TARGETURL_SUBSCR} http://${DMAAP_MR_IP}:3904/events/TestTopic1/CG1/C1?timeout=1000
12 ${TEST_DATA} {"topicName": "TestTopic1"}
13 ${TOPIC_DATA} {"topicName":"FirstTopic","topicDescription":"This is a TestTopic","partitionCount":"1","replicationCount":"3","transactionEnabled":"true"}
16 Run Topic Creation and Publish
17 [Documentation] Topic Creation
19 ${resp}= PostCall ${TARGETURL_PUBLISH} ${TEST_DATA}
20 log ${TARGETURL_PUBLISH}
22 Should Be Equal As Strings ${resp.status_code} 200
23 ${count}= Evaluate $resp.json().get('count')
24 log 'JSON Response Code:'${resp}
26 Run Subscribing a message status
27 [Documentation] Subscribide message status
29 ${resp}= GetCall ${TARGETURL_SUBSCR}
30 log ${TARGETURL_SUBSCR}
31 Should Be Equal As Strings ${resp.status_code} 200
32 log 'JSON Response Code :'${resp}
34 Run check topics are exisiting
35 [Documentation] Get the count of the Topics
37 ${resp}= GetCall ${TARGETURL_TOPICS}
38 log ${TARGETURL_TOPICS}
39 Should Be Equal As Strings ${resp.status_code} 200
40 log 'JSON Response Code :'${resp}
41 ${topics}= Evaluate $resp.json().get('topics')
43 ${ListLength}= Get Length ${topics}
45 List Should Contain Value ${topics} TestTopic1
47 Run Publich and Subscribe a message
48 [Documentation] Publish and Subscribe the message
50 ${resp}= PostCall ${TARGETURL_PUBLISH} ${TEST_DATA}
51 log ${TARGETURL_PUBLISH}
53 Should Be Equal As Strings ${resp.status_code} 200
54 ${sub_resp}= GetCall ${TARGETURL_SUBSCR}
55 log ${TARGETURL_SUBSCR}
56 Should Be Equal As Strings ${sub_resp.status_code} 200
57 log 'JSON Response Code :'${sub_resp}
58 ${ListLength}= Get Length ${sub_resp.json()}
60 List Should Contain Value ${sub_resp.json()} {"topicName":"TestTopic1"} case_insensitive=yes
64 [Arguments] ${url} ${data}
65 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
66 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
71 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
72 ${resp}= Evaluate requests.get('${url}', headers=${headers}, verify=False) requests