indexabout

This is a web interface for Eclipse Git repositories. Many projects also use the Gerrit Code Review. For more information about Git, please see the Git Wiki page.

The contents of the Git repositories are made available under the terms and conditions of the Eclipse.org Software User Agreement.

NameDescriptionOwnerIdle
cbi
native-build-testing/eclipse.platform.releng.aggregator.gitEclipse Platform Aggregator for native build testingCode Review2 years
native-build-testing/eclipse.platform.swt.binaries.gitEclipse Platform SWT Binaries for native build testingCode Review2 years
e4
eclipse.platform.runtime.e4.gitNot used anymoreGenie e47 years
eclipse.platform.ui.compat.gitNot used anymoreGenie e47 years
eclipse.platform.ui.e4.gitNot used anymoreGenie e47 years
org.eclipse.e4.ui.gitSeveral plug-ins from this Git repository have been migrated to eclipse.platform...Genie e46 days
gerrit
cbi/native-build-testing/eclipse.platform.releng.aggregator.gitEclipse Platform Aggregator for native build testingCode Review2 years
cbi/native-build-testing/eclipse.platform.swt.binaries.gitEclipse Platform SWT Binaries for native build testingCode Review2 years
e4/org.eclipse.e4.ui.gitSeveral plug-ins from this Git repository have been migrated to eclipse.platform...Genie e46 days
platform/eclipse.platform.common.gitEclipse Platform CommonGenie Platform25 hours
Change-Id: I33009623a11941e840cef5adcdd101adb2d2e411
-rw-r--r--tycho-metadata-model/src/main/java/org/eclipse/tycho/model/Feature.java127
-rw-r--r--tycho-metadata-model/src/test/java/org/eclipse/tycho/maven/test/EclipseModelTest.java24
-rw-r--r--tycho-metadata-model/src/test/resources/modelio/feature.xml21
3 files changed, 162 insertions, 10 deletions
diff --git a/tycho-metadata-model/src/main/java/org/eclipse/tycho/model/Feature.java b/tycho-metadata-model/src/main/java/org/eclipse/tycho/model/Feature.java
index 44b6944..864ce89 100644
--- a/tycho-metadata-model/src/main/java/org/eclipse/tycho/model/Feature.java
+++ b/tycho-metadata-model/src/main/java/org/eclipse/tycho/model/Feature.java
@@ -240,4 +240,131 @@ public class Feature {
dom.addNode(feature.getDom());
features = null;
}
+
+ //////
+ // Other (not structural) feature content
+ //////
+
+ // label
+ public String getLabel() {
+ return dom.getAttributeValue("label");
+ }
+
+ public void setLabel(String label) {
+ dom.setAttribute("label", label);
+ }
+
+ // provider
+ public String getProvider() {
+ return dom.getAttributeValue("provider-name");
+ }
+
+ public void setProvider(String provider) {
+ dom.setAttribute("provider-name", provider);
+ }
+
+ // description + url
+ public String getDescription() {
+ Element descElement = dom.getChild("description");
+ if (descElement != null) {
+ return descElement.getText();
+ }
+ return null;
+ }
+
+ public void setDescription(String description) {
+ Element descElement = dom.getChild("description");
+ if (descElement == null) {
+ descElement = new Element("description");
+ dom.addNode(descElement);
+ }
+ descElement.setText(description);
+ }
+
+ public String getDescriptionURL() {
+ Element descElement = dom.getChild("description");
+ if (descElement != null) {
+ return descElement.getAttributeValue("url");
+ }
+ return null;
+ }
+
+ public void setDescriptionURL(String descriptionURL) {
+ Element descElement = dom.getChild("description");
+ if (descElement == null) {
+ descElement = new Element("description");
+ dom.addNode(descElement);
+ }
+ descElement.setAttribute("url", descriptionURL);
+ }
+
+ // copyright + url
+ public String getCopyright() {
+ Element copyrightElement = dom.getChild("copyright");
+ if (copyrightElement != null) {
+ return copyrightElement.getText();
+ }
+ return null;
+ }
+
+ public void setCopyright(String description) {
+ Element copyrightElement = dom.getChild("copyright");
+ if (copyrightElement == null) {
+ copyrightElement = new Element("copyright");
+ dom.addNode(copyrightElement);
+ }
+ copyrightElement.setText(description);
+ }
+
+ public String getCopyrightURL() {
+ Element copyrightElement = dom.getChild("copyright");
+ if (copyrightElement != null) {
+ return copyrightElement.getAttributeValue("url");
+ }
+ return null;
+ }
+
+ public void setCopyrightURL(String copyrightURL) {
+ Element copyrightElement = dom.getChild("copyright");
+ if (copyrightElement == null) {
+ copyrightElement = new Element("copyright");
+ dom.addNode(copyrightElement);
+ }
+ copyrightElement.setAttribute("url", copyrightURL);
+ }
+
+ // license + url
+ public String getLicense() {
+ Element licenseElement = dom.getChild("license");
+ if (licenseElement != null) {
+ return licenseElement.getText();
+ }
+ return null;
+ }
+
+ public void setLicense(String license) {
+ Element licenseElement = dom.getChild("license");
+ if (licenseElement == null) {
+ licenseElement = new Element("license");
+ dom.addNode(licenseElement);
+ }
+ licenseElement.setText(license);
+ }
+
+ public String getLicenseURL() {
+ Element licenseElement = dom.getChild("license");
+ if (licenseElement != null) {
+ return licenseElement.getAttributeValue("url");
+ }
+ return null;
+ }
+
+ public void setLicenseURL(String licenseURL) {
+ Element licenseElement = dom.getChild("license");
+ if (licenseElement == null) {
+ licenseElement = new Element("license");
+ dom.addNode(licenseElement);
+ }
+ licenseElement.setAttribute("url", licenseURL);
+ }
}
diff --git a/tycho-metadata-model/src/test/java/org/eclipse/tycho/maven/test/EclipseModelTest.java b/tycho-metadata-model/src/test/java/org/eclipse/tycho/maven/test/EclipseModelTest.java
index fd1ce2e..df36579 100644
--- a/tycho-metadata-model/src/test/java/org/eclipse/tycho/maven/test/EclipseModelTest.java
+++ b/tycho-metadata-model/src/test/java/org/eclipse/tycho/maven/test/EclipseModelTest.java
@@ -80,14 +80,38 @@ public class EclipseModelTest extends TestCase {
assertEquals("pluginB", requires.get(0).getImports().get(0).getPlugin());
assertEquals("featureC", requires.get(0).getImports().get(1).getFeature());
+ // not structural data - getters
+ assertEquals("featureA", feature.getLabel());
+ assertEquals("COMPANY", feature.getProvider());
+ assertEquals("Test License", feature.getLicense().trim());
+ assertEquals("http://www.example.com/license", feature.getLicenseURL());
+ assertEquals(null, feature.getCopyrightURL());
+ assertEquals(null, feature.getCopyright());
+
feature.setVersion("1.2.3");
plugins.get(0).setVersion("3.4.5");
+ // not structural data - setters
+ feature.setLabel("featureA_MODIFIED");
+ feature.setProvider("COMPANY_MODIFIED");
+ feature.setLicense("Test License MODIFIED");
+ feature.setLicenseURL("http://www.example.com/license_MODIFIED");
+ feature.setCopyright("Test Copyright");
+ feature.setCopyrightURL("http://www.example.com/copyright");
+
File updatedFile = new File(target, "feature.xml");
Feature.write(feature, updatedFile);
Feature updated = Feature.read(updatedFile);
assertEquals("1.2.3", updated.getVersion());
assertEquals("3.4.5", updated.getPlugins().get(0).getVersion());
+
+ // not structural data - persistence
+ assertEquals("featureA_MODIFIED", feature.getLabel());
+ assertEquals("COMPANY_MODIFIED", feature.getProvider());
+ assertEquals("Test License MODIFIED", feature.getLicense());
+ assertEquals("http://www.example.com/license_MODIFIED", feature.getLicenseURL());
+ assertEquals("http://www.example.com/copyright", feature.getCopyrightURL());
+ assertEquals("Test Copyright", feature.getCopyright());
}
public void testPlatform() throws Exception {
diff --git a/tycho-metadata-model/src/test/resources/modelio/feature.xml b/tycho-metadata-model/src/test/resources/modelio/feature.xml
index 5d97086..756e783 100644
--- a/tycho-metadata-model/src/test/resources/modelio/feature.xml
+++ b/tycho-metadata-model/src/test/resources/modelio/feature.xml
@@ -6,21 +6,27 @@
provider-name="COMPANY">
<description url="http://www.example.com/description">
- [Enter Feature Description here.]
+ Test Description
</description>
- <copyright url="http://www.example.com/copyright">
- [Enter Copyright Description here.]
- </copyright>
+ <!-- LEFT Blank to test case dom node does not exist -->
+ <!--copyright url="http://www.example.com/copyright">
+ Test Copyright
+ </copyright-->
<license url="http://www.example.com/license">
- [Enter License Description here.]
+ Test License
</license>
<includes
id="featureB"
version="0.0.0"/>
+ <requires>
+ <import plugin="pluginB"/>
+ <import feature="featureC"/>
+ </requires>
+
<plugin
id="pluginA"
download-size="0"
@@ -28,9 +34,4 @@
version="0.0.0"
unpack="false"/>
- <requires>
- <import plugin="pluginB"/>
- <import feature="featureC"/>
- </requires>
-
</feature>

Back to the top

t -->