blob: bb94d2955371540d5761f992afdf1a42ede08cc6 [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 ***
13Get Music Version
14 [Documentation] It sends a REST GET request to retrieve the Music.war version
15 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
16 &{headers}= Create Dictionary Content-Type=application/json Accept=application/json
17 ${resp}= Get Request musicaas /MUSIC/rest/v2/version headers=${headers}
18 Log To Console *********************
19 Log To Console response = ${resp}
20 Log To Console body = ${resp.text}
21 Should Be Equal As Integers ${resp.status_code} 200
22
23Music AddOnBoarding
24 [Documentation] It sends a REST POST request to Music to Onboard a new application
25 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
26 ${data}= Get Binary File ${CURDIR}${/}data${/}onboard.json
27 &{headers}= Create Dictionary ns=lb7254 userId=music password=music Content-Type=application/json Accept=application/json
28 ${resp}= Post Request musicaas /MUSIC/rest/v2/admin/onboardAppWithMusic data=${data} headers=${headers}
29 Log To Console *********************
30 Log To Console response = ${resp}
31 Log To Console body = ${resp.text}
32 ${response_json} json.loads ${resp.content}
33 ${generatedAID}= Convert To String ${response_json['Generated AID']}
34 Set Global Variable ${generatedAID}
35 Log To Console generatedAID = ${generatedAID}
36 Should Be Equal As Integers ${resp.status_code} 200
37
38Music CreateKeyspace
39 [Documentation] It sends a REST POST request to Music to create a new keyspace in Cassandra
40 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
41 ${data}= Get Binary File ${CURDIR}${/}data${/}createkeyspace.json
42 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
43 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace data=${data} headers=${headers}
44 Log To Console *********************
45 Log To Console response = ${resp}
46 Log To Console body = ${resp.text}
47 Should Be Equal As Integers ${resp.status_code} 200
48
49Music CreateTable
50 [Documentation] It sends a REST POST request to Music to create a new Table in Cassandra
51 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
52 ${data}= Get Binary File ${CURDIR}${/}data${/}createtable.json
53 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
54 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable data=${data} headers=${headers}
55 Log To Console *********************
56 Log To Console response = ${resp}
57 Log To Console body = ${resp.text}
58 Should Be Equal As Integers ${resp.status_code} 200
59
60Music InsertRow
61 [Documentation] It sends a REST POST request to Music to create a new row in Cassandra
62 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
63 ${data}= Get Binary File ${CURDIR}${/}data${/}insertrow_eventual.json
64 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
65 ${resp}= Post Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows/?row=emp1 data=${data} headers=${headers}
66 Log To Console *********************
67 Log To Console response = ${resp}
68 Log To Console body = ${resp.text}
69 Should Be Equal As Integers ${resp.status_code} 200
70
71Music ReadRowJustInserted
72 [Documentation] It sends a REST GET request to Music to Read the row just inserted in Cassandra
73 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
74 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
75 ${resp}= Get Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 headers=${headers}
76 Log To Console *********************
77 Log To Console response = ${resp}
78 Log To Console body = ${resp.text}
79 Should Be Equal As Integers ${resp.status_code} 200
80
81Music UpdateRowInAtomicWay
82 [Documentation] It sends a REST PUT request to Music to create a new row in Cassandra
83 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
84 ${data}= Get Binary File ${CURDIR}${/}data${/}updaterow_atomic.json
85 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
86 ${resp}= Put Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 data=${data} headers=${headers}
87 Log To Console *********************
88 Log To Console response = ${resp}
89 Log To Console body = ${resp.text}
90 Should Be Equal As Integers ${resp.status_code} 200
91
92Music ReadRowAfterUpdate
93 [Documentation] It sends a REST GET request to Music to Read the row just inserted in Cassandra
94 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
95 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
96 ${resp}= Get Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 headers=${headers}
97 Log To Console *********************
98 Log To Console response = ${resp}
99 Log To Console body = ${resp.text}
100 Should Be Equal As Integers ${resp.status_code} 200
101
102Music DeleteRow
103 [Documentation] It sends a REST DELETE request to Music to delete a row in Cassandra
104 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
105 ${data}= Get Binary File ${CURDIR}${/}data${/}deleterow_eventual.json
106 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
107 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable/rows?name=emp1 data=${data} headers=${headers}
108 Log To Console *********************
109 Log To Console response = ${resp}
110 Log To Console body = ${resp.text}
111 Should Be Equal As Integers ${resp.status_code} 200
112
113Music DropTable
114 [Documentation] It sends a REST Delete request to Music to drop one existing Table in Cassandra
115 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
116 ${data}= Get Binary File ${CURDIR}${/}data${/}droptable.json
117 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
118 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace/tables/MusicOnapTable data=${data} headers=${headers}
119 Log To Console *********************
120 Log To Console response = ${resp}
121 Log To Console body = ${resp.text}
122 Should Be Equal As Integers ${resp.status_code} 200
123
124Music DropKeyspace
125 [Documentation] It sends a REST DELETE request to Music to drop one existing keyspace in Cassandra
126 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
127 ${data}= Get Binary File ${CURDIR}${/}data${/}dropkeyspace.json
128 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
129 ${resp}= Delete Request musicaas /MUSIC/rest/v2/keyspaces/MusicOnapKeyspace data=${data} headers=${headers}
130 Log To Console *********************
131 Log To Console response = ${resp}
132 Log To Console body = ${resp.text}
133 Should Be Equal As Integers ${resp.status_code} 200
134
135
136Music DeleteOnBoarding
137 [Documentation] It sends a REST DELETE request to Music to remove a previosly onboarded application
138 Create Session musicaas ${MUSIC_HOSTNAME}:${MUSIC_PORT}
139 ${data}= Get Binary File ${CURDIR}${/}data${/}onboard.json
140 &{headers}= Create Dictionary ns=lb7254 userId=music password=music aid=${generatedAID} Content-Type=application/json Accept=application/json
141 ${resp}= Delete Request musicaas /MUSIC/rest/v2/admin/onboardAppWithMusic data=${data} headers=${headers}
142 Log To Console *********************
143 Log To Console response = ${resp}
144 Log To Console body = ${resp.text}
145 Should Be Equal As Integers ${resp.status_code} 200
146
147*** Keywords ***
148