Skip to content

Commit

Permalink
Remove author from addon xsd (#3362)
Browse files Browse the repository at this point in the history
* Remove author from addon xsd

Signed-off-by: Kai Kreuzer <kai@openhab.org>
  • Loading branch information
kaikreuzer authored Feb 11, 2023
1 parent c30e4b8 commit 304617c
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 135 deletions.
5 changes: 0 additions & 5 deletions bundles/org.openhab.core.addon.xml/addon-1.0.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
<xs:element name="type" type="addon:addonType"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="author" type="xs:string" minOccurs="0">
<xs:annotation>
<xs:documentation>The organization maintaining the add-on (e.g. openHAB). Individual developer names should be avoided.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="connection" type="addon:connectionType" minOccurs="0"/>
<xs:element name="countries" type="addon:countryType" minOccurs="0">
<xs:annotation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class AddonInfo implements Identifiable<String> {
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<String> countries;
private final @Nullable String configDescriptionURI;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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}.
*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<AddonInfo> 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));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<name>hue Binding</name>
<description>The hue Binding integrates the Philips hue system. It
allows to control hue lights.</description>
<author>Deutsche Telekom AG</author>

<!-- Dummy config -->
<config-description>
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 304617c

Please sign in to comment.