diff --git a/features/backend/admin_setup/category/main_tests_category.feature b/features/backend/admin_setup/category/main_tests_category.feature index c45908880..f8bb9a60b 100644 --- a/features/backend/admin_setup/category/main_tests_category.feature +++ b/features/backend/admin_setup/category/main_tests_category.feature @@ -25,7 +25,7 @@ Scenario: Get a Category specific And the type is "array" And the "cat_uid" property equals "4177095085330818c324501061677193" And the "cat_name" property equals "Category Cases Lists" - And the "cat_total_processes" property equals 5 + And the "cat_total_processes" property equals 6 Scenario Outline: Create a new Categories @@ -134,4 +134,4 @@ Scenario: Get a Category specific And the type is "array" And the "cat_uid" property equals "4177095085330818c324501061677193" And the "cat_name" property equals "Category Cases Lists" - And the "cat_total_processes" property equals 5 \ No newline at end of file + And the "cat_total_processes" property equals 6 \ No newline at end of file diff --git a/features/backend/admin_setup/pm_tables/basic_sequence_pm_tables.feature b/features/backend/admin_setup/pm_tables/basic_sequence_pm_tables.feature index 89bf37536..b30e8242c 100644 --- a/features/backend/admin_setup/pm_tables/basic_sequence_pm_tables.feature +++ b/features/backend/admin_setup/pm_tables/basic_sequence_pm_tables.feature @@ -66,8 +66,9 @@ Scenario Outline: Create new pmtable Examples: - | test_description | pmt_uid_number | pmt_tab_name | pmt_tab_dsc | - | Create pmtable with fields defined | 1 | PMT_Test_QA | pmt table created with script | + | test_description | pmt_uid_number | pmt_tab_name | pmt_tab_dsc | + | Create pmtable with fields defined | 1 | PMT_Test_QA | pmt table created with script | + | Create pmtable for test data | 2 | PMT_DAT_QA | pmt para realizar el testeo del borrado del data | Scenario Outline: Create a new Data of pm table. @@ -88,6 +89,42 @@ Scenario Outline: Create a new Data of pm table. | pmt_uid_number | | 1 | + | 2 | + + +Scenario Outline: Update a a data of pm table + Given PUT this data: + """ + { + "CAMPO1" : "valor1", + "CAMPO2" : "updatevalor2" + } + """ + And that I want to update a "PM Table" + And I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | pmt_uid_number | + | 1 | + + +Scenario Outline: Get data of the PMTABLE + Given I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" + 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 "object" + And that "CAMPO1" is set to "valor1" + And that "CAMPO2" is set to "updatevalor2" + + Examples: + + | pmt_uid_number | + | 1 | Scenario Outline: Update a pm table of a project @@ -136,49 +173,63 @@ Examples: | 1 | -Scenario Outline: Update a a data of pm table - Given PUT this data: - """ - { - "CAMPO1" : "valor1", - "CAMPO2" : "updatevalor2" - } - """ - And that I want to update a "PM Table" - And I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" - And the content type is "application/json" - Then the response status code should be 200 - And the response charset is "UTF-8" - - Examples: - - | pmt_uid_number | - | 1 | - - -Scenario Outline: Get data of the PMTABLE - Given I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" - 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 "object" - And that "CAMPO1" is set to "valor1" - And that "CAMPO2" is set to "updatevalor2" - - Examples: - - | pmt_uid_number | - | 1 | - Scenario: Get the PMTABLE List when there are exactly ONE pmtables in this workspace Given I request "pmtable" 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 2 records + And the response has 3 records +#Test delete of Data + +Scenario Outline: Update a pm table of a project + Given PUT this data: + """ + { + "rep_tab_dsc" : "descripcion de la tabla", + "fields" : [ + { + "fld_key" : 1, + "fld_name" : "UPDATECAMPO", + "fld_label" : "UPDATECAMPO", + "fld_type" : "VARCHAR", + "fld_size" : 200 + + } + ] + } + """ + And that I want to update a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And I request "pmtable" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | pmt_uid_number | + | 2 | + + +Scenario Outline: Get a single the PMTABLE after update + Given that I want to get a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And I request "pmtable" + 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 "object" + And the response has 0 records + +Examples: + + | pmt_uid_number | + | 2 | + + +#Delete PM Tables + Scenario Outline: Delete a pm table of a pmtable Given that I want to delete a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" And I request "pmtable" @@ -191,20 +242,7 @@ Scenario Outline: Delete a pm table of a pmtable | pmt_uid_number | | 1 | - - -Scenario Outline: Delete a data of a pmtable - Given that I want to delete a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" - And I request "pmtable//data/CAMPO1/valor1" - 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" - - Examples: - - | pmt_uid_number | - | 1 | + | 2 | Scenario: Get the PMTABLE List when there are exactly ONE pmtables in this workspace diff --git a/features/backend/admin_setup/pm_tables/main_tests_pm_tables.feature b/features/backend/admin_setup/pm_tables/main_tests_pm_tables.feature index 61bd92da3..2bc2bf06b 100644 --- a/features/backend/admin_setup/pm_tables/main_tests_pm_tables.feature +++ b/features/backend/admin_setup/pm_tables/main_tests_pm_tables.feature @@ -113,13 +113,13 @@ Scenario Outline: Create new pmtable with type date and char | Create pmtable with type date | 2 | -Scenario Outline: Create a new Data of pm table. +Scenario Outline: Create a new Data of pm table Given POST this data: """ { - "UNO" : "", - "CAMPO1" : "QA", - "CAMPO2" : "" + "UNO" : "QA11", + "DOS" : "QA22", + "TRES" : "QA33" } """ And I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" @@ -130,14 +130,51 @@ Scenario Outline: Create a new Data of pm table. Examples: - | pmt_uid_number | CAMPO2 | - | 1 | DEV1 | - | 2 | DEV2 | - | 3 | DEV3 | - | 4 | DEV4 | - | 5 | DEV5 | - | 6 | DEV6 | - | 7 | DEV7 | + | pmt_uid_number | + | 1 | + | 4 | + | 5 | + | 6 | + + +Scenario Outline: Update a a data of pm table + Given PUT this data: + """ + { + "UNO" : "QA11", + "DOS" : "UPDATE QA22", + "TRES" : "UPDATE QA33" + } + """ + And that I want to update "PM Table" + And I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | pmt_uid_number | + | 1 | + | 4 | + | 6 | + + +Scenario Outline: Get data of the PMTABLE + Given I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" + 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 "object" + And that "CAMPO1" is set to "QA" + And that "CAMPO2" is set to "CAMPO2" + + Examples: + + | pmt_uid_number | CAMPO2 | + | 1 | UPDATE QA11 | + | 4 | UPDATE QA22 | + | 6 | UPDATE QA33 | Scenario Outline: Update a pm table of a project @@ -189,55 +226,80 @@ Scenario Outline: Get a single the PMTABLE after update | 6 | UPDATESEIS | UPDATESEIS | VARCHAR | - -Scenario Outline: Update a a data of pm table - Given PUT this data: - """ - { - "UNO" : "", - "CAMPO1" : "QA", - "CAMPO2" : "" - } - """ - And that I want to update "PM Table" - And I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" - And the content type is "application/json" - Then the response status code should be 200 - And the response charset is "UTF-8" - - Examples: - - | pmt_uid_number | CAMPO2 | - | 1 | UPDATEQA2 | - | 4 | UPDATEQA4 | - | 6 | UPDATEQA6 | - - -Scenario Outline: Get data of the PMTABLE - Given I request "pmtable/pmt_uid/data" with the key "pmt_uid" stored in session array as variable "pmt_uid_" - 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 "object" - And that "CAMPO1" is set to "QA" - And that "CAMPO2" is set to "CAMPO2" - - Examples: - - | pmt_uid_number | CAMPO2 | - | 1 | UPDATEQA2 | - | 4 | UPDATEQA4 | - | 6 | UPDATEQA6 | - - Scenario: Get the PMTABLE List when there are exactly two pmtables in this workspace Given I request "pmtable" 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 2 records + And the response has 8 records +#Test Delete of data + +Scenario Outline: Update a pm table of a project + Given PUT this data: + """ + { + "rep_tab_dsc" : "descripcion de la tabla", + "fields" : [ + { + "fld_key" : 1, + "fld_name" : "", + "fld_label" : "", + "fld_type" : "", + "fld_size" : 200 + } + ] + } + """ + And that I want to update a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And I request "pmtable" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | Description | pmt_uid_number | fld_name | fld_label | fld_type | + | Update a pmtable 1 | 4 | UPDATEUNO | UPDATEUNO | VARCHAR | + | Update a pmtable 3 | 5 | UPDATETRES | UPDATETRES | VARCHAR | + | Update a pmtable 6 | 7 | UPDATESEIS | UPDATESEIS | VARCHAR | + + +Scenario Outline: Get a single the PMTABLE after update + Given that I want to get a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And I request "pmtable" + 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 "object" + And that "fld_name" is set to "" + And that "fld_label" is set to "" + And that "fld_type" is set to "" + + Examples: + + | pmt_uid_number | fld_name | fld_label | fld_type | + | 4 | UPDATEUNO | UPDATEUNO | VARCHAR | + | 5 | UPDATETRES | UPDATETRES | VARCHAR | + | 7 | UPDATESEIS | UPDATESEIS | VARCHAR | + + +Scenario Outline: Get a single the PMTABLE after update + Given that I want to get a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" + And I request "pmtable" + 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 "object" + And the response has 0 records + + Examples: + + | pmt_uid_number | + | 4 | + | 5 | + | 7 | Scenario Outline: Delete a pm table of a pmtable Given that I want to delete a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" @@ -259,20 +321,6 @@ Scenario Outline: Delete a pm table of a pmtable | 7 | -Scenario Outline: Delete a data of a pmtable - Given that I want to delete a resource with the key "pmt_uid" stored in session array as variable "pmt_uid_" - And I request "pmtable//data/CAMPO1/QA" - 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" - - Examples: - - | pmt_uid_number | - | 1 | - - Scenario: Get the PMTABLE List when there are exactly ONE pmtables in this workspace Given I request "pmtable" Then the response status code should be 200 diff --git a/features/backend/admin_setup/pm_tables/negative_tests_pm_tables.feature b/features/backend/admin_setup/pm_tables/negative_tests_pm_tables.feature index 51bf2cac9..17a20f7e2 100644 --- a/features/backend/admin_setup/pm_tables/negative_tests_pm_tables.feature +++ b/features/backend/admin_setup/pm_tables/negative_tests_pm_tables.feature @@ -44,8 +44,8 @@ Scenario Outline: Create news pmtable (Negative Test) "fld_name" : "", "fld_label" : "", "fld_type" : "", - "fld_size" : "" - }, + "fld_size" : + } ] } """ @@ -55,11 +55,31 @@ Scenario Outline: Create news pmtable (Negative Test) Examples: - | test_description | pmt_tab_name | pmt_tab_dsc | fld_name | fld_label | fld_type | fld_size | fld_name | fld_label | fld_type | fld_size | fld_name | fld_label | fld_type | fld_size | error_code | error_message | - | Required pmt_tab_name | | pmt table 1 | UNO | UNO | VARCHAR | 32 | DOS | DOS | BIGINT | | TRES | TRES | BOOLEAN | | 400 | pmt_tab_name | - | Required pmt_tab_dsc | PMT_Test_QA2 | | UNO | UNO | VARCHAR | 32 | DOS | DOS | CHAR | | TRES | TRES | DATE | | 400 | pmt_tab_dsc | - | Required fld_name | PMT_Test_QA3 | pmt table 3 | | UNO | VARCHAR | 32 | DOS | DOS | DATETIME | | TRES | TRES | DECIMAL | | 400 | fld_name | - | Required fld_label | PMT_Test_QA4 | pmt table 4 | UNO | | VARCHAR | 32 | DOS | DOS | DOUBLE | | TRES | TRES | FLOAT | | 400 | fld_label | - | Required fld_type | PMT_Test_QA5 | pmt table 5 | UNO | UNO | VARCHAR | 32 | DOS | DOS | | | TRES | TRES | LONGVARCHAR | | 400 | fld_type | - | Invalid fld_size | PMT_Test_QA6 | pmt table 6 | UNO | UNO | VARCHAR | sample | DOS | DOS | REAL | samke | TRES | TRES | SMALLINT | task | 400 | fld_size | - | Invalid fld_type | PMT_Test_QA7 | pmt table 7 | UNO | UNO | 123 | 32 | DOS | DOS | 1234 | | TRES | TRES | 457,777 | | 400 | fld_type | \ No newline at end of file + | test_description | pmt_tab_name | pmt_tab_dsc | fld_name | fld_label | fld_type | fld_size | error_code | error_message | + | Required pmt_tab_name | | pmt table 1 | UNO | UNO | VARCHAR | 32 | 400 | pmt_tab_name | + | Required fld_name | PMT_Test_QA3 | pmt table 3 | | UNO | VARCHAR | 32 | 400 | fld_name | + | Required fld_label | PMT_Test_QA4 | pmt table 4 | UNO | | VARCHAR | 32 | 400 | fld_label | + | Required fld_type | PMT_Test_QA5 | pmt table 5 | UNO | UNO | | 32 | 400 | fld_type | + | Invalid fld_type | PMT_Test_QA7 | pmt table 7 | UNO | UNO | 123 | 32 | 400 | fld_type | + + +Scenario: Create news pmtable (Negative Test) + Given POST this data: + """ + { + "pmt_tab_name" : "", + "pmt_tab_dsc" : "", + "fields" : [ + { + "fld_key" : 1, + "fld_name" : "UNO", + "fld_label" : "UNO", + "fld_type" : "VARCHAR", + "fld_size" : "sample" + } + ] + } + """ + And I request "pmtable" + Then the response status code should be 400 + And the response status message should have the following text "fld_size" \ No newline at end of file diff --git a/features/backend/application_cases/case_actions/main_tests_cases_actions.feature b/features/backend/application_cases/case_actions/main_tests_cases_actions.feature index c787d165a..792a6f019 100644 --- a/features/backend/application_cases/case_actions/main_tests_cases_actions.feature +++ b/features/backend/application_cases/case_actions/main_tests_cases_actions.feature @@ -238,7 +238,6 @@ Scenario Outline: Route a case to the next task in the process Given PUT this data: """ { - "case_uid": "", "del_index": "1" } """ diff --git a/features/backend/projects/project/main_tests_project_resources.feature b/features/backend/projects/project/main_tests_project_resources.feature index 44b1d74e9..639b60649 100644 --- a/features/backend/projects/project/main_tests_project_resources.feature +++ b/features/backend/projects/project/main_tests_project_resources.feature @@ -52,7 +52,7 @@ Scenario Outline: Create new Projects with same name (negative test) Given POST data from file "" And I request "projects" Then the response status code should be 400 - And the response status message should have the following text "" + And the response status message should have the following text "already exists" Examples: diff --git a/features/backend/projects/project/negative_tests_project_resources.feature b/features/backend/projects/project/negative_tests_project_resources.feature index c0afec2b0..69f909bb2 100644 --- a/features/backend/projects/project/negative_tests_project_resources.feature +++ b/features/backend/projects/project/negative_tests_project_resources.feature @@ -207,7 +207,6 @@ Scenario Outline: Create new Projects (Negative Tests) | Description | prj_name | prj_description | act_name | act_type | evn_name | evn_marker | error_code | error_message | | Field required prj_name | | Prueba | Task # 1 | TASK | End # 1 | EMPTY | 400 | prj_name | - | Field required prj_description | Test negative project 1 | | Task # 1 | TASK | End # 1 | EMPTY | 400 | prj_description | | Field required act_name | Test negative project 2 | Prueba 1 | | TASK | End # 1 | EMPTY | 400 | act_name | | Field required act_type | Test negative project 3 | Prueba 2 | Task # 1 | | End # 1 | EMPTY | 400 | act_type | | Field required evn_name | Test negative project 4 | Prueba 3 | Task # 1 | TASK | | EMPTY | 400 | evn_name | 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 new file mode 100644 index 000000000..437a9efbd --- /dev/null +++ b/features/backend/projects/project_export_import/main_tests_project_export_import.feature @@ -0,0 +1,383 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Import/Export Process Main Tests + Requirements: + a workspace without the project 1455892245368ebeb11c1a5001393784 ("Process Complete BPMN") 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. + +Scenario: Get a List DynaForms of a Project Process Complete BPMN + Given I request "project/1455892245368ebeb11c1a5001393784/dynaforms" + 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 26 records + + Scenario: Get the Input Documents List when there are exactly zero input documents + Given I request "project/1455892245368ebeb11c1a5001393784/input-documents" + 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 records + +Scenario: Get the Output Documents List when there are exactly two output documents + Given I request "project/1455892245368ebeb11c1a5001393784/output-documents" + 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 1 records + +Scenario: Get the Triggers List when there are exactly two triggers + Given I request "project/1455892245368ebeb11c1a5001393784/triggers" + 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 3 records + +Scenario Outline: List assignees of each activity + Given I request "project/1455892245368ebeb11c1a5001393784/activity//assignee" + 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 records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | test_description | project | activity | records | aas_uid | aas_type | + | Verify that the activity has expected quantity of asignees | 1455892245368ebeb11c1a5001393784 | 6274755055368eed1116388064384542 | 1 | 70084316152d56749e0f393054862525 | group | + | Verify that the activity has expected quantity of asignees | 1455892245368ebeb11c1a5001393784 | 4790702485368efad167477011123879 | 1 | 70084316152d56749e0f393054862525 | group | + +Scenario: Get a List of current process supervisors of a project + Given I request "project/1455892245368ebeb11c1a5001393784/process-supervisors" + 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 1 records + +Scenario: Get a List of current Process Permissions of a project + Given I request "project/1455892245368ebeb11c1a5001393784/process-permissions" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has 1 record + +Scenario: Get a list templates folder of process files manager + Given I request "project/1455892245368ebeb11c1a5001393784/file-manager?path=templates" + 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 1 records + +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" + 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" + And that "pro_title" is set to "Process Complete BPMN" + And that "pro_description" is set to "" + And that "pro_parent" is set to "1455892245368ebeb11c1a5001393784" + And that "pro_time" is set to 1 + And that "pro_timeunit" is set to "DAYS" + And that "pro_status" is set to "ACTIVE" + And that "pro_type_day" is set to "" + And that "pro_type" is set to "NORMAL" + And that "pro_assignment" is set to 0 + And that "pro_show_map" is set to 0 + And that "pro_show_message" is set to 1 + And that "pro_subprocess" is set to 0 + And that "pro_tri_deleted" is set to "712197294536bea56a8b4d0014148679" + And that "pro_tri_canceled" is set to "950769923536bea6a39c833033416052" + And that "pro_tri_paused" is set to "350949312536bea73c53791057971272" + And that "pro_tri_reassigned" is set to "712197294536bea56a8b4d0014148679" + And that "pro_show_delegate" is set to 0 + And that "pro_show_dynaform" is set to 0 + And that "pro_category" is set to "4177095085330818c324501061677193" + And that "pro_sub_category" is set to "" + And that "pro_industry" is set to 0 + And that "pro_update_date" is set to "null" + And that "pro_create_date" is set to "2014-05-06 10:04:27" + And that "pro_create_user" is set to "00000000000000000000000000000001" + And that "pro_debug" is set to 0 + And that "pro_derivation_screen_tpl" is set to "" + And that "pro_summary_dynaform" is set to "898822326536be3a12addb0034537553" + And that "pro_calendar" is set to "14606161052f50839307899033145440" + +#Import Process + +Scenario Outline: Import a process + Given POST upload a project file "" to "project/import?option=" + 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" + And store "prj_uid" in session array as variable "prj_uid_" + + + 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 | + + +#Verificar cantidad de dynaform, output, inputs, triggers, asignacion de usuarios, etc. + +Scenario Outline: Get a List DynaForms of a Project Process Complete BPMN + Given I request "project/prj_uid/dynaforms" with the key "prj_uid" stored in session array as variable "prj_uid_" + 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 records + + 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 | + + +Scenario Outline: Get the Input Documents List when there are exactly zero input documents + Given I request "project/prj_uid/input-documents" with the key "prj_uid" stored in session array as variable "prj_uid_" + 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 records + + 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 | + + +Scenario Outline: Get the Output Documents List when there are exactly two output documents + Given I request "project/prj_uid/output-documents" with the key "prj_uid" stored in session array as variable "prj_uid_" + 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 records + + 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 | + + +Scenario Outline: Get the Triggers List when there are exactly two triggers + Given I request "project/prj_uid/triggers" with the key "prj_uid" stored in session array as variable "prj_uid_" + 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 records + + 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 | + + +Scenario Outline: List assignees of each activity + Given I request "project/prj_uid/activity//assignee" with the key "prj_uid" stored in session array as variable "prj_uid_" + 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 records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + 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 | + + +Scenario Outline: Get a List of current process supervisors of a project + Given I request "project/prj_uid/process-supervisors" with the key "prj_uid" stored in session array as variable "prj_uid_" + 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 records + + 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 | + + +Scenario Outline: Get a List of current Process Permissions of a project + Given I request "project/prj_uid/process-permissions" with the key "prj_uid" stored in session array as variable "prj_uid_" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the response has records + + 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 | + + +Scenario Outline: Get a list templates folder of process files manager + Given I request "project/prj_uid/file-manager?path=templates" with the key "prj_uid" stored in session array as variable "prj_uid_" + 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 records + + 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 | + + +Scenario: Get a single Process process "Process Complete BPMN" + Given that I want to get a resource with the key "obj_uid" stored in session array + And I request "project/1455892245368ebeb11c1a5001393784/process" + 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" + And that "pro_title" is set to "Process Complete BPMN" + And that "pro_description" is set to "" + And that "pro_parent" is set to "1455892245368ebeb11c1a5001393784" + And that "pro_time" is set to 1 + And that "pro_timeunit" is set to "DAYS" + And that "pro_status" is set to "ACTIVE" + And that "pro_type_day" is set to "" + And that "pro_type" is set to "NORMAL" + And that "pro_assignment" is set to 0 + And that "pro_show_map" is set to 0 + And that "pro_show_message" is set to 1 + And that "pro_subprocess" is set to 0 + And that "pro_tri_deleted" is set to "712197294536bea56a8b4d0014148679" + And that "pro_tri_canceled" is set to "950769923536bea6a39c833033416052" + And that "pro_tri_paused" is set to "350949312536bea73c53791057971272" + And that "pro_tri_reassigned" is set to "712197294536bea56a8b4d0014148679" + And that "pro_show_delegate" is set to 0 + And that "pro_show_dynaform" is set to 0 + And that "pro_category" is set to "4177095085330818c324501061677193" + And that "pro_sub_category" is set to "" + And that "pro_industry" is set to 0 + And that "pro_update_date" is set to "null" + And that "pro_create_date" is set to "2014-05-06 10:04:27" + And that "pro_create_user" is set to "00000000000000000000000000000001" + And that "pro_debug" is set to 0 + And that "pro_derivation_screen_tpl" is set to "" + And that "pro_summary_dynaform" is set to "898822326536be3a12addb0034537553" + And that "pro_calendar" is set to "14606161052f50839307899033145440" + + +Scenario: Get a single Process process "Process NewCreate BPMN" + Given that I want to get a resource with the key "obj_uid" stored in session array + And I request "project/601816709536cfeae7d7cd9079578104/process" + 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" + And that "pro_title" is set to "Process NewCreate BPMN" + And that "pro_description" is set to "" + And that "pro_parent" is set to "601816709536cfeae7d7cd9079578104" + And that "pro_time" is set to 1 + And that "pro_timeunit" is set to "DAYS" + And that "pro_status" is set to "ACTIVE" + And that "pro_type_day" is set to "" + And that "pro_type" is set to "NORMAL" + And that "pro_assignment" is set to 0 + And that "pro_show_map" is set to 0 + And that "pro_show_message" is set to 0 + And that "pro_subprocess" is set to 0 + And that "pro_tri_deleted" is set to "" + And that "pro_tri_canceled" is set to "" + And that "pro_tri_paused" is set to "" + And that "pro_tri_reassigned" is set to "" + And that "pro_show_delegate" is set to 0 + And that "pro_show_dynaform" is set to 0 + And that "pro_category" is set to "" + And that "pro_sub_category" is set to "" + And that "pro_industry" is set to 0 + And that "pro_update_date" is set to "null" + And that "pro_create_date" is set to "2014-05-12 09:10:23" + And that "pro_create_user" is set to "00000000000000000000000000000001" + And that "pro_debug" is set to 0 + And that "pro_derivation_screen_tpl" is set to "" + And that "pro_summary_dynaform" is set to "" + And that "pro_calendar" is set to "" + + +Scenario Outline: 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 as variable "prj_uid_" + And I request "projects" + 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" + + Examples: + + | prj_uid_number | + | 1 | + | 2 | + | 3 | + | 4 | + + +Scenario: Get a list of projects + Given I request "project" + 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" + + +Scenario Outline: Import a process + Given POST upload a project file "" to "project/import?option=" + 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" + + Examples: + | project_file | import_option | + | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create | + \ No newline at end of file diff --git a/features/backend/projects/project_export_import/negative_tests_project_export_import.feature b/features/backend/projects/project_export_import/negative_tests_project_export_import.feature new file mode 100644 index 000000000..96cfb2e2c --- /dev/null +++ b/features/backend/projects/project_export_import/negative_tests_project_export_import.feature @@ -0,0 +1,16 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Import/Export Process Negative Tests + + Background: + Given that I have a valid access_token + +Scenario Outline: Import a process negative tests + Given POST upload a project file "" to "project/import?option=" + Then the response status code should be + And the response status message should have the following text "" + + + Examples: + | Description | project_file | import_option | error_code | error_message | + | Import process when the process alredy exists | /home/wendy/uploadfiles/Process_Complete_BPMN.pmx | create | 400 | already exists | + #| Invalid path | /processmaker/sample/Project_invalido.pmx | create | 400 | invalid | \ No newline at end of file diff --git a/features/backend/projects/step/basic_sequence_step.feature b/features/backend/projects/step/basic_sequence_step.feature index e10e6113e..d84468353 100644 --- a/features/backend/projects/step/basic_sequence_step.feature +++ b/features/backend/projects/step/basic_sequence_step.feature @@ -174,7 +174,7 @@ Feature: Project Properties - Step Resources And POST this data: """ { - "tri_uid": "81919273152cd636c665080083928728", + "tri_uid": "1912812215371196449bf84008215531", "st_type": "BEFORE", "st_condition": "", "st_position": 1 @@ -215,7 +215,7 @@ Feature: Project Properties - Step Resources } """ And that I want to update a resource with the key "tgr1" stored in session array - And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger/81919273152cd636c665080083928728" + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger/1912812215371196449bf84008215531" And the content type is "application/json" Then the response status code should be 200 And the response charset is "UTF-8" @@ -247,7 +247,7 @@ Feature: Project Properties - Step Resources Then the response status code should be 200 And the response charset is "UTF-8" And the type is "array" - And the "tri_uid" property in row 0 equals "57401970252cd6393531551040242546" + And the "tri_uid" property in row 0 equals "91825536453711c35b042f3058715506" And the "tri_title" property in row 0 equals "Trigger Demo3" And the "tri_description" property in row 0 equals "Description" And the "tri_type" property in row 0 equals "SCRIPT" @@ -258,12 +258,12 @@ Feature: Project Properties - Step Resources # Get a single Trigger assigned to a Step Scenario: Get a single Trigger "Trigger Demo1" assigned to first Step of "Task2" Given that I have a valid access_token - And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger/81919273152cd636c665080083928728/before" + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger/1912812215371196449bf84008215531/before" 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" - And that "tri_uid" is set to "81919273152cd636c665080083928728" + And that "tri_uid" is set to "1912812215371196449bf84008215531" And that "tri_title" is set to "Trigger Demo1" And that "tri_description" is set to "Description" And that "st_type" is set to "BEFORE" @@ -275,7 +275,7 @@ Feature: Project Properties - Step Resources Scenario: Remove "Trigger Demo1" assigned to first Step of "Task2" Given that I have a valid access_token And that I want to delete a resource with the key "tgr1" stored in session array - And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger/81919273152cd636c665080083928728/before" + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger/1912812215371196449bf84008215531/before" And the content type is "application/json" Then the response status code should be 200 And the response charset is "UTF-8" @@ -321,7 +321,7 @@ Feature: Project Properties - Step Resources And POST this data: """ { - "tri_uid": "81919273152cd636c665080083928728", + "tri_uid": "1912812215371196449bf84008215531", "st_type": "BEFORE_ASSIGNMENT", "st_condition": "", "st_position": 1 @@ -362,7 +362,7 @@ Feature: Project Properties - Step Resources } """ And that I want to update a resource with the key "tgr1" stored in session array - And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/81919273152cd636c665080083928728" + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/1912812215371196449bf84008215531" And the content type is "application/json" Then the response status code should be 200 And the response charset is "UTF-8" @@ -394,7 +394,7 @@ Feature: Project Properties - Step Resources Then the response status code should be 200 And the response charset is "UTF-8" And the type is "array" - And the "tri_uid" property in row 0 equals "57401970252cd6393531551040242546" + And the "tri_uid" property in row 0 equals "91825536453711c35b042f3058715506" And the "tri_title" property in row 0 equals "Trigger Demo3" And the "tri_description" property in row 0 equals "Description" And the "tri_type" property in row 0 equals "SCRIPT" @@ -405,12 +405,12 @@ Feature: Project Properties - Step Resources # Get a single Trigger assigned to a Step Scenario: Get a single Trigger "Trigger Demo1" assigned to Step "Assign Task" of "Task2" Given that I have a valid access_token - And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/81919273152cd636c665080083928728/before-assignment" + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/1912812215371196449bf84008215531/before-assignment" 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" - And that "tri_uid" is set to "81919273152cd636c665080083928728" + And that "tri_uid" is set to "1912812215371196449bf84008215531" And that "tri_title" is set to "Trigger Demo1" And that "tri_description" is set to "Description" And that "st_type" is set to "BEFORE_ASSIGNMENT" @@ -422,7 +422,7 @@ Feature: Project Properties - Step Resources Scenario: Remove "Trigger Demo1" assigned to Step "Assign Task" of "Task2" Given that I have a valid access_token And that I want to delete a resource with the key "tgr1" stored in session array - And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/81919273152cd636c665080083928728/before-assignment" + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/trigger/1912812215371196449bf84008215531/before-assignment" And the content type is "application/json" Then the response status code should be 200 And the response charset is "UTF-8" diff --git a/features/backend/projects/step/main_tests_step.feature b/features/backend/projects/step/main_tests_step.feature index 309599cc6..ab4bea18c 100644 --- a/features/backend/projects/step/main_tests_step.feature +++ b/features/backend/projects/step/main_tests_step.feature @@ -199,43 +199,43 @@ Feature: Project Properties - Step Resources Main Tests Examples: | test_description | project | activity | step_number | tri_uid_number | tri_uid | st_type | st_condition | st_position | - | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 1 | 81919273152cd636c665080083928728 | BEFORE | | 1 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 1 | 1912812215371196449bf84008215531 | BEFORE | | 1 | | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 2 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | - | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 3 | 57401970252cd6393531551040242546 | BEFORE | | 3 | - | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 4 | 81919273152cd636c665080083928728 | AFTER | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 3 | 91825536453711c35b042f3058715506 | BEFORE | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 4 | 1912812215371196449bf84008215531 | AFTER | | 1 | | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 5 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | - | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 6 | 57401970252cd6393531551040242546 | AFTER | | 3 | - | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 7 | 81919273152cd636c665080083928728 | BEFORE | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 6 | 91825536453711c35b042f3058715506 | AFTER | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 7 | 1912812215371196449bf84008215531 | BEFORE | | 1 | | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 8 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | - | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 9 | 57401970252cd6393531551040242546 | BEFORE | | 3 | - | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 10 | 81919273152cd636c665080083928728 | AFTER | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 9 | 91825536453711c35b042f3058715506 | BEFORE | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 10 | 1912812215371196449bf84008215531 | AFTER | | 1 | | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 11 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | - | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 12 | 57401970252cd6393531551040242546 | AFTER | | 3 | - | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 13 | 81919273152cd636c665080083928728 | BEFORE | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 12 | 91825536453711c35b042f3058715506 | AFTER | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 13 | 1912812215371196449bf84008215531 | BEFORE | | 1 | | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 14 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | - | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 15 | 57401970252cd6393531551040242546 | BEFORE | | 3 | - | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 16 | 81919273152cd636c665080083928728 | AFTER | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 15 | 91825536453711c35b042f3058715506 | BEFORE | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 16 | 1912812215371196449bf84008215531 | AFTER | | 1 | | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 17 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | - | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 18 | 57401970252cd6393531551040242546 | AFTER | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 19 | 81919273152cd636c665080083928728 | BEFORE | | 1 | + | Trigger assigned to Task 1 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 18 | 91825536453711c35b042f3058715506 | AFTER | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 19 | 1912812215371196449bf84008215531 | BEFORE | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 20 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 21 | 57401970252cd6393531551040242546 | BEFORE | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 22 | 81919273152cd636c665080083928728 | AFTER | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 21 | 91825536453711c35b042f3058715506 | BEFORE | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 22 | 1912812215371196449bf84008215531 | AFTER | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 23 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 24 | 57401970252cd6393531551040242546 | AFTER | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 25 | 81919273152cd636c665080083928728 | BEFORE | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 24 | 91825536453711c35b042f3058715506 | AFTER | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 25 | 1912812215371196449bf84008215531 | BEFORE | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 26 | 56359776552cd6378b38e47080912028 | BEFORE | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 27 | 57401970252cd6393531551040242546 | BEFORE | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 28 | 81919273152cd636c665080083928728 | AFTER | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 27 | 91825536453711c35b042f3058715506 | BEFORE | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 28 | 1912812215371196449bf84008215531 | AFTER | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 29 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 30 | 57401970252cd6393531551040242546 | AFTER | | 3 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 30 | 91825536453711c35b042f3058715506 | AFTER | | 3 | Scenario: Trigger assigned to the step when it was already assigned Given POST this data: """ { - "tri_uid": "81919273152cd636c665080083928728", + "tri_uid": "1912812215371196449bf84008215531", "st_type": "BEFORE", "st_condition": "", "st_position": "1" @@ -256,8 +256,8 @@ Scenario: Trigger assigned to the step when it was already assigned Examples: | project | tri_uid | - | 16062437052cd6141881e06088349078 | 81919273152cd636c665080083928728 | - | 16062437052cd6141881e06088349078 | 57401970252cd6393531551040242546 | + | 16062437052cd6141881e06088349078 | 1912812215371196449bf84008215531 | + | 16062437052cd6141881e06088349078 | 91825536453711c35b042f3058715506 | Scenario Outline: List available Triggers for each assigned step @@ -298,9 +298,9 @@ Scenario: Trigger assigned to the step when it was already assigned Examples: | test_description | project | activity | step |tri_uid_number | step_number | tri_uid | st_type | st_condition | st_position | - | Update st_type, st_condition | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 63293140052cd61b29e21a9056770986 | 1 | 1 | 81919273152cd636c665080083928728 | BEFORE | @@var1 == 1 | 1 | + | Update st_type, st_condition | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 63293140052cd61b29e21a9056770986 | 1 | 1 | 1912812215371196449bf84008215531 | BEFORE | @@var1 == 1 | 1 | | Update st_type, st_condition and st_position | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 63293140052cd61b29e21a9056770986 | 2 | 1 | 56359776552cd6378b38e47080912028 | BEFORE | @@var1 == 2 | 2 | - | Update st_type, st_condition and st_position | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 63293140052cd61b29e21a9056770986 | 3 | 1 | 57401970252cd6393531551040242546 | BEFORE | @@var1 == 1 | 3 | + | Update st_type, st_condition and st_position | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 63293140052cd61b29e21a9056770986 | 3 | 1 | 91825536453711c35b042f3058715506 | BEFORE | @@var1 == 1 | 3 | @@ -318,30 +318,30 @@ Scenario: Trigger assigned to the step when it was already assigned Examples: | test_description | project | activity | step_number | tri_uid_number | tri_uid | st_type | st_condition | st_position | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 1 | 81919273152cd636c665080083928728 | before | | 1 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 1 | 1912812215371196449bf84008215531 | before | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 2 | 56359776552cd6378b38e47080912028 | before | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 3 | 57401970252cd6393531551040242546 | before | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 4 | 81919273152cd636c665080083928728 | after | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 3 | 91825536453711c35b042f3058715506 | before | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 4 | 1912812215371196449bf84008215531 | after | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 5 | 56359776552cd6378b38e47080912028 | after | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 6 | 57401970252cd6393531551040242546 | after | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 7 | 81919273152cd636c665080083928728 | before | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 6 | 91825536453711c35b042f3058715506 | after | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 7 | 1912812215371196449bf84008215531 | before | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 8 | 56359776552cd6378b38e47080912028 | before | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 9 | 57401970252cd6393531551040242546 | before | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 10 | 81919273152cd636c665080083928728 | after | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 9 | 91825536453711c35b042f3058715506 | before | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 10 | 1912812215371196449bf84008215531 | after | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 11 | 56359776552cd6378b38e47080912028 | after | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 12 | 57401970252cd6393531551040242546 | after | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 13 | 81919273152cd636c665080083928728 | before | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | 12 | 91825536453711c35b042f3058715506 | after | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 13 | 1912812215371196449bf84008215531 | before | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 14 | 56359776552cd6378b38e47080912028 | before | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 15 | 57401970252cd6393531551040242546 | before | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 16 | 81919273152cd636c665080083928728 | after | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 15 | 91825536453711c35b042f3058715506 | before | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 16 | 1912812215371196449bf84008215531 | after | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 17 | 56359776552cd6378b38e47080912028 | after | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 18 | 57401970252cd6393531551040242546 | after | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 19 | 81919273152cd636c665080083928728 | before | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 18 | 91825536453711c35b042f3058715506 | after | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 19 | 1912812215371196449bf84008215531 | before | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 20 | 56359776552cd6378b38e47080912028 | before | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 21 | 57401970252cd6393531551040242546 | before | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 22 | 81919273152cd636c665080083928728 | after | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 21 | 91825536453711c35b042f3058715506 | before | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 22 | 1912812215371196449bf84008215531 | after | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 23 | 56359776552cd6378b38e47080912028 | after | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 24 | 57401970252cd6393531551040242546 | after | | 3 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 24 | 91825536453711c35b042f3058715506 | after | | 3 | @@ -355,18 +355,18 @@ Scenario: Trigger assigned to the step when it was already assigned Examples: | test_description | project | activity | step_number | tri_uid_number | tri_uid | st_type | st_condition | st_position | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 13 | 81919273152cd636c665080083928728 | before | | 1 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 13 | 1912812215371196449bf84008215531 | before | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 14 | 56359776552cd6378b38e47080912028 | before | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 15 | 57401970252cd6393531551040242546 | before | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 16 | 81919273152cd636c665080083928728 | after | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 15 | 91825536453711c35b042f3058715506 | before | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 16 | 1912812215371196449bf84008215531 | after | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 17 | 56359776552cd6378b38e47080912028 | after | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 18 | 57401970252cd6393531551040242546 | after | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 19 | 81919273152cd636c665080083928728 | before | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 18 | 91825536453711c35b042f3058715506 | after | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 19 | 1912812215371196449bf84008215531 | before | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 20 | 56359776552cd6378b38e47080912028 | before | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 21 | 57401970252cd6393531551040242546 | before | | 3 | - | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 22 | 81919273152cd636c665080083928728 | after | | 1 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 21 | 91825536453711c35b042f3058715506 | before | | 3 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 22 | 1912812215371196449bf84008215531 | after | | 1 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 23 | 56359776552cd6378b38e47080912028 | after | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 24 | 57401970252cd6393531551040242546 | after | | 3 | + | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 24 | 91825536453711c35b042f3058715506 | after | | 3 | diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 8a0d75205..ba7a8d63a 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1526,6 +1526,21 @@ class RestContext extends BehatContext $this->iRequest($url); + } + + /** + * @Given /^POST upload a project file "([^"]*)" to "([^"]*)"$/ + */ + public function postUploadAProjectFile($file, $url) + { + $postFields = new StdClass(); + $postFields->project_file ='@'.$file; + + $this->_restObjectMethod = 'post'; + $this->_restObject = $postFields; + $this->iRequest($url); + + } diff --git a/workflow/engine/bin/tasks/cliCommon.php b/workflow/engine/bin/tasks/cliCommon.php index 7cd0cd3f5..2e5653d2e 100755 --- a/workflow/engine/bin/tasks/cliCommon.php +++ b/workflow/engine/bin/tasks/cliCommon.php @@ -27,7 +27,7 @@ /* Get the size of the terminal (only works on Linux, on Windows it's always 80) */ preg_match_all("/rows.([0-9]+);.columns.([0-9]+);/", strtolower(exec('stty -a |grep columns')), $output); -if(sizeof($output) == 3) { +if(sizeof($output) == 3 && isset($output[2]) && isset($output[2][0])) { define("COLUMNS", $output[2][0]); } else { define("COLUMNS", 80); diff --git a/workflow/engine/classes/class.processes.php b/workflow/engine/classes/class.processes.php index 8f2a8059d..4dacdf2c2 100755 --- a/workflow/engine/classes/class.processes.php +++ b/workflow/engine/classes/class.processes.php @@ -1719,11 +1719,12 @@ class Processes } } - if (isset($oData->process["PRO_TRI_DELETED"])) { - $oData->process["PRO_TRI_DELETED"] = $map[$oData->process["PRO_TRI_DELETED"]]; - $oData->process["PRO_TRI_CANCELED"] = $map[$oData->process["PRO_TRI_CANCELED"]]; - $oData->process["PRO_TRI_PAUSED"] = $map[$oData->process["PRO_TRI_PAUSED"]]; - $oData->process["PRO_TRI_REASSIGNED"] = $map[$oData->process["PRO_TRI_REASSIGNED"]]; + foreach (array("PRO_TRI_DELETED", "PRO_TRI_CANCELED", "PRO_TRI_PAUSED", "PRO_TRI_REASSIGNED") as $value) { + $key = $value; + + if (isset($map[$oData->process[$key]])) { + $oData->process[$key] = $map[$oData->process[$key]]; + } } } @@ -3623,7 +3624,8 @@ class Processes $this->createProcessCategoryRow( isset( $oData->processCategory ) ? $oData->processCategory : null ); // create the process - //$this->createProcessRow( $oData->process ); + $this->createProcessRow($oData->process); + $this->createTaskRows( $oData->tasks ); //it was commented becuase it seems to be working fine //$this->createEventRows(isset($oData->event) ? $oData->event : array()); diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 515b71a74..efca30abf 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -96,6 +96,13 @@ class workspaceTools $stop = microtime(true); $final = $stop - $start; CLI::logging("<*> Backup log files Process took $final seconds.\n"); + + $start = microtime(true); + CLI::logging("> check Mafe Requirements...\n"); + $this->checkMafeRequirements($workSpace, $lang); + $stop = microtime(true); + $final = $stop - $start; + CLI::logging("<*> Check Mafe Requirements Process took $final seconds.\n"); } /** @@ -1440,5 +1447,44 @@ class workspaceTools } } } + + public function checkMafeRequirements ($workspace,$lang) { + $this->initPropel(true); + $pmRestClient = OauthClientsPeer::retrieveByPK('x-pm-local-client'); + if (empty($pmRestClient)) { + if (is_file(PATH_DATA . 'sites/' . $workspace . '/' . '.server_info')) { + $SERVER_INFO = file_get_contents(PATH_DATA . 'sites/' . $workspace . '/'.'.server_info'); + $SERVER_INFO = unserialize($SERVER_INFO); + + $envFile = PATH_CONFIG . 'env.ini'; + $skin ='neoclassic'; + if (file_exists($envFile) ) { + $sysConf = System::getSystemConfiguration($envFile); + $lang = $sysConf['default_lang']; + $skin = $sysConf['default_skin']; + } + + $endpoint = sprintf( + '%s/sys%s/%s/%s/oauth2/grant', + $SERVER_INFO['HTTP_ORIGIN'], + $workspace, + $lang, + $skin + ); + + $oauthClients = new OauthClients(); + $oauthClients->setClientId('x-pm-local-client'); + $oauthClients->setClientSecret('179ad45c6ce2cb97cf1029e212046e81'); + $oauthClients->setClientName('PM Web Designer'); + $oauthClients->setClientDescription('ProcessMaker Web Designer App'); + $oauthClients->setClientWebsite('www.processmaker.com'); + $oauthClients->setRedirectUri($endpoint); + $oauthClients->save(); + } else { + eprintln("WARNING! No server info found!", 'red'); + } + } + } + } diff --git a/workflow/engine/controllers/installer.php b/workflow/engine/controllers/installer.php index adb927283..133e472c5 100755 --- a/workflow/engine/controllers/installer.php +++ b/workflow/engine/controllers/installer.php @@ -862,6 +862,26 @@ class Installer extends Controller $updatedConf['default_skin'] = $skinUri; $info->uri = PATH_SEP . 'sys' . $_REQUEST['workspace'] . PATH_SEP . $langUri . PATH_SEP . $skinUri . PATH_SEP . 'login' . PATH_SEP . 'login'; + //register PMDesigner Client + $http = (G::is_https() == true) ? 'https' : 'http'; + $host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : ''); + + $endpoint = sprintf( + '%s://%s/sys%s/%s/%s/oauth2/grant', + $http, + $host, + $wf, + $langUri, + $skinUri + ); + + // inserting the outh_client + $query = sprintf( "USE %s;", $wf ); + $this->mysqlQuery( $query ); + $query = ( "INSERT INTO OAUTH_CLIENTS (CLIENT_ID,CLIENT_SECRET,CLIENT_NAME,CLIENT_DESCRIPTION,CLIENT_WEBSITE,REDIRECT_URI,USR_UID ) VALUES + ('x-pm-local-client','179ad45c6ce2cb97cf1029e212046e81','PM Web Designer','ProcessMaker Web Designer App','www.processmaker.com','" . $endpoint . "','00000000000000000000000000000001' )"); + $this->mysqlQuery( $query ); + $indexFileUpdated = true; if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { $this->buildParternExtras($adminUsername, $adminPassword, $_REQUEST['workspace'], $langUri, $skinUri); diff --git a/workflow/engine/methods/processes/processes_Export.php b/workflow/engine/methods/processes/processes_Export.php index a7bfabcd9..5c5993eaf 100755 --- a/workflow/engine/methods/processes/processes_Export.php +++ b/workflow/engine/methods/processes/processes_Export.php @@ -30,7 +30,7 @@ try { $exporter = new ProcessMaker\Exporter\XmlExporter($_GET["pro_uid"]); $version = ProcessMaker\Util\Common::getLastVersion($outputDir . $exporter->getProjectName() . "-*.pmx") + 1; - $outputFilename = sprintf("%s-%s.%s", $exporter->getProjectName(), $version, "pmx"); + $outputFilename = sprintf("%s-%s.%s", str_replace(" ", "_", $exporter->getProjectName()), $version, "pmx"); $exporter->saveExport($outputDir . $outputFilename); } else { $oProcess = new Processes(); @@ -134,3 +134,4 @@ echo json_encode($response); // $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); // G::RenderPage( 'publish', 'raw' ); //} + diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index d38dc920d..93b18a1a9 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -1521,4 +1521,232 @@ class Cases $appNote = new \AppNotes(); $appNote->addCaseNote($app_uid, $usr_uid, $note_content, intval($send_mail)); } + + /** + * Get data Task Case + * + * @param string $sApplicationUID Unique id of Case + * + * return array Return an array with Task Case + */ + public function getTasks($sApplicationUID) + { + try { + $iDelegation = \AppDelegation::getCurrentIndex($sApplicationUID); + $case = new \Cases(); + $caseLoad = $case->loadCase($sApplicationUID); + $sProcessUID = $caseLoad['PRO_UID']; + $sTask = ''; + $bCT = true; + $oProcess = new \Process(); + $oPM = array(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\TaskPeer::PRO_UID); + $oCriteria->addSelectColumn(\TaskPeer::TAS_UID); + $oCriteria->addSelectColumn(\ContentPeer::CON_VALUE); + $oCriteria->addSelectColumn(\TaskPeer::TAS_START); + $oCriteria->addSelectColumn(\TaskPeer::TAS_TYPE); + $aConditions = array(); + $aConditions[] = array(0 => \TaskPeer::TAS_UID, 1 => \ContentPeer::CON_ID); + $aConditions[] = array(0 => \ContentPeer::CON_CATEGORY, 1 => \DBAdapter::getStringDelimiter() . 'TAS_TITLE' . \DBAdapter::getStringDelimiter() ); + $aConditions[] = array(0 => \ContentPeer::CON_LANG, 1 => \DBAdapter::getStringDelimiter() . SYS_LANG . \DBAdapter::getStringDelimiter() ); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID); + $oDataset = \TaskPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow1 = $oDataset->getRow()) { + $oTask = new \StdClass(); + $oTask->tas_uid = $aRow1['TAS_UID']; + $oTask->tas_type = $aRow1['TAS_TYPE']; + if ($aRow1['TAS_TYPE'] == 'NORMAL') { + if (($aRow1['CON_VALUE'] == "")) { + //There is no Label in Current SYS_LANG language so try to find in English - by default + $oTask1 = new \Task(); + $aRow1['CON_VALUE'] = $oTask1->getTasTitle(); + } + $oTask->tas_title = htmlentities($aRow1['CON_VALUE'], ENT_QUOTES, 'UTF-8'); + } else { + $oCriteria = new \Criteria('workflow'); + $del = \DBAdapter::getStringDelimiter(); + $oCriteria->add(\SubProcessPeer::PRO_PARENT, $aRow1['PRO_UID']); + $oCriteria->add(\SubProcessPeer::TAS_PARENT, $aRow1['TAS_UID']); + + $oCriteria->addAsColumn('TAS_TITLE', 'C1.CON_VALUE'); + $oCriteria->addAlias("C1", 'CONTENT'); + $tasTitleConds = array(); + $tasTitleConds[] = array(\SubProcessPeer::TAS_PARENT, 'C1.CON_ID'); + $tasTitleConds[] = array('C1.CON_CATEGORY', $del . 'TAS_TITLE' . $del); + $tasTitleConds[] = array('C1.CON_LANG', $del . SYS_LANG . $del); + $oCriteria->addJoinMC($tasTitleConds, \Criteria::LEFT_JOIN); + + $oDatasetX = \SubProcessPeer::doSelectRS($oCriteria); + $oDatasetX->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDatasetX->next(); + $aRowx = $oDatasetX->getRow(); + if ($oProcess->exists($aRowx['PRO_UID'])) { + $oTask->tas_title = htmlentities($aRowx['TAS_TITLE'], ENT_QUOTES, 'UTF-8'); + } else { + $oTask->tas_title = htmlentities($aRow1['CON_VALUE'], ENT_QUOTES, 'UTF-8'); + } + } + $oTask->routing = new \StdClass(); + $oTask->routing->rou_type = ''; + $oTask->routing->to = array(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\RoutePeer::ROU_TYPE); + $oCriteria->addSelectColumn(\RoutePeer::ROU_NEXT_TASK); + $oCriteria->addSelectColumn(\RoutePeer::ROU_CONDITION); + $oCriteria->addSelectColumn(\RoutePeer::ROU_TO_LAST_USER); + $oCriteria->addSelectColumn(\RoutePeer::ROU_OPTIONAL); + $oCriteria->addSelectColumn(\UsersPeer::USR_UID); + $oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME); + $oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME); + $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_INIT_DATE); + $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_TASK_DUE_DATE); + $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_FINISH_DATE); + $oCriteria->addJoin(\AppDelegationPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN); + $oCriteria->addJoin(\AppDelegationPeer::PRO_UID, \RoutePeer::PRO_UID, \Criteria::LEFT_JOIN); + $oCriteria->add(\RoutePeer::PRO_UID, $sProcessUID); + $oCriteria->add(\RoutePeer::TAS_UID, $aRow1['TAS_UID']); + $oCriteria->add(\AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria->add(\AppDelegationPeer::TAS_UID, $aRow1['TAS_UID']); + $oCriteria->addDescendingOrderByColumn(\AppDelegationPeer::DEL_INDEX); + $oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria); + $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset2->next(); + while ($aRow2 = $oDataset2->getRow()) { + switch ($aRow2['ROU_TYPE']) { + case 'SEQUENTIAL': + $aRow2['ROU_TYPE'] = 0; + break; + case 'SELECT': + $aRow2['ROU_TYPE'] = 1; + break; + case 'EVALUATE': + $aRow2['ROU_TYPE'] = 2; + break; + case 'PARALLEL': + $aRow2['ROU_TYPE'] = 3; + break; + case 'PARALLEL-BY-EVALUATION': + $aRow2['ROU_TYPE'] = 4; + break; + case 'SEC-JOIN': + $aRow2['ROU_TYPE'] = 5; + break; + case 'DISCRIMINATOR': + $aRow2['ROU_TYPE'] = 8; + break; + } + $iDiff = strtotime($aRow2['DEL_FINISH_DATE']) - strtotime($aRow2['DEL_INIT_DATE']); + $oTo = new \StdClass(); + $oTo->rou_next_task = $aRow2['ROU_NEXT_TASK']; + $oTo->rou_condition = $aRow2['ROU_CONDITION']; + $oTo->rou_to_last_user = $aRow2['ROU_TO_LAST_USER']; + $oTo->rou_optional = $aRow2['ROU_OPTIONAL']; + $oTo->usr_uid = ($aRow2['USR_UID'] != null ? $aRow2['USR_FIRSTNAME'] . ' ' . $aRow2['USR_LASTNAME'] : \G::LoadTranslation('ID_NONE')); + $oTo->usr_firstname = $aRow2['USR_FIRSTNAME']; + $oTo->usr_lastname = $aRow2['USR_LASTNAME']; + $oTo->del_init_date = ($aRow2['DEL_INIT_DATE'] != null ? $aRow2['DEL_INIT_DATE'] : \G::LoadTranslation('ID_CASE_NOT_YET_STARTED')); + $oTo->del_task_due_date = ($aRow2['DEL_TASK_DUE_DATE'] != null ? $aRow2['DEL_TASK_DUE_DATE'] : \G::LoadTranslation('ID_CASE_NOT_YET_STARTED')); + $oTo->del_finish_date = ($aRow2['DEL_FINISH_DATE'] != null ? $aRow2['DEL_FINISH_DATE'] : \G::LoadTranslation('ID_NOT_FINISHED')); + $oTo->duration = ($aRow2['DEL_FINISH_DATE'] != null ? (int) ($iDiff / 3600) . ' ' . ((int) ($iDiff / 3600) == 1 ? \G::LoadTranslation('ID_HOUR') : \G::LoadTranslation('ID_HOURS')) . ' ' . (int) (($iDiff % 3600) / 60) . ' ' . ((int) (($iDiff % 3600) / 60) == 1 ? \G::LoadTranslation('ID_MINUTE') : \G::LoadTranslation('ID_MINUTES')) . ' ' . (int) (($iDiff % 3600) % 60) . ' ' . ((int) (($iDiff % 3600) % 60) == 1 ? \G::LoadTranslation('ID_SECOND') : \G::LoadTranslation('ID_SECONDS')) : \G::LoadTranslation('ID_NOT_FINISHED')); + $oTask->routing->rou_type = $aRow2['ROU_TYPE']; + $oTask->routing->to[] = $oTo; + $oDataset2->next(); + } + if ($bCT) { + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn('COUNT(*) AS CANT'); + $oCriteria->addSelectColumn('MIN(DEL_FINISH_DATE) AS FINISH'); + $oCriteria->add(\AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria->add(\AppDelegationPeer::TAS_UID, $aRow1['TAS_UID']); + $oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria); + $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset2->next(); + $aRow2 = $oDataset2->getRow(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn('DEL_FINISH_DATE'); + $oCriteria->add(\AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria->add(\AppDelegationPeer::TAS_UID, $aRow1['TAS_UID']); + $oCriteria->add(\AppDelegationPeer::DEL_FINISH_DATE, null); + $oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria); + $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset2->next(); + $aRow3 = $oDataset2->getRow(); + if ($aRow3) { + $aRow2['FINISH'] = ''; + } + if (empty($aRow2["FINISH"]) && $aRow1["TAS_UID"] == $sTask) { + $oTask->color = "#FF0000"; //Red + } else { + if (!empty($aRow2["FINISH"])) { + $oTask->color = "#006633"; //Green + } else { + if ($oTask->routing->rou_type != 5) { + if ($aRow2["CANT"] != 0) { + $oTask->color = "#FF0000"; //Red + } else { + $oTask->color = "#939598"; //Gray + } + } else { + if ($aRow3) { + $oTask->color = "#FF0000"; //Red + } else { + $oTask->color = "#939598"; //Gray + } + } + } + } + } else { + if (($sApplicationUID != '') && ($iDelegation > 0) && ($sTask != '')) { + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn('COUNT(*) AS CANT'); + $oCriteria->addSelectColumn('MIN(DEL_FINISH_DATE) AS FINISH'); + $oCriteria->add(\AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria->add(\AppDelegationPeer::TAS_UID, $aRow1['TAS_UID']); + $oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria); + $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset2->next(); + $aRow2 = $oDataset2->getRow(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn('DEL_FINISH_DATE'); + $oCriteria->add(\AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria->add(\AppDelegationPeer::TAS_UID, $aRow1['TAS_UID']); + $oCriteria->add(\AppDelegationPeer::DEL_FINISH_DATE, null); + $oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria); + $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset2->next(); + $aRow3 = $oDataset2->getRow(); + if ($aRow3) { + $aRow2['FINISH'] = ''; + } + if (empty($aRow2["FINISH"]) && $aRow1["TAS_UID"] == $sTask) { + $oTask->color = "#FF0000"; //Red + } else { + if (!empty($aRow2["FINISH"])) { + $oTask->color = "#006633"; //Green + } else { + if ($oTask->routing->rou_type != 5) { + if ($aRow2["CANT"] != 0) { + $oTask->color = "#FF0000"; //Red + } else { + $oTask->color = "#939598"; //Gray + } + } else { + $oTask->color = "#FF9900"; //Yellow + } + } + } + } + } + $oPM[] = $oTask; + $oDataset->next(); + } + return $oPM; + } catch (\Exception $e) { + throw $e; + } + } } \ No newline at end of file diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index e084c7857..50853580a 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -352,7 +352,9 @@ class WebEntry switch ($webEntryMethod) { case "WS": - $user = new \Users(); + require_once(PATH_RBAC . "model" . PATH_SEP . "RbacUsers.php"); + + $user = new \RbacUsers(); $arrayUserData = $user->load($arrayWebEntryData["USR_UID"]); @@ -398,7 +400,7 @@ class WebEntry $template->assign("dynaformUid", $dynaFormUid); $template->assign("taskUid", $taskUid); $template->assign("wsUser", $usrUsername); - $template->assign("wsPass", "md5:" . md5($usrPassword)); + $template->assign("wsPass", "md5:" . $usrPassword); $template->assign("wsRoundRobin", $wsRoundRobin); if ($webEntryInputDocumentAccess == 0) { diff --git a/workflow/engine/src/ProcessMaker/Exporter/Exporter.php b/workflow/engine/src/ProcessMaker/Exporter/Exporter.php index df6c61c7a..8eb8d10e4 100644 --- a/workflow/engine/src/ProcessMaker/Exporter/Exporter.php +++ b/workflow/engine/src/ProcessMaker/Exporter/Exporter.php @@ -116,7 +116,7 @@ abstract class Exporter ? "" : serialize($workflowData["process"]['PRO_DYNAFORMS']); $workflowData["process"] = array($workflowData["process"]); - $workflowData["processCategory"] = empty($workflowData["processCategory"]) ? array() : $workflowData["processCategory"]; + $workflowData["processCategory"] = empty($workflowData["processCategory"]) ? array() : array($workflowData["processCategory"]); $data["bpmn-definition"] = $bpmnStruct; diff --git a/workflow/engine/src/ProcessMaker/Importer/Importer.php b/workflow/engine/src/ProcessMaker/Importer/Importer.php index b390234fc..58797862c 100644 --- a/workflow/engine/src/ProcessMaker/Importer/Importer.php +++ b/workflow/engine/src/ProcessMaker/Importer/Importer.php @@ -210,6 +210,10 @@ abstract class Importer throw new \Exception("Error while uploading file. Error code: {$data["error"]}"); } + if (! is_dir($this->getSaveDir())) { + Util\Common::mk_dir($this->getSaveDir()); + } + $this->filename = $this->getSaveDir() . $data["name"]; $oldUmask = umask(0); @@ -401,7 +405,7 @@ abstract class Importer $arrayFieldNameForException = $arrayFieldName; if (isset($_FILES[$arrayFieldName["projectFile"]])) { - $_FILES["filepmx"] = $_FILES[$arrayFieldName["projectFile"]]; + $_FILES["filePmx"] = $_FILES[$arrayFieldName["projectFile"]]; } if (isset($arrayData[$arrayFieldName["projectFile"]]) && @@ -418,7 +422,6 @@ abstract class Importer $process = new \ProcessMaker\BusinessModel\Process(); $validator = new \ProcessMaker\BusinessModel\Validator(); - $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData"); $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData"); $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $arrayFieldDefinition, $arrayFieldNameForException, true); @@ -433,7 +436,7 @@ abstract class Importer } } - if ((isset($_FILES["filepmx"]) && pathinfo($_FILES["filepmx"]["name"], PATHINFO_EXTENSION) != "pmx") || + if ((isset($_FILES["filePmx"]) && pathinfo($_FILES["filePmx"]["name"], PATHINFO_EXTENSION) != "pmx") || (isset($arrayData[$arrayFieldName["projectFile"]]) && pathinfo($arrayData[$arrayFieldName["projectFile"]], PATHINFO_EXTENSION) != "pmx") ) { throw (new \Exception("The file extension not is \"pmx\"")); @@ -456,12 +459,13 @@ abstract class Importer $option = $opt; - if (isset($_FILES["filepmx"])) { - $this->setSaveDir(PATH_DOCUMENT . "input"); - $this->setSourceFromGlobals("filepmx"); + if (isset($_FILES["filePmx"])) { + $this->setSourceFromGlobals("filePmx"); } else { - if (isset($arrayData[$arrayFieldName["projectFile"]]) && file_exists(PATH_DOCUMENT . "input" . PATH_SEP . $arrayData[$arrayFieldName["projectFile"]])) { - $this->setSourceFile(PATH_DOCUMENT . "input" . PATH_SEP . $arrayData[$arrayFieldName["projectFile"]]); + $filePmx = rtrim($this->getSaveDir(), PATH_SEP) . PATH_SEP . $arrayData[$arrayFieldName["projectFile"]]; + + if (isset($arrayData[$arrayFieldName["projectFile"]]) && file_exists($filePmx)) { + $this->setSourceFile($filePmx); } else { throw (new \Exception(str_replace(array("{0}", "{1}"), array($arrayFieldNameForException["projectFile"], $arrayData[$arrayFieldName["projectFile"]]), "The file with {0}: \"{1}\" does not exist."))); } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Cases.php b/workflow/engine/src/ProcessMaker/Services/Api/Cases.php index 0e215b64e..a5b00d123 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Cases.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Cases.php @@ -989,5 +989,22 @@ class Cases extends Api throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } + + /** + * @url GET /:app_uid/tasks + * + * @param string $app_uid {@min 32}{@max 32} + */ + public function doGetTasks($app_uid) + { + try { + $cases = new \ProcessMaker\BusinessModel\Cases(); + $oData = $cases->getTasks($app_uid); + return $oData; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project.php b/workflow/engine/src/ProcessMaker/Services/Api/Project.php index 7efa49eb7..3832ac898 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project.php @@ -120,7 +120,7 @@ class Project extends Api $fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION); $httpStream->loadFromFile($outputFilename); - $httpStream->setHeader("Content-Type", "application/$fileExtension"); + $httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8"); $httpStream->send(); } @@ -136,6 +136,7 @@ class Project extends Api try { $importer = new \ProcessMaker\Importer\XmlImporter(); + $importer->setSaveDir(PATH_DOCUMENT . "input"); $importer->setData("usr_uid", $this->getUserId()); $arrayData = $importer->importPostFile($request_data, $option, array("projectFile" => "project_file", "option" => "option")); diff --git a/workflow/engine/src/Tests/ProcessMaker/Exporter/XmlExporterTest.php b/workflow/engine/src/Tests/ProcessMaker/Exporter/XmlExporterTest.php index a3c0bb312..0f05168de 100644 --- a/workflow/engine/src/Tests/ProcessMaker/Exporter/XmlExporterTest.php +++ b/workflow/engine/src/Tests/ProcessMaker/Exporter/XmlExporterTest.php @@ -1,11 +1,8 @@ build(); - $exporter->saveExport("/home/erik/out.xml"); + $json = " + { + \"prj_name\": \"" . \ProcessMaker\Util\Common::generateUID() . "\", + \"prj_author\": \"00000000000000000000000000000001\", + \"diagrams\": [ + { + \"dia_uid\": \"\", + \"activities\": [], + \"events\": [], + \"gateways\": [], + \"flows\": [], + \"artifacts\": [], + \"laneset\": [], + \"lanes\": [] + } + ] + } + "; + + $arrayResult = \ProcessMaker\Project\Adapter\BpmnWorkflow::createFromStruct(json_decode($json, true)); + + self::$projectUid = $arrayResult[0]["new_uid"]; + self::$filePmx = PATH_DOCUMENT . "output" . PATH_SEP . self::$projectUid . ".pmx"; + + self::$exporter = new \ProcessMaker\Exporter\XmlExporter(self::$projectUid); } -} \ No newline at end of file + + /** + * Delete project + * + * @coversNothing + */ + public static function tearDownAfterClass() + { + $bpmnWf = \ProcessMaker\Project\Adapter\BpmnWorkflow::load(self::$projectUid); + $bpmnWf->remove(); + + unlink(self::$filePmx); + } + + /** + * Test export + * + * @covers \ProcessMaker\Exporter\XmlExporter::export + * + * @return string + */ + public function testExport() + { + $strXml = self::$exporter->export(); + + $this->assertTrue(is_string($strXml)); + $this->assertNotEmpty($strXml); + + return $strXml; + } + + /** + * Test build + * + * @covers \ProcessMaker\Exporter\XmlExporter::build + * + * @depends testExport + * @param string $strXml Data xml + */ + public function testBuild($strXml) + { + //DOMDocument + $doc = new \DOMDocument(); + $doc->loadXML($strXml); + + $nodeRoot = $doc->getElementsByTagName("ProcessMaker-Project")->item(0); + $uid = ""; + + //Node meta + $nodeMeta = $nodeRoot->getElementsByTagName("metadata")->item(0)->getElementsByTagName("meta"); + + $this->assertNotEmpty($nodeMeta); + + foreach ($nodeMeta as $value) { + $node = $value; + + if ($node->hasAttribute("key") && $node->getAttribute("key") == "uid") { + $uid = $node->nodeValue; + break; + } + } + + $this->assertEquals(self::$projectUid, $uid); + + //Node definition + $nodeDefinition = $nodeRoot->getElementsByTagName("definition"); + + $this->assertNotEmpty($nodeDefinition); + + foreach ($nodeDefinition as $value) { + $node = $value; + + if ($node->hasAttribute("class")) { + $this->assertContains($node->getAttribute("class"), array("BPMN", "workflow")); + } + } + } + + /** + * Test saveExport + * + * @covers \ProcessMaker\Exporter\XmlExporter::saveExport + */ + public function testSaveExport() + { + self::$exporter->saveExport(self::$filePmx); + + $this->assertTrue(file_exists(self::$filePmx)); + } + + /** + * Test getTextNode + * + * @covers \ProcessMaker\Exporter\XmlExporter::getTextNode + */ + public function testGetTextNode() + { + //Is not implemented. Method getTextNode() is private + } + + /** + * Test exception for invalid project uid + * + * @covers \ProcessMaker\Exporter\XmlExporter::__construct + * + * @expectedException Exception + * @expectedExceptionMessage Project "ProcessMaker\Project\Bpmn" with UID: 0, does not exist. + */ + public function test__constructExceptionInvalidProjectUid() + { + $exporter = new \ProcessMaker\Exporter\XmlExporter("0"); + } +} + diff --git a/workflow/engine/src/Tests/ProcessMaker/Importer/XmlImporterTest.php b/workflow/engine/src/Tests/ProcessMaker/Importer/XmlImporterTest.php new file mode 100644 index 000000000..9b54a5a10 --- /dev/null +++ b/workflow/engine/src/Tests/ProcessMaker/Importer/XmlImporterTest.php @@ -0,0 +1,216 @@ +saveExport(self::$filePmx); + + $bpmnWf = \ProcessMaker\Project\Adapter\BpmnWorkflow::load(self::$projectUid); + $bpmnWf->remove(); + + self::$importer = new \ProcessMaker\Importer\XmlImporter(); + self::$importer->setSourceFile(self::$filePmx); + } + + /** + * Delete projects + * + * @coversNothing + */ + public static function tearDownAfterClass() + { + foreach (self::$arrayPrjUid as $value) { + $prjUid = $value; + + $bpmnWf = \ProcessMaker\Project\Adapter\BpmnWorkflow::load($prjUid); + $bpmnWf->remove(); + } + + unlink(self::$filePmx); + } + + /** + * Test load + * + * @covers \ProcessMaker\Importer\XmlImporter::load + */ + public function testLoad() + { + $arrayData = self::$importer->load(); + + $this->assertTrue(is_array($arrayData)); + $this->assertNotEmpty($arrayData); + + $this->assertArrayHasKey("tables", $arrayData); + $this->assertArrayHasKey("files", $arrayData); + + $this->assertEquals($arrayData["tables"]["bpmn"]["project"][0]["prj_uid"], self::$projectUid); + $this->assertEquals($arrayData["tables"]["workflow"]["process"][0]["PRO_UID"], self::$projectUid); + } + + /** + * Test getTextNode + * + * @covers \ProcessMaker\Importer\XmlImporter::getTextNode + */ + public function testGetTextNode() + { + //Is not implemented. Method getTextNode() is private + } + + /** + * Test import + * + * @covers \ProcessMaker\Importer\XmlImporter::import + */ + public function testImport() + { + $prjUid = self::$importer->import(); + self::$arrayPrjUid[] = $prjUid; + + $this->assertNotNull(\BpmnProjectPeer::retrieveByPK($prjUid)); + } + + /** + * Test importPostFile + * + * @covers \ProcessMaker\Importer\XmlImporter::importPostFile + */ + public function testImportPostFile() + { + self::$importer->setSaveDir(PATH_DOCUMENT . "input"); + + $arrayData = self::$importer->importPostFile(array("PROJECT_FILE" => self::$projectUid . ".pmx"), "KEEP"); + self::$arrayPrjUid[] = $arrayData["PRJ_UID"]; + + $this->assertNotNull(\BpmnProjectPeer::retrieveByPK($arrayData["PRJ_UID"])); + } + + /** + * Test exception when the project exists + * + * @covers \ProcessMaker\Importer\XmlImporter::import + * + * @expectedException Exception + * @expectedExceptionMessage Project already exists, you need set an action to continue. Available actions: [project.import.create_new|project.import.override|project.import.disable_and_create_new|project.import.keep_without_changing_and_create_new]. + */ + public function testImportExceptionProjectExists() + { + $prjUid = self::$importer->import(); + } + + /** + * Test exception for empty data + * + * @covers \ProcessMaker\Importer\XmlImporter::importPostFile + * + * @expectedException Exception + * @expectedExceptionMessage Invalid value for "$arrayData", it can not be empty. + */ + public function testImportPostFileExceptionEmptyData() + { + $arrayData = self::$importer->importPostFile(array()); + } + + /** + * Test exception for invalid extension + * + * @covers \ProcessMaker\Importer\XmlImporter::importPostFile + * + * @expectedException Exception + * @expectedExceptionMessage The file extension not is "pmx" + */ + public function testImportPostFileExceptionInvalidExtension() + { + $arrayData = self::$importer->importPostFile(array("PROJECT_FILE" => "file.pm")); + } + + /** + * Test exception for file does not exist + * + * @covers \ProcessMaker\Importer\XmlImporter::importPostFile + * + * @expectedException Exception + * @expectedExceptionMessage The file with PROJECT_FILE: "file.pmx" does not exist. + */ + public function testImportPostFileExceptionFileNotExists() + { + $arrayData = self::$importer->importPostFile(array("PROJECT_FILE" => "file.pmx")); + } + + /** + * Test exception for invalid option + * + * @covers \ProcessMaker\Importer\XmlImporter::importPostFile + * + * @expectedException Exception + * @expectedExceptionMessage Invalid value for "OPTION", it only accepts values: "CREATE|OVERWRITE|DISABLE|KEEP". + */ + public function testImportPostFileExceptionInvalidOption() + { + $arrayData = self::$importer->importPostFile(array("PROJECT_FILE" => "file.pmx"), "CREATED"); + } + + /** + * Test exception when the project exists + * + * @covers \ProcessMaker\Importer\XmlImporter::importPostFile + * + * @expectedException Exception + * @expectedExceptionMessage Project already exists, you need set an action to continue. Available actions: [CREATE|OVERWRITE|DISABLE|KEEP]. + */ + public function testImportPostFileExceptionProjectExists() + { + self::$importer->setSaveDir(PATH_DOCUMENT . "input"); + + $arrayData = self::$importer->importPostFile(array("PROJECT_FILE" => self::$projectUid . ".pmx")); + } +} +