mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 19:55:48 +01:00
Assume installed addons are compatible (#2975)
It was reported that after an upgrade from aprevious version installed addons from marketplaces are not shown in the add-ons pages. This is a result of the new compatibility check which excludes incompatible add-ons by default. Already installed add-ons must be excluded from this check otherwise they can't be uninstalled. Signed-off-by: Jan N. Klug <github@klug.nrw>
This commit is contained in:
parent
6edab02c45
commit
ad3a3c1caf
@ -116,7 +116,7 @@ public abstract class AbstractRemoteAddonService implements AddonService {
|
|||||||
|
|
||||||
// remove incompatible add-ons if not enabled
|
// remove incompatible add-ons if not enabled
|
||||||
boolean showIncompatible = includeIncompatible();
|
boolean showIncompatible = includeIncompatible();
|
||||||
addons.removeIf(addon -> !addon.getCompatible() && !showIncompatible);
|
addons.removeIf(addon -> !addon.isInstalled() && !addon.getCompatible() && !showIncompatible);
|
||||||
|
|
||||||
cachedAddons = addons;
|
cachedAddons = addons;
|
||||||
this.installedAddons = installedAddons;
|
this.installedAddons = installedAddons;
|
||||||
|
@ -21,6 +21,7 @@ import static org.hamcrest.Matchers.nullValue;
|
|||||||
import static org.openhab.core.addon.marketplace.AbstractRemoteAddonService.CONFIG_REMOTE_ENABLED;
|
import static org.openhab.core.addon.marketplace.AbstractRemoteAddonService.CONFIG_REMOTE_ENABLED;
|
||||||
import static org.openhab.core.addon.marketplace.test.TestAddonService.ALL_ADDON_COUNT;
|
import static org.openhab.core.addon.marketplace.test.TestAddonService.ALL_ADDON_COUNT;
|
||||||
import static org.openhab.core.addon.marketplace.test.TestAddonService.COMPATIBLE_ADDON_COUNT;
|
import static org.openhab.core.addon.marketplace.test.TestAddonService.COMPATIBLE_ADDON_COUNT;
|
||||||
|
import static org.openhab.core.addon.marketplace.test.TestAddonService.INCOMPATIBLE_VERSION;
|
||||||
import static org.openhab.core.addon.marketplace.test.TestAddonService.INSTALL_EXCEPTION_ADDON;
|
import static org.openhab.core.addon.marketplace.test.TestAddonService.INSTALL_EXCEPTION_ADDON;
|
||||||
import static org.openhab.core.addon.marketplace.test.TestAddonService.SERVICE_PID;
|
import static org.openhab.core.addon.marketplace.test.TestAddonService.SERVICE_PID;
|
||||||
import static org.openhab.core.addon.marketplace.test.TestAddonService.TEST_ADDON;
|
import static org.openhab.core.addon.marketplace.test.TestAddonService.TEST_ADDON;
|
||||||
@ -149,6 +150,12 @@ public class AbstractRemoteAddonServiceTest {
|
|||||||
assertThat(addonService.getAddons(null), hasSize(COMPATIBLE_ADDON_COUNT));
|
assertThat(addonService.getAddons(null), hasSize(COMPATIBLE_ADDON_COUNT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIncompatibleAddonsAlwaysIncludedIfInstalled() {
|
||||||
|
addonService.setInstalled(INCOMPATIBLE_VERSION);
|
||||||
|
assertThat(addonService.getAddons(null), hasSize(COMPATIBLE_ADDON_COUNT + 1));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIncompatibleAddonsAreIncludedIfRequested() {
|
public void testIncompatibleAddonsAreIncludedIfRequested() {
|
||||||
properties.put("includeIncompatible", true);
|
properties.put("includeIncompatible", true);
|
||||||
|
Loading…
Reference in New Issue
Block a user