Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProvisioningPlan.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProvisioningPlan.java18
-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/Bug271954.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java55
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleSingleton.java7
8 files changed, 91 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
index 63447fd65..55affc2a2 100644
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
+++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java
@@ -51,6 +51,7 @@ public class SimplePlanner implements IPlanner {
private IProvisioningPlan generateProvisioningPlan(Collection<IInstallableUnit> fromState, Collection<IInstallableUnit> toState, ProfileChangeRequest changeRequest, IProvisioningPlan installerPlan, ProvisioningContext context) {
IProvisioningPlan plan = engine.createPlan(changeRequest.getProfile(), context);
+ plan.setFuturePlan(new CollectionResult<IInstallableUnit>(toState));
planIUOperations(plan, fromState, toState);
planPropertyOperations(plan, changeRequest, toState);
diff --git a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF
index f25efd3ec..720280b0e 100644
--- a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.engine;singleton:=true
-Bundle-Version: 2.1.100.qualifier
+Bundle-Version: 2.2.0.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.engine.EngineActivator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProvisioningPlan.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProvisioningPlan.java
index 0c679a59f..992f4adaa 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProvisioningPlan.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProvisioningPlan.java
@@ -24,6 +24,7 @@ public class ProvisioningPlan implements IProvisioningPlan {
final IProfile profile;
final List<Operand> operands = new ArrayList<Operand>();
final ProvisioningContext context;
+ IQueryable<IInstallableUnit> futureState;
IStatus status;
private IProvisioningPlan installerPlan;
@@ -144,4 +145,12 @@ public class ProvisioningPlan implements IProvisioningPlan {
return;
operands.add(new InstallableUnitPropertyOperand(iu, name, currentValue, value));
}
+
+ public IQueryable<IInstallableUnit> getFutureState() {
+ return futureState;
+ }
+
+ public void setFuturePlan(IQueryable<IInstallableUnit> futureState) {
+ this.futureState = futureState;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProvisioningPlan.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProvisioningPlan.java
index c67ab03a1..2493b85fd 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProvisioningPlan.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProvisioningPlan.java
@@ -58,6 +58,15 @@ public interface IProvisioningPlan {
public IProfile getProfile();
/**
+ * Returns the set of IUs that will constitute the profile if the plan is executed successfully.
+ *
+ * @return The set of the IUs that will constitute the profile after the plan is executed successfully, or @null if the
+ * plan is in error or the value has not been set.
+ * @since 2.2
+ */
+ public IQueryable<IInstallableUnit> getFutureState();
+
+ /**
* Returns the proposed set of installable units to be removed from this profile.
*
* @return The proposed profile removals.
@@ -173,4 +182,13 @@ public interface IProvisioningPlan {
* @param to the installable unit to add
*/
public void updateInstallableUnit(IInstallableUnit from, IInstallableUnit to);
+
+ /**
+ * Sets the value that is returned by the method getFutureState.
+ * Note that this method is a simple setter and will not cause any update to the other fields of this object.
+ * This field can be set to @null.
+ * @param futureState A set of IU representing the future plan if the plan is executed successfully.
+ * @since 2.2
+ */
+ public void setFuturePlan(IQueryable<IInstallableUnit> futureState);
} \ No newline at end of file
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 3a02876c1..8e9888c3b 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
@@ -72,6 +72,7 @@ public class AllTests extends TestCase {
suite.addTestSuite(ExplanationForPartialInstallation.class);
suite.addTestSuite(ExplanationLargeConflict.class);
suite.addTestSuite(ExplanationSeveralConflictingRoots.class);
+ suite.addTestSuite(FindRootsAfterUpdate.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/Bug271954.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java
index 594ba03b4..dd1b8d2c0 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java
@@ -10,12 +10,11 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.planner;
-import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
-
import java.io.File;
import java.lang.reflect.Field;
import java.net.URI;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry;
import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -85,6 +84,7 @@ public class Bug271954 extends AbstractProvisioningTest {
ctx.setArtifactRepositories(new URI[0]);
IProvisioningPlan plan = createPlanner().getProvisioningPlan(req, ctx, new NullProgressMonitor());
assertOK("Uninstall plan for myBundle", plan.getStatus());
+ assertNotNull(plan.getInstallerPlan().getFutureState());
assertEquals(0, queryResultSize(plan.getInstallerPlan().getAdditions().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
assertEquals(0, queryResultSize(plan.getInstallerPlan().getRemovals().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor())));
assertUninstallOperand(plan, (IInstallableUnit) c.iterator().next());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java
new file mode 100644
index 000000000..18d1d0b6d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Sonatype, 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:
+ * Sonatype, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.p2.tests.planner;
+
+import java.util.Arrays;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
+import org.eclipse.equinox.p2.engine.*;
+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 FindRootsAfterUpdate extends AbstractProvisioningTest {
+ IInstallableUnit b1;
+ IInstallableUnit b2;
+ IInstallableUnit b3;
+
+ IProfile profile;
+ IPlanner planner;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ b1 = createIU("B", Version.create("1.0.0"), true);
+
+ b2 = createIU("B", Version.create("2.0.0"), true);
+
+ b3 = createIU("B", Version.create("3.0.0"), true);
+
+ createTestMetdataRepository(new IInstallableUnit[] {b1, b2, b3});
+
+ profile = createProfile("TestProfile." + getName());
+ planner = createPlanner();
+
+ }
+
+ public void testInstallA1() {
+ ProfileChangeRequest req = new ProfileChangeRequest(profile);
+ ProvisioningContext ctx = new ProvisioningContext(getAgent());
+ IRequirement[] reqs = createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[2.0.0, 4.0.0]"));
+ req.addExtraRequirements(Arrays.<IRequirement> asList(reqs[0]));
+ IProvisioningPlan plan = planner.getProvisioningPlan(req, ctx, null);
+ assertEquals(IStatus.OK, plan.getStatus().getSeverity());
+ assertInstallOperand(plan, b3);
+ assertContains(plan.getFutureState().query(QueryUtil.createMatchQuery(reqs[0].getMatches()), null), b3);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleSingleton.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleSingleton.java
index 56ff9dfd5..e5781d3da 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleSingleton.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleSingleton.java
@@ -10,12 +10,12 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.planner;
-import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
-
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.metadata.*;
import org.eclipse.equinox.p2.planner.IPlanner;
@@ -53,6 +53,7 @@ public class SimpleSingleton extends AbstractProvisioningTest {
req.addInstallableUnits(new IInstallableUnit[] {y});
ProvisioningPlan provisioningPlan = (ProvisioningPlan) planner.getProvisioningPlan(req, null, null);
assertEquals(IStatus.ERROR, provisioningPlan.getStatus().getSeverity());
+ assertNull(provisioningPlan.getFutureState());
assertNotNull(((PlannerStatus) provisioningPlan.getStatus()).getPlannedState());
}

Back to the top