blob: 9f8e435c8ba25b6aa6939ec2134ff7f6e799748f [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"}
8
9#global variables
10${generatedAID}
11
12*** Test Cases ***
Leonardo Bellinide47fd42018-03-07 12:07:30 -060013Check Cassandra Docker Container
14 [Documentation] It checks cassandra docker container is running
15 ${rc} ${output}= Run and Return RC and Output docker ps
16 Log To Console *********************
17 Log To Console retrurn_code = ${rc}
18 Log To Console output = ${output}
19 Should Be Equal As Integers ${rc} 0
20 Should Contain ${output} music-db
21
22Check Zookeeper Docker Container
23 [Documentation] It checks zookeeper docker container is running
24 ${rc} ${output}= Run and Return RC and Output docker ps
25 Log To Console *********************
26 Log To Console retrurn_code = ${rc}
27 Log To Console output = ${output}
28 Should Be Equal As Integers ${rc} 0
29 Should Contain ${output} music-zk
30
31Check Tomcat Docker Container
32 [Documentation] It checks tomcat docker container is running
33 ${rc} ${output}= Run and Return RC and Output docker ps
34 Log To Console *********************
35 Log To Console retrurn_code = ${rc}
36 Log To Console output = ${output}
37 Should Be Equal As Integers ${rc} 0
38 Should Contain ${output} music-tomcat
39
40Check Music War Docker Container
41 [Documentation] It checks music.war docker container is running
42 ${rc} ${output}= Run and Return RC and Output docker ps
43 Log To Console *********************
44 Log To Console retrurn_code = ${rc}
45 Log To Console output = ${output}
46 Should Be Equal As Integers ${rc} 0
47 Should Contain ${output} music-war
48
Leonardo Bellinid5739462018-03-14 03:59:33 -050049Get Music Version
50 [Documentation] It sends a REST GET request to retrieve the Music.war version
51 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
52 &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
53 ${resp}= Get Request musicaas /MUSIC/rest/v2/version headers=${headers}
54 Log To Console *********************
55 Log To Console response = ${resp}
56 Log To Console body = ${resp.text}
57 Should Be Equal As Integers ${resp.status_code} 200
58
59Music AddOnBoarding
60 [Documentation] It sends a REST POST request to Music to Onboard a new application
61 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
62 ${data}= Get Binary File ${CURDIR}${/}data${/}onboard.json
63 &{headers}= Create Dictionary ns=lb7254 userId=music password=music Content-Type=application/json Accept=application/json
64 ${resp}= Post Request musicaas /MUSIC/rest/v2/admin/onboardAppWithMusic data=${data} headers=${headers}
65 Log To Console *********************
66 Log To Console response = ${resp}
67 Log To Console body = ${resp.text}
68 ${response_json} json.loads ${resp.content}
69 ${generatedAID}= Convert To String ${response_json['Generated AID']}
70 Set Global Variable ${generatedAID}
71 Log To Console generatedAID = ${generatedAID}
72 Should Be Equal As Integers ${resp.status_code} 200
73
74Music CreateKeyspace
75 [Documentation] It sends a REST POST request to Music to create a new keyspace in Cassandra
76 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
77 ${data}= Get Binary File ${CURDIR}${/}data${/}createkeyspace.json
78 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
79 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace data=${data} headers=${headers}
80 Log To Console *********************
81 Log To Console response = ${resp}
82 Log To Console body = ${resp.text}
83 Should Be Equal As Integers ${resp.status_code} 200
84
85Music CreateTable
86 [Documentation] It sends a REST POST request to Music to create a new Table in Cassandra
87 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
88 ${data}= Get Binary File ${CURDIR}${/}data${/}createtable.json
89 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
90 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable data=${data} headers=${headers}
91 Log To Console *********************
92 Log To Console response = ${resp}
93 Log To Console body = ${resp.text}
94 Should Be Equal As Integers ${resp.status_code} 200
95
96Music InsertRow
97 [Documentation] It sends a REST POST request to Music to create a new row in Cassandra
98 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
99 ${data}= Get Binary File ${CURDIR}${/}data${/}insertrow_eventual.json
100 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
101 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows/?row=emp1 data=${data} headers=${headers}
102 Log To Console *********************
103 Log To Console response = ${resp}
104 Log To Console body = ${resp.text}
105 Should Be Equal As Integers ${resp.status_code} 200
106
107Music ReadRowJustInserted
108 [Documentation] It sends a REST GET request to Music to Read the row just inserted in Cassandra
109 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
110 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
111 ${resp}= Get Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 headers=${headers}
112 Log To Console *********************
113 Log To Console response = ${resp}
114 Log To Console body = ${resp.text}
115 Should Be Equal As Integers ${resp.status_code} 200
116
117Music UpdateRowInAtomicWay
118 [Documentation] It sends a REST PUT request to Music to create a new row in Cassandra
119 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
120 ${data}= Get Binary File ${CURDIR}${/}data${/}updaterow_atomic.json
121 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
122 ${resp}= Put Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 data=${data} headers=${headers}
123 Log To Console *********************
124 Log To Console response = ${resp}
125 Log To Console body = ${resp.text}
126 Should Be Equal As Integers ${resp.status_code} 200
127
128Music ReadRowAfterUpdate
129 [Documentation] It sends a REST GET request to Music to Read the row just inserted in Cassandra
130 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
131 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
132 ${resp}= Get Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 headers=${headers}
133 Log To Console *********************
134 Log To Console response = ${resp}
135 Log To Console body = ${resp.text}
136 Should Be Equal As Integers ${resp.status_code} 200
137
138Music DeleteRow
139 [Documentation] It sends a REST DELETE request to Music to delete a row in Cassandra
140 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
141 ${data}= Get Binary File ${CURDIR}${/}data${/}deleterow_eventual.json
142 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
143 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 data=${data} headers=${headers}
144 Log To Console *********************
145 Log To Console response = ${resp}
146 Log To Console body = ${resp.text}
147 Should Be Equal As Integers ${resp.status_code} 200
148
149Music DropTable
150 [Documentation] It sends a REST Delete request to Music to drop one existing Table in Cassandra
151 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
152 ${data}= Get Binary File ${CURDIR}${/}data${/}droptable.json
153 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
154 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable data=${data} headers=${headers}
155 Log To Console *********************
156 Log To Console response = ${resp}
157 Log To Console body = ${resp.text}
158 Should Be Equal As Integers ${resp.status_code} 200
159
160Music DropKeyspace
161 [Documentation] It sends a REST DELETE request to Music to drop one existing keyspace in Cassandra
162 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
163 ${data}= Get Binary File ${CURDIR}${/}data${/}dropkeyspace.json
164 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
165 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace data=${data} headers=${headers}
166 Log To Console *********************
167 Log To Console response = ${resp}
168 Log To Console body = ${resp.text}
169 Should Be Equal As Integers ${resp.status_code} 200
170
171
172Music DeleteOnBoarding
173 [Documentation] It sends a REST DELETE request to Music to remove a previosly onboarded application
174 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
175 ${data}= Get Binary File ${CURDIR}${/}data${/}onboard.json
176 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
177 ${resp}= Delete Request musicaas /MUSIC/rest/v2/admin/onboardAppWithMusic 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
Leonardo Bellini4dfc5ca2018-03-01 10:56:57 -0600183
184*** Keywords ***
185