blob: 9fc937e4966a0e5af6139518928cc55c1bed28eb [file] [log] [blame]
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -06001*** Settings ***
2Library OperatingSystem
3Library RequestsLibrary
4Library json
5
6*** Variables ***
7${MESSAGE} {"ping": "ok"}
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -04008${BASIC} Basic
9${AUTHVALUE} bXVzaWM6bXVzaWM=
10${Authorization} ${BASIC} ${AUTHVALUE}
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -060011
12#global variables
13${generatedAID}
14
15*** Test Cases ***
Leonardo Bellinide47fd42018-03-07 12:07:30 -060016Check Cassandra Docker Container
17 [Documentation] It checks cassandra docker container is running
18 ${rc} ${output}= Run and Return RC and Output docker ps
19 Log To Console *********************
20 Log To Console retrurn_code = ${rc}
21 Log To Console output = ${output}
22 Should Be Equal As Integers ${rc} 0
23 Should Contain ${output} music-db
24
25Check Zookeeper Docker Container
26 [Documentation] It checks zookeeper docker container is running
27 ${rc} ${output}= Run and Return RC and Output docker ps
28 Log To Console *********************
29 Log To Console retrurn_code = ${rc}
30 Log To Console output = ${output}
31 Should Be Equal As Integers ${rc} 0
32 Should Contain ${output} music-zk
33
34Check Tomcat Docker Container
35 [Documentation] It checks tomcat docker container is running
36 ${rc} ${output}= Run and Return RC and Output docker ps
37 Log To Console *********************
38 Log To Console retrurn_code = ${rc}
39 Log To Console output = ${output}
40 Should Be Equal As Integers ${rc} 0
41 Should Contain ${output} music-tomcat
42
43Check Music War Docker Container
44 [Documentation] It checks music.war docker container is running
45 ${rc} ${output}= Run and Return RC and Output docker ps
46 Log To Console *********************
47 Log To Console retrurn_code = ${rc}
48 Log To Console output = ${output}
49 Should Be Equal As Integers ${rc} 0
50 Should Contain ${output} music-war
51
Leonardo Bellinid5739462018-03-14 03:59:33 -050052Get Music Version
53 [Documentation] It sends a REST GET request to retrieve the Music.war version
54 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
55 &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
56 ${resp}= Get Request musicaas /MUSIC/rest/v2/version headers=${headers}
57 Log To Console *********************
58 Log To Console response = ${resp}
59 Log To Console body = ${resp.text}
60 Should Be Equal As Integers ${resp.status_code} 200
61
62Music AddOnBoarding
63 [Documentation] It sends a REST POST request to Music to Onboard a new application
64 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
65 ${data}= Get Binary File ${CURDIR}${/}data${/}onboard.json
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -040066 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -050067 ${resp}= Post Request musicaas /MUSIC/rest/v2/admin/onboardAppWithMusic data=${data} headers=${headers}
68 Log To Console *********************
69 Log To Console response = ${resp}
70 Log To Console body = ${resp.text}
71 ${response_json} json.loads ${resp.content}
72 ${generatedAID}= Convert To String ${response_json['Generated AID']}
73 Set Global Variable ${generatedAID}
74 Log To Console generatedAID = ${generatedAID}
75 Should Be Equal As Integers ${resp.status_code} 200
76
77Music CreateKeyspace
78 [Documentation] It sends a REST POST request to Music to create a new keyspace in Cassandra
79 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
80 ${data}= Get Binary File ${CURDIR}${/}data${/}createkeyspace.json
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -040081 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -050082 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace data=${data} headers=${headers}
83 Log To Console *********************
84 Log To Console response = ${resp}
85 Log To Console body = ${resp.text}
86 Should Be Equal As Integers ${resp.status_code} 200
87
88Music CreateTable
89 [Documentation] It sends a REST POST request to Music to create a new Table in Cassandra
90 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
91 ${data}= Get Binary File ${CURDIR}${/}data${/}createtable.json
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -040092 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -050093 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable data=${data} headers=${headers}
94 Log To Console *********************
95 Log To Console response = ${resp}
96 Log To Console body = ${resp.text}
97 Should Be Equal As Integers ${resp.status_code} 200
98
99Music InsertRow
100 [Documentation] It sends a REST POST request to Music to create a new row in Cassandra
101 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
102 ${data}= Get Binary File ${CURDIR}${/}data${/}insertrow_eventual.json
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -0400103 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -0500104 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows/?row=emp1 data=${data} headers=${headers}
105 Log To Console *********************
106 Log To Console response = ${resp}
107 Log To Console body = ${resp.text}
108 Should Be Equal As Integers ${resp.status_code} 200
109
110Music ReadRowJustInserted
111 [Documentation] It sends a REST GET request to Music to Read the row just inserted in Cassandra
112 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -0400113 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -0500114 ${resp}= Get Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 headers=${headers}
115 Log To Console *********************
116 Log To Console response = ${resp}
117 Log To Console body = ${resp.text}
118 Should Be Equal As Integers ${resp.status_code} 200
119
120Music UpdateRowInAtomicWay
121 [Documentation] It sends a REST PUT request to Music to create a new row in Cassandra
122 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
123 ${data}= Get Binary File ${CURDIR}${/}data${/}updaterow_atomic.json
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -0400124 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -0500125 ${resp}= Put Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 data=${data} headers=${headers}
126 Log To Console *********************
127 Log To Console response = ${resp}
128 Log To Console body = ${resp.text}
129 Should Be Equal As Integers ${resp.status_code} 200
130
131Music ReadRowAfterUpdate
132 [Documentation] It sends a REST GET request to Music to Read the row just inserted in Cassandra
133 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -0400134 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -0500135 ${resp}= Get Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 headers=${headers}
136 Log To Console *********************
137 Log To Console response = ${resp}
138 Log To Console body = ${resp.text}
139 Should Be Equal As Integers ${resp.status_code} 200
140
141Music DeleteRow
142 [Documentation] It sends a REST DELETE request to Music to delete a row in Cassandra
143 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
144 ${data}= Get Binary File ${CURDIR}${/}data${/}deleterow_eventual.json
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -0400145 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -0500146 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 data=${data} headers=${headers}
147 Log To Console *********************
148 Log To Console response = ${resp}
149 Log To Console body = ${resp.text}
150 Should Be Equal As Integers ${resp.status_code} 200
151
152Music DropTable
153 [Documentation] It sends a REST Delete request to Music to drop one existing Table in Cassandra
154 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
155 ${data}= Get Binary File ${CURDIR}${/}data${/}droptable.json
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -0400156 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -0500157 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable data=${data} headers=${headers}
158 Log To Console *********************
159 Log To Console response = ${resp}
160 Log To Console body = ${resp.text}
161 Should Be Equal As Integers ${resp.status_code} 200
162
163Music DropKeyspace
164 [Documentation] It sends a REST DELETE request to Music to drop one existing keyspace in Cassandra
165 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
166 ${data}= Get Binary File ${CURDIR}${/}data${/}dropkeyspace.json
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -0400167 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -0500168 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace data=${data} headers=${headers}
169 Log To Console *********************
170 Log To Console response = ${resp}
171 Log To Console body = ${resp.text}
172 Should Be Equal As Integers ${resp.status_code} 200
173
174
175Music DeleteOnBoarding
176 [Documentation] It sends a REST DELETE request to Music to remove a previosly onboarded application
177 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
178 ${data}= Get Binary File ${CURDIR}${/}data${/}onboard.json
Nelson,Thomas(tn1381)(arthurdent3)9f3cab82018-09-05 14:06:45 -0400179 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
Leonardo Bellinid5739462018-03-14 03:59:33 -0500180 ${resp}= Delete Request musicaas /MUSIC/rest/v2/admin/onboardAppWithMusic data=${data} headers=${headers}
181 Log To Console *********************
182 Log To Console response = ${resp}
183 Log To Console body = ${resp.text}
184 Should Be Equal As Integers ${resp.status_code} 200
185
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -0600186
187*** Keywords ***
188