diff options
author | Pascal Rapicault | 2010-03-09 03:00:35 +0000 |
---|---|---|
committer | Pascal Rapicault | 2010-03-09 03:00:35 +0000 |
commit | 23e4b274fa19ab0cf57b39faccbfac509e106c4a (patch) | |
tree | c43af12aea02bb7d80424075bf5668eed414e925 | |
parent | b6f54c6de86ecb2811d2d105dfeb3d22fc298b5a (diff) | |
download | rt.equinox.p2-23e4b274fa19ab0cf57b39faccbfac509e106c4a.tar.gz rt.equinox.p2-23e4b274fa19ab0cf57b39faccbfac509e106c4a.tar.xz rt.equinox.p2-23e4b274fa19ab0cf57b39faccbfac509e106c4a.zip |
Add description to IRequirement
6 files changed, 91 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java index 2e9f0d439..378898f8e 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/RequiredCapability.java @@ -41,6 +41,7 @@ public class RequiredCapability implements IRequiredCapability, IMemberProvider private final IMatchExpression<IInstallableUnit> matchExpression; private final int min; private final int max; + private String description; private static final IExpression allVersionsExpression; private static final IExpression range_II_Expression; @@ -288,4 +289,8 @@ public class RequiredCapability implements IRequiredCapability, IMemberProvider return matchExpression; throw new IllegalArgumentException("No such member: " + memberName); //$NON-NLS-1$ } + + public String getDescription() { + return description; + } } diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IRequirement.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IRequirement.java index 97f8285af..a1543df02 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IRequirement.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/p2/metadata/IRequirement.java @@ -38,4 +38,7 @@ public interface IRequirement { boolean isMatch(IInstallableUnit iu); boolean isGreedy(); + + String getDescription(); + }
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.tests/All p2 Tests.launch b/bundles/org.eclipse.equinox.p2.tests/All p2 Tests.launch index 1f4dd0324..49e903eb1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/All p2 Tests.launch +++ b/bundles/org.eclipse.equinox.p2.tests/All p2 Tests.launch @@ -1,4 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?><launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig"> +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig"> <booleanAttribute key="append.args" value="true"/> <stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/> <booleanAttribute key="askclear" value="false"/> @@ -52,7 +53,7 @@ <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/> <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/> <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> -<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/IBM-1.6.0-20090519-SR5"/> +<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6.0 (MacOS X Default)"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.equinox.p2.tests.AutomatedTests"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consolelog -console"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.p2.tests"/> @@ -68,4 +69,4 @@ <booleanAttribute key="useDefaultConfig" value="true"/> <booleanAttribute key="useDefaultConfigArea" value="false"/> <booleanAttribute key="useProduct" value="false"/> -</launchConfiguration>
\ No newline at end of file +</launchConfiguration> diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java index 8c2472423..0a720b971 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java @@ -62,6 +62,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { boolean isGreedy; int min; int max; + private String description; public SPIRequiredCapability(String namespace, String name, VersionRange versionRange, String filter, boolean isGreedy, boolean isMultiple, boolean isOptional) { this.namespace = namespace; @@ -163,6 +164,10 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { public IMatchExpression<IInstallableUnit> getMatches() { return ExpressionUtil.getFactory().matchExpression(ExpressionUtil.parse("providedCapabilities.exists(x | x.name == $0 && x.namespace == $1 && x.version ~= $2"), name, namespace, versionRange); } + + public String getDescription() { + return description; + } } class SPIProvidedCapability implements IProvidedCapability { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug259537.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug259537.java new file mode 100644 index 000000000..672ce6bbb --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug259537.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2007, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.p2.tests.planner; + +import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; +import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability; +import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest; +import org.eclipse.equinox.p2.engine.IEngine; +import org.eclipse.equinox.p2.engine.IProfile; +import org.eclipse.equinox.p2.metadata.*; +import org.eclipse.equinox.p2.planner.IPlanner; +import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; + +public class Bug259537 extends AbstractProvisioningTest { + IInstallableUnit a1, a2, b1, b2; + IInstallableUnit f1, f2; + + IPlanner planner; + IProfile profile; + private IEngine engine; + private String profileId; + + protected void setUp() throws Exception { + super.setUp(); + a1 = createIU("A", Version.create("1.0.0"), true); + + b1 = createIU("B", Version.create("2.0.0"), true); + + IRequiredCapability c1 = MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 2.0.0)"), null, false, false); + IRequiredCapability c2 = MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[2.0.0, 3.0.0)"), null, false, false); + f1 = createIU("F", Version.createOSGi(2, 0, 0), new IRequiredCapability[] {c1, c2}); + + createTestMetdataRepository(new IInstallableUnit[] {a1, b1, f1}); + + profileId = "TestProfile." + getName(); + profile = createProfile(profileId); + planner = createPlanner(); + engine = createEngine(); + + } + + public void test1() { + ProfileChangeRequest req = new ProfileChangeRequest(getProfile(profileId)); + req.addInstallableUnits(new IInstallableUnit[] {f1}); + ProvisioningPlan provisioningPlan = (ProvisioningPlan) planner.getProvisioningPlan(req, null, null); + assertOK("Plan not OK", provisioningPlan.getStatus()); + assertOK("Engine failed", engine.perform(provisioningPlan, null)); + } + + public void test2() { + a2 = createIU("A", Version.create("1.1.0"), true); + b2 = createIU("B", Version.create("2.2.0"), true); + IRequiredCapability c1 = MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 2.0.0)"), null, false, false); + IRequiredCapability c2 = MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[2.0.0, 3.0.0)"), null, false, false); + f2 = createIU("F", Version.createOSGi(2, 1, 0), new IRequiredCapability[] {c1, c2}); + + createTestMetdataRepository(new IInstallableUnit[] {a2, b2, f2}); + ProfileChangeRequest req = new ProfileChangeRequest(getProfile("TestProfile." + getName())); + req.addInstallableUnits(f2); + req.remove(f1); + ProvisioningPlan provisioningPlan = (ProvisioningPlan) planner.getProvisioningPlan(req, null, null); + assertOK("Plan not OK", provisioningPlan.getStatus()); + + } +} diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter.java index 0328b04f5..ba11a4cc8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter.java @@ -28,6 +28,7 @@ public class IUWithFilter extends AbstractProvisioningTest { MetadataFactory.InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription(); iud.setId("A"); iud.setVersion(Version.create("1.0.0")); + iud.setCapabilities(new IProvidedCapability[] {MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, "A", Version.createOSGi(1, 0, 0))}); iud.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.0.0]"))); iud.setFilter("(invalid=true)"); a1 = MetadataFactory.createInstallableUnit(iud); |