-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
[addonservices] allow offline mode #2633
Conversation
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
Since there is a lot of common code between both addon services, it might be a good idea to refactor them to inherit from an |
Test fails unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for looking into this. From my pov we now reached some point where we need unit tests to cover the functionality of those addon services. Wdyt?
If you like I can give you a hand on that. Just ping me.
And I agree. The code can be reduced by introducing an abstract base class.
.../org/openhab/core/addon/marketplace/internal/community/CommunityMarketplaceAddonService.java
Outdated
Show resolved
Hide resolved
Regarding the unit tests: I agree. Unfortunately it's not that easy to mock the remote end (and it's also different for both add-on services. This will improve with the introduction of the IMO the bundle installers also need test coverage. I can have a look in a separate PR. |
Signed-off-by: Jan N. Klug <github@klug.nrw>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks.
🎆 Happy New Year.
private boolean remoteEnabled() { | ||
try { | ||
Configuration configuration = configurationAdmin.getConfiguration("org.openhab.addons", null); | ||
return (boolean) Objects.requireNonNullElse(configuration.getProperties().get("remote"), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the getProperties() can return null
and we are potentially run into NPEs here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in fc25ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
I will try to find a solution for #2581 based on ExpiringCacheMap
later.
* allow offline mode Signed-off-by: Jan N. Klug <jan.n.klug@rub.de> GitOrigin-RevId: d420bee
Fixes #2628
Signed-off-by: Jan N. Klug jan.n.klug@rub.de