Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2013-03-14 02:08:51 +0000
committerPascal Rapicault2013-03-14 02:17:27 +0000
commit8f0bc15dea0bf124b1f56e7da8a64de010c7e285 (patch)
treecabf1c4f17ec36a4ff2b1db7edd968bff5a766a6 /bundles
parent48bbc74bc2134718d082411c37f741a965d49a29 (diff)
downloadrt.equinox.p2-8f0bc15dea0bf124b1f56e7da8a64de010c7e285.tar.gz
rt.equinox.p2-8f0bc15dea0bf124b1f56e7da8a64de010c7e285.tar.xz
rt.equinox.p2-8f0bc15dea0bf124b1f56e7da8a64de010c7e285.zip
deal with legacy configuration foldersI20130314-1330
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/PreviousConfigurationFinderTest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testLegacyFormat/org.eclipse.platform_3.8.1_12345/empty.txt0
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testLegacyFormat/org.eclipse.platform_3.8_12345/empty.txt0
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java12
4 files changed, 16 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/PreviousConfigurationFinderTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/PreviousConfigurationFinderTest.java
index be364efb8..e7f97b8ad 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/PreviousConfigurationFinderTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/PreviousConfigurationFinderTest.java
@@ -97,4 +97,13 @@ public class PreviousConfigurationFinderTest extends AbstractProvisioningTest {
assertEquals(new Identifier(4, 1, 0), match.getVersion());
}
+ public void testLegacyFormat() throws Exception {
+ File configFolder = getTestData("sameProduct", "testData/previousConfigurationFinder/testLegacyFormat");
+ List<ConfigurationDescriptor> configs = new PreviousConfigurationFinder(configFolder).readPreviousConfigurations(configFolder);
+ ConfigurationDescriptor match = new PreviousConfigurationFinder(configFolder).findMostRelevantConfigurationFromProductId(configs, referenceConfiguration);
+ assertEquals("org.eclipse.platform", match.getProductId());
+ assertEquals(new Identifier(3, 8, 0), match.getVersion());
+ assertNull(match.getPlatformConfig());
+
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testLegacyFormat/org.eclipse.platform_3.8.1_12345/empty.txt b/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testLegacyFormat/org.eclipse.platform_3.8.1_12345/empty.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testLegacyFormat/org.eclipse.platform_3.8.1_12345/empty.txt
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testLegacyFormat/org.eclipse.platform_3.8_12345/empty.txt b/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testLegacyFormat/org.eclipse.platform_3.8_12345/empty.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testLegacyFormat/org.eclipse.platform_3.8_12345/empty.txt
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
index 09ae0f104..4010af2b9 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
@@ -172,8 +172,8 @@ public class PreviousConfigurationFinder {
}
criteriaMet++;
- if (candidate.getProductId().equals(configToMatch.getProductId()) && //
- candidate.getPlatformConfig().equals(configToMatch.getPlatformConfig()) && //
+ if (configToMatch.getProductId().equals(candidate.getProductId()) && //
+ configToMatch.getPlatformConfig().equals(candidate.getPlatformConfig()) && //
(!candidate.getVersion().isGreaterEqualTo(configToMatch.getVersion()))) {
//We have a match
criteriaMet++;
@@ -203,11 +203,13 @@ public class PreviousConfigurationFinder {
int numberOfcriteriaMet = 0;
for (ConfigurationDescriptor candidate : configurations) {
int criteriaMet = 0;
- if (!candidate.getProductId().equals(configToMatch.getProductId()))
+ if (!configToMatch.getProductId().equals(candidate.getProductId()))
continue;
- if (candidate.getPlatformConfig().equals(configToMatch.getPlatformConfig()) && //
- (configToMatch.getVersion().isGreaterEqualTo(candidate.getVersion()))) {
+ if (configToMatch.getPlatformConfig().equals(candidate.getPlatformConfig()))
+ criteriaMet++;
+
+ if (configToMatch.getVersion().isGreaterEqualTo(candidate.getVersion())) {
//We have a match
criteriaMet++;
}

Back to the top