Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java22
2 files changed, 21 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
index 2a9ef4334..868d31c6b 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/JREAction.java
@@ -192,7 +192,7 @@ public class JREAction extends AbstractPublisherAction {
for (int namespaceIx = 0; namespaceIx < namespaces.length; namespaceIx++) {
String namespace = namespaces[namespaceIx];
- if ("osgi.ee".equals(namespace)) { // this is the OSGi capability namespace "osgi.ee" //$NON-NLS-1$
+ if (NAMESPACE_OSGI_EE.equals(namespace)) { // this is the OSGi capability namespace "osgi.ee"
parseEECapability(systemCapability, parsingStatus, parsingResult);
} else {
@@ -204,7 +204,7 @@ public class JREAction extends AbstractPublisherAction {
}
private static void parseEECapability(ManifestElement eeCapability, MultiStatus parsingStatus, List<IProvidedCapability> parsingResult) {
- String eeName = eeCapability.getAttribute("osgi.ee"); // this is an attribute required for capabilities in the "osgi.ee" namespace //$NON-NLS-1$
+ String eeName = eeCapability.getAttribute(NAMESPACE_OSGI_EE); // this is an attribute required for capabilities in the "osgi.ee" namespace
if (eeName == null) {
parsingStatus.add(newErrorStatus(NLS.bind(Messages.message_eeMissingNameAttribute, eeCapability), null));
return;
@@ -222,7 +222,11 @@ public class JREAction extends AbstractPublisherAction {
Version parsedVersion = Version.parseVersion(rawVersion);
// complete record -> store
- parsingResult.add(MetadataFactory.createProvidedCapability(NAMESPACE_OSGI_EE, eeName, parsedVersion));
+ Map<String, Object> capAttrs = new HashMap<String, Object>();
+ capAttrs.put(NAMESPACE_OSGI_EE, eeName);
+ capAttrs.put("version", parsedVersion);
+
+ parsingResult.add(MetadataFactory.createProvidedCapability(NAMESPACE_OSGI_EE, capAttrs));
} catch (IllegalArgumentException e) {
parsingStatus.add(newErrorStatus(NLS.bind(Messages.message_eeInvalidVersionAttribute, rawVersion), e));
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java
index 32d05e216..6310a02c3 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
-import org.eclipse.equinox.internal.p2.metadata.ProvidedCapability;
import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.publisher.IPublisherInfo;
import org.eclipse.equinox.p2.publisher.IPublisherResult;
@@ -130,11 +129,11 @@ public class JREActionTest extends ActionTest {
performAction(new JREAction("J2SE-1.5"));
Collection<IProvidedCapability> capabilities = getPublishedCapabilitiesOf("a.jre.j2se");
- assertThat(capabilities, not(hasItem((IProvidedCapability) new ProvidedCapability("osgi.ee", "JavaSE", Version.parseVersion("1.6")))));
- assertThat(capabilities, hasItem((IProvidedCapability) new ProvidedCapability("osgi.ee", "JavaSE", Version.parseVersion("1.5"))));
- assertThat(capabilities, hasItem((IProvidedCapability) new ProvidedCapability("osgi.ee", "OSGi/Minimum", Version.parseVersion("1.0"))));
+ assertThat(capabilities, not(hasItem(createEECapability("JavaSE", "1.6"))));
+ assertThat(capabilities, hasItem(createEECapability("JavaSE", "1.5")));
+ assertThat(capabilities, hasItem(createEECapability("OSGi/Minimum", "1.0")));
- assertThat(capabilities, not(hasItem((IProvidedCapability) new ProvidedCapability("osgi.ee", "J2SE", Version.parseVersion("1.5")))));
+ assertThat(capabilities, not(hasItem(createEECapability("J2SE", "1.5"))));
}
public void testSingleOsgiEECapability() {
@@ -142,8 +141,8 @@ public class JREActionTest extends ActionTest {
performAction(new JREAction("OSGi/Minimum-1.0"));
Collection<IProvidedCapability> capabilities = getPublishedCapabilitiesOf("a.jre.osgi.minimum");
- assertThat(capabilities, not(hasItem((IProvidedCapability) new ProvidedCapability("osgi.ee", "JavaSE", Version.parseVersion("1.5")))));
- assertThat(capabilities, hasItem((IProvidedCapability) new ProvidedCapability("osgi.ee", "OSGi/Minimum", Version.parseVersion("1.0"))));
+ assertThat(capabilities, not(hasItem(createEECapability("JavaSE", "1.5"))));
+ assertThat(capabilities, hasItem(createEECapability("OSGi/Minimum", "1.0")));
}
public void testInvalidOsgiEECapabilitySpec() {
@@ -226,10 +225,17 @@ public class JREActionTest extends ActionTest {
return iu.getProvidedCapabilities();
}
+ private static IProvidedCapability createEECapability(String ee, String version) {
+ Map<String, Object> attrs = new HashMap<>();
+ attrs.put("osgi.ee", ee);
+ attrs.put("version", Version.parseVersion(version));
+
+ return MetadataFactory.createProvidedCapability("osgi.ee", attrs);
+ }
+
@Override
protected void insertPublisherInfoBehavior() {
expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes();
expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_PUBLISH).anyTimes();
}
-
}

Back to the top