Remove author from addon xsd (#3362)

* Remove author from addon xsd

Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Kai Kreuzer
2023-02-11 19:50:05 +01:00
committed by GitHub
parent c30e4b8eea
commit 304617c5b7
9 changed files with 4 additions and 135 deletions
@@ -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>
@@ -85,7 +85,6 @@ public class AddonInfoConverter extends GenericUnmarshaller<AddonInfoXmlResult>
"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));
@@ -72,7 +72,6 @@ public class AddonInfoReader extends XmlDocumentReader<AddonInfoXmlResult> {
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);
@@ -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;
@@ -70,7 +69,6 @@ public class AddonInfo implements Identifiable<String> {
this.description = description;
// optional fields
this.author = author;
this.connection = connection;
this.countries = countries;
this.configDescriptionURI = configDescriptionURI;
@@ -124,15 +122,6 @@ public class AddonInfo implements Identifiable<String> {
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 @@ public class AddonInfo implements Identifiable<String> {
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 class AddonInfo implements Identifiable<String> {
/**
* 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
*/
@@ -151,9 +151,9 @@ public class JarFileAddonService extends BundleTracker<Bundle> implements AddonS
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();
}
@@ -39,7 +39,6 @@ import org.openhab.core.test.java.JavaOSGiTest;
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 class AddonInfoTest extends JavaOSGiTest {
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));
});
}
@@ -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>
@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon:addon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:addon="https://openhab.org/schemas/addon/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/addon/v1.0.0 https://openhab.org/schemas/addon-1.0.0.xsd" id="hue">
<type>binding</type>
<name>hue Binding</name>
<description>The hue Binding integrates the Philips hue system. It
allows to control hue lights.</description>
<!-- Dummy config -->
<config-description uri="foo:bar">
<parameter name="list" type="text" multiple="true" min="2" max="3">
<options>
<option value="key1">label1</option>
<option value="key2">label2</option>
</options>
</parameter>
<parameter name="color-alarming-light" type="text" multiple="true">
<context>item</context>
<filter>
<criteria name="tags">alarm, light</criteria>
<criteria name="type">color</criteria>
<criteria name="binding-id">hue</criteria>
</filter>
</parameter>
</config-description>
</addon:addon>
@@ -1,61 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="hue" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- HUE Bridge -->
<bridge-type id="bridge">
<label>HUE Bridge</label>
<description>The hue Bridge represents the Philips hue bridge.</description>
<config-description>
<parameter name="ip" type="text">
<context>network-address</context>
<label>Network Address</label>
<description>Network address of the hue bridge.</description>
<required>true</required>
</parameter>
<parameter name="username" type="text">
<context>password</context>
<label>Username</label>
<description>Name of a registered hue bridge user, that allows to access the API.</description>
</parameter>
</config-description>
</bridge-type>
<!-- HUE Lamp -->
<thing-type id="lamp">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge"/>
</supported-bridge-type-refs>
<label>HUE Lamp</label>
<description>My own great HUE Lamp.</description>
<channels>
<channel id="color" typeId="color"/>
<channel id="color_temperature" typeId="color_temperature"/>
</channels>
</thing-type>
<!-- HUE Lamp Color Channel -->
<channel-type id="color">
<item-type>ColorItem</item-type>
<label>HUE Lamp Color</label>
<description>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.</description>
<config-description>
<parameter name="lastDimValue" type="boolean"/>
</config-description>
</channel-type>
<!-- HUE Lamp Color Temperature Channel -->
<channel-type id="color_temperature">
<item-type>DimmerItem</item-type>
<label>HUE Lamp Color Temperature</label>
<description>The color temperature channel allows to set the color temperature from 0 (cold) to 100 (warm).</description>
</channel-type>
</thing:thing-descriptions>