Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2008-08-12 16:09:44 +0000
committerJohn Arthorne2008-08-12 16:09:44 +0000
commitc6e69c478fd5b72f3af8cee49cddd76e9638f43d (patch)
tree25a17e0ab4efc86bbe8fd52c042fd43902cde1e5 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite
parentd05385be1445fda451fe8fa5d627328232c35e2d (diff)
downloadrt.equinox.p2-c6e69c478fd5b72f3af8cee49cddd76e9638f43d.tar.gz
rt.equinox.p2-c6e69c478fd5b72f3af8cee49cddd76e9638f43d.tar.xz
rt.equinox.p2-c6e69c478fd5b72f3af8cee49cddd76e9638f43d.zip
Bug 243422 Feature with empty required version incorrectly converted to [0.0.0,1.0.0)
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java35
1 files changed, 34 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
index 43b9a53d2..ba9f4d7fc 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/UpdateSiteTest.java
@@ -22,9 +22,15 @@ import org.eclipse.equinox.internal.p2.updatesite.UpdateSite;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.internal.provisional.p2.metadata.*;
+import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.internal.provisional.p2.query.Collector;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.p2.tests.TestActivator;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
/**
* @since 1.0
@@ -408,6 +414,33 @@ public class UpdateSiteTest extends AbstractProvisioningTest {
}
}
+ /**
+ * Tests that a feature requiring a bundle with no range is converted correctly.
+ */
+ public void testBug243422() {
+ IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) ServiceHelper.getService(TestActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ assertNotNull(repoMan);
+ File site = getTestData("Update site", "/testData/updatesite/UpdateSite243422/");
+ IMetadataRepository metadataRepo = null;
+ try {
+ metadataRepo = repoMan.loadRepository(site.toURL(), null);
+ } catch (ProvisionException e) {
+ fail("Can't load repository UpdateSite243422");
+ } catch (MalformedURLException e) {
+ fail("Can't load repository UpdateSite243422");
+ }
+ InstallableUnitQuery query = new InstallableUnitQuery("org.eclipse.jdt.astview.feature.feature.group", new Version("1.0.1"));
+ Collector result = metadataRepo.query(query, new Collector(), null);
+ assertEquals("1.0", 1, result.size());
+ IInstallableUnit featureIU = (IInstallableUnit) result.iterator().next();
+ RequiredCapability[] required = featureIU.getRequiredCapabilities();
+ for (int i = 0; i < required.length; i++) {
+ if (required[i].getName().equals("org.eclipse.ui.ide")) {
+ assertEquals("2.0", VersionRange.emptyRange, required[i].getRange());
+ }
+ }
+ }
+
public void testShortenVersionNumberInFeature() {
IArtifactRepositoryManager repoMan = (IArtifactRepositoryManager) ServiceHelper.getService(TestActivator.getContext(), IArtifactRepositoryManager.class.getName());
assertNotNull(repoMan);

Back to the top