kapua icon indicating copy to clipboard operation
kapua copied to clipboard

Persistence Operation Error should not be returned

Open ct-ajovanovic opened this issue 5 years ago • 1 comments

Describe the bug While working on the TriggerService integration tests, I got a KapuaException with the text "Error during Persistence Operation" when setting a 256 character trigger name. This error is not specific enough, and it displays unneeded information to the user. I would recommend to replace it.

To Reproduce Run the following scenario:

 Scenario: Adding Device Connect Schedule With Too Long Name // 256 characters

    Given I login as user with name "kapua-sys" and password "kapua-password"
    And I create a job with the name "job0"
    When I found trigger properties with name "Device Connect"
    And A regular trigger creator with the name "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"
    And The trigger is set to start today at 10:00.
    When I expect the exception "KapuaException" with the text "Error during Persistence Operation"
    And I create a new trigger from the existing creator with previously defined date properties
    And An exception was thrown
    And I logout

The scenario will be run successfully and the mentioned Persistence Error will be returned as expected.

Expected behavior A more specific error should be returned, e.g. Trigger name too long/Trigger name should not exceed 255 characters…

Screenshots None

Version of Kapua 1.1.0

Type of deployment [ ] Local Vagrant deployment [ ] Docker [ ] Openshift (in its variants) [x] Others

Main component affected [ ] Console (in case of console please report info on which browser you encountered the problem) [x] REST API [ ] Message Broker [x] - Others

Additional context None

ct-ajovanovic avatar Oct 29 '19 14:10 ct-ajovanovic

Another validation issue appeared when working with the schedule names. It is is possible to enter any symbol or their combination for the schedule name. The example of this is given in the next test:

Scenario: Adding Device Connect Schedule With Name That Contains Invalid Symbols 

    Given I login as user with name "kapua-sys" and password "kapua-password"
    And I create a job with the name "job0"
    When I found trigger properties with name "Device Connect"
    And A regular trigger creator with the name "#@$!?_"
    And The trigger is set to start today at 10:00.
    And I create a new trigger from the existing creator with previously defined date properties
    And I logout 

There should be some validation here right?

ct-ajovanovic avatar Oct 30 '19 10:10 ct-ajovanovic