From 282ac56a9c334c44f8ac78abf254bf6fcbdb424b Mon Sep 17 00:00:00 2001 From: Kai Kreuzer Date: Wed, 8 Feb 2023 19:07:33 +0100 Subject: [PATCH 1/3] Remove author from addon xsd Signed-off-by: Kai Kreuzer --- bundles/org.openhab.core.addon.xml/addon-1.0.0.xsd | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bundles/org.openhab.core.addon.xml/addon-1.0.0.xsd b/bundles/org.openhab.core.addon.xml/addon-1.0.0.xsd index 82b4ff86eb4..a087613aece 100644 --- a/bundles/org.openhab.core.addon.xml/addon-1.0.0.xsd +++ b/bundles/org.openhab.core.addon.xml/addon-1.0.0.xsd @@ -13,11 +13,6 @@ - - - The organization maintaining the add-on (e.g. openHAB). Individual developer names should be avoided. - - From cd0bba394a74a65b3fd5596d375db80d0c189b4e Mon Sep 17 00:00:00 2001 From: Kai Kreuzer Date: Thu, 9 Feb 2023 08:15:48 +0100 Subject: [PATCH 2/3] Addressed review feedback Signed-off-by: Kai Kreuzer --- .../addon/xml/internal/AddonInfoConverter.java | 1 - .../core/addon/xml/internal/AddonInfoReader.java | 1 - .../java/org/openhab/core/addon/AddonInfo.java | 14 +------------- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/bundles/org.openhab.core.addon.xml/src/main/java/org/openhab/core/addon/xml/internal/AddonInfoConverter.java b/bundles/org.openhab.core.addon.xml/src/main/java/org/openhab/core/addon/xml/internal/AddonInfoConverter.java index 56ba1273aa3..d29b57f7b76 100644 --- a/bundles/org.openhab.core.addon.xml/src/main/java/org/openhab/core/addon/xml/internal/AddonInfoConverter.java +++ b/bundles/org.openhab.core.addon.xml/src/main/java/org/openhab/core/addon/xml/internal/AddonInfoConverter.java @@ -85,7 +85,6 @@ public AddonInfoConverter() { "Add-on description is null or empty"); AddonInfo.Builder addonInfo = AddonInfo.builder(id, type).withName(name).withDescription(description); - addonInfo.withAuthor((String) nodeIterator.nextValue("author", false)); addonInfo.withConnection((String) nodeIterator.nextValue("connection", false)); addonInfo.withCountries((String) nodeIterator.nextValue("countries", false)); addonInfo.withServiceId((String) nodeIterator.nextValue("service-id", false)); diff --git a/bundles/org.openhab.core.addon.xml/src/main/java/org/openhab/core/addon/xml/internal/AddonInfoReader.java b/bundles/org.openhab.core.addon.xml/src/main/java/org/openhab/core/addon/xml/internal/AddonInfoReader.java index 033e1db63e0..d18b7ed251c 100644 --- a/bundles/org.openhab.core.addon.xml/src/main/java/org/openhab/core/addon/xml/internal/AddonInfoReader.java +++ b/bundles/org.openhab.core.addon.xml/src/main/java/org/openhab/core/addon/xml/internal/AddonInfoReader.java @@ -72,7 +72,6 @@ protected void registerAliases(XStream xstream) { xstream.alias("addon", AddonInfoXmlResult.class); xstream.alias("name", NodeValue.class); xstream.alias("description", NodeValue.class); - xstream.alias("author", NodeValue.class); xstream.alias("type", NodeValue.class); xstream.alias("connection", NodeValue.class); xstream.alias("countries", NodeValue.class); diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/addon/AddonInfo.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/addon/AddonInfo.java index defc98b336b..7094871fbc5 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/addon/AddonInfo.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/addon/AddonInfo.java @@ -40,7 +40,6 @@ public class AddonInfo implements Identifiable { private final String type; private final String name; private final String description; - private final @Nullable String author; private final @Nullable String connection; private final List countries; private final @Nullable String configDescriptionURI; @@ -70,7 +69,6 @@ private AddonInfo(String id, String type, String name, String description, @Null this.description = description; // optional fields - this.author = author; this.connection = connection; this.countries = countries; this.configDescriptionURI = configDescriptionURI; @@ -124,15 +122,6 @@ public String getDescription() { return description; } - /** - * Returns the author of the add-on (e.g. "Max Mustermann"). - * - * @return the author of the add-on (could be null or empty) - */ - public @Nullable String getAuthor() { - return author; - } - /** * Returns the link to a concrete {@link org.openhab.core.config.core.ConfigDescription}. * @@ -181,7 +170,6 @@ private Builder(AddonInfo addonInfo) { this.type = addonInfo.type; this.name = addonInfo.name; this.description = addonInfo.description; - this.author = addonInfo.author; this.connection = addonInfo.connection; this.countries = addonInfo.countries; this.configDescriptionURI = addonInfo.configDescriptionURI; @@ -236,7 +224,7 @@ public Builder withSourceBundle(@Nullable String sourceBundle) { /** * Build an {@link AddonInfo} from this builder - * + * * @return the add-on info object * @throws IllegalArgumentException if any of the information in this builder is invalid */ From 6c9d5fb68b923a028a17c8481f1a2cbc445c57af Mon Sep 17 00:00:00 2001 From: Kai Kreuzer Date: Thu, 9 Feb 2023 08:38:45 +0100 Subject: [PATCH 3/3] Further cleanup Signed-off-by: Kai Kreuzer --- .../internal/addon/JarFileAddonService.java | 6 +- .../core/addon/xml/test/AddonInfoTest.java | 17 ------ .../OH-INF/addon/addon.xml | 1 - .../OH-INF/addon/addon.xml | 33 ---------- .../OH-INF/thing/thing-types.xml | 61 ------------------- 5 files changed, 3 insertions(+), 115 deletions(-) delete mode 100644 itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTestNoAuthor.bundle/OH-INF/addon/addon.xml delete mode 100644 itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTestNoAuthor.bundle/OH-INF/thing/thing-types.xml diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/addon/JarFileAddonService.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/addon/JarFileAddonService.java index 60ce56f8fdc..8e6c74c979e 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/addon/JarFileAddonService.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/addon/JarFileAddonService.java @@ -151,9 +151,9 @@ public synchronized void refreshSource() { private Addon toAddon(Bundle bundle, AddonInfo addonInfo) { String uid = ADDON_ID_PREFIX + addonInfo.getUID(); - return Addon.create(uid).withId(addonInfo.getId()).withType(addonInfo.getType()) - .withAuthor(addonInfo.getAuthor()).withInstalled(true).withVersion(bundle.getVersion().toString()) - .withLabel(addonInfo.getName()).withConfigDescriptionURI(addonInfo.getConfigDescriptionURI()) + return Addon.create(uid).withId(addonInfo.getId()).withType(addonInfo.getType()).withInstalled(true) + .withVersion(bundle.getVersion().toString()).withLabel(addonInfo.getName()) + .withConfigDescriptionURI(addonInfo.getConfigDescriptionURI()) .withDescription(Objects.requireNonNullElse(addonInfo.getDescription(), bundle.getSymbolicName())) .build(); } diff --git a/itests/org.openhab.core.addon.xml.tests/src/main/java/org/openhab/core/addon/xml/test/AddonInfoTest.java b/itests/org.openhab.core.addon.xml.tests/src/main/java/org/openhab/core/addon/xml/test/AddonInfoTest.java index 48dc4fa65e2..0778f76f369 100644 --- a/itests/org.openhab.core.addon.xml.tests/src/main/java/org/openhab/core/addon/xml/test/AddonInfoTest.java +++ b/itests/org.openhab.core.addon.xml.tests/src/main/java/org/openhab/core/addon/xml/test/AddonInfoTest.java @@ -39,7 +39,6 @@ public class AddonInfoTest extends JavaOSGiTest { private static final String TEST_BUNDLE_NAME = "BundleInfoTest.bundle"; - private static final String TEST_BUNDLE_NAME2 = "BundleInfoTestNoAuthor.bundle"; private @NonNullByDefault({}) AddonInfoRegistry addonInfoRegistry; private @NonNullByDefault({}) ConfigDescriptionRegistry configDescriptionRegistry; @@ -65,22 +64,6 @@ public void assertThatAddonInfoIsReadProperly() throws Exception { assertThat(addonInfo.getDescription(), is("The hue Binding integrates the Philips hue system. It allows to control hue lights.")); assertThat(addonInfo.getName(), is("hue Binding")); - assertThat(addonInfo.getAuthor(), is("Deutsche Telekom AG")); - }); - } - - @Test - public void assertThatAddonInfoWithoutAuthorIsReadProperly() throws Exception { - addonInstaller.exec(TEST_BUNDLE_NAME2, () -> { - Set addonInfos = addonInfoRegistry.getAddonInfos(); - AddonInfo addonInfo = addonInfos.iterator().next(); - assertThat(addonInfo.getId(), is("hue")); - assertThat(addonInfo.getUID(), is("binding-hue")); - assertThat(addonInfo.getConfigDescriptionURI(), is("foo:bar")); - assertThat(addonInfo.getDescription(), - is("The hue Binding integrates the Philips hue system. It allows to control hue lights.")); - assertThat(addonInfo.getName(), is("hue Binding")); - assertThat(addonInfo.getAuthor(), is((String) null)); }); } diff --git a/itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTest.bundle/OH-INF/addon/addon.xml b/itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTest.bundle/OH-INF/addon/addon.xml index 1b1a3696de9..0fec4bf2ffc 100644 --- a/itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTest.bundle/OH-INF/addon/addon.xml +++ b/itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTest.bundle/OH-INF/addon/addon.xml @@ -7,7 +7,6 @@ hue Binding The hue Binding integrates the Philips hue system. It allows to control hue lights. - Deutsche Telekom AG diff --git a/itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTestNoAuthor.bundle/OH-INF/addon/addon.xml b/itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTestNoAuthor.bundle/OH-INF/addon/addon.xml deleted file mode 100644 index 7a7260c91be..00000000000 --- a/itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTestNoAuthor.bundle/OH-INF/addon/addon.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - binding - hue Binding - The hue Binding integrates the Philips hue system. It - allows to control hue lights. - - - - - - - - - - - - - - item - - alarm, light - color - hue - - - - - - diff --git a/itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTestNoAuthor.bundle/OH-INF/thing/thing-types.xml b/itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTestNoAuthor.bundle/OH-INF/thing/thing-types.xml deleted file mode 100644 index 3cd98624524..00000000000 --- a/itests/org.openhab.core.addon.xml.tests/src/main/resources/test-bundle-pool/BundleInfoTestNoAuthor.bundle/OH-INF/thing/thing-types.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - The hue Bridge represents the Philips hue bridge. - - - - network-address - - Network address of the hue bridge. - true - - - password - - Name of a registered hue bridge user, that allows to access the API. - - - - - - - - - - - - My own great HUE Lamp. - - - - - - - - - - - ColorItem - - The color channel allows to control the color of the hue lamp. It is also possible to dim values and - switch the lamp on and off. - - - - - - - - - DimmerItem - - The color temperature channel allows to set the color temperature from 0 (cold) to 100 (warm). - - -