Marco Platania | 2233777 | 2018-04-03 16:52:13 -0400 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Resource ../../common.robot |
| 3 | Library Collections |
| 4 | Library json |
| 5 | Library OperatingSystem |
| 6 | Library RequestsLibrary |
| 7 | Library HttpLibrary.HTTP |
| 8 | |
| 9 | *** Variables *** |
| 10 | ${MSB_IP} 127.0.0.1 |
| 11 | ${MSB_PORT} 10550 |
| 12 | ${ACTIVITI_IP} 127.0.0.1 |
| 13 | ${ACTIVITI_PORT} 8804 |
| 14 | ${MGRSERVICE_IP} 127.0.0.1 |
| 15 | ${MGRSERVICE_PORT} 8805 |
| 16 | ${processId} demo |
| 17 | ${deployid} 0 |
| 18 | ${bmpfilepath} ${SCRIPTS}/nfvo-wfengine/demo.bpmn20.xml |
| 19 | |
| 20 | *** Test Cases *** |
| 21 | Deploy BPMN File Test On Activiti |
| 22 | [Documentation] Check if the test bpmn file can be deployed in activiti engine |
| 23 | ${auth}= Create List kermit kermit |
| 24 | ${headers}= Create Dictionary Accept=application/json |
| 25 | Create Session web_session http://${ACTIVITI_IP}:${ACTIVITI_PORT} headers=${headers} auth=${auth} |
| 26 | ${files}= evaluate {"file":open('${bmpfilepath}','rb')} |
| 27 | ${resp}= Post Request web_session /activiti-rest/service/repository/deployments files=${files} |
| 28 | Should Be Equal ${resp.status_code} ${201} |
| 29 | Log ${resp.json()} |
| 30 | ${deployedId}= Set Variable ${resp.json()["id"]} |
| 31 | Set Global Variable ${deployedId} |
| 32 | |
| 33 | Exectue BPMN File Testt On Activiti |
| 34 | [Documentation] Check if the test bpmn file can be exectued in activiti engine |
| 35 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Basic a2VybWl0Omtlcm1pdA== |
| 36 | Create Session web_session http://${ACTIVITI_IP}:${ACTIVITI_PORT} headers=${headers} |
| 37 | ${body} Create Dictionary processDefinitionKey=${processId} |
| 38 | ${body} dumps ${body} |
| 39 | ${resp}= Post Request web_session /activiti-rest/service/runtime/process-instances ${body} |
| 40 | Should Be Equal ${resp.status_code} ${201} |
| 41 | |
| 42 | UnDeploy BPMN File Testt On Activiti |
| 43 | [Documentation] Check if the test bpmn file can be undeployed in activiti engine |
| 44 | log ${deployedId} |
| 45 | ${auth}= Create List kermit kermit |
| 46 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 47 | Create Session web_session http://${ACTIVITI_IP}:${ACTIVITI_PORT} headers=${headers} auth=${auth} |
| 48 | ${resp}= Delete Request web_session /activiti-rest/service/repository/deployments/${deployedId}?cascade=true |
| 49 | Should Be Equal ${resp.status_code} ${204} |
| 50 | |
| 51 | Deploy BPMN File Test On MgrService |
| 52 | [Documentation] Check if the test bpmn file can be deployed in Management Service |
| 53 | ${auth}= Create List kermit kermit |
| 54 | ${headers}= Create Dictionary Accept=application/json |
| 55 | Create Session web_session http://${MGRSERVICE_IP}:${MGRSERVICE_PORT} headers=${headers} auth=${auth} |
| 56 | ${files}= evaluate {"file":open('${bmpfilepath}','rb')} |
| 57 | ${resp}= Post Request web_session api/workflow/v1/package files=${files} |
| 58 | Should Be Equal ${resp.status_code} ${200} |
| 59 | Log ${resp.json()} |
| 60 | ${deployedId}= Set Variable ${resp.json()["deployedId"]} |
| 61 | Set Global Variable ${deployedId} |
| 62 | |
| 63 | Exectue BPMN File Testt On MgrService |
| 64 | [Documentation] Check if the test bpmn file can be exectued in Management Service |
| 65 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Basic a2VybWl0Omtlcm1pdA== |
| 66 | Create Session web_session http://${MGRSERVICE_IP}:${MGRSERVICE_PORT} headers=${headers} |
| 67 | ${body} Create Dictionary processDefinitionKey=${processId} |
| 68 | ${body} dumps ${body} |
| 69 | ${resp}= Post Request web_session api/workflow/v1/process/instance ${body} |
| 70 | Should Be Equal ${resp.status_code} ${200} |
| 71 | Log ${resp.json()} |
| 72 | Should Be Equal ${resp.json()["processDefinitionKey"]} ${processId} |
| 73 | |
| 74 | UnDeploy BPMN File Testt On MgrService |
| 75 | [Documentation] Check if the test bpmn file can be undeployed in Management Service |
| 76 | log ${deployedId} |
| 77 | ${auth}= Create List kermit kermit |
| 78 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 79 | Create Session web_session http://${MGRSERVICE_IP}:${MGRSERVICE_PORT} headers=${headers} auth=${auth} |
| 80 | ${resp}= Delete Request web_session /api/workflow/v1/package/${deployedId} |
| 81 | Should Be Equal ${resp.status_code} ${200} |
| 82 | |
| 83 | Deploy BPMN File Test On MSB |
| 84 | [Documentation] Check if the test bpmn file can be deployed in activiti engine |
| 85 | ${auth}= Create List kermit kermit |
| 86 | ${headers}= Create Dictionary Accept=application/json |
| 87 | Create Session web_session http://${MSB_IP}:${MSB_PORT} headers=${headers} auth=${auth} |
| 88 | ${files}= evaluate {"file":open('${bmpfilepath}','rb')} |
| 89 | ${resp}= Post Request web_session api/workflow/v1/package files=${files} |
| 90 | Should Be Equal ${resp.status_code} ${200} |
| 91 | Log ${resp.json()} |
| 92 | ${deployedId}= Set Variable ${resp.json()["deployedId"]} |
| 93 | Set Global Variable ${deployedId} |
| 94 | |
| 95 | Exectue BPMN File Testt On MSB |
| 96 | [Documentation] Check if the test bpmn file can be exectued in MSB |
| 97 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Basic a2VybWl0Omtlcm1pdA== |
| 98 | Create Session web_session http://${MSB_IP}:${MSB_PORT} headers=${headers} |
| 99 | ${body} Create Dictionary processDefinitionKey=${processId} |
| 100 | ${body} dumps ${body} |
| 101 | ${resp}= Post Request web_session api/workflow/v1/process/instance ${body} |
| 102 | Should Be Equal ${resp.status_code} ${200} |
| 103 | Log ${resp.json()} |
| 104 | Should Be Equal ${resp.json()["processDefinitionKey"]} ${processId} |
| 105 | |
| 106 | UnDeploy BPMN File Testt On MSB |
| 107 | [Documentation] Check if the test bpmn file can be undeployed in MSB |
| 108 | log ${deployedId} |
| 109 | ${auth}= Create List kermit kermit |
| 110 | ${headers} Create Dictionary Content-Type=application/json Accept=application/json |
| 111 | Create Session web_session http://${MSB_IP}:${MSB_PORT} headers=${headers} auth=${auth} |
| 112 | ${resp}= Delete Request web_session /api/workflow/v1/package/${deployedId} |
| 113 | Should Be Equal ${resp.status_code} ${200} |