summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (Ericsson)2013-02-27 11:07:23 (EST)
committerPascal Rapicault2013-02-27 11:07:23 (EST)
commit790e216bde5d1d518611396c540216b2fcbac8ec (patch)
treeec1e68b9367bcbf17fff72536aa16a597337508c
parentea7172997438f874cff0116c37648882dfa14616 (diff)
downloadrt.equinox.p2-790e216bde5d1d518611396c540216b2fcbac8ec.zip
rt.equinox.p2-790e216bde5d1d518611396c540216b2fcbac8ec.tar.gz
rt.equinox.p2-790e216bde5d1d518611396c540216b2fcbac8ec.tar.bz2
Fix logic to detect previous configuration when matching product id
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/PreviousConfigurationFinderTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/noMatch/otherProduct_1.1.1_11111111_win32_win32_x86_64/empty.txt0
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/sameProductWithSameVersion/org.eclipse.platform_4.2.1_23456789_win32_win32_x86/empty.txt0
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/sameProductWithSameVersion/org.eclipse.platform_4.3.0_01234567_win32_win32_x86/empty.txt0
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java9
5 files changed, 20 insertions, 4 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 67fdc21..04f06a8 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
@@ -56,6 +56,21 @@ public class PreviousConfigurationFinderTest extends AbstractProvisioningTest {
assertEquals(new Identifier(4, 2, 1), match.getVersion());
}
+ public void testNewBuildInDifferentFolder_sameProductWithSameVersion() throws Exception {
+ File configFolder = getTestData("sameProduct", "testData/previousConfigurationFinder/testNewBuildInDifferentFolder/sameProductWithSameVersion");
+ 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(4, 3, 0), match.getVersion());
+ }
+
+ public void testNewBuildInDifferentFolder_noMatch() throws Exception {
+ File configFolder = getTestData("sameProduct", "testData/previousConfigurationFinder/testNewBuildInDifferentFolder/noMatch");
+ List<ConfigurationDescriptor> configs = new PreviousConfigurationFinder(configFolder).readPreviousConfigurations(configFolder);
+ ConfigurationDescriptor match = new PreviousConfigurationFinder(configFolder).findMostRelevantConfigurationFromProductId(configs, referenceConfiguration);
+ assertNull(match);
+ }
+
public void testNewBuildInDifferentFolder_mixedProducts() throws Exception {
File configFolder = getTestData("sameProduct", "testData/previousConfigurationFinder/testNewBuildInDifferentFolder/mixedProducts");
List<ConfigurationDescriptor> configs = new PreviousConfigurationFinder(configFolder).readPreviousConfigurations(configFolder);
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/noMatch/otherProduct_1.1.1_11111111_win32_win32_x86_64/empty.txt b/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/noMatch/otherProduct_1.1.1_11111111_win32_win32_x86_64/empty.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/noMatch/otherProduct_1.1.1_11111111_win32_win32_x86_64/empty.txt
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/sameProductWithSameVersion/org.eclipse.platform_4.2.1_23456789_win32_win32_x86/empty.txt b/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/sameProductWithSameVersion/org.eclipse.platform_4.2.1_23456789_win32_win32_x86/empty.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/sameProductWithSameVersion/org.eclipse.platform_4.2.1_23456789_win32_win32_x86/empty.txt
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/sameProductWithSameVersion/org.eclipse.platform_4.3.0_01234567_win32_win32_x86/empty.txt b/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/sameProductWithSameVersion/org.eclipse.platform_4.3.0_01234567_win32_win32_x86/empty.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/previousConfigurationFinder/testNewBuildInDifferentFolder/sameProductWithSameVersion/org.eclipse.platform_4.3.0_01234567_win32_win32_x86/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 8c60913..9fd244b 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
@@ -185,10 +185,11 @@ public class PreviousConfigurationFinder {
int numberOfcriteriaMet = 0;
for (ConfigurationDescriptor candidate : configurations) {
int criteriaMet = 0;
- criteriaMet++;
- if (candidate.getProductId().equals(configToMatch.getProductId()) && //
- candidate.getPlatformConfig().equals(configToMatch.getPlatformConfig()) && //
- (!candidate.getVersion().isGreaterEqualTo(configToMatch.getVersion()))) {
+ if (!candidate.getProductId().equals(configToMatch.getProductId()))
+ continue;
+
+ if (candidate.getPlatformConfig().equals(configToMatch.getPlatformConfig()) && //
+ (configToMatch.getVersion().isGreaterEqualTo(candidate.getVersion()))) {
//We have a match
criteriaMet++;
}