Bug 1141816
| Summary: | Rest API do not create a Repository | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Retired] JBoss BPMS Platform 6 | Reporter: | Paulo Henrique Alves <alvesph.redhat> | ||||
| Component: | Business Central | Assignee: | Shelly McGowan <smcgowan> | ||||
| Status: | CLOSED EOL | QA Contact: | Karel Suta <ksuta> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | high | ||||||
| Version: | 6.0.2 | CC: | abhumbe, alazarot, alvesph.redhat, kverlaen, mbaluch, rrajasek | ||||
| Target Milestone: | ER2 | ||||||
| Target Release: | 6.1.0 | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2020-03-27 20:11:18 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Hello Paulo, did you mean the version 6.0.2 by any chance? There's no BPMS version 6.2.0 yet. Regards Marek The version is 6.0.2. Thanks. curl request test curl -i -X POST -H "Content-Type:application/json" --user bpmsuser:bpmspass http://bpms:8080/business-central/rest/repositories/ --data '{"name":"grfTeste", "description":"grfTeste", "userName":"", "password":"", "requestType":"create", "gitURL":"git://localhost/grfTeste"}' curl -i -X GET -H "Content-Type:application/json" --user bpmsuser:bpmspass http://bpms:8080/business-central/rest/repositories Hi Paulo, Could you attach a full server.log please? (startup to at least after the problem). Thanks! Created attachment 938497 [details]
bpms server.log
bpms server.log with logger FINE for org.drools, org.jbpm and org.kie.
The work for this BZ has been completed. I will be adding an explanation and a list of commits tomorrow. There was actually not a bug here. All POST operations for the Knowledge Store API should be treated as asynchronous. ( See https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_BPM_Suite/6.0/html/Development_Guide/chap-REST_API.html#sect-Knowledge_Store_REST_API for a list of these operations and more info) Ths means that all POST operations will always return a JobResult instance with the status of "ACCEPTED", regardless of whether or not the operation has succeeded. In certain cases, a HTTP error might be returned ("not found") if a referenced part of the url can not be found (repository or organizational unit, for example). Here's an example of what a syntactically and semantically correct POST request to http://server:8080/test/rest/repositories will return: {"jobId":"1413544512674-2","status":"ACCEPTED","repository":{ "name":"repository-name", "description":"repo for testing rest services", "userName":null, "password":null, "requestType":"new", "gitURL":null }} In order to determine whether or not the request has succeeded, it's necessary to do a subsequent GET request that retrieves the status of the job: GET http://server:8080/business-central/rest/jobs/1413544512674-2 In the current code, if you submit a repository request with request type "create" (instead of "new" or "clone"), then a POST operation and a subsequent GET job status operation will return a JobResult with the status "BAD_REQUEST". Also, in 6.0.x, the operations are actually synchronous because of an oversight. That means that the first GET job status request after the initial POST request will return the status of the completed (or failed) job. In 6.1.x, it may take slightly longer (milliseconds? seconds?) until you GET a job status back that is not "ACCEPTED". That being said, I've added some minor checks so that some jobs fail a little more quickly. For the POST repository creation/clone operation, if the requestType field is incorrect, the POST request will now not be processed further and a JobResult with the status "BAD_REQUEST" will be immediately returned. Commits: 6.0.x: https://github.com/droolsjbpm/drools-wb/commit/3508c797 https://github.com/droolsjbpm/drools-wb/commit/0e552d03 https://github.com/droolsjbpm/drools-wb/commit/a1b2f80c Modified to have similar behaviour (checks) on 6.2.x and master: 6.2.x: https://github.com/droolsjbpm/guvnor/commit/541376c6 master: https://github.com/droolsjbpm/guvnor/commit/a64afb7c Verified in 6.1.0 ER2 |
Description of problem: Rest API do not create a Repository. Version-Release number of selected component (if applicable): 6.0.2 How reproducible: Call url to create repository ([POST] /repositories/) with a json entity like {"name":"grfTeste", "description":"grfTeste", "userName":"", "password":"", "requestType":"create", "gitURL":"git://localhost/grfTeste"} Actual results: - BPMS Logs show that a repository has created. - BPMS Workbench do not show a created repository. - Rest API ([GET] /repositories/) to not show a created repository. Expected results: - BPMS Logs show that a repository has created. - BPMS Workbench show a created repository. - Rest API ([GET] /repositories/) show a created repository. Additional info: JSON entity to create repository ([POST] /repositories/) {"name":"grfTeste", "description":"grfTeste", "userName":"", "password":"", "requestType":"create", "gitURL":"git://localhost/grfTeste"} BPMS Log 09:11:32,336 INFO [org.drools.workbench.common.services.rest.JobRequestHelper] (http-/0.0.0.0:8080-3) -----createOrCloneRepository--- , repository name:grfTeste 09:11:32,344 INFO [org.drools.workbench.common.services.rest.JobRequestObserver] (http-/0.0.0.0:8080-3) CreateOrCloneRepositoryRequest event received. 09:11:32,345 INFO [org.drools.workbench.common.services.rest.JobRequestApprovalService] (http-/0.0.0.0:8080-3) Approval request for Job: 1410783092336-1 received. 09:11:32,596 INFO [org.drools.workbench.common.services.rest.JobRequestApprovalService] (http-/0.0.0.0:8080-3) Approval request for Job: 1410783092336-1 result: ACCEPTED 09:11:32,596 INFO [org.drools.workbench.common.services.rest.JobRequestObserver] (http-/0.0.0.0:8080-3) CreateOrCloneRepositoryRequest event approved. Performing requested operation. 09:11:32,600 INFO [org.drools.workbench.common.services.rest.JobRequestHelper] (http-/0.0.0.0:8080-3) -----JobRequestHelper:createOrCloneRepository--- , repository name:grfTeste Result when access Rest API [GET] /repositories/ [{"name":"repositorio1","description":null,"userName":null,"password":null,"requestType":null,"gitURL":"git://repositorio1"},{"name":"repository1","description":null,"userName":null,"password":null,"requestType":null,"gitURL":"git://repository1"},{"name":"repo1","description":null,"userName":null,"password":null,"requestType":null,"gitURL":"git://repo1"},{"name":"teste1","description":null,"userName":null,"password":null,"requestType":null,"gitURL":"git://teste1"},{"name":"poc","description":null,"userName":null,"password":null,"requestType":null,"gitURL":"git://poc"},{"name":"grf","description":null,"userName":null,"password":null,"requestType":null,"gitURL":"git://grf"}] http://pastebin.com/Rp8tKi4Y