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

Restrictable Service Configurations #2947

Merged
merged 1 commit into from
May 11, 2020

Conversation

lorthirk
Copy link

@lorthirk lorthirk commented Apr 23, 2020

This PR introduces support for Restrictable Service Configurations. Two methods are introduced in AbstractKapuaConfigurableService, meant to be overridden by the extending services:

  • boolean isAvailableService(): controls whether the whole service is available or not
  • boolean isAvailableProperty(KapuaTad ad): controls whether a single property is available or nor

Related Issue
No related issues

@lorthirk lorthirk force-pushed the feature-restrictedConfigurations branch from 1ae72f2 to 0a10fac Compare April 23, 2020 09:07
@lorthirk lorthirk changed the title Feature restricted configurations Restrictable Configurations Apr 23, 2020
@lorthirk lorthirk changed the title Restrictable Configurations Restrictable Service Configurations Apr 23, 2020
@lorthirk lorthirk requested a review from Coduz April 23, 2020 09:11
@lorthirk lorthirk added Bug This is a bug or an unexpected behaviour. Fix it! Enhancement This PR/Issue improves an part of Kapua labels Apr 23, 2020
@lorthirk lorthirk force-pushed the feature-restrictedConfigurations branch 7 times, most recently from 7c8c0be to 7ea89f4 Compare April 28, 2020 10:04
@lorthirk
Copy link
Author

The issue where a user could change some settings on its own account via REST API is now fixed by #2954.

@lorthirk lorthirk removed the Bug This is a bug or an unexpected behaviour. Fix it! label Apr 28, 2020
@lorthirk lorthirk added the Waitfor/Test This issue/PR needs tests implementation to be properly resolved label Apr 28, 2020
@lorthirk lorthirk marked this pull request as draft April 28, 2020 14:30
@lorthirk
Copy link
Author

PR goes back to draft to wait for fixes in tests

LeoNerdoG pushed a commit to LeoNerdoG/kapua that referenced this pull request May 5, 2020
With a fix for a certain REST API bug (preventing users to change their account settings) in PR eclipse#2946 and PR eclipse#2954 the unit tests for services (tags, users, jobs, scheduling,...) started to fail.
I have fixed this by introducing a mocked account that is used as basis for the service creation.
I have already ran PR on my Travis and everything was fine. CodeCov should report 0% increased/decreased coverage, since all the changes made are in the ignored folders.

Signed-off-by: Leonardo Gaube <leonardo.gaube@comtrade.com>

**Related Issue**
This PR fixes problems with unit tests in PR eclipse#2947 and PR eclipse#2954.

**Description of the solution adopted:**
I have added a mocked AccountService and mocked AccountFactory classes to the existing unit tests, so that the check does not fail. This is  achieved with Mockito's "spy" method. The necessary Account methods are injected in the _CucumberWithProeprtiesFor(Service)_ file.

@lorthirk can you please look at the solution adopted and see if it's ok? After you merge this PR into develop, just rebase your PRs to develop and the tests should be passing normally.
**Screenshots**
N/A

**Any side note on the changes made**
N/A

Signed-off-by: Leonardo Gaube <leonardo.gaube@comtrade.com>
LeoNerdoG pushed a commit to LeoNerdoG/kapua that referenced this pull request May 5, 2020
With a fix for a certain REST API bug (preventing users to change their account settings) in PR eclipse#2946 and PR eclipse#2954 the unit tests for services (tags, users, jobs, scheduling,...) started to fail.
I have fixed this by introducing a mocked account that is used as basis for the service creation.
I have already ran PR on my Travis and everything was fine. CodeCov should report 0% increased/decreased coverage, since all the changes made are in the ignored folders.

Signed-off-by: Leonardo Gaube <leonardo.gaube@comtrade.com>

**Related Issue**
This PR fixes problems with unit tests in PR eclipse#2947 and PR eclipse#2954.

**Description of the solution adopted:**
I have added a mocked AccountService and mocked AccountFactory classes to the existing unit tests, so that the check does not fail. This is  achieved with Mockito's "spy" method. The necessary Account methods are injected in the _CucumberWithProeprtiesFor(Service)_ file.

@lorthirk can you please look at the solution adopted and see if it's ok? After you merge this PR into develop, just rebase your PRs to develop and the tests should be passing normally.
**Screenshots**
N/A

**Any side note on the changes made**
N/A

Signed-off-by: Leonardo Gaube <leonardo.gaube@comtrade.com>
LeoNerdoG pushed a commit to LeoNerdoG/kapua that referenced this pull request May 5, 2020
With a fix for a certain REST API bug (preventing users to change their account settings) in PR eclipse#2946 and PR eclipse#2954 the unit tests for services (tags, users, jobs, scheduling,...) started to fail.
I have fixed this by introducing a mocked account that is used as basis for the service creation.
I have already ran PR on my Travis and everything was fine. CodeCov should report 0% increased/decreased coverage, since all the changes made are in the ignored folders.

Signed-off-by: Leonardo Gaube <leonardo.gaube@comtrade.com>

**Related Issue**
This PR fixes problems with unit tests in PR eclipse#2947 and PR eclipse#2954.

**Description of the solution adopted:**
I have added a mocked AccountService and mocked AccountFactory classes to the existing unit tests, so that the check does not fail. This is  achieved with Mockito's "spy" method. The necessary Account methods are injected in the _CucumberWithProeprtiesFor(Service)_ file.

@lorthirk can you please look at the solution adopted and see if it's ok? After you merge this PR into develop, just rebase your PRs to develop and the tests should be passing normally.
**Screenshots**
N/A

**Any side note on the changes made**
N/A
LeoNerdoG pushed a commit to LeoNerdoG/kapua that referenced this pull request May 5, 2020
With a fix for a certain REST API bug (preventing users to change their account settings) in PR eclipse#2946 and PR eclipse#2954 the unit tests for services (tags, users, jobs, scheduling,...) started to fail.
I have fixed this by introducing a mocked account that is used as basis for the service creation.
I have already ran PR on my Travis and everything was fine. CodeCov should report 0% increased/decreased coverage, since all the changes made are in the ignored folders.

Signed-off-by: Leonardo Gaube <leonardo.gaube@comtrade.com>

**Related Issue**
This PR fixes problems with unit tests in PR eclipse#2947 and PR eclipse#2954.

**Description of the solution adopted:**
I have added a mocked AccountService and mocked AccountFactory classes to the existing unit tests, so that the check does not fail. This is  achieved with Mockito's "spy" method. The necessary Account methods are injected in the _CucumberWithProeprtiesFor(Service)_ file.

@lorthirk can you please look at the solution adopted and see if it's ok? After you merge this PR into develop, just rebase your PRs to develop and the tests should be passing normally.
**Screenshots**
N/A

**Any side note on the changes made**
N/A
@lorthirk lorthirk force-pushed the feature-restrictedConfigurations branch 4 times, most recently from 9f811bc to 3dc32e6 Compare May 6, 2020 14:57
@lorthirk lorthirk force-pushed the feature-restrictedConfigurations branch 4 times, most recently from c7da02e to 5442520 Compare May 6, 2020 15:45
@codecov
Copy link

codecov bot commented May 6, 2020

Codecov Report

Merging #2947 into develop will increase coverage by 0.06%.
The diff coverage is 78.57%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2947      +/-   ##
=============================================
+ Coverage      56.16%   56.22%   +0.06%     
+ Complexity      2595     2593       -2     
=============================================
  Files           1061     1061              
  Lines          22990    23002      +12     
  Branches        2065     2064       -1     
=============================================
+ Hits           12912    12934      +22     
+ Misses          9135     9117      -18     
- Partials         943      951       +8     
Impacted Files Coverage Δ Complexity Δ
...apua/commons/configuration/metatype/EmptyTocd.java 18.18% <ø> (ø) 0.00 <0.00> (ø)
...onfiguration/AbstractKapuaConfigurableService.java 78.08% <73.52%> (-5.39%) 0.00 <0.00> (ø)
...stractKapuaConfigurableResourceLimitedService.java 88.09% <100.00%> (ø) 0.00 <0.00> (ø)
...ns/configuration/KapuaConfigurationErrorCodes.java 100.00% <100.00%> (ø) 0.00 <0.00> (ø)
...kapua/commons/configuration/metatype/TocdImpl.java 75.60% <100.00%> (+4.18%) 0.00 <0.00> (ø)
...transport/mqtt/exception/MqttClientErrorCodes.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (-1.00%)
...ort/mqtt/exception/MqttClientConnectException.java 0.00% <0.00%> (-50.00%) 0.00% <0.00%> (-1.00%)
.../transport/mqtt/exception/MqttClientException.java 0.00% <0.00%> (-33.34%) 0.00% <0.00%> (-1.00%)
...obDeviceManagementOperationManagerServiceImpl.java 73.17% <0.00%> (-9.76%) 13.00% <0.00%> (-2.00%)
...ransport/mqtt/pooling/PooledMqttClientFactory.java 61.90% <0.00%> (-9.53%) 7.00% <0.00%> (ø%)
... and 15 more

@lorthirk lorthirk force-pushed the feature-restrictedConfigurations branch 5 times, most recently from dc610b6 to 2f835b2 Compare May 8, 2020 13:55
Signed-off-by: Claudio Mezzasalma <claudio.mezzasalma@eurotech.com>
@lorthirk lorthirk force-pushed the feature-restrictedConfigurations branch from 2f835b2 to 82b52df Compare May 11, 2020 10:23
@lorthirk lorthirk marked this pull request as ready for review May 11, 2020 11:13
@lorthirk lorthirk merged commit 499c601 into eclipse:develop May 11, 2020
@lorthirk lorthirk deleted the feature-restrictedConfigurations branch May 11, 2020 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement This PR/Issue improves an part of Kapua Waitfor/Test This issue/PR needs tests implementation to be properly resolved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants