Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix KapuaNamedEntity name validation #2796

Merged
merged 10 commits into from
Dec 18, 2019

Conversation

Coduz
Copy link
Contributor

@Coduz Coduz commented Dec 17, 2019

This PR fixes the validation on KapuaNamedEntityes.

The validation of the name field for some entities had thw wrong check on the UI and the wrong/none validation on the backend.

Related Issue
This PR also fixes #2709 , #2710

Description of the solution adopted
Created a new utility method in ArgumentValidator class that validates the value provided supposing it is a KapuaNamedEntity name.

Checks for:

  • not null
  • min length and max langth (provided)
  • That contains only alphanumerics, dash, underscore and whitespaces

Screenshots
None

Any side note on the changes made
Removed some unused code.
Refactored ArgumentValidator. lengthRange(...) with was requiring Long type for max and min length that made no sense.

@Coduz Coduz added the Bug This is a bug or an unexpected behaviour. Fix it! label Dec 17, 2019
@Coduz Coduz requested a review from lorthirk December 17, 2019 14:15
…ndle multiple checks

Signed-off-by: coduz <alberto.codutti@eurotech.com>
Signed-off-by: coduz <alberto.codutti@eurotech.com>
Signed-off-by: coduz <alberto.codutti@eurotech.com>
Signed-off-by: coduz <alberto.codutti@eurotech.com>
Signed-off-by: coduz <alberto.codutti@eurotech.com>
Signed-off-by: coduz <alberto.codutti@eurotech.com>
Signed-off-by: coduz <alberto.codutti@eurotech.com>
Signed-off-by: coduz <alberto.codutti@eurotech.com>
Signed-off-by: coduz <alberto.codutti@eurotech.com>
@Coduz Coduz force-pushed the fix-kapuaEntityNameValidation branch from 806176e to e255ded Compare December 17, 2019 14:40
Signed-off-by: coduz <alberto.codutti@eurotech.com>
@codecov
Copy link

codecov bot commented Dec 18, 2019

Codecov Report

Merging #2796 into develop will decrease coverage by 0.43%.
The diff coverage is 79.16%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2796      +/-   ##
=============================================
- Coverage      57.46%   57.03%   -0.44%     
- Complexity      3395     3469      +74     
=============================================
  Files           1074     1074              
  Lines          30505    30510       +5     
  Branches        2436     2436              
=============================================
- Hits           17531    17402     -129     
- Misses         11804    11946     +142     
+ Partials        1170     1162       -8
Impacted Files Coverage Δ Complexity Δ
...efinition/quartz/TriggerDefinitionServiceImpl.java 27.5% <0%> (ø) 6 <0> (ø) ⬇️
...pse/kapua/service/tag/internal/TagServiceImpl.java 77.77% <100%> (ø) 13 <0> (ø) ⬇️
.../eclipse/kapua/commons/util/ArgumentValidator.java 88% <100%> (+1.63%) 0 <0> (ø) ⬇️
.../service/job/step/internal/JobStepServiceImpl.java 76.92% <100%> (-0.22%) 21 <0> (ø)
...e/scheduler/trigger/quartz/TriggerServiceImpl.java 64.28% <100%> (ø) 24 <0> (ø) ⬇️
...pse/kapua/service/job/internal/JobServiceImpl.java 79.72% <100%> (ø) 20 <1> (ø) ⬇️
...ice/endpoint/internal/EndpointInfoServiceImpl.java 54.9% <50%> (ø) 15 <0> (ø) ⬇️
...inition/internal/JobStepDefinitionServiceImpl.java 44.11% <50%> (ø) 7 <0> (ø) ⬇️
...clipse/kapua/kura/simulator/generator/Payload.java 0% <0%> (-50%) 0% <0%> (ø)
...pua/kura/simulator/app/data/PeriodicGenerator.java 24.56% <0%> (-36.85%) 0% <0%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 344daa0...a0f4bc3. Read the comment docs.

@Coduz Coduz merged commit d8d1973 into eclipse-kapua:develop Dec 18, 2019
@Coduz Coduz deleted the fix-kapuaEntityNameValidation branch December 18, 2019 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug or an unexpected behaviour. Fix it!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug While Creating a New Tag From Backend
2 participants