Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordj2011-09-20 18:56:48 +0000
committerdj2011-09-20 18:58:59 +0000
commit41e215bfde9dc5d7041c963db1feb366989e34bc (patch)
tree1a33ea4ff08ca28fdd66a9dfe871b217bf44dc29
parentca7c0a1c092328e111f1f51c3fb2021a961b5493 (diff)
downloadrt.equinox.p2-41e215bfde9dc5d7041c963db1feb366989e34bc.tar.gz
rt.equinox.p2-41e215bfde9dc5d7041c963db1feb366989e34bc.tar.xz
rt.equinox.p2-41e215bfde9dc5d7041c963db1feb366989e34bc.zip
More planner test cases.
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java82
1 files changed, 71 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java
index de3c7f1c2..bac67a575 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java
@@ -10,25 +10,24 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.planner;
-import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
-
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.director.Explanation;
+import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.director.*;
+import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus;
+import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus;
import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
public class MultipleSingleton extends AbstractProvisioningTest {
- IInstallableUnit a1;
- IInstallableUnit a2;
- IInstallableUnit a3;
- IInstallableUnit a4;
+ IInstallableUnit a1, a2, a3, a4;
IInstallableUnit u, v, w, x, y, z;
+ IInstallableUnit sdk1, sdk2, platform1, platform2, third1, third2, s1, s2, t1, t2, random;
IPlanner planner;
IProfile profile;
@@ -36,11 +35,8 @@ public class MultipleSingleton extends AbstractProvisioningTest {
protected void setUp() throws Exception {
super.setUp();
a1 = createIU("A", Version.create("1.0.0"), true);
-
a2 = createIU("A", Version.create("2.0.0"), true);
-
a3 = createIU("A", Version.create("3.0.0"), false);
-
a4 = createIU("A", Version.create("4.0.0"), false);
x = createIU("X", Version.createOSGi(2, 0, 0), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 4.1.0)")));
@@ -62,11 +58,75 @@ public class MultipleSingleton extends AbstractProvisioningTest {
v = createIU("V", Version.createOSGi(2, 0, 0), new IRequirement[] {c7});
u = createIU("U", Version.createOSGi(2, 0, 0), new IRequirement[] {c8});
- createTestMetdataRepository(new IInstallableUnit[] {a1, a2, a3, a4, w, x, y, z});
+ // create IUs to mimic the platform, SDK, and a third-party feature
+ platform1 = createIU("platform", Version.create("1.0.0"), true);
+ platform2 = createIU("platform", Version.create("2.0.0"), true);
+ sdk1 = createIU("sdk", Version.create("1.0.0"), true);
+ sdk2 = createIU("sdk", Version.create("2.0.0"), true);
+ third1 = createIU("third", Version.create("1.0.0"), true);
+ third2 = createIU("third", Version.create("2.0.0"), true);
+ random = createIU("random");
+
+ IRequirement pr1 = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "platform", new VersionRange("[1.0.0, 1.0.0]"), null, false, false);
+ IRequirement pr2 = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "platform", new VersionRange("[2.0.0, 2.0.0]"), null, false, false);
+
+ // the sdk has a dependency on the platform
+ s1 = createIU("s1", Version.createOSGi(1, 0, 0), new IRequirement[] {pr1});
+ s2 = createIU("s2", Version.createOSGi(2, 0, 0), new IRequirement[] {pr2});
+
+ // the third-party feature has a dependency on the platform
+ t1 = createIU("t1", Version.createOSGi(1, 0, 0), new IRequirement[] {pr1});
+ t2 = createIU("t2", Version.createOSGi(2, 0, 0), new IRequirement[] {pr2});
+
+ // create a repo with the data in it
+ createTestMetdataRepository(new IInstallableUnit[] {a1, a2, a3, a4, w, x, y, z, platform1, platform2, sdk1, sdk2, third1, third2, s1, s2, t1, t2, random});
profile = createProfile("TestProfile.MultipleSingleton" + getName());
planner = createPlanner();
+ }
+
+ /*
+ * Install both the SDK and Third as roots.
+ * Both have a dependency on the Platform.
+ * Try to update the SDK.
+ * Operation blocked because Third also depends on Platform.
+ */
+ public void testSDKandThirdPartyConflict() {
+ assertOK(install(profile, new IInstallableUnit[] {s1, t1}, true, planner, createEngine()));
+ ProfileChangeRequest pcr = new ProfileChangeRequest(profile);
+ pcr.addInstallableUnits(s2);
+ pcr.remove(s1);
+ IProvisioningPlan plan = planner.getProvisioningPlan(pcr, null, null);
+ assertNotOK(plan.getStatus());
+ }
+
+ /*
+ * Install Platform as root.
+ * Add SDK.
+ * Try to update SDK.
+ * Operation blocked because Platform is root and not automatically updated.
+ */
+ public void testSDKandPlatformBothRootsConflict() {
+ assertOK(install(profile, new IInstallableUnit[] {platform1, s1}, true, planner, createEngine()));
+ ProfileChangeRequest pcr = new ProfileChangeRequest(profile);
+ pcr.addInstallableUnits(s2);
+ pcr.remove(s1);
+ IProvisioningPlan plan = planner.getProvisioningPlan(pcr, null, null);
+ assertNotOK(plan.getStatus());
+ }
+ /*
+ * Install Platform and SDK both as roots.
+ * Try and update Platform.
+ * Blocked because SDK needs Platform.
+ */
+ public void testSDKandPlatformBothRootsConflict2() {
+ assertOK(install(profile, new IInstallableUnit[] {platform1, s1}, true, planner, createEngine()));
+ ProfileChangeRequest pcr = new ProfileChangeRequest(profile);
+ pcr.addInstallableUnits(platform2);
+ pcr.remove(platform1);
+ IProvisioningPlan plan = planner.getProvisioningPlan(pcr, null, null);
+ assertNotOK(plan.getStatus());
}
public void test1() {

Back to the top