summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2013-02-19 23:47:17 (EST)
committerPascal Rapicault2013-02-19 23:47:17 (EST)
commit53165c49e9bc2d8b9e389d31c4a4885ab1f6d192 (patch)
tree118d9011cf7cb49909644eb53fd21b9b003425a8
parente5514dcd8b13fc6de35ba82487a7087dc41df5cc (diff)
downloadrt.equinox.p2-53165c49e9bc2d8b9e389d31c4a4885ab1f6d192.zip
rt.equinox.p2-53165c49e9bc2d8b9e389d31c4a4885ab1f6d192.tar.gz
rt.equinox.p2-53165c49e9bc2d8b9e389d31c4a4885ab1f6d192.tar.bz2
Test we can move from strict to optionalI20130224-2000I20130223-1500I20130222-2000
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllTests.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FromStrictToOptional.java59
2 files changed, 60 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllTests.java
index 666d8ff..e3abb7d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllTests.java
@@ -73,6 +73,7 @@ public class AllTests extends TestCase {
suite.addTestSuite(ExplanationLargeConflict.class);
suite.addTestSuite(ExplanationSeveralConflictingRoots.class);
suite.addTestSuite(FindRootsAfterUpdate.class);
+ suite.addTestSuite(FromStrictToOptional.class);
suite.addTestSuite(GreedyRequirement.class);
suite.addTestSuite(InclusionRuleTest.class);
suite.addTestSuite(InclusionRuleTest2.class);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FromStrictToOptional.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FromStrictToOptional.java
new file mode 100644
index 0000000..e956c46
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FromStrictToOptional.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Rapicorp, Inc. 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:
+ * Rapicorp, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.p2.tests.planner;
+
+import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
+import org.eclipse.equinox.p2.engine.IEngine;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.planner.IPlanner;
+import org.eclipse.equinox.p2.planner.ProfileInclusionRules;
+import org.eclipse.equinox.p2.tests.*;
+
+public class FromStrictToOptional extends AbstractProvisioningTest {
+ @IUDescription(content = "package: A \n" + "singleton: true\n" + "version: 1 \n" + "depends: B = 1")
+ public IInstallableUnit a1;
+
+ @IUDescription(content = "package: B \n" + "singleton: true\n" + "version: 1 \n")
+ public IInstallableUnit b1;
+
+ @IUDescription(content = "package: C \n" + "singleton: true\n" + "version: 1 \n" + "depends: B = 2")
+ public IInstallableUnit c1;
+
+ @IUDescription(content = "package: B \n" + "singleton: true\n" + "version: 2 \n")
+ public IInstallableUnit b2;
+
+ IProfile profile = createProfile("TestProfile." + getName());
+
+ private IPlanner planner;
+
+ private IEngine engine;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ IULoader.loadIUs(this);
+ createTestMetdataRepository(new IInstallableUnit[] {a1, b1, b2, c1});
+ planner = createPlanner();
+ engine = createEngine();
+ assertOK(install(profile, new IInstallableUnit[] {a1}, true, planner, engine));
+ }
+
+ public void testChangeFromStrictToOptional() {
+ assertNotOK(install(profile, new IInstallableUnit[] {c1}, true, planner, engine));
+ ProfileChangeRequest req = new ProfileChangeRequest(profile);
+ req.add(a1);
+ req.setInstallableUnitInclusionRules(a1, ProfileInclusionRules.createStrictInclusionRule(a1));
+ req.add(c1);
+ req.setInstallableUnitInclusionRules(c1, ProfileInclusionRules.createOptionalInclusionRule(c1));
+ assertOK(install(req, planner, engine));
+ }
+}