blob: 4eda86919343e38dbe7e0e6ed31e78911a5a154d [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Library OperatingSystem
3Library RequestsLibrary
4Library json
5
6*** Variables ***
7${MESSAGE} {"ping": "ok"}
8${BASIC} Basic
9${AUTHVALUE} bXVzaWM6bXVzaWM=
10${Authorization} ${BASIC} ${AUTHVALUE}
11
12#global variables
13${generatedAID}
14
15*** Test Cases ***
16Check 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
52Healthcheck Cassandra
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/service/pingCassandra/ONE 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
62Healthcheck Zookeeper
63 [Documentation] It sends a REST GET request to retrieve the Music.war version
64 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
65 &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
66 ${resp}= Get Request musicaas /MUSIC/rest/v2/service/pingZookeeper headers=${headers}
67 Log To Console *********************
68 Log To Console response = ${resp}
69 Log To Console body = ${resp.text}
70 Should Be Equal As Integers ${resp.status_code} 200
71
72Get Music Version
73 [Documentation] It sends a REST GET request to retrieve the Music.war version
74 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
75 &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
76 ${resp}= Get Request musicaas /MUSIC/rest/v2/version headers=${headers}
77 Log To Console *********************
78 Log To Console response = ${resp}
79 Log To Console body = ${resp.text}
80 Should Be Equal As Integers ${resp.status_code} 200
81
82Music AddOnBoarding
83 [Documentation] It sends a REST POST request to Music to Onboard a new application
84 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
85 ${data}= Get Binary File ${CURDIR}${/}data${/}onboard.json
86 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} Content-Type=application/json Accept=application/json
87 ${resp}= Post Request musicaas /MUSIC/rest/v2/admin/onboardAppWithMusic data=${data} headers=${headers}
88 Log To Console *********************
89 Log To Console response = ${resp}
90 Log To Console body = ${resp.text}
91 ${response_json} json.loads ${resp.content}
92 ${generatedAID}= Convert To String ${response_json['Generated AID']}
93 Set Global Variable ${generatedAID}
94 Log To Console generatedAID = ${generatedAID}
95 Should Be Equal As Integers ${resp.status_code} 200
96
97Music CreateKeyspace
98 [Documentation] It sends a REST POST request to Music to create a new keyspace in Cassandra
99 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
100 ${data}= Get Binary File ${CURDIR}${/}data${/}createkeyspace.json
101 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
102 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace data=${data} headers=${headers}
103 Log To Console *********************
104 Log To Console response = ${resp}
105 Log To Console body = ${resp.text}
106 Should Be Equal As Integers ${resp.status_code} 200
107
108Music CreateTable
109 [Documentation] It sends a REST POST request to Music to create a new Table in Cassandra
110 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
111 ${data}= Get Binary File ${CURDIR}${/}data${/}createtable.json
112 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
113 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable data=${data} headers=${headers}
114 Log To Console *********************
115 Log To Console response = ${resp}
116 Log To Console body = ${resp.text}
117 Should Be Equal As Integers ${resp.status_code} 200
118
119Music InsertRow
120 [Documentation] It sends a REST POST request to Music to create a new row in Cassandra
121 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
122 ${data}= Get Binary File ${CURDIR}${/}data${/}insertrow_eventual.json
123 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
124 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows/?row=emp1 data=${data} headers=${headers}
125 Log To Console *********************
126 Log To Console response = ${resp}
127 Log To Console body = ${resp.text}
128 Should Be Equal As Integers ${resp.status_code} 200
129
130Music ReadRowJustInserted
131 [Documentation] It sends a REST GET request to Music to Read the row just inserted in Cassandra
132 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
133 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
134 ${resp}= Get Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 headers=${headers}
135 Log To Console *********************
136 Log To Console response = ${resp}
137 Log To Console body = ${resp.text}
138 Should Be Equal As Integers ${resp.status_code} 200
139
140Music UpdateRowInAtomicWay
141 [Documentation] It sends a REST PUT request to Music to create a new row in Cassandra
142 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
143 ${data}= Get Binary File ${CURDIR}${/}data${/}updaterow_atomic.json
144 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
145 ${resp}= Put Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 data=${data} headers=${headers}
146 Log To Console *********************
147 Log To Console response = ${resp}
148 Log To Console body = ${resp.text}
149 Should Be Equal As Integers ${resp.status_code} 200
150
151Music ReadRowAfterUpdate
152 [Documentation] It sends a REST GET request to Music to Read the row just inserted in Cassandra
153 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
154 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
155 ${resp}= Get Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 headers=${headers}
156 Log To Console *********************
157 Log To Console response = ${resp}
158 Log To Console body = ${resp.text}
159 Should Be Equal As Integers ${resp.status_code} 200
160
161Music DeleteRow
162 [Documentation] It sends a REST DELETE request to Music to delete a row in Cassandra
163 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
164 ${data}= Get Binary File ${CURDIR}${/}data${/}deleterow_eventual.json
165 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
166 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 data=${data} headers=${headers}
167 Log To Console *********************
168 Log To Console response = ${resp}
169 Log To Console body = ${resp.text}
170 Should Be Equal As Integers ${resp.status_code} 200
171
172Music DropTable
173 [Documentation] It sends a REST Delete request to Music to drop one existing Table in Cassandra
174 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
175 ${data}= Get Binary File ${CURDIR}${/}data${/}droptable.json
176 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
177 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable data=${data} headers=${headers}
178 Log To Console *********************
179 Log To Console response = ${resp}
180 Log To Console body = ${resp.text}
181 Should Be Equal As Integers ${resp.status_code} 200
182
183Music DropKeyspace
184 [Documentation] It sends a REST DELETE request to Music to drop one existing keyspace in Cassandra
185 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
186 ${data}= Get Binary File ${CURDIR}${/}data${/}dropkeyspace.json
187 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
188 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace data=${data} headers=${headers}
189 Log To Console *********************
190 Log To Console response = ${resp}
191 Log To Console body = ${resp.text}
192 Should Be Equal As Integers ${resp.status_code} 200
193
194
195Music DeleteOnBoarding
196 [Documentation] It sends a REST DELETE request to Music to remove a previosly onboarded application
197 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
198 ${data}= Get Binary File ${CURDIR}${/}data${/}onboard.json
199 &{headers}= Create Dictionary ns=lb7254 Authorization=${Authorization} aid=${generatedAID} Content-Type=application/json Accept=application/json
200 ${resp}= Delete Request musicaas /MUSIC/rest/v2/admin/onboardAppWithMusic data=${data} headers=${headers}
201 Log To Console *********************
202 Log To Console response = ${resp}
203 Log To Console body = ${resp.text}
204 Should Be Equal As Integers ${resp.status_code} 200
205
206
207*** Keywords ***
208