Skip to content

Commit 3f36b28

Browse files
committed
Adjust dependencies in ConfigurationSessionTestSuite (fixup for #2162)
org.eclipse.core.tests.session.ConfigurationSessionTestSuite must be adjusted in the same way as org.eclipse.core.tests.harness.session.customization.CustomSessionConfigurationImpl
1 parent 08ad49e commit 3f36b28

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/session/ConfigurationSessionTestSuite.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.Arrays;
2727
import java.util.Collection;
2828
import java.util.HashMap;
29+
import java.util.HashSet;
2930
import java.util.List;
3031
import java.util.Map;
3132
import java.util.Optional;
@@ -45,6 +46,8 @@
4546
import org.osgi.framework.Constants;
4647
import org.osgi.framework.FrameworkUtil;
4748
import org.osgi.framework.Version;
49+
import org.osgi.framework.wiring.BundleWire;
50+
import org.osgi.framework.wiring.BundleWiring;
4851

4952
@SuppressWarnings("restriction")
5053
public class ConfigurationSessionTestSuite extends SessionTestSuite {
@@ -71,6 +74,18 @@ public ConfigurationSessionTestSuite(String pluginId, String name) {
7174
super(pluginId, name);
7275
}
7376

77+
private static void collectDependencies(Bundle bundle, Collection<Bundle> dependencyClosure) {
78+
if (!dependencyClosure.add(bundle)) {
79+
return;
80+
}
81+
BundleWiring wiring = bundle.adapt(BundleWiring.class);
82+
if (wiring != null) {
83+
for (BundleWire wire : wiring.getRequiredWires(null)) {
84+
collectDependencies(wire.getProviderWiring().getBundle(), dependencyClosure);
85+
}
86+
}
87+
}
88+
7489
@SuppressWarnings("deprecation")
7590
public void addMinimalBundleSet() {
7691
// Just use any class from the bundles we want to add as minimal bundle set
@@ -84,6 +99,12 @@ public void addMinimalBundleSet() {
8499
addBundle(org.eclipse.core.runtime.content.IContentType.class); // org.eclipse.core.contenttype
85100
addBundle(org.eclipse.equinox.app.IApplication.class); // org.eclipse.equinox.app
86101

102+
// org.apache.felix.scr + dependencies
103+
Bundle scrBundle = FrameworkUtil.getBundle(org.apache.felix.scr.info.ScrInfo.class);
104+
Collection<Bundle> scrAndDependencies = new HashSet<>();
105+
collectDependencies(scrBundle, scrAndDependencies);
106+
scrAndDependencies.forEach(i -> addBundle(i, null));
107+
87108
addBundle(org.eclipse.core.tests.harness.TestHarnessPlugin.class); // org.eclipse.core.tests.harness
88109
addBundle(org.eclipse.test.performance.Performance.class); // org.eclipse.test.performance
89110

0 commit comments

Comments
 (0)