From 0b2033d2106d2119d2d4a1ed209d733c6e9e0e97 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Mon, 19 May 2014 10:42:08 -0400 Subject: [PATCH] Culminacion del behat para export/import proyect y nueva funcion para en rest para guardar el proyecto exportado --- .../main_tests_project_export_import.feature | 172 ++++++++++++++---- features/bootstrap/RestContext.php | 25 +++ .../json/process_template_sequencial.json | 47 ++++- 3 files changed, 205 insertions(+), 39 deletions(-) diff --git a/features/backend/projects/project_export_import/main_tests_project_export_import.feature b/features/backend/projects/project_export_import/main_tests_project_export_import.feature index 437a9efbd..dfa4af573 100644 --- a/features/backend/projects/project_export_import/main_tests_project_export_import.feature +++ b/features/backend/projects/project_export_import/main_tests_project_export_import.feature @@ -1,21 +1,14 @@ @ProcessMakerMichelangelo @RestAPI Feature: Import/Export Process Main Tests Requirements: - a workspace without the project 1455892245368ebeb11c1a5001393784 ("Process Complete BPMN") already loaded + a workspace without the project 1455892245368ebeb11c1a5001393784 ("Process Complete BPMN", "Export process empty") already loaded there are many activities, steps, triggers, pmtables, asignee, process supervisor, process permissions, etc. in the process Background: Given that I have a valid access_token -Scenario: Get for Export Project - Given I request "project/1455892245368ebeb11c1a5001393784/export" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/xml" - And the type is "array" - -#Verificar cantidad de dynaform, output, inputs, triggers, asignacion de usuarios, etc. +#Verificar cantidad de dynaform, output, inputs, triggers, asignacion de usuarios, etc. del proyecto "Process Complete BPMN" Scenario: Get a List DynaForms of a Project Process Complete BPMN Given I request "project/1455892245368ebeb11c1a5001393784/dynaforms" @@ -86,6 +79,20 @@ Scenario: Get a list templates folder of process files manager And the type is "array" And the response has 1 records +Scenario: Verify that there are report tables + Given I request "project/1455892245368ebeb11c1a5001393784/report-tables" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has 1 record + +Scenario: Get the Case Trackers Objects of a Project + And I request "project/1455892245368ebeb11c1a5001393784/case-tracker/objects" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 1 record + Scenario: Get a single Process Given that I want to get a resource with the key "obj_uid" stored in session array And I request "project/1455892245368ebeb11c1a5001393784/process" @@ -122,6 +129,24 @@ Scenario: Get a single Process And that "pro_summary_dynaform" is set to "898822326536be3a12addb0034537553" And that "pro_calendar" is set to "14606161052f50839307899033145440" +#Export Process + +Scenario: Get for Export Project + Given I request "project/1455892245368ebeb11c1a5001393784/export" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/xml" + And save exported process to "/home/wendy/uploadfiles/" as "Process_Complete_BPMN" + + +Scenario: Delete a Project created previously in this script + Given that I want to delete a resource with the key "prj_uid" stored in session array + And I request "projects/1455892245368ebeb11c1a5001393784" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + #Import Process Scenario Outline: Import a process @@ -136,9 +161,10 @@ Scenario Outline: Import a process Examples: | project_file | import_option | prj_uid_number | | /home/wendy/uploadfiles/Process_NewCreate_BPMN.pmx | create | 1 | - | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | overwrite | 2 | - | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | disable | 3 | - | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | keep | 4 | + | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create | 2 | + | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | overwrite | 3 | + | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | disable | 4 | + | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | keep | 5 | #Verificar cantidad de dynaform, output, inputs, triggers, asignacion de usuarios, etc. @@ -154,9 +180,10 @@ Scenario Outline: Get a List DynaForms of a Project Process Complete BPMN Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 4 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 26 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 26 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 26 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 26 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 26 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 26 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 26 | Scenario Outline: Get the Input Documents List when there are exactly zero input documents @@ -170,9 +197,10 @@ Scenario Outline: Get the Input Documents List when there are exactly zero input Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 1 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 1 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 1 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 1 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 1 | Scenario Outline: Get the Output Documents List when there are exactly two output documents @@ -186,9 +214,10 @@ Scenario Outline: Get the Output Documents List when there are exactly two outpu Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 1 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 1 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 1 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 1 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 1 | Scenario Outline: Get the Triggers List when there are exactly two triggers @@ -202,9 +231,10 @@ Scenario Outline: Get the Triggers List when there are exactly two triggers Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 3 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 3 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 3 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 3 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 3 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 3 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 3 | Scenario Outline: List assignees of each activity @@ -220,9 +250,10 @@ Scenario Outline: List assignees of each activity Examples: | import_option | prj_uid_number | prj_uid | records | project | activity | records | aas_uid | aas_type | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | 601816709536cfeae7d7cd9079578104 | 771350954536cfec446fab9019867857 | 1 | 70084316152d56749e0f393054862525 | group | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 6274755055368eed1116388064384542 | 1 | 70084316152d56749e0f393054862525 | group | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 4790702485368efad167477011123879 | 1 | 70084316152d56749e0f393054862525 | group | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 2072984565368efc137a394001073529 | 1 | 70084316152d56749e0f393054862525 | group | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 6274755055368eed1116388064384542 | 1 | 70084316152d56749e0f393054862525 | group | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 6274755055368eed1116388064384542 | 1 | 70084316152d56749e0f393054862525 | group | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 4790702485368efad167477011123879 | 1 | 70084316152d56749e0f393054862525 | group | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 26 | 1455892245368ebeb11c1a5001393784 | 2072984565368efc137a394001073529 | 1 | 70084316152d56749e0f393054862525 | group | Scenario Outline: Get a List of current process supervisors of a project @@ -236,9 +267,10 @@ Scenario Outline: Get a List of current process supervisors of a project Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 1 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 1 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 1 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 1 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 1 | Scenario Outline: Get a List of current Process Permissions of a project @@ -250,9 +282,10 @@ Scenario Outline: Get a List of current Process Permissions of a project Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 1 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 1 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 1 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 1 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 1 | Scenario Outline: Get a list templates folder of process files manager @@ -266,9 +299,10 @@ Scenario Outline: Get a list templates folder of process files manager Examples: | import_option | prj_uid_number | prj_uid | records | | create | 1 | 601816709536cfeae7d7cd9079578104 | 0 | - | overwrite | 2 | 1455892245368ebeb11c1a5001393784 | 1 | - | disable | 3 | 1455892245368ebeb11c1a5001393784 | 1 | - | keep | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | create | 2 | 1455892245368ebeb11c1a5001393784 | 1 | + | overwrite | 3 | 1455892245368ebeb11c1a5001393784 | 1 | + | disable | 4 | 1455892245368ebeb11c1a5001393784 | 1 | + | keep | 5 | 1455892245368ebeb11c1a5001393784 | 1 | Scenario: Get a single Process process "Process Complete BPMN" @@ -358,8 +392,8 @@ Scenario Outline: Delete a Project created previously in this script | prj_uid_number | | 1 | | 2 | - | 3 | | 4 | + | 5 | Scenario: Get a list of projects @@ -380,4 +414,66 @@ Scenario Outline: Import a process Examples: | project_file | import_option | | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create | - \ No newline at end of file + + +#For example, to export a empty process + +Scenario: Get for Export Project "Export process empty" + Given I request "project/5195971265375127fce82f4015927137/export" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/xml" + And save exported process to "/home/wendy/uploadfiles/" as "Export process empty" + +Scenario: Delete a Project created previously in this script "Export process empty" + Given that I want to delete a resource with the key "prj_uid" stored in session array + And I request "projects/5195971265375127fce82f4015927137" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + +Scenario: Import a process "Export process empty" + Given POST upload a project file "/home/wendy/uploadfiles/Export_process_empty.pmx" to "project/import?option=create" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + +Scenario: Get a List DynaForms of a Project "Export process empty" + Given I request "project/5195971265375127fce82f4015927137/dynaforms" with the key "prj_uid" stored in session array + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 0 records + +Scenario: Get the Input Documents List when there are exactly zero input documents + Given I request "project/5195971265375127fce82f4015927137/input-documents" with the key "prj_uid" stored in session array + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 0 records + +Scenario: Get the Output Documents List when there are exactly zero output documents + Given I request "project/5195971265375127fce82f4015927137/output-documents" with the key "prj_uid" stored in session array + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 0 records + +Scenario: Verify that there are report tables + Given I request "project/5195971265375127fce82f4015927137/report-tables" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has 0 record + +Scenario: Get the Case Trackers Objects of a Project + And I request "project/5195971265375127fce82f4015927137/case-tracker/objects" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 0 record \ No newline at end of file diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index ba7a8d63a..0f8f07ea2 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1623,4 +1623,29 @@ class RestContext extends BehatContext throw new \Exception("JSON Response does not have '$varName' property\n\n" ); } } + /** + * @Given /^save exported process to "([^"]*)"$/ + * @Given /^save exported process to "([^"]*)" as "([^"]*)"$/ + */ + public function saveExportedProcessTo($destinationFolder, $exportedProcessFileName="") + { + + if($exportedProcessFileName == ""){//Obtain name from XML + $exportedProcessFileName=$this->_data->xpath('//metadata/meta[@key="name"]'); + $exportedProcessFileName = $exportedProcessFileName[0]; + $exportedProcessFileName = "ExpBehat ".$exportedProcessFileName; + + + } + + $exportedProcessFileName = $destinationFolder.str_replace(" ","_",$exportedProcessFileName).".pmx"; + + $this->printDebug("Exporting process to: $exportedProcessFileName"); + + file_put_contents($exportedProcessFileName, $this->_response->getBody(true)); + + + + } + } \ No newline at end of file diff --git a/features/json/process_template_sequencial.json b/features/json/process_template_sequencial.json index 9fe68aed2..5b66a18c4 100644 --- a/features/json/process_template_sequencial.json +++ b/features/json/process_template_sequencial.json @@ -299,7 +299,52 @@ ] } ], - "artifacts": [], + "artifacts": [ + { + "art_uid": "9008273035360fb4508c320094467351", + "art_type": "VERTICAL_LINE", + "art_name": "linea ejemplo", + "art_category_ref": "9008273035360fb4508c320094467351", + "bou_x": "180", + "bou_y": "0", + "bou_width": "50", + "bou_height": "0", + "bou_container": "" + }, + { + "art_uid": "9008273035360fb4508c320094467351", + "art_type": "VERTICAL_LINE", + "art_name": "linea ejemplo", + "art_category_ref": "9008273035360fb4508c320094467351", + "bou_x": "420", + "bou_y": "0", + "bou_width": "50", + "bou_height": "0", + "bou_container": "" + }, + { + "art_uid": "9008273035360fb4508c320094467351", + "art_type": "VERTICAL_LINE", + "art_name": "linea ejemplo", + "art_category_ref": "9008273035360fb4508c320094467351", + "bou_x": "660", + "bou_y": "0", + "bou_width": "50", + "bou_height": "0", + "bou_container": "" + }, + { + "art_uid": "9008273035360fb4508c320094467351", + "art_type": "VERTICAL_LINE", + "art_name": "linea ejemplo", + "art_category_ref": "9008273035360fb4508c320094467351", + "bou_x": "900", + "bou_y": "0", + "bou_width": "50", + "bou_height": "0", + "bou_container": "" + } + ], "laneset": [], "lanes": [] }