Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2011-09-05 16:40:43 -0400
committerPascal Rapicault2011-09-05 16:42:07 -0400
commit37df25467c3b5a333c6c7993836723da05d9e8e1 (patch)
tree28cf00fb5b7ca7102e7653f7e3cd66bca27f5502
parentdf0e3ecefa5df573f6b51a49155442d83fdb2a5f (diff)
downloadrt.equinox.p2-37df25467c3b5a333c6c7993836723da05d9e8e1.tar.gz
rt.equinox.p2-37df25467c3b5a333c6c7993836723da05d9e8e1.tar.xz
rt.equinox.p2-37df25467c3b5a333c6c7993836723da05d9e8e1.zip
Actual RequestStatus incorrectly set when adding and removing the same
IU
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimplePlanner.java7
-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/TestNoopChangeRequest.java44
3 files changed, 50 insertions, 2 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 e8d6be1e7..63447fd65 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
@@ -21,7 +21,8 @@ import org.eclipse.equinox.internal.p2.director.Explanation.MissingIU;
import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.internal.p2.metadata.query.UpdateQuery;
import org.eclipse.equinox.internal.p2.rollback.FormerState;
-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.core.IAgentLocation;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.*;
@@ -93,7 +94,9 @@ public class SimplePlanner implements IPlanner {
private Map<IInstallableUnit, RequestStatus>[] computeActualChangeRequest(Collection<IInstallableUnit> toState, ProfileChangeRequest changeRequest) {
Collection<IInstallableUnit> requestedAdditions = changeRequest.getAdditions();
- Collection<IInstallableUnit> requestedRemovals = changeRequest.getRemovals();
+ Collection<IInstallableUnit> requestedRemovals = new ArrayList<IInstallableUnit>(changeRequest.getRemovals());
+ requestedRemovals.removeAll(requestedAdditions);
+
Map<IInstallableUnit, RequestStatus> requestStatus = new HashMap<IInstallableUnit, RequestStatus>(requestedAdditions.size() + requestedRemovals.size());
for (IInstallableUnit added : requestedAdditions) {
if (toState.contains(added))
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 0ec488de4..3a02876c1 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
@@ -152,6 +152,7 @@ public class AllTests extends TestCase {
suite.addTestSuite(SingletonOptionallyInstalled2.class);
suite.addTestSuite(SWTFragment.class);
suite.addTestSuite(SynchronizeOperationTest.class);
+ suite.addTestSuite(TestNoopChangeRequest.class);
suite.addTestSuite(TopLevelFilterTest.class);
suite.addTestSuite(TwoVersionsOfWSDL.class);
suite.addTestSuite(UninstallEverything.class);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestNoopChangeRequest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestNoopChangeRequest.java
new file mode 100644
index 000000000..7f02ee651
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestNoopChangeRequest.java
@@ -0,0 +1,44 @@
+package org.eclipse.equinox.p2.tests.planner;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
+import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus;
+import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus;
+import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.planner.IPlanner;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+
+public class TestNoopChangeRequest extends AbstractProvisioningTest {
+
+ private IInstallableUnit a;
+ private IPlanner planner;
+ private IEngine engine;
+ private IProfile profile;
+
+ @Override
+ protected void setUp() throws Exception {
+ // TODO Auto-generated method stub
+ super.setUp();
+
+ a = createIU("A");
+
+ createTestMetdataRepository(new IInstallableUnit[] {a});
+
+ planner = createPlanner();
+ engine = createEngine();
+ profile = createProfile("TestProfile." + getName());
+ assertOK(install(profile, new IInstallableUnit[] {a}, true, planner, engine));
+ }
+
+ public void testNoopInstall() {
+ ProfileChangeRequest pcr = new ProfileChangeRequest(profile);
+ pcr.add(a);
+ pcr.remove(a);
+ IProvisioningPlan plan = planner.getProvisioningPlan(pcr, null, new NullProgressMonitor());
+ PlannerStatus plannerStatus = plan.getStatus() instanceof PlannerStatus ? (PlannerStatus) plan.getStatus() : null;
+ RequestStatus rs = plannerStatus.getRequestChanges().get(a);
+ assertEquals(IStatus.OK, rs.getSeverity());
+ }
+}

Back to the top