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

Remove domain classes #3939

Merged

Conversation

dseurotech
Copy link
Contributor

Brief description of the PR

This PR replaces cumbersome Domain classes with String constants and moves the declaration of expected Domains to a more flexible DI mechanism.

Related Issue
This PR fixes/closes 3938

Description of the solution adopted
This PR replaces Domain classes with String constants in a Domains utility class in kapua-commons (just to find all instances), and moves the declaration of desired Domains to Guice's Wiring.
Also, a DB populator pattern is introduced - used to programmatically initialise all necessary data once the db tables have been initialized. The first instance of such populators is a class which compares Domains declared in wiring to the ones present in the database, creating the missing one and logging discrepancies.

Any side note on the changes made
Potentially breaking:
org.eclipse.kapua.service.authorization.permission.PermissionFactory#newPermission (all overloads) now take a simple String as first parameter, instead of a Domain.

@Coduz
Copy link
Contributor

Coduz commented Jan 16, 2024

/request-license-review

Copy link

/request-license-review

License review requests:

After all reviews have concluded, re-run the license-vetting check from the Github Actions web-interface to update its status.

Workflow run (with attached summary files):
https://github.com/eclipse/kapua/actions/runs/7540498200

@dseurotech dseurotech force-pushed the refactorings/removeDomainClasses branch 2 times, most recently from 0ea8658 to a83500e Compare January 17, 2024 08:59
@dseurotech dseurotech marked this pull request as draft January 17, 2024 15:49
Copy link

codecov bot commented Jan 17, 2024

Codecov Report

Attention: 464 lines in your changes are missing coverage. Please review.

Comparison is base (474caaf) 20.74% compared to head (a1663f0) 20.57%.

❗ Current head a1663f0 differs from pull request most recent head e2e1439. Consider uploading reports for the commit e2e1439 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #3939      +/-   ##
=============================================
- Coverage      20.74%   20.57%   -0.17%     
- Complexity         6        8       +2     
=============================================
  Files           1951     1916      -35     
  Lines          41767    41777      +10     
  Branches        3956     3970      +14     
=============================================
- Hits            8664     8596      -68     
- Misses         32700    32776      +76     
- Partials         403      405       +2     
Files Coverage Δ
...ns/configuration/KapuaConfigurableServiceBase.java 41.17% <ø> (ø)
...se/kapua/commons/jpa/KapuaEntityJpaRepository.java 7.27% <100.00%> (+0.02%) ⬆️
...lipse/kapua/commons/model/AbstractKapuaEntity.java 100.00% <ø> (ø)
...entication/authentication/AuthenticationLogic.java 0.00% <ø> (ø)
...t/commons/AbstractDeviceManagementServiceImpl.java 0.00% <ø> (ø)
...tractDeviceManagementTransactionalServiceImpl.java 0.00% <ø> (ø)
...ce/authorization/permission/PermissionFactory.java 28.57% <ø> (ø)
...e/certificate/internal/CertificateServiceImpl.java 70.21% <100.00%> (ø)
...service/authorization/domain/shiro/DomainImpl.java 96.77% <100.00%> (+6.77%) ⬆️
...zation/permission/shiro/PermissionFactoryImpl.java 100.00% <100.00%> (ø)
... and 78 more

... and 5 files with indirect coverage changes

@dseurotech dseurotech force-pushed the refactorings/removeDomainClasses branch 13 times, most recently from 7332bd6 to 2b0c919 Compare January 19, 2024 15:39
@dseurotech dseurotech marked this pull request as ready for review January 19, 2024 15:40
@dseurotech dseurotech force-pushed the refactorings/removeDomainClasses branch 3 times, most recently from 03574b9 to a1663f0 Compare January 25, 2024 14:54
…e dependencies in the future

Signed-off-by: dseurotech <[email protected]>
… wiring to the ones in the database

Signed-off-by: dseurotech <[email protected]>
… included in the equality comparison, as it has no effect at all (and could be removed completely as a property)

Signed-off-by: dseurotech <[email protected]>
@dseurotech dseurotech force-pushed the refactorings/removeDomainClasses branch from a1663f0 to e2e1439 Compare January 29, 2024 11:31
@Coduz Coduz merged commit 837e259 into eclipse-kapua:develop Jan 30, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Domain classes
2 participants