From c09883afab617bc0ffb4bd558057c9b38f0ec80f Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 6 Mar 2014 09:28:34 -0400 Subject: [PATCH 01/17] Mejoras y avance de los feature case scheduler, file manager, trigger wizards --- .../main_tests_case_scheduler.feature | 2 +- .../negative_tests_case_scheduler.feature | 2 +- .../main_test_files_manager.feature | 125 ++++++++++++++---- .../negative_tests_files_manager.feature | 54 +++++++- .../main_tests_trigger_wizards.feature | 7 +- .../negative_tests_triggers_wizards.feature | 8 ++ features/bootstrap/RestContext.php | 1 - 7 files changed, 164 insertions(+), 35 deletions(-) diff --git a/features/backend/case_scheduler/main_tests_case_scheduler.feature b/features/backend/case_scheduler/main_tests_case_scheduler.feature index 8b9a62d11..b6d74f0a0 100644 --- a/features/backend/case_scheduler/main_tests_case_scheduler.feature +++ b/features/backend/case_scheduler/main_tests_case_scheduler.feature @@ -84,7 +84,7 @@ Feature: Case Scheduler Main Tests """ And I request "project/1265557095225ff5c688f46031700471/case-scheduler" Then the response status code should be 400 - And the response status message should have the following text "duplicate" + And the response status message should have the following text "Duplicate Case Scheduler name" Scenario: Get the case schedulers list when there are exactly 13 case schedulers diff --git a/features/backend/case_scheduler/negative_tests_case_scheduler.feature b/features/backend/case_scheduler/negative_tests_case_scheduler.feature index 7b0773b85..87869ff32 100644 --- a/features/backend/case_scheduler/negative_tests_case_scheduler.feature +++ b/features/backend/case_scheduler/negative_tests_case_scheduler.feature @@ -36,7 +36,7 @@ Feature: Output Documents Negative Tests | Invalid sch_option | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 21 | 20 | 2014-01-30 | 2014-02-20 | 12:00 | | | | | | | 400 | sch_option | | Invalid sch_del_user_name | sample | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly monday 345%$# | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 400 | User | | Invalid sch_del_user_pass | admin | sample | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly 345%$# 22 | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 2\|3\|5\|6\|7 | | | | | | 400 | password | - | Invalid tas_uid | admin | admin | 00000000000005be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 1 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 400 | task | + | Invalid tas_uid | admin | admin | 00000000000005be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 1 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 400 | Task not found | | Invalid sch_start_time | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 2 | 3 | 2014-03-21 | 2014-04-18 | 39:00:99 | | 1 | 15 | 1\|2\|5\|6\|7\|8\|9\|10\|11\|12 | | | 400 | sch_start_time | | Invalid sch_start_date | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 3 | 3 | 2014-20-35 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 1\|7 | | 400 | sch_start_date | | Invalid sch_week_days | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 4 | 2 | 2014-03-21 | 2014-04-18 | 18:00 | 8\|9\|10 | | | | | | 400 | sch_week_days | diff --git a/features/backend/files_manager/main_test_files_manager.feature b/features/backend/files_manager/main_test_files_manager.feature index 5b9e54236..75c457463 100644 --- a/features/backend/files_manager/main_test_files_manager.feature +++ b/features/backend/files_manager/main_test_files_manager.feature @@ -37,9 +37,9 @@ Feature: Files Manager Resources Main Tests Given POST this data: """ { - "prf_filename": "", - "prf_path": "", - "prf_content": "" + "prf_filename": "", + "prf_path": "", + "prf_content": "" } """ And I request "project/1265557095225ff5c688f46031700471/file-manager" @@ -50,17 +50,46 @@ Feature: Files Manager Resources Main Tests And store "prf_uid" in session array as variable "prf_uid_" Examples: - | test_description | file_name | path | content | http_code | type | prf_number | - | into public folder | file_test_1.txt | public/ | only text | 200 | object | 0 | - | into mailtemplates folder | file_test_2.html | templates/ |

Test

html test

| 200 | object | 1 | - | into public subfolder | file_test_3.txt | public/public_subfolder | test | 200 | object | 2 | - | into mailtemplates subfolder | file_test_4.html | templates/templates_subfolder | test | 200 | object | 3 | + | test_description | prf_filename | prf_path | prf_content | http_code | type | prf_number | + | into public folder | file_test_1.txt | public/ | only text | 200 | object | 0 | + | into mailtemplates folder | file_test_2.html | templates/ |

Test

html test

| 200 | object | 1 | + | into public subfolder | file_test_3 | public/public_subfolder | test | 200 | object | 2 | + | into mailtemplates subfolder | file_test_4 | templates/templates_subfolder | test | 200 | object | 3 | - Scenario Outline: Post files + + Scenario: Create files and subfolders with same name in path public + Given POST this data: + """ + { + "prf_filename": "file_test_1.txt", + "prf_path": "public/", + "prf_content": "only text" + } + """ + And I request "project/1265557095225ff5c688f46031700471/file-manager" + Then the response status code should be 400 + And the response status message should have the following text "already exists" + + + Scenario: Create files and subfolders with same name in path templates + Given POST this data: + """ + { + "prf_filename": "file_test_2.html", + "prf_path": "templates/", + "prf_content": "

Test

html test

" + } + """ + And I request "project/1265557095225ff5c688f46031700471/file-manager" + Then the response status code should be 400 + And the response status message should have the following text "already exists" + + + Scenario Outline: Update files by updating the content Given PUT this data: """ { - "prf_content": "" + "prf_content": "" } """ And that I want to update a resource with the key "prf_uid" stored in session array as variable "prf_uid_" @@ -71,24 +100,65 @@ Feature: Files Manager Resources Main Tests And the type is "" Examples: - | test_description | content | http_code | type | prf_number | - | put into public folder | only text - modified | 200 | object | 0 | - | put into mailtemplates folder |

Test

html test

modified | 200 | object | 1 | - | put into public subfolder | put test | 200 | object | 2 | - | put into mailtemplates subfolder | put test | 200 | object | 3 | + | test_description | prf_filename | prf_content | http_code | type | prf_number | + | put into public folder | file_test_1.txt | only text - modified | 200 | object | 0 | + | put into mailtemplates folder | file_test_2.html |

Test

html test

modified | 200 | object | 1 | + | put into public subfolder | file_test_3 | put test | 200 | object | 2 | + | put into mailtemplates subfolder | file_test_4 | put test | 200 | object | 3 | - #Para que funcione este test, debe existir el archivo que se quiere subir + + Scenario Outline: Get a single Files Manager and check some properties + Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=" + 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 "prf_filename" property in row equals "" + And the "prf_path" property in row equals "" + And the "prf_content" property in row equals "" + + + Examples: + | test_description | prf_filename | prf_content | http_code | type | prf_number | row | prf_path | + | put into public folder | file_test_1.txt | only text - modified | 200 | object | 0 | 1 | public/ | + | put into mailtemplates folder | file_test_2.html |

Test

html test

modified | 200 | object | 1 | 1 | templates/ | + | put into public subfolder | file_test_3.txt | put test | 200 | object | 2 | 0 | public/public_subfolder | + | put into mailtemplates subfolder | file_test_4.html | put test | 200 | object | 3 | 0 | templates/templates_subfolder | + + Scenario Outline: Upload files to same folders - Given POST I want to upload the file "" to path "". Url "project/1265557095225ff5c688f46031700471/file-manager" + Given POST I want to upload the file "" to path "". Url "project/1265557095225ff5c688f46031700471/file-manager" And store "prf_uid" in session array as variable "prf_uid_" Examples: - | file | path | prf_number | - |/home/daniel/test1.html | templates | 4 | - |/home/daniel/test2.html | templates | 5 | - |/home/daniel/test.txt | public | 6 | + | file | prf_path | prf_number | + |/home/wendy/uploadfiles/test1.html | templates | 4 | + |/home/wendy/uploadfiles/test2.html | templates | 5 | + |/home/wendy/uploadfiles/test.txt | public | 6 | + Scenario: Upload files when the file already exists + Given POST I want to upload the file "/home/wendy/uploadfiles/alert_message.html" to path "templates". Url "project/1265557095225ff5c688f46031700471/file-manager" + Then the response status code should be 400 + And the response status message should have the following text "already exists" + + + + Scenario Outline: Download files + Given I request "project/1265557095225ff5c688f46031700471/file-manager/prf_uid/download" with the key "prf_uid" stored in session array as variable "prf_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" + + Examples: + | test_description | prf_number | + | Download file | 0 | + | Download file | 1 | + | Download file | 2 | + | Download file | 4 | + + Scenario Outline: Delete file Given that I want to delete a resource with the key "prf_uid" stored in session array as variable "prf_uid_" And I request "project/1265557095225ff5c688f46031700471/file-manager" @@ -106,6 +176,15 @@ Feature: Files Manager Resources Main Tests | delete mailtemplates subfolder | 5 | | delete mailtemplates subfolder | 6 | - - \ No newline at end of file + Scenario Outline: Delete folder + Given that I want to delete the folder + And I request "project/1265557095225ff5c688f46031700471/file-manager/folder?path=" + + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + | test_description | prf_path | + | delete public sub folder | templates/templates_subfolder | + | delete templates sub folder | public/public_subfolder | diff --git a/features/backend/files_manager/negative_tests_files_manager.feature b/features/backend/files_manager/negative_tests_files_manager.feature index 9af8ac0e5..a90a00666 100644 --- a/features/backend/files_manager/negative_tests_files_manager.feature +++ b/features/backend/files_manager/negative_tests_files_manager.feature @@ -1,6 +1,48 @@ -# get a list of an inexistent path -# try to create a file with same name as an existent -# try to upload a file with same name as an existent -# how to get content if a file -# how to delete sub folders -# upload bi files \ No newline at end of file +@ProcessMakerMichelangelo @RestAPI +Feature: File Manager Negative Tests + + + Background: + Given that I have a valid access_token + + Scenario: Get a list public folder of process files manager with bad parameters (negative tests) + Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=sample" + Then the response status code should be 400 + And the response status message should have the following text "" + + + Scenario: Get a list templates folder of process files manager with bad parameters (negative tests) + Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=sample" + Then the response status code should be 200 + And the response status message should have the following text "" + + + Scenario Outline: Create files and subfolders for a project with bad parameters (negative tests) + Given POST this data: + """ + { + "prf_filename": "", + "prf_path": "", + "prf_content": "" + } + """ + And I request "project//file-manager" + Then the response status code should be + And the response status message should have the following text "" + + Examples: + | test_description | project | prf_filename | prf_path | prf_content | error_code | error_message | + | Invalid path public | 1265557095225ff5c688f46031700471 | file_test_1.txt | file_input_public/ | only text | 400 | prf_path | + | Invalid path template | 1265557095225ff5c688f46031700471 | file_test_2.html | temptes_manager/ |

Test

html test

| 400 | prf_path | + | Field Required prf_filename in public | 1265557095225ff5c688f46031700471 | | public/ | only text | 200 | prf_filename | + | Field Required prf_filename in template | 1265557095225ff5c688f46031700471 | | templates/ |

Test

html test

| 200 | prf_filename | + | Field Required project | | file_test_1.txt | public/ | only text | 200 | prj_uid | + + + + + +# how to get content if a file - revisar si hay el endpoint para poner el contenido del html +# how to delete sub folders +# upload big files - +# actualizar el conteniudo subiendo un archivo nuevo con el mismo nombre... \ No newline at end of file diff --git a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature index d5a1a567f..e4a0787d1 100644 --- a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature +++ b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature @@ -82,7 +82,7 @@ Feature: Group "tri_description": "", "tri_type": "", "tri_params": { - "input": { + "input": { "arrayData": "", "index": "", "value": "", @@ -102,8 +102,9 @@ Feature: Group And store "tri_uid" in session array as variable "tri_uid" Examples: - | i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.arrayData | tri_params.input.index | tri_params.input.value | tri_params.input.suffix | tri_params.output.tri_answer | - | 0 | pmFunctions | PMFAddAttachmentToArray | My trigger | | SCRIPT | array(1, 2) | 1 | 2 | My Copy({i}) | $respuesta | + | i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.arrayData | tri_params.input.index | tri_params.input.value | tri_params.input.suffix | tri_params.output.tri_answer | + | 0 | pmFunctions | PMFAddAttachmentToArray | My trigger | | SCRIPT | array(1, 2) | 1 | 2 | My Copy({i}) | $respuesta | + | 1 | pmFunctions | PMFSendMessage | My trigger 1 | Envio de email | SCRIPT | Scenario Outline: Update Trigger diff --git a/features/backend/trigger_wizard/negative_tests_triggers_wizards.feature b/features/backend/trigger_wizard/negative_tests_triggers_wizards.feature index e69de29bb..72ea1727c 100644 --- a/features/backend/trigger_wizard/negative_tests_triggers_wizards.feature +++ b/features/backend/trigger_wizard/negative_tests_triggers_wizards.feature @@ -0,0 +1,8 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Triggers Wizard Negative Tests + + + Background: + Given that I have a valid access_token + + diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 9c82a30ae..e64ef88b0 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1250,7 +1250,6 @@ class RestContext extends BehatContext } else { $varValue = $sessionData->$sessionVarName; } -print_r($sessionData); $pageUrl = str_replace($varName, $varValue, $pageUrl); From f6c0e36a815902fe25cce471e800ada3601064d1 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 6 Mar 2014 09:48:06 -0400 Subject: [PATCH 02/17] arreglos en file manager y step --- .../negative_tests_files_manager.feature | 12 ++++++------ features/backend/step/main_tests_step.feature | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/features/backend/files_manager/negative_tests_files_manager.feature b/features/backend/files_manager/negative_tests_files_manager.feature index a90a00666..0bd692c19 100644 --- a/features/backend/files_manager/negative_tests_files_manager.feature +++ b/features/backend/files_manager/negative_tests_files_manager.feature @@ -8,13 +8,13 @@ Feature: File Manager Negative Tests Scenario: Get a list public folder of process files manager with bad parameters (negative tests) Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=sample" 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 "path" Scenario: Get a list templates folder of process files manager with bad parameters (negative tests) Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=sample" - Then the response status code should be 200 - And the response status message should have the following text "" + Then the response status code should be 400 + And the response status message should have the following text "path" Scenario Outline: Create files and subfolders for a project with bad parameters (negative tests) @@ -34,9 +34,9 @@ Feature: File Manager Negative Tests | test_description | project | prf_filename | prf_path | prf_content | error_code | error_message | | Invalid path public | 1265557095225ff5c688f46031700471 | file_test_1.txt | file_input_public/ | only text | 400 | prf_path | | Invalid path template | 1265557095225ff5c688f46031700471 | file_test_2.html | temptes_manager/ |

Test

html test

| 400 | prf_path | - | Field Required prf_filename in public | 1265557095225ff5c688f46031700471 | | public/ | only text | 200 | prf_filename | - | Field Required prf_filename in template | 1265557095225ff5c688f46031700471 | | templates/ |

Test

html test

| 200 | prf_filename | - | Field Required project | | file_test_1.txt | public/ | only text | 200 | prj_uid | + | Field Required prf_filename in public | 1265557095225ff5c688f46031700471 | | public/ | only text | 400 | prf_filename | + | Field Required prf_filename in template | 1265557095225ff5c688f46031700471 | | templates/ |

Test

html test

| 400 | prf_filename | + | Field Required project | | file_test_1.txt | public/ | only text | 400 | prj_uid | diff --git a/features/backend/step/main_tests_step.feature b/features/backend/step/main_tests_step.feature index 48ce32bc4..4f1e6c657 100644 --- a/features/backend/step/main_tests_step.feature +++ b/features/backend/step/main_tests_step.feature @@ -39,7 +39,7 @@ Feature: Project Properties - Step Resources Main Tests And the content type is "application/json" Then the response status code should be 201 And the response charset is "UTF-8" - And the type is "object" + And the type is "object"git And store "step_uid" in session array as variable "step_uid_" Examples: From b3fe1d2d40babaaaa0f0e4b94883b3d0fdd4bb4a Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 6 Mar 2014 10:16:14 -0400 Subject: [PATCH 03/17] Adding Support t return versions like: 1.1 or 2.4.9 for Util\Common::getLastVersion(...) and its unit test --- .../engine/src/ProcessMaker/Util/Common.php | 21 ++++++++++++++++--- .../src/ProcessMaker/Util/IO/HttpStream.php | 4 ---- .../Tests/ProcessMaker/Util/CommonTest.php | 9 +++++++- .../fixtures/files_struct/third/sample-1.txt | 1 + .../fixtures/files_struct/third/sample-2.txt | 1 + .../files_struct/third/sample-3.1.9.txt | 1 + .../files_struct/third/sample-3.1.txt | 1 + .../fixtures/files_struct/third/sample-3.txt | 1 + 8 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 workflow/engine/src/Tests/fixtures/files_struct/third/sample-1.txt create mode 100644 workflow/engine/src/Tests/fixtures/files_struct/third/sample-2.txt create mode 100644 workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.1.9.txt create mode 100644 workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.1.txt create mode 100644 workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.txt diff --git a/workflow/engine/src/ProcessMaker/Util/Common.php b/workflow/engine/src/ProcessMaker/Util/Common.php index 875c1f8aa..f375011d2 100644 --- a/workflow/engine/src/ProcessMaker/Util/Common.php +++ b/workflow/engine/src/ProcessMaker/Util/Common.php @@ -32,7 +32,7 @@ class Common * * Common::rglob("/example/path/*.json"); * - * it will returns: + * It will returns: * * Array * ( @@ -70,17 +70,32 @@ class Common * * @param string $pattern a valid pattern for glob(...) native function * @param int $flag php flags for glob(...) native function - * @return int + * @return int|string + * + * Example: + * - Given the following files inside a directory: + * /example/path/myApplication-v1.tar + * /example/path/myApplication-v2.tar + * /example/path/myApplication-v3.tar + * /example/path/myApplication-v5.tar + * /example/path/myApplication-v7.tar + * + * $lastVer = ProcessMaker\Util\Common::getLastVersion("/example/path/myApplication-*.tar"); + * + * It will returns: 7 */ public static function getLastVersion($pattern, $flag = 0) { $files = glob($pattern, $flag); $maxVersion = 0; + $pattern = str_replace("*", '([0-9\.]+)', basename($pattern)); + foreach ($files as $file) { $filename = basename($file); - if (preg_match("/-([0-9]+)/", $filename, $match)) { + if (preg_match('/'.$pattern.'/', $filename, $match)) { + if ($maxVersion < $match[1]) { $maxVersion = $match[1]; } diff --git a/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php b/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php index d8870fd77..fd85d0016 100644 --- a/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php +++ b/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php @@ -301,10 +301,6 @@ class HttpStream header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)); // headers - - - //print_r($this->headers); die; - foreach ($this->headers as $name => $value) { if (is_array($value)) { foreach ($value as $v) { diff --git a/workflow/engine/src/Tests/ProcessMaker/Util/CommonTest.php b/workflow/engine/src/Tests/ProcessMaker/Util/CommonTest.php index 2908bf56e..237cbc4c9 100644 --- a/workflow/engine/src/Tests/ProcessMaker/Util/CommonTest.php +++ b/workflow/engine/src/Tests/ProcessMaker/Util/CommonTest.php @@ -25,10 +25,17 @@ class XmlExporterTest extends \PHPUnit_Framework_TestCase $this->assertEquals(5, $lastVer); } + function testGetLastVersionThr() + { + $lastVer = Util\Common::getLastVersion(__DIR__."/../../fixtures/files_struct/third/sample-*.txt"); + + $this->assertEquals("3.1.9", $lastVer); + } + /** * Negative test, no matched files found */ - function testGetLastVersionThr() + function testGetLastVersionOther() { $lastVer = Util\Common::getLastVersion(sys_get_temp_dir()."/sample-*.txt"); diff --git a/workflow/engine/src/Tests/fixtures/files_struct/third/sample-1.txt b/workflow/engine/src/Tests/fixtures/files_struct/third/sample-1.txt new file mode 100644 index 000000000..c4de27d5a --- /dev/null +++ b/workflow/engine/src/Tests/fixtures/files_struct/third/sample-1.txt @@ -0,0 +1 @@ +file sample-1.txt \ No newline at end of file diff --git a/workflow/engine/src/Tests/fixtures/files_struct/third/sample-2.txt b/workflow/engine/src/Tests/fixtures/files_struct/third/sample-2.txt new file mode 100644 index 000000000..c4de27d5a --- /dev/null +++ b/workflow/engine/src/Tests/fixtures/files_struct/third/sample-2.txt @@ -0,0 +1 @@ +file sample-1.txt \ No newline at end of file diff --git a/workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.1.9.txt b/workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.1.9.txt new file mode 100644 index 000000000..c4de27d5a --- /dev/null +++ b/workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.1.9.txt @@ -0,0 +1 @@ +file sample-1.txt \ No newline at end of file diff --git a/workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.1.txt b/workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.1.txt new file mode 100644 index 000000000..c4de27d5a --- /dev/null +++ b/workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.1.txt @@ -0,0 +1 @@ +file sample-1.txt \ No newline at end of file diff --git a/workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.txt b/workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.txt new file mode 100644 index 000000000..c4de27d5a --- /dev/null +++ b/workflow/engine/src/Tests/fixtures/files_struct/third/sample-3.txt @@ -0,0 +1 @@ +file sample-1.txt \ No newline at end of file From ba1ff9e6e9d379f49426bc037a26a2c78341e1a3 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Thu, 6 Mar 2014 10:40:50 -0400 Subject: [PATCH 04/17] Correcion de DEPARTAMENTSs a DEPARTMENTS --- .../{Departament.php => Department.php} | 42 +++++++++---------- .../{Departament.php => Department.php} | 28 ++++++------- .../Tests/BusinessModel/DepartmentTest.php | 25 +++++++++++ 3 files changed, 60 insertions(+), 35 deletions(-) rename workflow/engine/src/BusinessModel/{Departament.php => Department.php} (83%) rename workflow/engine/src/Services/Api/ProcessMaker/{Departament.php => Department.php} (76%) create mode 100644 workflow/engine/src/Tests/BusinessModel/DepartmentTest.php diff --git a/workflow/engine/src/BusinessModel/Departament.php b/workflow/engine/src/BusinessModel/Department.php similarity index 83% rename from workflow/engine/src/BusinessModel/Departament.php rename to workflow/engine/src/BusinessModel/Department.php index 535112a19..eebd6f2cf 100644 --- a/workflow/engine/src/BusinessModel/Departament.php +++ b/workflow/engine/src/BusinessModel/Department.php @@ -9,10 +9,10 @@ use \DepartmentPeer; * @author Brayan Pereyra (Cochalo) * @copyright Colosa - Bolivia */ -class Departament +class Department { /** - * Get list for Departaments + * Get list for Departments * * @access public * @author Brayan Pereyra (Cochalo) @@ -20,10 +20,10 @@ class Departament * * @return array */ - public function getDepartaments() + public function getDepartments() { - $oDepartament = new \Department(); - $aDepts = $oDepartament->getDepartments(''); + $oDepartment = new \Department(); + $aDepts = $oDepartment->getDepartments(''); foreach ($aDepts as &$depData) { $depData['DEP_CHILDREN'] = $this->getChildren($depData); $depData = array_change_key_case($depData, CASE_LOWER); @@ -32,8 +32,8 @@ class Departament } /** - * Get list for Departaments - * @var string $dep_uid. Uid for Departament + * Get list for Departments + * @var string $dep_uid. Uid for Department * * @access public * @author Brayan Pereyra (Cochalo) @@ -41,7 +41,7 @@ class Departament * * @return array */ - public function getDepartament($dep_uid) + public function getDepartment($dep_uid) { $dep_uid = Validator::depUid($dep_uid); $criteria = new \Criteria( 'workflow' ); @@ -86,7 +86,7 @@ class Departament } /** - * Save Departament + * Save Department * @var string $dep_data. Data for Process * @var string $create. Flag for create or update * @@ -96,11 +96,11 @@ class Departament * * @return array */ - public function saveDepartament($dep_data, $create = true) + public function saveDepartment($dep_data, $create = true) { $dep_data = array_change_key_case($dep_data, CASE_UPPER); - $oDepartament = new \Department(); + $oDepartment = new \Department(); if (isset($dep_data['DEP_UID']) && $dep_data['DEP_UID'] != '') { Validator::depUid($dep_data['DEP_UID']); } @@ -119,17 +119,17 @@ class Departament if (!$create) { $dep_data['DEPO_TITLE'] = $dep_data['DEP_TITLE']; - $oDepartament->update($dep_data); - $oDepartament->updateDepartmentManager($dep_data['DEP_UID']); + $oDepartment->update($dep_data); + $oDepartment->updateDepartmentManager($dep_data['DEP_UID']); } else { - $dep_uid = $oDepartament->create($dep_data); - $response = $this->getDepartament($dep_uid); + $dep_uid = $oDepartment->create($dep_data); + $response = $this->getDepartment($dep_uid); return $response; } } /** - * Delete departament + * Delete department * @var string $dep_uid. Uid for department * * @access public @@ -138,11 +138,11 @@ class Departament * * @return array */ - public function deleteDepartament($dep_uid) + public function deleteDepartment($dep_uid) { $dep_uid = Validator::depUid($dep_uid); - $oDepartament = new \Department(); - $oDepartament->remove($dep_uid); + $oDepartment = new \Department(); + $oDepartment->remove($dep_uid); } /** @@ -159,8 +159,8 @@ class Departament { $children = array(); if ((int)$dataDep['HAS_CHILDREN'] > 0) { - $oDepartament = new \Department(); - $aDepts = $oDepartament->getDepartments($dataDep['DEP_UID']); + $oDepartment = new \Department(); + $aDepts = $oDepartment->getDepartments($dataDep['DEP_UID']); foreach ($aDepts as &$depData) { $depData['DEP_CHILDREN'] = $this->getChildren($depData); $depData = array_change_key_case($depData, CASE_LOWER); diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Departament.php b/workflow/engine/src/Services/Api/ProcessMaker/Department.php similarity index 76% rename from workflow/engine/src/Services/Api/ProcessMaker/Departament.php rename to workflow/engine/src/Services/Api/ProcessMaker/Department.php index 3fb36e2df..7f97e6b51 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Departament.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Department.php @@ -6,14 +6,14 @@ use \Luracast\Restler\RestException; /** - * Departament Api Controller + * Department Api Controller * * @author Brayan Pereyra (Cochalo) * @copyright Colosa - Bolivia * * @protected */ -class Departament extends Api +class Department extends Api { /** * @access public @@ -24,11 +24,11 @@ class Departament extends Api * * @url GET */ - public function doGetDepartaments() + public function doGetDepartments() { try { - $oDepartament = new \BusinessModel\Departament(); - $response = $oDepartament->getDepartaments(); + $oDepartment = new \BusinessModel\Department(); + $response = $oDepartment->getDepartments(); return $response; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); @@ -46,11 +46,11 @@ class Departament extends Api * * @url GET /:dep_uid */ - public function doGetDepartament($dep_uid) + public function doGetDepartment($dep_uid) { try { - $oDepartament = new \BusinessModel\Departament(); - $response = $oDepartament->getDepartament($dep_uid); + $oDepartment = new \BusinessModel\Department(); + $response = $oDepartment->getDepartment($dep_uid); return $response; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); @@ -73,8 +73,8 @@ class Departament extends Api public function doPost($request_data, $dep_title) { try { - $oDepartament = new \BusinessModel\Departament(); - $response = $oDepartament->saveDepartament($request_data); + $oDepartment = new \BusinessModel\Department(); + $response = $oDepartment->saveDepartment($request_data); return $response; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); @@ -98,8 +98,8 @@ class Departament extends Api { try { $request_data['dep_uid'] = $dep_uid; - $oDepartament = new \BusinessModel\Departament(); - $response = $oDepartament->saveDepartament($request_data, false); + $oDepartment = new \BusinessModel\Department(); + $response = $oDepartment->saveDepartment($request_data, false); return $response; } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); @@ -120,8 +120,8 @@ class Departament extends Api public function doDelete($dep_uid) { try { - $oDepartament = new \BusinessModel\Departament(); - $oDepartament->deleteDepartament($dep_uid); + $oDepartment = new \BusinessModel\Department(); + $oDepartment->deleteDepartment($dep_uid); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } diff --git a/workflow/engine/src/Tests/BusinessModel/DepartmentTest.php b/workflow/engine/src/Tests/BusinessModel/DepartmentTest.php new file mode 100644 index 000000000..fdf9bca74 --- /dev/null +++ b/workflow/engine/src/Tests/BusinessModel/DepartmentTest.php @@ -0,0 +1,25 @@ + + * @copyright Colosa - Bolivia + * + * @protected + * @package Tests\BusinessModel + */ +class DepartmentTest extends \PHPUnit_Framework_TestCase +{ + public function testGetDepartments() + { + $oDepartment = new \BusinessModel\Department(); + $arrayDepartments = $oDepartment->getDepartments(); + } +} + From bc464cbe55815c583bb4dd0f323f7b70fe35ea3a Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 6 Mar 2014 12:10:00 -0400 Subject: [PATCH 05/17] Fix for HttpStream class, updating old scheme to updater return value using pathinfo() func. --- workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php b/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php index fd85d0016..808d2217e 100644 --- a/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php +++ b/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php @@ -154,10 +154,14 @@ class HttpStream */ public function loadFromFile($filename) { - $this->filename =$filename; + if (! file_exists($filename)) { + throw new \Exception("Unable to find file: $filename"); + } + + $this->filename = $filename; $this->content = file_get_contents($this->filename); $fileInfo = pathinfo($filename, PATHINFO_EXTENSION); - $this->setExtension($fileInfo["extension"]); + $this->setExtension($fileInfo); $this->setSourceName(basename($filename)); } From 0ebeab5c9d4f74fd37104c0f17d420a1bdce0601 Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 6 Mar 2014 12:39:16 -0400 Subject: [PATCH 06/17] Completing UI integration for new Export methods and fixing some details --- .../processes/processes_DownloadFile.php | 37 ++++++++++++++----- .../methods/processes/processes_Export.php | 37 ++++++++++--------- .../src/ProcessMaker/Util/IO/HttpStream.php | 1 + workflow/engine/templates/processes/main.js | 37 ++++++------------- 4 files changed, 60 insertions(+), 52 deletions(-) diff --git a/workflow/engine/methods/processes/processes_DownloadFile.php b/workflow/engine/methods/processes/processes_DownloadFile.php index c1847e52a..56cfce6c7 100755 --- a/workflow/engine/methods/processes/processes_DownloadFile.php +++ b/workflow/engine/methods/processes/processes_DownloadFile.php @@ -21,16 +21,33 @@ * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ -//add more security, and catch any error or exception - -$sFileName = $_GET['p'] . '.pm'; -$file = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName . 'tpm'; -$filex = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName; - -if (file_exists( $file )) { - rename( $file, $filex ); +if (! isset($_GET["file_hash"])) { + throw new Exception("Invalid Request, param 'file_hash' was not sent."); } -$realPath = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName; -G::streamFile( $realPath, true ); +$httpStream = new \ProcessMaker\Util\IO\HttpStream(); +$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; +$filename = base64_decode($_GET["file_hash"]); +$fileExtension = pathinfo($outputDir . $filename, PATHINFO_EXTENSION); + +if (! file_exists($outputDir . $filename)) { + throw new Exception("Error, couldn't find request file: $filename"); +} + +$httpStream->loadFromFile($outputDir . $filename); +$httpStream->setHeader("Content-Type", "application/$fileExtension"); +$httpStream->send(); + +// ************* DEPRECATED (it will be removed soon) ********************************* +//add more security, and catch any error or exception +//$sFileName = $_GET['p'] . '.pm'; +//$file = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName . 'tpm'; +//$filex = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName; +// +//if (file_exists( $file )) { +// rename( $file, $filex ); +//} +// +//$realPath = PATH_DOCUMENT . 'output' . PATH_SEP . $sFileName; +//G::streamFile( $realPath, true ); diff --git a/workflow/engine/methods/processes/processes_Export.php b/workflow/engine/methods/processes/processes_Export.php index 9bf95a77d..a7bfabcd9 100755 --- a/workflow/engine/methods/processes/processes_Export.php +++ b/workflow/engine/methods/processes/processes_Export.php @@ -22,30 +22,33 @@ * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ -$httpStream = new \ProcessMaker\Util\IO\HttpStream(); +$response = new StdClass(); $outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; -if (\BpmnProject::exists($_GET["pro_uid"])) { - $exporter = new ProcessMaker\Exporter\XmlExporter($_GET["pro_uid"]); +try { + if (\BpmnProject::exists($_GET["pro_uid"])) { + $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"); - $exporter->saveExport($outputDir . $outputFilename); + $version = ProcessMaker\Util\Common::getLastVersion($outputDir . $exporter->getProjectName() . "-*.pmx") + 1; + $outputFilename = sprintf("%s-%s.%s", $exporter->getProjectName(), $version, "pmx"); + $exporter->saveExport($outputDir . $outputFilename); + } else { + $oProcess = new Processes(); + $proFields = $oProcess->serializeProcess($_GET["pro_uid"]); + $result = $oProcess->saveSerializedProcess($proFields); + $outputFilename = $result["FILENAME"]; - $httpStream->setHeader("Content-Type" , "application/pmx"); + rename($outputDir . $outputFilename . "tpm", $outputDir . $outputFilename); + } -} else { - $oProcess = new Processes(); - $proFields = $oProcess->serializeProcess($_GET["pro_uid"]); - $result = $oProcess->saveSerializedProcess($proFields); - $outputFilename = $outputDir . $result["FILENAME"]; - - rename($outputFilename . "tpm", $outputFilename); + $response->file_hash = base64_encode($outputFilename); + $response->success = true; +} catch (Exception $e) { + $response->message = $e->getMessage(); + $response->success = false; } -$httpStream->loadFromFile($outputFilename); -$httpStream->send(); - +echo json_encode($response); // ************* DEPRECATED (it will be removed soon) ********************************* diff --git a/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php b/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php index 808d2217e..b8e3b8d3d 100644 --- a/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php +++ b/workflow/engine/src/ProcessMaker/Util/IO/HttpStream.php @@ -151,6 +151,7 @@ class HttpStream /** * @param string $filename file to stream + * @throws \Exception */ public function loadFromFile($filename) { diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index f25169ba1..b58aa3e34 100755 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -695,37 +695,24 @@ function exportProcess() { var record = processesGrid.getSelectionModel().getSelections(); if(record.length == 1) { - window.location = "../processes/processes_Export?pro_uid=" + record[0].get("PRO_UID"); - return; - - var myMask = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING")}); + var proUid = record[0].get("PRO_UID"); + myMask.show(); - /////// - var proUid = record[0].get("PRO_UID"); - var proTitle = record[0].get("PRO_TITLE"); - var titleLength = 60; - - title = (titleLength - proTitle.length >= 0)? proTitle : proTitle.substring(0, (titleLength - 1) + 1) + "..."; - - /////// Ext.Ajax.request({ - url: "../processes/processes_Ajax", - method: "POST", - params: { - "action": "process_Export", - "data": "{\"pro_uid\": \"" + proUid + "\"}", - "processMap": 0 - }, - - success: function (response, opts) { + url: "../processes/processes_Export", + method: "GET", + params: {"pro_uid": proUid}, + success: function (response) { + var result = JSON.parse(response.responseText); myMask.hide(); - var dataResponse = eval("(" + response.responseText + ")"); //json - var url = window.location.href; - - window.location = url.substring(0, url.lastIndexOf("/") + 1) + dataResponse.FILENAME_LINK; + if (result.success) { + window.location = "../processes/processes_DownloadFile?file_hash=" + result.file_hash; + } else { + Ext.Msg.show({title: "", msg: result.message, icon: Ext.MessageBox.ERROR, buttons: Ext.MessageBox.OK}); + } }, failure: function (response, opts) { From c67decc5975e4c56c9392e040e8c0c1736c5eb39 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Mon, 10 Mar 2014 09:13:35 -0400 Subject: [PATCH 07/17] Cambios en upload de pm user --- .../backend/pm_user/basic_sequence_pm_user.feature | 2 +- features/backend/pm_user/main_tests_pm_user.feature | 12 ++---------- features/bootstrap/RestContext.php | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/features/backend/pm_user/basic_sequence_pm_user.feature b/features/backend/pm_user/basic_sequence_pm_user.feature index 401c38747..4dd68e1f1 100644 --- a/features/backend/pm_user/basic_sequence_pm_user.feature +++ b/features/backend/pm_user/basic_sequence_pm_user.feature @@ -35,7 +35,7 @@ Feature: User #GET /api/1.0/{workspace}/user/{usr_uid} # Upload a image Scenario: Upload a image - Given POST I want to upload the image "/home/daniel/pic3.jpg" to user "00000000000000000000000000000001". Url "user/" + Given POST I want to upload the image "/home/wendy/pic3.jpg" to user "00000000000000000000000000000001". Url "user/" #POST /api/1.0/{workspace}/user # Create new User diff --git a/features/backend/pm_user/main_tests_pm_user.feature b/features/backend/pm_user/main_tests_pm_user.feature index eebf7ea45..58e28f806 100644 --- a/features/backend/pm_user/main_tests_pm_user.feature +++ b/features/backend/pm_user/main_tests_pm_user.feature @@ -95,14 +95,6 @@ Feature: User Main Tests | Create user Vacation | 5 | micaela | sanchez | micaela | micaela@gmail.com | sancjh #544 | 555-6652 | US | FL | MIA | 555-6655-555 | Gerencia | | 2016-02-15 | | VACATION | PROCESSMAKER_OPERATOR | sample | sample | - #Para que funcione este test, debe existir el archivo que se quiere subir - #GET /api/1.0/{workspace}/user/{usr_uid} - # Upload a image - Scenario: Upload a image - Given POST I want to upload the image "/home/daniel/pic3.jpg" to user "00000000000000000000000000000001". Url "user/" - - - # Upload a image Scenario Outline: Upload a image Given POST I want to upload the image "" to user with the key "usr_uid" stored in session array as variable "usr_uid_". Url "user/" @@ -167,8 +159,8 @@ Feature: User Main Tests Examples: | Test_description | usr_number | usr_firstname | usr_lastname | usr_username | usr_email | usr_address | usr_zip_code | usr_country | usr_city | usr_location | usr_phone | usr_position | usr_replaced_by | usr_due_date | usr_calendar | usr_status | usr_role | usr_new_pass | usr_cnf_pass | - | Update usr_calendar, usr_role | 1 | jhoohan | smith | jhoohan | jhon@gmail.com | grenn #344 | 555-6555 | US | FL | MIA | 555-6655-555 | Gerencia | | 2016-02-15 | 99159704252f501c63f8c58025859967 | ACTIVE | PROCESSMAKER_ADMIN | sample | sample | - | Update usr_firstname, usr_lastname, usr_username | 2 | william | carters | william | will@gmail.com | saim #45 | 555-6522 | BO | L | LPB | 23344444 | Adminsitracion | 44811996752d567110634a1013636964 | 2014-12-12 | | ACTIVE | PROCESSMAKER_MANAGER | sample | sample | + | Update usr_calendar, usr_role | 1 | jhoohan | smith | jhoohan | jhon@gmail.com | grenn #344 | 555-6555 | US | FL | MIA | 555-6655-555 | Gerencia | | 2014-02-15 | 99159704252f501c63f8c58025859967 | ACTIVE | PROCESSMAKER_ADMIN | sample | sample | + | Update usr_firstname, usr_lastname, usr_username | 2 | wilian | carters | william | will@gmail.com | saim #45 | 555-6522 | BO | L | LPB | 23344444 | Adminsitracion | 44811996752d567110634a1013636964 | 2014-12-12 | | ACTIVE | PROCESSMAKER_MANAGER | sample | sample | | Update usr_status | 3 | sarita | sandler | sarita | saraah@gmail.com | laberh #985 | 555-9999 | AR | B | BUE | 2353643644 | Desarrollo | 61364466452d56711adb378002702791 | 2014-12-12 | 99159704252f501c63f8c58025859967 | INACTIVE | PROCESSMAKER_ADMIN | admin | admin | diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 2a18f6846..3b542b664 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1259,7 +1259,7 @@ class RestContext extends BehatContext $pageUrl = str_replace($varName, $varValue, $pageUrl); - $this->printDebug("URL: $pageUrl\n$varName = $varValue\n"); + //$this->printDebug("URL: $pageUrl\n$varName = $varValue\n"); $this->iRequest($pageUrl, $urlType); From c58206dfa1afe6b473567df400f2148dcb43b354 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Mon, 10 Mar 2014 10:56:04 -0400 Subject: [PATCH 08/17] Correccion de UID en pmuser --- features/backend/pm_user/main_tests_pm_user.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/backend/pm_user/main_tests_pm_user.feature b/features/backend/pm_user/main_tests_pm_user.feature index 58e28f806..73a89fd88 100644 --- a/features/backend/pm_user/main_tests_pm_user.feature +++ b/features/backend/pm_user/main_tests_pm_user.feature @@ -160,7 +160,7 @@ Feature: User Main Tests | Test_description | usr_number | usr_firstname | usr_lastname | usr_username | usr_email | usr_address | usr_zip_code | usr_country | usr_city | usr_location | usr_phone | usr_position | usr_replaced_by | usr_due_date | usr_calendar | usr_status | usr_role | usr_new_pass | usr_cnf_pass | | Update usr_calendar, usr_role | 1 | jhoohan | smith | jhoohan | jhon@gmail.com | grenn #344 | 555-6555 | US | FL | MIA | 555-6655-555 | Gerencia | | 2014-02-15 | 99159704252f501c63f8c58025859967 | ACTIVE | PROCESSMAKER_ADMIN | sample | sample | - | Update usr_firstname, usr_lastname, usr_username | 2 | wilian | carters | william | will@gmail.com | saim #45 | 555-6522 | BO | L | LPB | 23344444 | Adminsitracion | 44811996752d567110634a1013636964 | 2014-12-12 | | ACTIVE | PROCESSMAKER_MANAGER | sample | sample | + | Update usr_firstname, usr_lastname, usr_username | 2 | wilian | carters | wilian | will@gmail.com | saim #45 | 555-6522 | BO | L | LPB | 23344444 | Adminsitracion | 44811996752d567110634a1013636964 | 2014-12-12 | | ACTIVE | PROCESSMAKER_MANAGER | sample | sample | | Update usr_status | 3 | sarita | sandler | sarita | saraah@gmail.com | laberh #985 | 555-9999 | AR | B | BUE | 2353643644 | Desarrollo | 61364466452d56711adb378002702791 | 2014-12-12 | 99159704252f501c63f8c58025859967 | INACTIVE | PROCESSMAKER_ADMIN | admin | admin | @@ -194,7 +194,7 @@ Feature: User Main Tests | Test_description | usr_number | usr_firstname | usr_lastname | usr_username | usr_email | usr_address | usr_zip_code | usr_country | usr_city | usr_location | usr_phone | usr_position | usr_replaced_by | usr_due_date | usr_calendar | usr_status | usr_role | usr_new_pass | usr_cnf_pass | | Update usr_calendar, usr_role | 1 | jhoohan | smith | jhoohan | jhon@gmail.com | grenn #344 | 555-6555 | US | FL | MIA | 555-6655-555 | Gerencia | | 2016-02-15 | 99159704252f501c63f8c58025859967 | ACTIVE | PROCESSMAKER_ADMIN | sample | sample | - | Update usr_firstname, usr_lastname, usr_username | 2 | william | carters | william | will@gmail.com | saim #45 | 555-6522 | BO | L | LPB | 23344444 | Adminsitracion | 44811996752d567110634a1013636964 | 2014-12-12 | | ACTIVE | PROCESSMAKER_MANAGER | sample | sample | + | Update usr_firstname, usr_lastname, usr_username | 2 | wilian | carters | wilian | will@gmail.com | saim #45 | 555-6522 | BO | L | LPB | 23344444 | Adminsitracion | 44811996752d567110634a1013636964 | 2014-12-12 | | ACTIVE | PROCESSMAKER_MANAGER | sample | sample | | Update usr_status | 3 | sarita | sandler | sarita | saraah@gmail.com | laberh #985 | 555-9999 | AR | B | BUE | 2353643644 | Desarrollo | 61364466452d56711adb378002702791 | 2014-12-12 | 99159704252f501c63f8c58025859967 | INACTIVE | PROCESSMAKER_ADMIN | admin | admin | From 630eefbcd19869c004dfd4cf1dd4ce0ca9a58ac6 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Mon, 10 Mar 2014 11:03:20 -0400 Subject: [PATCH 09/17] Correccion en adicion de un texto --- features/backend/step/main_tests_step.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/backend/step/main_tests_step.feature b/features/backend/step/main_tests_step.feature index 4f1e6c657..48ce32bc4 100644 --- a/features/backend/step/main_tests_step.feature +++ b/features/backend/step/main_tests_step.feature @@ -39,7 +39,7 @@ Feature: Project Properties - Step Resources Main Tests And the content type is "application/json" Then the response status code should be 201 And the response charset is "UTF-8" - And the type is "object"git + And the type is "object" And store "step_uid" in session array as variable "step_uid_" Examples: From f58c684ad6025e171a7d653d3fc242e79e4b452b Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Mon, 10 Mar 2014 11:09:10 -0400 Subject: [PATCH 10/17] Correcciones a los features step y trigger wizard --- features/backend/step/basic_sequence_step.feature | 2 +- .../main_tests_trigger_wizards.feature | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/features/backend/step/basic_sequence_step.feature b/features/backend/step/basic_sequence_step.feature index e10e6113e..47850235f 100644 --- a/features/backend/step/basic_sequence_step.feature +++ b/features/backend/step/basic_sequence_step.feature @@ -100,7 +100,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 "obj_uid" property in row 1 equals "32743823452cd63105006e1076595203" + And the "obj_uid" property in row 1 equals "6869969705306aaae049a62048840877" And the "obj_title" property in row 1 equals "OutputDocument Demo" And the "obj_description" property in row 1 equals "Description" And the "obj_type" property in row 1 equals "OUTPUT_DOCUMENT" diff --git a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature index 15030ad55..793c52409 100644 --- a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature +++ b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature @@ -22,13 +22,13 @@ Feature: Group Examples: | i | lib_name | lib_title | lib_class_name | | 0 | pmFunctions | ProcessMaker Functions | class.pmFunctions.php | - | 1 | pmTrSharepoint | Sharepoint DWS Triggers v. 0.1 | class.pmTrSharepoint.pmFunctions.php | - | 2 | pmTrAlfresco | Alfresco DM Triggers v. 0.1 | class.pmTrAlfresco.pmFunctions.php | - | 3 | pmZimbra | Zimbra Triggers v. 0.1 | class.pmZimbra.pmFunctions.php | - | 4 | pmSugar | Sugar CRM Triggers | class.pmSugar.pmFunctions.php | - | 5 | pmTalend | Talend ETL Integration | class.pmTalend.pmFunctions.php | + | 1 | pmTrSharepoint | Sharepoint DWS Triggers v. 0.1 | class.pmTrSharepoint.pmFunctions.php | + | 2 | pmSugar | Sugar CRM Triggers | class.pmSugar.pmFunctions.php | + | 3 | pmTalend | Talend ETL Integration | class.pmTalend.pmFunctions.php | + | 4 | pmZimbra | Zimbra Triggers v. 0.1 | class.pmZimbra.pmFunctions.php | + | 5 | pmTrAlfresco | Alfresco DM Triggers v. 0.1 | class.pmTrAlfresco.pmFunctions.php | - + Scenario Outline: Get a single Library And I request "project/14414793652a5d718b65590036026581/trigger-wizard/" And the content type is "application/json" From 665ad474694d637f359bf6a4e18ce4ae5c7320cb Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Mon, 10 Mar 2014 11:32:56 -0400 Subject: [PATCH 11/17] cambio en el endpoint upload --- features/backend/pm_user/basic_sequence_pm_user.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/backend/pm_user/basic_sequence_pm_user.feature b/features/backend/pm_user/basic_sequence_pm_user.feature index 4dd68e1f1..7337af3be 100644 --- a/features/backend/pm_user/basic_sequence_pm_user.feature +++ b/features/backend/pm_user/basic_sequence_pm_user.feature @@ -35,7 +35,7 @@ Feature: User #GET /api/1.0/{workspace}/user/{usr_uid} # Upload a image Scenario: Upload a image - Given POST I want to upload the image "/home/wendy/pic3.jpg" to user "00000000000000000000000000000001". Url "user/" + Given POST I want to upload the image "/home/wendy/photo/pic3.jpg" to user "00000000000000000000000000000001". Url "user/" #POST /api/1.0/{workspace}/user # Create new User From 86db8a9026919337d9081bcdd6d30f19ba7282bc Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Mon, 10 Mar 2014 11:46:05 -0400 Subject: [PATCH 12/17] Se agrega la funcionalidad de reordenamiento para PROCESS SUPERVISOR (dynafoms e inputdocuments). Fix Code style en FILESMANAGER --- .../engine/src/BusinessModel/FilesManager.php | 3 +- .../src/BusinessModel/ProcessSupervisor.php | 204 ++++++++++++++++-- .../Project/ProcessSupervisors.php | 62 +++++- 3 files changed, 242 insertions(+), 27 deletions(-) diff --git a/workflow/engine/src/BusinessModel/FilesManager.php b/workflow/engine/src/BusinessModel/FilesManager.php index a2da64444..0abc1d3a2 100644 --- a/workflow/engine/src/BusinessModel/FilesManager.php +++ b/workflow/engine/src/BusinessModel/FilesManager.php @@ -67,7 +67,6 @@ class FilesManager } \G::verifyPath($sDirectory, true); $aTheFiles = array(); - $aDirectories = array(); $aFiles = array(); $oDirectory = dir($sDirectory); while ($sObject = $oDirectory->read()) { @@ -127,7 +126,7 @@ class FilesManager } } return $aTheFiles; - } catch (Exception $e) { + } catch (\Exception $e) { throw $e; } } diff --git a/workflow/engine/src/BusinessModel/ProcessSupervisor.php b/workflow/engine/src/BusinessModel/ProcessSupervisor.php index 571d4a9e4..86a212075 100644 --- a/workflow/engine/src/BusinessModel/ProcessSupervisor.php +++ b/workflow/engine/src/BusinessModel/ProcessSupervisor.php @@ -624,9 +624,10 @@ class ProcessSupervisor * * @param string $sProcessUID * @param string $sDynUID + * @param int $sPudPosition * @access public */ - public function addProcessSupervisorDynaform($sProcessUID, $sDynUID) + public function addProcessSupervisorDynaform($sProcessUID, $sDynUID, $sPudPosition) { $oTypeDynaform = \DynaformPeer::retrieveByPK($sDynUID); if (is_null( $oTypeDynaform )) { @@ -692,9 +693,10 @@ class ProcessSupervisor while ($aRow = $oDataset->getRow()) { $aResp = array('pud_uid' => $aRow['STEP_UID'], 'pud_position' => $aRow['STEP_POSITION'], - 'dyn_uid' => $aRow['STEP_UID_OBJ'], - 'dyn_title' => $aRow['DYN_TITLE']); + 'dyn_uid' => $aRow['STEP_UID_OBJ']); $oDataset->next(); + $aRespPosition = $this->updateProcessSupervisorDynaform($sProcessUID ,$aRow['STEP_UID'], $sPudPosition); + $aResp = array_merge(array('dyn_title' => $aRow['DYN_TITLE']), $aRespPosition); } return $aResp; } else { @@ -707,9 +709,11 @@ class ProcessSupervisor * * @param string $sProcessUID * @param string $sInputDocumentUID + * @param int $sPuiPosition * @access public */ - public function addProcessSupervisorInputDocument($sProcessUID, $sInputDocumentUID) + + public function addProcessSupervisorInputDocument($sProcessUID, $sInputDocumentUID, $sPuiPosition) { $oTypeInputDocument= \InputDocumentPeer::retrieveByPK($sInputDocumentUID); if (is_null( $oTypeInputDocument )) { @@ -747,7 +751,7 @@ class ProcessSupervisor $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, 'STEP_TYPE_OBJ' => "INPUT_DOCUMENT", 'STEP_UID_OBJ' => $sInputDocumentUID, - 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); + 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "INPUT_DOCUMENT"))); $sDelimiter = \DBAdapter::getStringDelimiter(); $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); @@ -776,9 +780,10 @@ class ProcessSupervisor while ($aRow = $oDataset->getRow()) { $aResp = array('pui_uid' => $aRow['STEP_UID'], 'pui_position' => $aRow['STEP_POSITION'], - 'input_doc_uid' => $aRow['STEP_UID_OBJ'], - 'input_doc_title' => $aRow['INP_DOC_TITLE']); + 'input_doc_uid' => $aRow['STEP_UID_OBJ']); $oDataset->next(); + $aRespPosition = $this->updateProcessSupervisorInputDocument($sProcessUID ,$aRow['STEP_UID'], $sPuiPosition); + $aResp = array_merge(array('input_doc_title' => $aRow['INP_DOC_TITLE']), $aRespPosition); } return $aResp; } else { @@ -821,19 +826,15 @@ class ProcessSupervisor */ public function removeDynaformSupervisor($sProcessUID, $sPudUID) { - $oConnection = \Propel::getConnection(\StepSupervisorPeer::DATABASE_NAME); try { $oDynaformSupervidor = \StepSupervisorPeer::retrieveByPK($sPudUID); if (!is_null($oDynaformSupervidor)) { - $oConnection->begin(); - $iResult = $oDynaformSupervidor->delete(); - $oConnection->commit(); - return $iResult; + $oProcessMap = new \processMap(new \DBConnection()); + $oProcessMap->removeSupervisorStep( $oDynaformSupervidor->getStepUid(), $sProcessUID, 'DYNAFORM', $oDynaformSupervidor->getStepUidObj(), $oDynaformSupervidor->getStepPosition() ); } else { throw (new \Exception('This row does not exist!')); } } catch (Exception $oError) { - $oConnection->rollback(); throw ($oError); } } @@ -851,10 +852,8 @@ class ProcessSupervisor try { $oInputDocumentSupervidor = \StepSupervisorPeer::retrieveByPK($sPuiUID); if (!is_null($oInputDocumentSupervidor)) { - $oConnection->begin(); - $iResult = $oInputDocumentSupervidor->delete(); - $oConnection->commit(); - return $iResult; + $oProcessMap = new \processMap(new \DBConnection()); + $oProcessMap->removeSupervisorStep( $oInputDocumentSupervidor->getStepUid(), $sProcessUID, 'INPUT_DOCUMENT', $oInputDocumentSupervidor->getStepUidObj(), $oInputDocumentSupervidor->getStepPosition() ); } else { throw (new \Exception('This row does not exist!')); } @@ -863,5 +862,174 @@ class ProcessSupervisor throw ($oError); } } -} + /** + * Assign a dynaform supervisor of a process + * + * @param string $sProcessUID + * @param string $sPudUID + * @param string $sPudPosition + * @access public + */ + public function updateProcessSupervisorDynaform($sProcessUID, $sPudUID, $sPudPosition) + { + $oCriteria=\StepSupervisorPeer::retrieveByPK($sPudUID); + $actualPosition = $oCriteria->getStepPosition(); + $tempPosition = (isset($sPudPosition)) ? $sPudPosition : $actualPosition; + if (isset($tempPosition) && ($tempPosition != $actualPosition)) { + $this->moveDynaforms($sProcessUID, $sPudUID, $tempPosition); + } + //Return + unset($sPudPosition); + $sPudPosition = $tempPosition; + $oCriteria->setStepPosition($sPudPosition); + $oCriteria->save(); + $oCriteria=array('pud_uid' => $oCriteria->getStepUid(), + 'pud_position' => $oCriteria->getStepPosition(), + 'dyn_uid' => $oCriteria->getStepUidObj()); + return $oCriteria; + } + + /** + * Assign a InputDocument supervisor of a process + * + * @param string $sProcessUID + * @param string $sPuiUID + * @param string $sPuiPosition + * @access public + */ + public function updateProcessSupervisorInputDocument($sProcessUID, $sPuiUID, $sPuiPosition) + { + $oCriteria=\StepSupervisorPeer::retrieveByPK($sPuiUID); + $actualPosition = $oCriteria->getStepPosition(); + $tempPosition = (isset($sPuiPosition)) ? $sPuiPosition : $actualPosition; + if (isset($tempPosition) && ($tempPosition != $actualPosition)) { + $this->moveInputDocuments($sProcessUID, $sPuiUID, $tempPosition); + } + //Return + unset($sPuiPosition); + $sPuiPosition = $tempPosition; + $oCriteria->setStepPosition($sPuiPosition); + $oCriteria->save(); + $oCriteria=array('pui_uid' => $oCriteria->getStepUid(), + 'pui_position' => $oCriteria->getStepPosition(), + 'inp_doc_uid' => $oCriteria->getStepUidObj()); + return $oCriteria; + } + + /** + * Validate Process Uid + * @var string $pro_uid. Uid for Process + * @var string $pu_uid. Uid for Step + * @var string $pu_pos. Position for Step + * + * @return void + */ + public function moveDynaforms($pro_uid, $pu_uid, $pu_pos) + { + $aSteps = $this->getProcessSupervisorDynaforms($pro_uid); + $step_pos = $pu_pos; + $step_uid = $pu_uid; + foreach ($aSteps as $dataStep) { + if ($dataStep['pud_uid'] == $step_uid) { + $prStepPos = (int)$dataStep['pud_position']; + } + } + $seStepPos = $step_pos; + //Principal Step is up + if ($prStepPos == $seStepPos) { + return true; + } elseif ($prStepPos < $seStepPos) { + $modPos = 'UP'; + $newPos = $seStepPos; + $iniPos = $prStepPos+1; + $finPos = $seStepPos; + } else { + $modPos = 'DOWN'; + $newPos = $seStepPos; + $iniPos = $seStepPos; + $finPos = $prStepPos-1; + } + $range = range($iniPos, $finPos); + foreach ($aSteps as $dataStep) { + if ((in_array($dataStep['pud_position'], $range)) && ($dataStep['pud_uid'] != $step_uid)) { + $stepChangeIds[] = $dataStep['pud_uid']; + $stepChangePos[] = $dataStep['pud_position']; + } + } + foreach ($stepChangeIds as $key => $value) { + if ($modPos == 'UP') { + $tempPos = ((int)$stepChangePos[$key])-1; + $this ->changePosStep($value, $tempPos); + } else { + $tempPos = ((int)$stepChangePos[$key])+1; + $this ->changePosStep($value, $tempPos); + } + } + $this ->changePosStep($value, $tempPos); + } + + /** + * Validate Process Uid + * @var string $pro_uid. Uid for Process + * @var string $pu_uid. Uid for Step + * @var string $pu_pos. Position for Step + * + * @return void + */ + public function moveInputDocuments($pro_uid, $pu_uid, $pu_pos) + { + $aSteps = $this->getProcessSupervisorInputDocuments($pro_uid); + $step_pos = $pu_pos; + $step_uid = $pu_uid; + foreach ($aSteps as $dataStep) { + if ($dataStep['pui_uid'] == $step_uid) { + $prStepPos = (int)$dataStep['pui_position']; + } + } + $seStepPos = $step_pos; + //Principal Step is up + if ($prStepPos == $seStepPos) { + return true; + } elseif ($prStepPos < $seStepPos) { + $modPos = 'UP'; + $newPos = $seStepPos; + $iniPos = $prStepPos+1; + $finPos = $seStepPos; + } else { + $modPos = 'DOWN'; + $newPos = $seStepPos; + $iniPos = $seStepPos; + $finPos = $prStepPos-1; + } + $range = range($iniPos, $finPos); + foreach ($aSteps as $dataStep) { + if ((in_array($dataStep['pui_position'], $range)) && ($dataStep['pui_uid'] != $step_uid)) { + $stepChangeIds[] = $dataStep['pui_uid']; + $stepChangePos[] = $dataStep['pui_position']; + } + } + foreach ($stepChangeIds as $key => $value) { + if ($modPos == 'UP') { + $tempPos = ((int)$stepChangePos[$key])-1; + $this ->changePosStep($value, $tempPos); + } else { + $tempPos = ((int)$stepChangePos[$key])+1; + $this ->changePosStep($value, $tempPos); + } + } + $this ->changePosStep($value, $tempPos); + } + + /** + * Validate Process Uid + * @var string $pro_uid. Uid for process + * + */ + public function changePosStep ($step_uid, $pos) + { + $oCriteria=\StepSupervisorPeer::retrieveByPK($step_uid); + $oCriteria->setStepPosition($pos); + $oCriteria->save(); + } +} diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php index 11cf7a782..3dff5185e 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php @@ -215,14 +215,15 @@ class ProcessSupervisors extends Api * * @param string $prjUid {@min 32} {@max 32} * @param string $dyn_uid {@min 32} {@max 32} + * @param int $pud_position * * @status 201 */ - public function doPostProcessSupervisorDynaform($prjUid, $dyn_uid) + public function doPostProcessSupervisorDynaform($prjUid, $dyn_uid, $pud_position=null) { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $objectData = $supervisor->addProcessSupervisorDynaform($prjUid, $dyn_uid); + $objectData = $supervisor->addProcessSupervisorDynaform($prjUid, $dyn_uid, $pud_position); //Response $response = $objectData; } catch (\Exception $e) { @@ -237,14 +238,15 @@ class ProcessSupervisors extends Api * * @param string $prjUid {@min 32} {@max 32} * @param string $inp_doc_uid {@min 32} {@max 32} + * @param int $pui_position * * @status 201 */ - public function doPostProcessSupervisorInputDocument($prjUid, $inp_doc_uid) + public function doPostProcessSupervisorInputDocument($prjUid, $inp_doc_uid, $pui_position=null) { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $objectData = $supervisor->addProcessSupervisorInputDocument($prjUid, $inp_doc_uid); + $objectData = $supervisor->addProcessSupervisorInputDocument($prjUid, $inp_doc_uid, $pui_position); //Response $response = $objectData; } catch (\Exception $e) { @@ -265,7 +267,7 @@ class ProcessSupervisors extends Api { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->removeProcessSupervisor($prjUid, $puUid); + $supervisor->removeProcessSupervisor($prjUid, $puUid); } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); @@ -283,7 +285,7 @@ class ProcessSupervisors extends Api { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->removeDynaformSupervisor($prjUid, $pudUid); + $supervisor->removeDynaformSupervisor($prjUid, $pudUid); } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); @@ -301,11 +303,57 @@ class ProcessSupervisors extends Api { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->removeInputDocumentSupervisor($prjUid, $puiUid); + $supervisor->removeInputDocumentSupervisor($prjUid, $puiUid); } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } + + /** + * @url PUT /:prjUid/process-supervisor/dynaform/:pud_uid + * + * @param string $prjUid {@min 32} {@max 32} + * @param string $pud_uid {@min 32} {@max 32} + * @param int $pud_position + * + * @status 201 + */ + public function doPutProcessSupervisorDynaform($prjUid, $pud_uid, $pud_position = null) + { + try { + $supervisor = new \BusinessModel\ProcessSupervisor(); + $objectData = $supervisor->updateProcessSupervisorDynaform($prjUid, $pud_uid, $pud_position); + //Response + $response = $objectData; + } catch (\Exception $e) { + //Response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } + + /** + * @url PUT /:prjUid/process-supervisor/input-document/:pui_uid + * + * @param string $prjUid {@min 32} {@max 32} + * @param string $pui_uid {@min 32} {@max 32} + * @param int $pui_position + * + * @status 201 + */ + public function doPutProcessSupervisorInputDocument($prjUid, $pui_uid, $pui_position = null) + { + try { + $supervisor = new \BusinessModel\ProcessSupervisor(); + $objectData = $supervisor->updateProcessSupervisorInputDocument($prjUid, $pui_uid, $pui_position); + //Response + $response = $objectData; + } catch (\Exception $e) { + //Response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } } From 29f48b99ca6fcc6fd8e343a229306c545a74c0d4 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Mon, 10 Mar 2014 12:24:17 -0400 Subject: [PATCH 13/17] Modificaciones a los features pm user y step --- features/backend/pm_user/main_tests_pm_user.feature | 2 +- features/backend/step/main_tests_step.feature | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/features/backend/pm_user/main_tests_pm_user.feature b/features/backend/pm_user/main_tests_pm_user.feature index 73a89fd88..e3b4e4d71 100644 --- a/features/backend/pm_user/main_tests_pm_user.feature +++ b/features/backend/pm_user/main_tests_pm_user.feature @@ -141,7 +141,7 @@ Feature: User Main Tests "usr_phone": "", "usr_position": "", "usr_replaced_by": "", - "usr_due_date": "", + "usr_due_date": "", "usr_calendar": "", "usr_status": "", "usr_role": "", diff --git a/features/backend/step/main_tests_step.feature b/features/backend/step/main_tests_step.feature index 48ce32bc4..028bc80b6 100644 --- a/features/backend/step/main_tests_step.feature +++ b/features/backend/step/main_tests_step.feature @@ -328,7 +328,7 @@ Feature: Project Properties - Step Resources Main Tests | Trigger assigned to External in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | 0 | - Scenario Outline: Unassign all"DynaForm Demo1" from "Task1" + Scenario Outline: Unassign all "DynaForm Demo1" from "Task1" and "Task 2" Given that I have a valid access_token And that I want to delete a resource with the key "step1" stored in session array Given that I want to delete a resource with the key "step_uid" stored in session array as variable "step_uid_" @@ -344,6 +344,8 @@ Feature: Project Properties - Step Resources Main Tests | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 2 | | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | + | Trigger assigned to Task 2 in type before | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 5 | + Scenario Outline: List assigned Steps to "Task1" & "Task2" (empty) (verify if everithing was deleted) From c2eaa5a8d498a32fa6ad83cd08b26488277a0012 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Mon, 10 Mar 2014 13:56:43 -0400 Subject: [PATCH 14/17] Se controla si un archivo es creado mediante upload o post y se agrega validacion en FILESMANAGER --- .../engine/src/BusinessModel/FilesManager.php | 6 ++++++ .../Api/ProcessMaker/Project/FilesManager.php | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/workflow/engine/src/BusinessModel/FilesManager.php b/workflow/engine/src/BusinessModel/FilesManager.php index 0abc1d3a2..ffe22de16 100644 --- a/workflow/engine/src/BusinessModel/FilesManager.php +++ b/workflow/engine/src/BusinessModel/FilesManager.php @@ -183,6 +183,12 @@ class FilesManager $sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sSubDirectory . $aData['prf_filename']; break; } + $content = $aData['prf_content']; + if (is_string($content)) { + if (file_exists(PATH_SEP.$sDirectory)) { + throw (new \Exception( 'The file: '. $sDirectory . ' already exists.')); + } + } if (!file_exists($sCheckDirectory)) { $sPkProcessFiles = \G::generateUniqueID(); $oProcessFiles = new \ProcessFiles(); diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php index e916c8a8f..351af84be 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/FilesManager.php @@ -37,15 +37,17 @@ class FilesManager extends Api /** * @param string $prj_uid {@min 32} {@max 32} - * @param ProcessFilesManagerStructure $request_data + * @param ProcessFilesManagerStructurePost $request_data + * @param string $prf_content * * @url POST /:prj_uid/file-manager */ - public function doPostProcessFilesManager($prj_uid, ProcessFilesManagerStructure $request_data) + public function doPostProcessFilesManager($prj_uid, ProcessFilesManagerStructurePost $request_data, $prf_content=null) { try { $userUid = $this->getUserId(); $request_data = (array)($request_data); + $request_data = array_merge(array('prf_content' => $prf_content ), $request_data); $filesManager = new \BusinessModel\FilesManager(); $arrayData = $filesManager->addProcessFilesManager($prj_uid, $userUid, $request_data); //Response @@ -151,6 +153,18 @@ class FilesManager extends Api } } +class ProcessFilesManagerStructurePost +{ /** + * @var string {@from body} + */ + public $prf_filename; + + /** + * @var string {@from body} + */ + public $prf_path; +} + class ProcessFilesManagerStructure { /** From d3f11790063a976a793b92a986b4fdc36522b431 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Mon, 10 Mar 2014 14:04:20 -0400 Subject: [PATCH 15/17] Se controla si un archivo es creado mediante upload o post y se agrega validacion --- features/bootstrap/RestContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index e64ef88b0..4e8ffbfec 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1328,7 +1328,7 @@ class RestContext extends BehatContext $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HTTPHEADER,$headr); - curl_setopt($ch, CURLOPT_POSTFIELDS, array('prf_filename'=>$sfile, "prf_path" => $path, "prf_content" => null)); + curl_setopt($ch, CURLOPT_POSTFIELDS, array('prf_filename'=>$sfile, "prf_path" => $path)); curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult = curl_exec($ch); From e17ed479a1cb99e7bb1e5e006efe54ee2b07d16e Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Mon, 10 Mar 2014 14:35:14 -0400 Subject: [PATCH 16/17] Se controla si un archivo es creado mediante upload o post y se agrega validacion --- workflow/engine/src/BusinessModel/FilesManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/src/BusinessModel/FilesManager.php b/workflow/engine/src/BusinessModel/FilesManager.php index ffe22de16..d2cd7a0e2 100644 --- a/workflow/engine/src/BusinessModel/FilesManager.php +++ b/workflow/engine/src/BusinessModel/FilesManager.php @@ -186,7 +186,7 @@ class FilesManager $content = $aData['prf_content']; if (is_string($content)) { if (file_exists(PATH_SEP.$sDirectory)) { - throw (new \Exception( 'The file: '. $sDirectory . ' already exists.')); + throw (new \Exception( 'The file: '.$sMainDirectory. PATH_SEP . $sSubDirectory . $aData['prf_filename'] . ' already exists.')); } } if (!file_exists($sCheckDirectory)) { From 4190b9fef76db684cdd1cb213edb69e2d19e30a0 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Tue, 11 Mar 2014 08:58:29 -0400 Subject: [PATCH 17/17] Adicion de un nuevo escenario --- features/backend/step/main_tests_step.feature | 53 ++++++++++++------- .../main_tests_trigger_wizards.feature | 49 ++++++++++++++--- 2 files changed, 77 insertions(+), 25 deletions(-) diff --git a/features/backend/step/main_tests_step.feature b/features/backend/step/main_tests_step.feature index 028bc80b6..167cc08f4 100644 --- a/features/backend/step/main_tests_step.feature +++ b/features/backend/step/main_tests_step.feature @@ -112,7 +112,7 @@ Feature: Project Properties - Step Resources Main Tests | test_description | project | activity | records | step_type_obj | step_uid_obj | | 3 steps in task 1 - verify that the first record is the first position | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | DYNAFORM | 50332332752cd9b9a7cc989003652905 | - | 2 steps in task 2 - verify that the first record is the first position | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 2 | DYNAFORM | 63293140052cd61b29e21a9056770986 | + | 2 steps in task 2 - verify that the first record is the first position | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 3 | DYNAFORM | 63293140052cd61b29e21a9056770986 | #STEP TRIGGERS @@ -174,24 +174,24 @@ 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 2 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 1 | 81919273152cd636c665080083928728 | 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 | 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 | 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 | 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 | 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 | 17 | 56359776552cd6378b38e47080912028 | AFTER | | 2 | - | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 3 | 18 | 57401970252cd6393531551040242546 | AFTER | | 3 | + | Trigger assigned to Task 1 in type before | 16062437052cd6141881e06088349078 | 10163687452cd6234e0dd25086954968 | 1 | 1 | 81919273152cd636c665080083928728 | 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 | 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 | 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 | 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 | 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 | 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 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 | @@ -200,6 +200,21 @@ Feature: Project Properties - Step Resources Main Tests | Trigger assigned to Task 2 in type After | 16062437052cd6141881e06088349078 | 89706843252cd9decdcf9b3047762708 | 4 | 24 | 57401970252cd6393531551040242546 | AFTER | | 3 | + +Scenario Outline: Delete all Triggers created previously in this script + Given that I want to delete a "trigger" + And I request "project//trigger/" + Then the response status code should be 400 + And the response charset is "UTF-8" + And the type is "object" + + Examples: + + | project | tri_uid | + | 16062437052cd6141881e06088349078 | 81919273152cd636c665080083928728 | + | 16062437052cd6141881e06088349078 | 57401970252cd6393531551040242546 | + + Scenario Outline: List available Triggers for each assigned step Given I request "project//activity//step/step_uid/available-triggers/before" with the key "step_uid" stored in session array as variable "step_uid_" And the content type is "application/json" diff --git a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature index 793c52409..153ab1e5a 100644 --- a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature +++ b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature @@ -22,13 +22,13 @@ Feature: Group Examples: | i | lib_name | lib_title | lib_class_name | | 0 | pmFunctions | ProcessMaker Functions | class.pmFunctions.php | - | 1 | pmTrSharepoint | Sharepoint DWS Triggers v. 0.1 | class.pmTrSharepoint.pmFunctions.php | - | 2 | pmSugar | Sugar CRM Triggers | class.pmSugar.pmFunctions.php | - | 3 | pmTalend | Talend ETL Integration | class.pmTalend.pmFunctions.php | - | 4 | pmZimbra | Zimbra Triggers v. 0.1 | class.pmZimbra.pmFunctions.php | - | 5 | pmTrAlfresco | Alfresco DM Triggers v. 0.1 | class.pmTrAlfresco.pmFunctions.php | + | 1 | pmTrSharepoint | Sharepoint DWS Triggers v. 0.1 | class.pmTrSharepoint.pmFunctions.php | + | 2 | pmTrAlfresco | Alfresco DM Triggers v. 0.1 | class.pmTrAlfresco.pmFunctions.php | + | 3 | pmZimbra | Zimbra Triggers v. 0.1 | class.pmZimbra.pmFunctions.php | + | 4 | pmSugar | Sugar CRM Triggers | class.pmSugar.pmFunctions.php | + | 5 | pmTalend | Talend ETL Integration | class.pmTalend.pmFunctions.php | - + Scenario Outline: Get a single Library And I request "project/14414793652a5d718b65590036026581/trigger-wizard/" And the content type is "application/json" @@ -144,6 +144,43 @@ Scenario Outline: Create new Trigger: createDWS Examples: | i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.sharepointServer | tri_params.input.auth | tri_params.input.name | tri_params.input.users | tri_params.input.title | tri_params.input.documents | tri_params.output.tri_answer | | 1 | pmTrSharepoint | createDWS | Sharepoint 1 | | SCRIPT | @@SERVER | username:password | Test DWS | @@users | Test DWS | /files/test.doc | $respuesta | + + +Scenario Outline: Create new Trigger: createDWS (no enviar campos no requeridos) + Given POST this data: + """ + { + "tri_title": "", + "tri_description": "", + "tri_type": "", + "tri_params": { + "input": { + + "sharepointServer": "", + "auth": "", + "name": "", + "users": "", + "title": "", + "documents": "" + + }, + "output": { + "tri_answer": "" + } + } + } + """ + And I request "project/14414793652a5d718b65590036026581/trigger-wizard//" + And the content type is "application/json" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the type is "object" + And store "tri_uid" in session array as variable "tri_uid" + + Examples: + | i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.sharepointServer | tri_params.input.auth | tri_params.input.name | tri_params.input.users | tri_params.input.title | tri_params.input.documents | tri_params.output.tri_answer | + | 2 | pmTrSharepoint | createDWS | Sharepoint 1 | | SCRIPT | @@SERVER | username:password | Test DWS | @@users | Test DWS | /files/test.doc | $respuesta | + Scenario Outline: Update Trigger Given PUT this data: