Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (Ericsson)2013-04-05 19:37:34 +0000
committerPascal Rapicault2013-04-05 19:37:34 +0000
commitcacedf0145c6fc46e417a2cfe5960c4913562e38 (patch)
treefdd6d766c2243e7e31bb5b8ccc05b3e6ff8bbdb1 /bundles
parent63e1a9c2064cb40f8d4eaa214c3db45c5dba0f56 (diff)
downloadrt.equinox.p2-cacedf0145c6fc46e417a2cfe5960c4913562e38.tar.gz
rt.equinox.p2-cacedf0145c6fc46e417a2cfe5960c4913562e38.tar.xz
rt.equinox.p2-cacedf0145c6fc46e417a2cfe5960c4913562e38.zip
Roots from the previous base should not be proposed in migration
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/NeedsMigration.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java16
2 files changed, 67 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/NeedsMigration.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/NeedsMigration.java
index 287e7fb95..980797834 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/NeedsMigration.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/NeedsMigration.java
@@ -123,6 +123,60 @@ public class NeedsMigration extends AbstractProvisioningTest {
assertTrue(needsMigration(previousUserProfile, currentBaseProfile));
}
+ public void testNoIUsInstalledInUserProfile() {
+ IProfile previousUserProfile = createProfile("previous" + getName());
+ IProfile currentBaseProfile = createProfile("current" + getName());
+ assertOK(installAsRootsAndFlaggedAsBase(previousUserProfile, new IInstallableUnit[] {sdk1}, true, planner, engine));
+ assertOK(installAsRoots(currentBaseProfile, new IInstallableUnit[] {sdk2}, true, planner, engine));
+
+ //The elements from the previous base are not proposed for migration
+ assertFalse(needsMigration(previousUserProfile, currentBaseProfile));
+ }
+
+ public void testOneIUInUserSpaceNotAvailableInBase() {
+ IProfile previousUserProfile = createProfile("previous" + getName());
+ IProfile currentBaseProfile = createProfile("current" + getName());
+ assertOK(installAsRootsAndFlaggedAsBase(previousUserProfile, new IInstallableUnit[] {sdk1}, true, planner, engine));
+ assertOK(installAsRoots(previousUserProfile, new IInstallableUnit[] {egit1}, true, planner, engine));
+ assertOK(installAsRoots(currentBaseProfile, new IInstallableUnit[] {sdk2}, true, planner, engine));
+
+ //In this case egit1 should be migrated
+ assertTrue(needsMigration(previousUserProfile, currentBaseProfile));
+ }
+
+ public void testLowerVersionAvailableInBase() {
+ IProfile previousUserProfile = createProfile("previous" + getName());
+ IProfile currentBaseProfile = createProfile("current" + getName());
+ assertOK(installAsRootsAndFlaggedAsBase(previousUserProfile, new IInstallableUnit[] {sdk1}, true, planner, engine));
+ assertOK(installAsRoots(previousUserProfile, new IInstallableUnit[] {egit2}, true, planner, engine));
+ assertOK(installAsRoots(currentBaseProfile, new IInstallableUnit[] {sdk2, egit1}, true, planner, engine));
+
+ //In this case egit2 should be migrated
+ assertTrue(needsMigration(previousUserProfile, currentBaseProfile));
+ }
+
+ public void testHigerVersionAvailableInBase() {
+ IProfile previousUserProfile = createProfile("previous" + getName());
+ IProfile currentBaseProfile = createProfile("current" + getName());
+ assertOK(installAsRootsAndFlaggedAsBase(previousUserProfile, new IInstallableUnit[] {sdk1}, true, planner, engine));
+ assertOK(installAsRoots(previousUserProfile, new IInstallableUnit[] {egit1}, true, planner, engine));
+ assertOK(installAsRoots(currentBaseProfile, new IInstallableUnit[] {sdk2, egit1}, true, planner, engine));
+
+ //Nothing to migrate
+ assertFalse(needsMigration(previousUserProfile, currentBaseProfile));
+ }
+
+ public void testSameVersionAvailableInBase() {
+ IProfile previousUserProfile = createProfile("previous" + getName());
+ IProfile currentBaseProfile = createProfile("current" + getName());
+ assertOK(installAsRootsAndFlaggedAsBase(previousUserProfile, new IInstallableUnit[] {sdk1}, true, planner, engine));
+ assertOK(installAsRoots(previousUserProfile, new IInstallableUnit[] {egit1}, true, planner, engine));
+ assertOK(installAsRoots(currentBaseProfile, new IInstallableUnit[] {sdk2, egit1}, true, planner, engine));
+
+ //Nothing to migrate
+ assertFalse(needsMigration(previousUserProfile, currentBaseProfile));
+ }
+
private boolean needsMigration(IProfile previousUserProfile, IProfile currentBaseProfile) {
try {
return (Boolean) needsMigrationMethod.invoke(scheduler, previousUserProfile, currentBaseProfile);
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java
index ecce7afef..42ac844a5 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationSupport.java
@@ -21,8 +21,10 @@ import org.eclipse.equinox.internal.p2.ui.sdk.scheduler.PreviousConfigurationFin
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery;
import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
@@ -124,9 +126,9 @@ public class MigrationSupport {
* @param currentProfile is the current profile used by eclipse.
* @return true if set difference between previousProfile units and currentProfile units not empty, otherwise false
*/
- private boolean needsMigration(IProfile previousProfile, IProfile currentProfile) {
+ protected boolean needsMigration(IProfile previousProfile, IProfile currentProfile) {
//First, try the case of inclusion
- Set<IInstallableUnit> previousProfileUnits = previousProfile.query(new UserVisibleRootQuery(), null).toSet();
+ Set<IInstallableUnit> previousProfileUnits = getUserRoots(previousProfile);
Set<IInstallableUnit> currentProfileUnits = currentProfile.available(new UserVisibleRootQuery(), null).toSet();
previousProfileUnits.removeAll(currentProfileUnits);
@@ -147,7 +149,15 @@ public class MigrationSupport {
return !previousProfileUnits.isEmpty();
}
- private void openMigrationWizard(final IProfile inputProfile, final URI[] reposToMigrate) {
+ private Set<IInstallableUnit> getUserRoots(IProfile previousProfile) {
+ IQueryResult<IInstallableUnit> allRoots = previousProfile.query(new UserVisibleRootQuery(), null);
+ Set<IInstallableUnit> rootsFromTheBase = previousProfile.query(new IUProfilePropertyQuery("org.eclipse.equinox.p2.base", "true"), null).toUnmodifiableSet();
+ Set<IInstallableUnit> userRoots = allRoots.toSet();
+ userRoots.removeAll(rootsFromTheBase);
+ return userRoots;
+ }
+
+ protected void openMigrationWizard(final IProfile inputProfile, final URI[] reposToMigrate) {
Display d = Display.getDefault();
d.asyncExec(new Runnable() {
public void run() {

Back to the top