Leonardo Bellini | 4dfc5ca | 2018-03-01 10:56:57 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library OperatingSystem |
| 3 | Library RequestsLibrary |
| 4 | Library json |
| 5 | |
| 6 | *** Variables *** |
| 7 | ${MESSAGE} {"ping": "ok"} |
| 8 | |
| 9 | #global variables |
| 10 | ${generatedAID} |
| 11 | |
| 12 | *** Test Cases *** |
Leonardo Bellini | de47fd4 | 2018-03-07 12:07:30 -0600 | [diff] [blame] | 13 | Check 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 | |
| 22 | Check 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 | |
| 31 | Check 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 | |
| 40 | Check 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 Bellini | d573946 | 2018-03-14 03:59:33 -0500 | [diff] [blame^] | 49 | Get 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 | |
| 59 | Music 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 | |
| 74 | Music 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 | |
| 85 | Music 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 | |
| 96 | Music 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 | |
| 107 | Music 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 | |
| 117 | Music 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 | |
| 128 | Music 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 | |
| 138 | Music 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 | |
| 149 | Music 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 | |
| 160 | Music 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 | |
| 172 | Music 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 Bellini | 4dfc5ca | 2018-03-01 10:56:57 -0600 | [diff] [blame] | 183 | |
| 184 | *** Keywords *** |
| 185 | |