From 568ffe4501d07d720ec7f353a88cc9c823eb4ef4 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 24 Apr 2014 08:55:28 -0400 Subject: [PATCH 01/10] Se modifico con los nuevos cambios aplicados al behat basic de web entry --- .../basic_sequence_web_entry.feature | 195 ++++++++++-------- 1 file changed, 106 insertions(+), 89 deletions(-) diff --git a/features/backend/projects/web_entry/basic_sequence_web_entry.feature b/features/backend/projects/web_entry/basic_sequence_web_entry.feature index 3831fc024..5181edeb6 100644 --- a/features/backend/projects/web_entry/basic_sequence_web_entry.feature +++ b/features/backend/projects/web_entry/basic_sequence_web_entry.feature @@ -6,8 +6,7 @@ Feature: Web Entry Background: Given that I have a valid access_token - #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee?filter=john&start=0&limit=50 - # List assignees of an activity +#GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee?filter=john&start=0&limit=50 Scenario Outline: List assignees of an activity Given I request "project/28733629952e66a362c4f63066393844/activity//assignee" And the content type is "application/json" @@ -22,8 +21,8 @@ Feature: Web Entry | 56118778152e66babcc2103002009439 | Task 2 | | 18096002352e66bc1643af8048493068 | Task 3 | - #POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee - # Assign a user or group to an activity + +#POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee Scenario Outline: Assign a user or group to an activity Given POST this data: """ @@ -44,31 +43,31 @@ Feature: Web Entry | 56118778152e66babcc2103002009439 | Task 2 | 00000000000000000000000000000001 | | 18096002352e66bc1643af8048493068 | Task 3 | 00000000000000000000000000000001 | - #WEB ENTRY - #GET /api/1.0/{workspace}/project/{prj_uid}/web-entries - # Get list Web Entries of a Project +#WEB ENTRY +#GET /api/1.0/{workspace}/project/{prj_uid}/web-entries Scenario: Get list Web Entries of a Project And I request "project/28733629952e66a362c4f63066393844/web-entries" 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 json data is an empty array + And the response has 0 records + - #POST /api/1.0/{workspace}/project/{prj_uid}/web-entry - # Create a new Web Entry for a project - # Create a new Web Entry using the method: PHP pages with Web Services +#POST /api/1.0/{workspace}/project/{prj_uid}/web-entry Scenario Outline: Create a new Web Entry using the method: PHP pages with Web Services Given POST this data: """ { "tas_uid": "", "dyn_uid": "", - "method": "WS", - "input_document_access": 1, - "usr_username": "admin", - "usr_password": "admin" + "usr_uid": "00000000000000000000000000000001", + "we_title": "", + "we_description": "", + "we_method": "WS", + "we_input_document_access": 1 + } """ And I request "project/28733629952e66a362c4f63066393844/web-entry" @@ -76,25 +75,31 @@ Feature: Web Entry Then the response status code should be 201 And the response charset is "UTF-8" And the type is "object" - And the response has a "url" property - And the "url" property type is "string" - + And the response has a "we_data" property + And the "we_data" property type is "string" + And store "we_data" in session array as variable "we_data_" + And store "we_uid" in session array as variable "we_uid_" + And I request "we_data" with the key "we_data" stored in session array as variable "we_data_" and url is "absolute" + And the content type is "text/html" + Then the response status code should be 200 + Examples: - | tas_uid | tas_title | dyn_uid | dyn_title | - | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 |DynaForm Demo1 | - | 56118778152e66babcc2103002009439 | Task 2 | 99869771852e66b7dc4b858088901665 |DynaForm Demo2 | + | we_number | tas_uid | we_title | dyn_uid | we_description | + | 1 | 44199549652e66ba533bb06088252754 | Webservice PHP Title 1 | 60308801852e66b7181ae21045247174 | Webservice PHP Description | + | 2 | 56118778152e66babcc2103002009439 | Webservice PHP Title 2 | 99869771852e66b7dc4b858088901665 | Webservice PHP Description | - #POST /api/1.0/{workspace}/project/{prj_uid}/web-entry - # Create a new Web Entry for a project - # Create a new Web Entry using the method: Single HTML + +#POST /api/1.0/{workspace}/project/{prj_uid}/web-entry Scenario Outline: Create a new Web Entry using the method: Single HTML Given POST this data: """ { "tas_uid": "", "dyn_uid": "", - "method": "HTML", - "input_document_access": 1 + "we_title": "", + "we_description": "", + "we_method": "HTML", + "we_input_document_access": 1 } """ And I request "project/28733629952e66a362c4f63066393844/web-entry" @@ -102,106 +107,119 @@ Feature: Web Entry Then the response status code should be 201 And the response charset is "UTF-8" And the type is "object" - And the response has a "html" property - And the "html" property type is "string" + And the response has a "we_data" property + And the "we_data" property type is "string" + And store "we_data" in session array as variable "we_data_" + And store "we_uid" in session array as variable "we_uid_" Examples: - | tas_uid | tas_title | dyn_uid | dyn_title | - | 18096002352e66bc1643af8048493068 | Task 3 | 37977455352e66b892babe6071295002 |DynaForm Demo3 | + | we_number | tas_uid | we_title | dyn_uid | we_description | + | 3 | 18096002352e66bc1643af8048493068 | Webservice HTML Title 2 | 37977455352e66b892babe6071295002 | Webservice description | - #GET /api/1.0/{workspace}/project/{prj_uid}/web-entries - # Get list Web Entries of a Project - Scenario Outline: Get list Web Entries of a Project + +#GET /api/1.0/{workspace}/project/{prj_uid}/web-entries + Scenario: Get list Web Entries of a Project And I request "project/28733629952e66a362c4f63066393844/web-entries" 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 "tas_uid" property in row equals "" - And the "tas_title" property in row equals "" - And the "dyn_uid" property in row equals "" - And the "dyn_title" property in row equals "" - - Examples: - | i | tas_uid | tas_title | dyn_uid | dyn_title | - | 0 | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 |DynaForm Demo1 | - | 1 | 56118778152e66babcc2103002009439 | Task 2 | 99869771852e66b7dc4b858088901665 |DynaForm Demo2 | - - #GET GET /api/1.0/{workspace}/project/{prj_uid}/web-entry/{tas_uid}/{dyn_uid} - # Get a single Web Entry of a Project - Scenario Outline: Get a single Web Entry of a Project - Given that I want to get a resource with the key "obj_uid" stored in session array - And I request "project/28733629952e66a362c4f63066393844/web-entry//" + And the response has 3 records + + +#GET GET /api/1.0/{workspace}/project/{prj_uid}/web-entry/{tas_uid}/{dyn_uid} + Scenario Outline: Get a single Web Entry PHP of a Project + Given that I want to get a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" 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 "tas_uid" is set to "" - And that "tas_title" is set to "" - And that "dyn_uid" is set to "" - And that "dyn_title" is set to "" - + And that "we_title" is set to "" + And that "we_description" is set to "" + Examples: - | tas_uid | tas_title | dyn_uid | dyn_title | - | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 |DynaForm Demo1 | - | 56118778152e66babcc2103002009439 | Task 2 | 99869771852e66b7dc4b858088901665 |DynaForm Demo2 | + | we_number | tas_uid | dyn_uid | we_title | we_description | + | 1 | 44199549652e66ba533bb06088252754 | 60308801852e66b7181ae21045247174 | Webservice PHP Title 1 | Webservice PHP Description | + | 2 | 56118778152e66babcc2103002009439 | 99869771852e66b7dc4b858088901665 | Webservice PHP Title 2 | Webservice PHP Description | + | 3 | 18096002352e66bc1643af8048493068 | 37977455352e66b892babe6071295002 | Webservice HTML Title 2 | Webservice description | - #POST /api/1.0/{workspace}/project/{prj_uid}/web-entry - # Create a new Web Entry for a project - # Create a new Web Entry using the method: PHP pages with Web Services - Scenario Outline: Create a new Web Entry using the method: PHP pages with Web Services - Given POST this data: + +#PUT /api/1.0/{workspace}/project/{prj_uid}/web-entry/{we_uid} + Scenario Outline: Update Web Entry + Given PUT this data: """ { "tas_uid": "", "dyn_uid": "", - "method": "WS", - "input_document_access": 1, - "usr_username": "admin", - "usr_password": "admin" + "usr_uid": "", + "we_title": "", + "we_description": "", + "we_method": "", + "we_input_document_access": 1 } """ + And that I want to update a resource with the key "we_uid" stored in session array as variable "we_uid_" And I request "project/28733629952e66a362c4f63066393844/web-entry" And the content type is "application/json" - Then the response status code should be + Then the response status code should be 200 And the response charset is "UTF-8" - And the type is "object" - And the response status message should have the following text "" Examples: - | tas_uid | tas_title | dyn_uid | dyn_title | status_code | status_message | - | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 |DynaForm Demo1 | 400 | exist | - | 56118778152e66babcc2103002009439 | Task 2 | 99869771852e66b7dc4b858088901665 |DynaForm Demo2 | 400 | exist | - #DELETE /api/1.0/{workspace}/project/{prj_uid}/web-entry/{tas_uid}/{dyn_uid} - # Delete a Web Entry of a Project + | we_number | tas_uid | we_title | dyn_uid | we_description | usr_uid | we_method | + | 1 | 44199549652e66ba533bb06088252754 | Update Webservice PHP Title 1 | 60308801852e66b7181ae21045247174 | Update Webservice PHP Description | 00000000000000000000000000000001 | WS | + | 2 | 56118778152e66babcc2103002009439 | Update Webservice PHP Title 2 | 99869771852e66b7dc4b858088901665 | Update Webservice PHP Description | 00000000000000000000000000000001 | WS | + + +#GET GET /api/1.0/{workspace}/project/{prj_uid}/web-entry/{tas_uid}/{dyn_uid} + Scenario Outline: Get a single Web Entry HTML of a Project + Given that I want to get a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" + 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 "we_title" is set to "" + And that "we_description" is set to "" + + Examples: + | we_number | tas_uid | dyn_uid | we_title | we_description | + | 1 | 44199549652e66ba533bb06088252754 | 60308801852e66b7181ae21045247174 | Update Webservice PHP Title 1 | Update Webservice PHP Description | + | 2 | 56118778152e66babcc2103002009439 | 99869771852e66b7dc4b858088901665 | Update Webservice PHP Title 2 | Update Webservice PHP Description | + | 3 | 18096002352e66bc1643af8048493068 | 37977455352e66b892babe6071295002 | Update Webservice HTML Title 2 | Update Webservice description | + + +#DELETE /api/1.0/{workspace}/project/{prj_uid}/web-entry/{tas_uid}/{dyn_uid} Scenario Outline: Delete a Web Entry of a Project - Given that I want to delete a resource with the key "obj_uid" stored in session array - And I request "project/28733629952e66a362c4f63066393844/web-entry//" + Given that I want to delete a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" 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: - | tas_uid | tas_title | dyn_uid | dyn_title | - | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 |DynaForm Demo1 | - | 56118778152e66babcc2103002009439 | Task 2 | 99869771852e66b7dc4b858088901665 |DynaForm Demo2 | + | we_number | + | 1 | + | 2 | + | 3 | - #GET /api/1.0/{workspace}/project/{prj_uid}/web-entries - # Get list Web Entries of a Project - Scenario: Get list Web Entries of a Project + +#GET /api/1.0/{workspace}/project/{prj_uid}/web-entries + Scenario: Get list Web Entries of a Project And I request "project/28733629952e66a362c4f63066393844/web-entries" 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 json data is an empty array + And the response has 0 records - #WEB ENTRY - END - #DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/{aas_uid} - # Remove an assignee of an activity +#WEB ENTRY - END + + +#DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/{aas_uid} Scenario Outline: Remove an assignee of an activity Given that I want to delete a resource with the key "obj_uid" stored in session array And I request "project/28733629952e66a362c4f63066393844/activity//assignee/" @@ -216,8 +234,8 @@ Feature: Web Entry | 56118778152e66babcc2103002009439 | Task 2 | 00000000000000000000000000000001 | | 18096002352e66bc1643af8048493068 | Task 3 | 00000000000000000000000000000001 | - #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee?filter=john&start=0&limit=50 - # List assignees of an activity + +#GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee?filter=john&start=0&limit=50 Scenario Outline: List assignees of an activity Given I request "project/28733629952e66a362c4f63066393844/activity//assignee" And the content type is "application/json" @@ -230,5 +248,4 @@ Feature: Web Entry | tas_uid | tas_title | | 44199549652e66ba533bb06088252754 | Task 1 | | 56118778152e66babcc2103002009439 | Task 2 | - | 18096002352e66bc1643af8048493068 | Task 3 | - + | 18096002352e66bc1643af8048493068 | Task 3 | \ No newline at end of file From bca64a1a9e033ca3711a50bbb2ff4e275178640a Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 24 Apr 2014 15:45:35 -0400 Subject: [PATCH 02/10] Culminacion de arreglos en los behat de web entry --- .../web_entry/main_tests_web_entry.feature | 462 +++++++++++++----- .../negative_tests_web_entry.feature | 112 +++-- 2 files changed, 398 insertions(+), 176 deletions(-) diff --git a/features/backend/projects/web_entry/main_tests_web_entry.feature b/features/backend/projects/web_entry/main_tests_web_entry.feature index ec87135e2..355fc36c4 100644 --- a/features/backend/projects/web_entry/main_tests_web_entry.feature +++ b/features/backend/projects/web_entry/main_tests_web_entry.feature @@ -1,157 +1,357 @@ @ProcessMakerMichelangelo @RestAPI Feature: Web Entry Main Tests - Requirements: - a workspace with the process 28733629952e66a362c4f63066393844 ("Sample Project #5 (Web Entry)") already loaded - there are zero web entry in the process - Default user "admin" with password "admin" +Requirements: +a workspace with the process 28733629952e66a362c4f63066393844 ("Sample Project #5 (Web Entry)") already loaded +there are zero web entry in the process + +Background: + Given that I have a valid access_token - Background: - Given that I have a valid access_token - - #ASSIGNEE USER OF AN ACTIVITY +#ASSIGNEE USER OF AN ACTIVITY - Scenario Outline: List assignees of an activity - Given I request "project/28733629952e66a362c4f63066393844/activity//assignee" - 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 json data is an empty array +Scenario Outline: List assignees of an activity + Given I request "project/28733629952e66a362c4f63066393844/activity//assignee" + 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 json data is an empty array - Examples: - | tas_uid | tas_title | - | 44199549652e66ba533bb06088252754 | Task 1 | - | 56118778152e66babcc2103002009439 | Task 2 | - | 18096002352e66bc1643af8048493068 | Task 3 | + Examples: + + | tas_uid | tas_title | + | 44199549652e66ba533bb06088252754 | Task 1 | + | 56118778152e66babcc2103002009439 | Task 2 | + | 18096002352e66bc1643af8048493068 | Task 3 | - Scenario Outline: Assign a user or group to an activity - Given POST this data: - """ - { - "aas_uid": "", - "aas_type": "user" - } - """ - And I request "project/28733629952e66a362c4f63066393844/activity//assignee" - 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" +Scenario Outline: Assign a user or group to an activity + Given POST this data: + """ + { + "aas_uid": "", + "aas_type": "user" + } + """ + And I request "project/28733629952e66a362c4f63066393844/activity//assignee" + 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" - Examples: - | tas_uid | tas_title | aas_uid | - | 44199549652e66ba533bb06088252754 | Task 1 | 00000000000000000000000000000001 | - | 56118778152e66babcc2103002009439 | Task 2 | 00000000000000000000000000000001 | - | 18096002352e66bc1643af8048493068 | Task 3 | 00000000000000000000000000000001 | + Examples: - #WEB ENTRY + | tas_uid | tas_title | aas_uid | + | 44199549652e66ba533bb06088252754 | Task 1 | 00000000000000000000000000000001 | + | 56118778152e66babcc2103002009439 | Task 2 | 00000000000000000000000000000001 | + | 18096002352e66bc1643af8048493068 | Task 3 | 00000000000000000000000000000001 | - Scenario: Get list Web Entries of a Project when there are exactly zero web entries - And I request "project/28733629952e66a362c4f63066393844/web-entries" - 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 json data is an empty array +#WEB ENTRY + +Scenario: Get list Web Entries of a Project when there are exactly zero web entries + And I request "project/28733629952e66a362c4f63066393844/web-entries" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 0 records - Scenario Outline: Create a new Web Entry using the method: PHP pages with Web Services - Given POST this data: - """ - { - "tas_uid": "", - "dyn_uid": "", - "method": "WS", - "input_document_access": 1, - "usr_username": "admin", - "usr_password": "admin" - } - """ - And I request "project/28733629952e66a362c4f63066393844/web-entry" - 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 response has a "url" property - And the "url" property type is "string" - And store "url" in session array as variable "url_" - - Examples: - | tas_uid | tas_title | dyn_uid | dyn_title | url_number | - | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 | DynaForm Demo1 | 1 | - | 56118778152e66babcc2103002009439 | Task 2 | 99869771852e66b7dc4b858088901665 | DynaForm Demo2 | 2 | - - - Scenario Outline: Test webentry URL - Given I request "url" with the key "url" stored in session array as variable "url_" and url is "absolute" +Scenario Outline: Create a new Web Entry using the method: PHP pages with Web Services + Given POST this data: + """ + { + "tas_uid": "", + "dyn_uid": "", + "usr_uid": "00000000000000000000000000000001", + "we_title": "", + "we_description": "", + "we_method": "WS", + "we_input_document_access": + } + """ + And I request "project/28733629952e66a362c4f63066393844/web-entry" + 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 response has a "we_data" property + And the "we_data" property type is "string" + And store "we_data" in session array as variable "we_data_" + And store "we_uid" in session array as variable "we_uid_" + And I request "we_data" with the key "we_data" stored in session array as variable "we_data_" and url is "absolute" And the content type is "text/html" Then the response status code should be 200 Examples: - | url_number | - | 1 | - | 2 | - - Scenario Outline: Create a new Web Entry using the method: Single HTML - Given POST this data: - """ - { - "tas_uid": "", - "dyn_uid": "", - "method": "HTML", - "input_document_access": 1 - } - """ - And I request "project/28733629952e66a362c4f63066393844/web-entry" - 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 response has a "html" property - And the "html" property type is "string" - - Examples: - | tas_uid | tas_title | dyn_uid | dyn_title | - | 18096002352e66bc1643af8048493068 | Task 3 | 37977455352e66b892babe6071295002 | DynaForm Demo3 | + | Description | we_number | tas_uid | we_title | dyn_uid | we_description | we_input_document_access | + | Web entry PHP task 1, with values normal | 1 | 44199549652e66ba533bb06088252754 | Web Entry PHP 1 | 60308801852e66b7181ae21045247174 | Webservice PHP Description 1 | 1 | + | Web entry PHP task 2, with character special | 2 | 56118778152e66babcc2103002009439 | Web Entry PHP 2 @#$%&* | 99869771852e66b7dc4b858088901665 | Webservice PHP Description 2 | 1 | + | Web entry PHP task 3, with we_input_document_access in 0 | 3 | 18096002352e66bc1643af8048493068 | Web Entry PHP 3 | 37977455352e66b892babe6071295002 | Webservice PHP Description 3 | 0 | - Scenario Outline: Get list Web Entries of a Project - And I request "project/28733629952e66a362c4f63066393844/web-entries" - 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 "tas_uid" property in row equals "" - And the "tas_title" property in row equals "" - And the "dyn_uid" property in row equals "" - And the "dyn_title" property in row equals "" +Scenario: Get list Web Entries of a Project after created in this scritp web entries PHP + And I request "project/28733629952e66a362c4f63066393844/web-entries" + 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 3 records - Examples: - | i | tas_uid | tas_title | dyn_uid | dyn_title | - | 0 | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 |DynaForm Demo1 | - | 1 | 56118778152e66babcc2103002009439 | Task 2 | 99869771852e66b7dc4b858088901665 |DynaForm Demo2 | - - Scenario Outline: Get a single Web Entry of a Project - Given that I want to get a resource with the key "obj_uid" stored in session array - And I request "project/28733629952e66a362c4f63066393844/web-entry//" - 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 "tas_uid" is set to "" - And that "tas_title" is set to "" - And that "dyn_uid" is set to "" - And that "dyn_title" is set to "" +Scenario Outline: Get a single Web Entry PHP of a Project + Given that I want to get a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" + 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 "we_title" is set to "" + And that "we_description" is set to "" + And that "we_input_document_access" is set to "" + + Examples: - Examples: - | tas_uid | tas_title | dyn_uid | dyn_title | - | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 |DynaForm Demo1 | - | 56118778152e66babcc2103002009439 | Task 2 | 99869771852e66b7dc4b858088901665 |DynaForm Demo2 | + | we_number | tas_uid | we_title | dyn_uid | we_description | we_input_document_access | + | 1 | 44199549652e66ba533bb06088252754 | Web Entry PHP 1 | 60308801852e66b7181ae21045247174 | Webservice PHP Description 1 | 1 | + | 2 | 56118778152e66babcc2103002009439 | Web Entry PHP 2 @#$%&* | 99869771852e66b7dc4b858088901665 | Webservice PHP Description 2 | 1 | + | 3 | 18096002352e66bc1643af8048493068 | Web Entry PHP 3 | 37977455352e66b892babe6071295002 | Webservice PHP Description 3 | 0 | + +Scenario Outline: Update Web Entry PHP + Given PUT this data: + """ + { + "tas_uid": "", + "dyn_uid": "", + "usr_uid": "", + "we_title": "", + "we_description": "", + "we_method": "", + "we_input_document_access": 1 + } + """ + And that I want to update a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | we_number | tas_uid | we_title | dyn_uid | we_description | usr_uid | we_method | + | 1 | 44199549652e66ba533bb06088252754 | Update Web Entry PHP 1 | 60308801852e66b7181ae21045247174 | Update Webservice PHP Description 1 | 00000000000000000000000000000001 | WS | + | 2 | 56118778152e66babcc2103002009439 | Update Web Entry PHP 2 @#$%&* | 99869771852e66b7dc4b858088901665 | Update Webservice PHP Description 2 | 00000000000000000000000000000001 | WS | + + +Scenario Outline: Get a single Web Entry PHP of a Project + Given that I want to get a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" + 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 "we_title" is set to "" + And that "we_description" is set to "" + And that "we_input_document_access" is set to "" + + Examples: + + | we_number | tas_uid | we_title | dyn_uid | we_description | usr_uid | we_method | + | 1 | 44199549652e66ba533bb06088252754 | Update Web Entry PHP 1 | 60308801852e66b7181ae21045247174 | Update Webservice PHP Description 1 | 00000000000000000000000000000001 | WS | + | 2 | 56118778152e66babcc2103002009439 | Update Web Entry PHP 2 @#$%&* | 99869771852e66b7dc4b858088901665 | Update Webservice PHP Description 2 | 00000000000000000000000000000001 | WS | + | 3 | 18096002352e66bc1643af8048493068 | Web Entry PHP 3 | 37977455352e66b892babe6071295002 | Webservice PHP Description 3 | 00000000000000000000000000000001 | WS | + + +Scenario Outline: Update Web Entry, when we_method is change a other method of the register 3 + Given PUT this data: + """ + { + "tas_uid": "18096002352e66bc1643af8048493068", + "dyn_uid": "37977455352e66b892babe6071295002", + "usr_uid": "00000000000000000000000000000001", + "we_title": "Web Entry PHP 3 change method", + "we_description": "Webservice PHP Description 3", + "we_method": "HTML", + "we_input_document_access": 1 + } + """ + And that I want to update a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | we_number | tas_uid | we_title | dyn_uid | we_description | usr_uid | we_method | + | 3 | 18096002352e66bc1643af8048493068 | Web Entry PHP 3 | 37977455352e66b892babe6071295002 | Webservice PHP Description 3 | 00000000000000000000000000000001 | WS | + + +Scenario Outline: Create a new Web Entry using the method: Single HTML + Given POST this data: + """ + { + "tas_uid": "", + "dyn_uid": "", + "we_title": "", + "we_description": "", + "we_method": "HTML", + "we_input_document_access": + } + """ + And I request "project/28733629952e66a362c4f63066393844/web-entry" + 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 response has a "we_data" property + And the "we_data" property type is "string" + And store "we_data" in session array as variable "we_data_" + And store "we_uid" in session array as variable "we_uid_" + + Examples: + + | Description | we_number | tas_uid | we_title | dyn_uid | we_description | we_input_document_access | + | Web entry HTML task 3, with values normal | 4 | 18096002352e66bc1643af8048493068 | Web Entry HTML 1 | 37977455352e66b892babe6071295002 | Webservice HTML description 1 | 1 | + | Web entry HTML task 1, with we_input_document_access in 0 | 5 | 44199549652e66ba533bb06088252754 | Web Entry HTML 2 | 60308801852e66b7181ae21045247174 | Webservice HTML Description 2 | 1 | + | Web entry HTML task 2, with character special | 6 | 56118778152e66babcc2103002009439 | Web Entry HTML 3 @#$%&* | 99869771852e66b7dc4b858088901665 | Webservice HTML Description 3 | 1 | +Scenario: Get list Web Entries of a Project after created in this scritp web entries HTML + And I request "project/28733629952e66a362c4f63066393844/web-entries" + 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 6 records - \ No newline at end of file + +Scenario Outline: Get a single Web Entry HTML of a Project + Given that I want to get a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" + 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 "we_title" is set to "" + And that "we_description" is set to "" + And that "we_input_document_access" is set to "" + + Examples: + + | we_number | tas_uid | we_title | dyn_uid | we_description | we_input_document_access | + | 4 | 18096002352e66bc1643af8048493068 | Web Entry HTML 1 | 37977455352e66b892babe6071295002 | Webservice HTML description 1 | 1 | + | 5 | 44199549652e66ba533bb06088252754 | Web Entry HTML 2 | 60308801852e66b7181ae21045247174 | Webservice HTML Description 2 | 1 | + | 6 | 56118778152e66babcc2103002009439 | Web Entry HTML 3 @#$%&* | 99869771852e66b7dc4b858088901665 | Webservice HTML Description 3 | 1 | + + +Scenario Outline: Update Web Entry HTML + Given PUT this data: + """ + { + "tas_uid": "", + "dyn_uid": "", + "usr_uid": "", + "we_title": "", + "we_description": "", + "we_method": "", + "we_input_document_access": 1 + } + """ + And that I want to update a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + + | we_number | tas_uid | we_title | dyn_uid | we_description | usr_uid | we_method | + | 4 | 18096002352e66bc1643af8048493068 | Update Web Entry HTML 1 | 37977455352e66b892babe6071295002 | Update Webservice HTML Description 1 | 00000000000000000000000000000001 | HTML | + | 5 | 44199549652e66ba533bb06088252754 | Update Web Entry HTML 2 @#$%&* | 60308801852e66b7181ae21045247174 | Update Webservice HTML Description 2 | 00000000000000000000000000000001 | HTML | + + +Scenario Outline: Get a single Web Entry HTML of a Project + Given that I want to get a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" + 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 "we_title" is set to "" + And that "we_description" is set to "" + And that "we_input_document_access" is set to "" + + Examples: + + | we_number | tas_uid | we_title | dyn_uid | we_description | usr_uid | we_method | + | 4 | 18096002352e66bc1643af8048493068 | Update Web Entry HTML 1 | 37977455352e66b892babe6071295002 | Update Webservice HTML Description 1 | 00000000000000000000000000000001 | HTML | + | 5 | 44199549652e66ba533bb06088252754 | Update Web Entry HTML 2 @#$%&* | 60308801852e66b7181ae21045247174 | Update Webservice HTML Description 2 | 00000000000000000000000000000001 | HTML | + | 6 | 56118778152e66babcc2103002009439 | Web Entry HTML 3 @#$%&* | 99869771852e66b7dc4b858088901665 | Webservice HTML Description 3 | 00000000000000000000000000000001 | HTML | + + +Scenario Outline: Delete a Web Entry of a Project + Given that I want to delete a resource with the key "we_uid" stored in session array as variable "we_uid_" + And I request "project/28733629952e66a362c4f63066393844/web-entry" + 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: + + | we_number | + | 1 | + | 2 | + | 3 | + | 4 | + | 5 | + | 6 | + + +Scenario: Get list Web Entries of a Project + And I request "project/28733629952e66a362c4f63066393844/web-entries" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 0 records + + +#WEB ENTRY - END + + +#DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/{aas_uid} + Scenario Outline: Remove an assignee of an activity + Given that I want to delete a resource with the key "obj_uid" stored in session array + And I request "project/28733629952e66a362c4f63066393844/activity//assignee/" + 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: + + | tas_uid | tas_title | aas_uid | + | 44199549652e66ba533bb06088252754 | Task 1 | 00000000000000000000000000000001 | + | 56118778152e66babcc2103002009439 | Task 2 | 00000000000000000000000000000001 | + | 18096002352e66bc1643af8048493068 | Task 3 | 00000000000000000000000000000001 | + + +#GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee?filter=john&start=0&limit=50 + Scenario Outline: List assignees of an activity + Given I request "project/28733629952e66a362c4f63066393844/activity//assignee" + 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 json data is an empty array + + Examples: + + | tas_uid | tas_title | + | 44199549652e66ba533bb06088252754 | Task 1 | + | 56118778152e66babcc2103002009439 | Task 2 | + | 18096002352e66bc1643af8048493068 | Task 3 | \ No newline at end of file diff --git a/features/backend/projects/web_entry/negative_tests_web_entry.feature b/features/backend/projects/web_entry/negative_tests_web_entry.feature index c75066e47..8649c578c 100644 --- a/features/backend/projects/web_entry/negative_tests_web_entry.feature +++ b/features/backend/projects/web_entry/negative_tests_web_entry.feature @@ -2,56 +2,78 @@ Feature: Webentry Negative Tests - Background: +Background: Given that I have a valid access_token - Scenario Outline: Create a new Web Entry using the method: PHP pages with Web Services with bad parameters (negative tests) - Given POST this data: - """ - { - "tas_uid": "", - "dyn_uid": "", - "method": "", - "input_document_access": 1, - "usr_username": "", - "usr_password": "" - } - """ - And I request "project//web-entry" - Then the response status code should be - And the response status message should have the following text "" +Scenario Outline: Create a new Web Entry using the method: PHP pages with Web Services with bad parameters (negative tests) + Given POST this data: + """ + { + "tas_uid": "", + "dyn_uid": "", + "usr_uid": "00000000000000000000000000000001", + "we_title": "", + "we_description": "pruebas negativas", + "we_method": "", + "we_input_document_access": 1 + } + """ + And I request "project//web-entry" + And the content type is "application/json" + Then the response status code should be + And the response status message should have the following text "" - Examples: + Examples: - | test_description | project | tas_uid | tas_title | dyn_uid | dyn_title | method | usr_username | usr_password | error_code | error_message | - | Invalid method | 28733629952e66a362c4f63066393844 | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 | DynaForm Demo1 | JS | admin | admin | 400 | method | - | Invalid usr_username | 28733629952e66a362c4f63066393844 | 56118778152e66babcc2103002009439 | Task 2 | 99869771852e66b7dc4b858088901665 | DynaForm Demo2 | JS | aaro | admin | 400 | method | - | Invalid usr_password | 28733629952e66a362c4f63066393844 | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 | DynaForm Demo1 | WS | admin | sample | 400 | password | - | Field required prj_uid | | 56118778152e66babcc2103002009439 | Task 2 | 99869771852e66b7dc4b858088901665 | DynaForm Demo2 | HTML | admin | admin | 400 | prj_uid | - | Field required tas_uid | 28733629952e66a362c4f63066393844 | | Task 1 | 60308801852e66b7181ae21045247174 | DynaForm Demo1 | WS | admin | admin | 400 | tas_uid | - | Field required dyn_uid | 28733629952e66a362c4f63066393844 | 56118778152e66babcc2103002009439 | Task 2 | | DynaForm Demo2 | HTML | admin | admin | 400 | dyn_uid | - | Field required method | 28733629952e66a362c4f63066393844 | 44199549652e66ba533bb06088252754 | Task 1 | 60308801852e66b7181ae21045247174 | DynaForm Demo1 | | admin | admin | 400 | method | + | test_description | project | tas_uid | dyn_uid | we_title | we_method | error_code | error_message | + | Invalid method | 28733629952e66a362c4f63066393844 | 44199549652e66ba533bb06088252754 | 60308801852e66b7181ae21045247174 | DynaForm Demo1 | JS | 400 | method | + | Field required prj_uid | | 56118778152e66babcc2103002009439 | 99869771852e66b7dc4b858088901665 | DynaForm Demo2 | HTML | 400 | prj_uid | + | Field required tas_uid | 28733629952e66a362c4f63066393844 | | 60308801852e66b7181ae21045247174 | DynaForm Demo1 | WS | 400 | tas_uid | + | Field required dyn_uid | 28733629952e66a362c4f63066393844 | 56118778152e66babcc2103002009439 | | DynaForm Demo2 | HTML | 400 | dyn_uid | + | Field required method | 28733629952e66a362c4f63066393844 | 44199549652e66ba533bb06088252754 | 60308801852e66b7181ae21045247174 | DynaForm Demo1 | | 400 | method | - Scenario Outline: Create a new Web Entry using the method: Single HTML - Given POST this data: - """ - { - "tas_uid": "", - "dyn_uid": "", - "method": "", - "input_document_access": 1 - } - """ - And I request "project//web-entry" - Then the response status code should be - And the response status message should have the following text "" +Scenario Outline: Create a new Web Entry using the method: Single HTML + Given POST this data: + """ + { + "tas_uid": "", + "dyn_uid": "", + "we_title": "", + "we_description": "pruebas negativas", + "we_method": "", + "we_input_document_access": 1 + } + """ + And I request "project//web-entry" + Then the response status code should be + And the response status message should have the following text "" + + Examples: + + | test_description | project | tas_uid | dyn_uid | we_title | we_method | error_code | error_message | + | Invalid method | 28733629952e66a362c4f63066393844 | 18096002352e66bc1643af8048493068 | 37977455352e66b892babe6071295002 | DynaForm Demo1 | JS | 400 | method | + | Field required prj_uid | | 18096002352e66bc1643af8048493068 | 37977455352e66b892babe6071295002 | DynaForm Demo2 | HTML | 400 | prj_uid | + | Field required tas_uid | 28733629952e66a362c4f63066393844 | | 37977455352e66b892babe6071295002 | DynaForm Demo1 | WS | 400 | tas_uid | + | Field required dyn_uid | 28733629952e66a362c4f63066393844 | 18096002352e66bc1643af8048493068 | | DynaForm Demo2 | HTML | 400 | dyn_uid | + | Field required method | 28733629952e66a362c4f63066393844 | 18096002352e66bc1643af8048493068 | 37977455352e66b892babe6071295002 | DynaForm Demo1 | | 400 | method | + + +Scenario: Create a new Web Entry using the method: PHP pages with Web Services with bad parameters (we_input_document_access) + Given POST this data: + """ + { + "tas_uid": "18096002352e66bc1643af8048493068", + "dyn_uid": "37977455352e66b892babe6071295002", + "usr_uid": "00000000000000000000000000000001", + "we_title": "Field wrong - we_method", + "we_description": "pruebas negativas", + "we_method": "WS", + "we_input_document_access": 67 + } + """ + And I request "project/28733629952e66a362c4f63066393844/web-entry" + Then the response status code should be 400 + And the response status message should have the following text "we_input_document_access" - Examples: - | test_description | project | tas_uid | tas_title | dyn_uid | dyn_title | method | error_code | error_message | - | Invalid method | 28733629952e66a362c4f63066393844 | 18096002352e66bc1643af8048493068 | Task 1 | 37977455352e66b892babe6071295002 | DynaForm Demo1 | JS | 400 | method | - | Field required prj_uid | | 18096002352e66bc1643af8048493068 | Task 2 | 37977455352e66b892babe6071295002 | DynaForm Demo2 | HTML | 400 | prj_uid | - | Field required tas_uid | 28733629952e66a362c4f63066393844 | | Task 1 | 37977455352e66b892babe6071295002 | DynaForm Demo1 | WS | 400 | tas_uid | - | Field required dyn_uid | 28733629952e66a362c4f63066393844 | 18096002352e66bc1643af8048493068 | Task 2 | | DynaForm Demo2 | HTML | 400 | dyn_uid | - | Field required method | 28733629952e66a362c4f63066393844 | 18096002352e66bc1643af8048493068 | Task 1 | 37977455352e66b892babe6071295002 | DynaForm Demo1 | | 400 | method | From 09b9e2b6c00ac90294a451ff3888a9ea14ef6a9a Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 24 Apr 2014 12:36:30 -0400 Subject: [PATCH 03/10] updating composer.json to use the last working version for pm of restler --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3e840153f..7b7c9ca89 100644 --- a/composer.json +++ b/composer.json @@ -38,8 +38,11 @@ } ], + "minimum-stability": "beta", + "prefer-stable": true, + "require": { - "luracast/restler" : "v3.0.0", + "luracast/restler" : "3.0.0-RC4", "bshaffer/oauth2-server-php": "v1.0", "jquery/jquery": "1.10.2", "underscore/underscore": "1.5.2", From a30ecee03f85a3c483a37b16bff9e1ebc0540ac3 Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 24 Apr 2014 16:05:42 -0400 Subject: [PATCH 04/10] some changes to implement latest version of restler 3.0.0 --- composer.json | 4 ++-- .../src/ProcessMaker/Services/Api/Project.php | 14 +++++++++++--- .../src/ProcessMaker/Services/OAuth2/Server.php | 5 +++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 7b7c9ca89..31373274b 100644 --- a/composer.json +++ b/composer.json @@ -38,11 +38,11 @@ } ], - "minimum-stability": "beta", + "minimum-stability": "stable", "prefer-stable": true, "require": { - "luracast/restler" : "3.0.0-RC4", + "luracast/restler" : "3.0.0", "bshaffer/oauth2-server-php": "v1.0", "jquery/jquery": "1.10.2", "underscore/underscore": "1.5.2", diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project.php b/workflow/engine/src/ProcessMaker/Services/Api/Project.php index 8e596a7f1..4ae9f55c8 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project.php @@ -16,7 +16,10 @@ use \ProcessMaker\Util; */ class Project extends Api { - public function index() + /** + * @url GET + */ + public function doGetProjects() { try { $start = null; @@ -31,10 +34,15 @@ class Project extends Api } } - public function get($prjUid) + /** + * @url GET /:prj_uid + * + * @param string $prj_uid {@min 32}{@max 32} + */ + public function doGetProject($prj_uid) { try { - return Adapter\BpmnWorkflow::getStruct($prjUid); + return Adapter\BpmnWorkflow::getStruct($prj_uid); } catch (\Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } diff --git a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php index 127201760..efe509912 100644 --- a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php +++ b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php @@ -235,5 +235,10 @@ class Server implements iAuthenticate { return array_keys($this->scope); } + + public function __getWWWAuthenticateString() + { + return ""; + } } From 69916a08081cad4e732e4e7d8c274098d2990300 Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Fri, 25 Apr 2014 11:32:13 -0400 Subject: [PATCH 05/10] little fix to match a request with an api url pattern --- framework/src/Maveriks/WebApplication.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 71c9e8910..5112cf87b 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -69,7 +69,9 @@ class WebApplication } else { return self::RUNNING_DEFAULT; } - } elseif (substr($this->requestUri, 1, 3) === "api") { + } elseif (substr($this->requestUri, 1, 3) === "api" + && count(explode("/", $this->requestUri)) >= 4 // url api pattern: /api/1.0// + ) { return self::RUNNING_API; } else { return self::RUNNING_WORKFLOW; From 14a3afce33fcebe75d2777da21634d0ea79b2e12 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Fri, 25 Apr 2014 11:38:53 -0400 Subject: [PATCH 06/10] Adicion de POST y PUT en PROJECT --- workflow/engine/classes/model/Process.php | 13 +++++++++++++ workflow/engine/src/ProcessMaker/Project/Bpmn.php | 12 +++++++++--- .../src/ProcessMaker/Services/Api/Project.php | 14 ++++++++------ 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index 59f09b020..18e060ba3 100755 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -808,6 +808,19 @@ class Process extends BaseProcess return $aProcesses; } + public function getCasesCountForProcess($pro_uid) + { + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( 'COUNT(*) AS TOTAL_CASES' ); + $oCriteria->add( ApplicationPeer::PRO_UID, $pro_uid ); + $oDataset = ApplicationPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + + $oDataset->next(); + $cases = $oDataset->getRow(); + return (int)$cases['TOTAL_CASES']; + } + public function getAllProcessesByCategory () { $oCriteria = new Criteria( 'workflow' ); diff --git a/workflow/engine/src/ProcessMaker/Project/Bpmn.php b/workflow/engine/src/ProcessMaker/Project/Bpmn.php index 69b077306..4e132094a 100644 --- a/workflow/engine/src/ProcessMaker/Project/Bpmn.php +++ b/workflow/engine/src/ProcessMaker/Project/Bpmn.php @@ -158,6 +158,9 @@ class Bpmn extends Handler foreach ($this->getFlows() as $flow) { $this->removeFlow($flow["FLO_UID"]); } + foreach ($this->getArtifacts() as $artifacts) { + $this->removeArtifact($artifacts["ART_UID"]); + } if ($process = $this->getProcess("object")) { $process->delete(); @@ -213,9 +216,12 @@ class Bpmn extends Handler public function canRemove() { - // TODO this must validate if the project can be deleted or not. - // TODO the project can be deleted only if it has not any started cases - return true; + $totalCases = \Process::getCasesCountForProcess($this->prjUid); + if ($totalCases == 0) { + return true; + } else { + return false; + } } /* diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project.php b/workflow/engine/src/ProcessMaker/Services/Api/Project.php index 4ae9f55c8..412c3823e 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project.php @@ -54,11 +54,8 @@ class Project extends Api public function post($request_data) { try { - //TODO + return Adapter\BpmnWorkflow::createFromStruct($request_data); } catch (\Exception $e) { - // TODO in case that $process->createProcess($userUid, $data); fails maybe the BPMN project was created successfully - // so, we need remove it or change the creation order. - throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -72,10 +69,15 @@ class Project extends Api } } - public function delete($prjUid) + /** + * @param string $prj_uid {@min 1}{@max 32} + * @url DELETE /:prj_uid + */ + public function delete($prj_uid) { try { - // TODO + $oBpmnWf = Adapter\BpmnWorkflow::load($prj_uid); + $oBpmnWf->remove(); } catch (\Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } From cbae382d0fc82b3c87c3eca87c9095a32793fb52 Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Fri, 25 Apr 2014 13:35:59 -0400 Subject: [PATCH 07/10] Adding flush cache command --- workflow/engine/bin/tasks/cliFlushCache.php | 63 +++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 workflow/engine/bin/tasks/cliFlushCache.php diff --git a/workflow/engine/bin/tasks/cliFlushCache.php b/workflow/engine/bin/tasks/cliFlushCache.php new file mode 100644 index 000000000..543b68932 --- /dev/null +++ b/workflow/engine/bin/tasks/cliFlushCache.php @@ -0,0 +1,63 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + * @package workflow-engine-bin-tasks + */ +G::LoadSystem("g"); + +CLI::taskName('flush-cache'); +CLI::taskDescription(<<setRootDir($rootDir); + $loadConstants = false; + $workspaces = get_workspaces_from_args($args); + + if (! defined("PATH_C")) { + die("ERROR: seems processmaker is not properly installed (System constants are missing).".PHP_EOL); + } + + CLI::logging("Flush ".pakeColor::colorize("system", "INFO")." cache ... "); + G::rm_dir(PATH_C); + G::mk_dir(PATH_C, 0777); + echo "DONE" . PHP_EOL; + + foreach ($workspaces as $workspace) { + echo "Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... "; + + G::rm_dir($workspace->path . "/cache"); + G::mk_dir($workspace->path . "/cache", 0777); + G::rm_dir($workspace->path . "/cachefiles"); + G::mk_dir($workspace->path . "/cachefiles", 0777); + echo "DONE" . PHP_EOL; + } +} From ac24e70ae2ce2604407610667d1aebd53249bfa5 Mon Sep 17 00:00:00 2001 From: Fernando Ontiveros Date: Fri, 25 Apr 2014 14:41:25 -0400 Subject: [PATCH 08/10] changing composer.json, we are using composer-public.colosa.net again --- composer.json | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 31373274b..2c86e6700 100644 --- a/composer.json +++ b/composer.json @@ -7,36 +7,17 @@ "repositories": [ { - "type": "package", - "package": { - "name": "jquery/jquery", - "version": "1.10.2", - "dist": { - "url": "http://code.jquery.com/jquery-1.10.2.min.js", - "type": "file" - } - } + "packagist": false }, { - "type": "package", - "package": { - "name": "underscore/underscore", - "version": "1.5.2", - "dist": { - "url": "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js", - "type": "file" - } - } + "type": "composer", + "url": "http://composer-public.colosa.net/" }, { - "type": "vcs", - "url": "git@bitbucket.org:colosa/pmUI.git" - }, - { - "type": "vcs", - "url": "git@bitbucket.org:colosa/MichelangeloFE.git" + "type": "composer", + "url": "http://composer.colosa.net/" } - ], + ], "minimum-stability": "stable", "prefer-stable": true, From ba0e08aa7d522a3834cfbb2d0ad04e1866e2cd0e Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Fri, 25 Apr 2014 14:47:00 -0400 Subject: [PATCH 09/10] little fix, adding @url to match url matter for PUT /project/{prj_uid} --- .../engine/src/ProcessMaker/Services/Api/Project.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project.php b/workflow/engine/src/ProcessMaker/Services/Api/Project.php index 4ae9f55c8..697ca7863 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project.php @@ -63,10 +63,15 @@ class Project extends Api } } - public function put($prjUid, $request_data) + /** + * @url PUT /:prj_uid + * + * @param string $prj_uid {@min 32}{@max 32} + */ + public function doPutProject($prj_uid, $request_data) { try { - return Adapter\BpmnWorkflow::updateFromStruct($prjUid, $request_data); + return Adapter\BpmnWorkflow::updateFromStruct($prj_uid, $request_data); } catch (\Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } From d1131d90607452003fab15499b778b0b1a484ac1 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Fri, 25 Apr 2014 15:14:31 -0400 Subject: [PATCH 10/10] BUG 13974 merged from Github code --- workflow/engine/classes/class.pmScript.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/workflow/engine/classes/class.pmScript.php b/workflow/engine/classes/class.pmScript.php index adb842dc7..7a53721e1 100644 --- a/workflow/engine/classes/class.pmScript.php +++ b/workflow/engine/classes/class.pmScript.php @@ -58,7 +58,7 @@ G::LoadClass( 'pmFunctions' ); //call plugin if (class_exists( 'folderData' )) { //$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid); - $oPluginRegistry = PMPluginRegistry::getSingleton(); + $oPluginRegistry = &PMPluginRegistry::getSingleton(); $aAvailablePmFunctions = $oPluginRegistry->getPmFunctions(); foreach ($aAvailablePmFunctions as $key => $class) { $filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php'; @@ -165,7 +165,7 @@ class PMScript foreach ($tokens as $token) { if (is_string($token)) { - $result = $result . $token; + $result .= $token; } else { list($id, $text) = $token; @@ -175,18 +175,18 @@ class PMScript case T_COMMENT: case T_ML_COMMENT: //we've defined this case T_DOC_COMMENT: //and this + if ($text != 'sScript = $sScript; + $this->sScript = trim($result); } /**