Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Grunberg2017-02-03 13:30:27 -0500
committerAlexander Kurtakov2017-07-03 13:20:25 -0400
commit92928dfaa2124188bb30149d1bf706a6f5e7f897 (patch)
treeaf98a1e3cb21b00b7bad7d17c24b867053e60fff
parentd6c862cc5a2b20d5577e41baf513d01fbf6f80ac (diff)
downloadrt.equinox.p2-92928dfaa2124188bb30149d1bf706a6f5e7f897.tar.gz
rt.equinox.p2-92928dfaa2124188bb30149d1bf706a6f5e7f897.tar.xz
rt.equinox.p2-92928dfaa2124188bb30149d1bf706a6f5e7f897.zip
Bug 512312: Droplets should correctly detect feature group IUs.I20170703-2000
This issue has been mostly addressed by 7c95455. The logic for detection of feature groups was wrongly comparing a string and a boolean for equality as well as being computed more times than necessary. Change-Id: Icd714e39b798fba748d88c3aea2845649aa9fee1 Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/SurrogateProfileHandlerTest.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/features/org.foo.bar.feature_1.0.0/build.properties3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/features/org.foo.bar.feature_1.0.0/feature.xml27
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/fragment.info3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/plugins/org.foo.bar_1.0.0.jarbin0 -> 380 bytes
6 files changed, 62 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
index 85162fa9a..877007183 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
@@ -236,10 +236,11 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
|| "feature".equals(cap.getName())) { //$NON-NLS-1$
featureOrBundle = true;
}
- } else if (Boolean.TRUE.equals(Boolean.valueOf(unit.getProperties().get("org.eclipse.equinox.p2.type.group")))) { //$NON-NLS-1$
- featureOrBundle = true;
}
}
+ if (Boolean.TRUE.equals(Boolean.valueOf(unit.getProperties().get("org.eclipse.equinox.p2.type.group")))) { //$NON-NLS-1$
+ featureOrBundle = true;
+ }
if (featureOrBundle && !added.contains(unit)) {
added.add(unit);
sharedProfile.addInstallableUnit(unit);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/SurrogateProfileHandlerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/SurrogateProfileHandlerTest.java
index 3aff7348a..eb975bf09 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/SurrogateProfileHandlerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/SurrogateProfileHandlerTest.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.engine;
+import java.io.File;
+import java.io.IOException;
import java.lang.reflect.Field;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -17,8 +19,12 @@ import org.eclipse.equinox.internal.p2.engine.*;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
+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.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.p2.tests.reconciler.dropins.SharedInstallTests;
+import org.eclipse.equinox.p2.tests.sharedinstall.AbstractSharedInstallTest;
public class SurrogateProfileHandlerTest extends AbstractProvisioningTest {
private static final String PROFILE_NAME = "profile.SurrogateProfileHandlerTest";
@@ -85,4 +91,24 @@ public class SurrogateProfileHandlerTest extends AbstractProvisioningTest {
assertEquals(1, queryResultSize(surrogateProfile.query(QueryUtil.createIUAnyQuery(), null)));
assertEquals(2, queryResultSize(surrogateProfile.available(QueryUtil.createIUAnyQuery(), null)));
}
+
+ public void testDropletsCanDetectFeatureGroup() throws IOException, ProvisionException {
+ // Droplet containing 'org.foo.bar', 'org.foo.bar.feature.feature.jar' and 'org.foo.bar.feature.feature.group'
+ File fragTestData = getTestData("0.1", "/testData/testRepos/foo-droplet");
+ File fragDir = getTempFolder();
+ copy("Copying ..", fragTestData, fragDir);
+ SharedInstallTests.setReadOnly(fragDir, true);
+ AbstractSharedInstallTest.reallyReadOnly(fragDir, true);
+ EngineActivator.EXTENDED = true;
+ EngineActivator.EXTENSIONS = fragDir.getAbsolutePath();
+
+ Profile profile = (Profile) registry.addProfile(PROFILE_NAME);
+ saveProfile(registry, profile);
+ IProfile surrogateProfile = handler.createProfile(PROFILE_NAME);
+ IQueryResult<IInstallableUnit> qRes = surrogateProfile.available(QueryUtil.createIUPropertyQuery(QueryUtil.PROP_TYPE_GROUP, "true"), null);
+ assertFalse(qRes.isEmpty());
+
+ AbstractSharedInstallTest.removeReallyReadOnly(fragDir, true);
+ SharedInstallTests.setReadOnly(fragDir, false);
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/features/org.foo.bar.feature_1.0.0/build.properties b/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/features/org.foo.bar.feature_1.0.0/build.properties
new file mode 100644
index 000000000..2694532b6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/features/org.foo.bar.feature_1.0.0/build.properties
@@ -0,0 +1,3 @@
+bin.includes = feature.xml,\
+ build.properties
+src.includes = feature.xml
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/features/org.foo.bar.feature_1.0.0/feature.xml b/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/features/org.foo.bar.feature_1.0.0/feature.xml
new file mode 100644
index 000000000..f9513f307
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/features/org.foo.bar.feature_1.0.0/feature.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.foo.bar.feature"
+ label="%featureName"
+ version="1.0.0"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.foo.bar"
+ download-size="217"
+ install-size="449"
+ version="1.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/fragment.info b/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/fragment.info
new file mode 100644
index 000000000..658caecd3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/fragment.info
@@ -0,0 +1,3 @@
+#encoding=UTF-8
+#version=1
+org.foo.bar,1.0.0,plugins/org.foo.bar_1.0.0.jar,4,false
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/plugins/org.foo.bar_1.0.0.jar b/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/plugins/org.foo.bar_1.0.0.jar
new file mode 100644
index 000000000..91d9282de
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/testRepos/foo-droplet/eclipse/plugins/org.foo.bar_1.0.0.jar
Binary files differ

Back to the top