Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand All @@ -45,6 +46,8 @@
import org.osgi.framework.Constants;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.Version;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;

@SuppressWarnings("restriction")
public class ConfigurationSessionTestSuite extends SessionTestSuite {
Expand All @@ -71,6 +74,18 @@ public ConfigurationSessionTestSuite(String pluginId, String name) {
super(pluginId, name);
}

private static void collectDependencies(Bundle bundle, Collection<Bundle> dependencyClosure) {
if (!dependencyClosure.add(bundle)) {
return;
}
BundleWiring wiring = bundle.adapt(BundleWiring.class);
if (wiring != null) {
for (BundleWire wire : wiring.getRequiredWires(null)) {
collectDependencies(wire.getProviderWiring().getBundle(), dependencyClosure);
}
}
}

@SuppressWarnings("deprecation")
public void addMinimalBundleSet() {
// Just use any class from the bundles we want to add as minimal bundle set
Expand All @@ -84,6 +99,12 @@ public void addMinimalBundleSet() {
addBundle(org.eclipse.core.runtime.content.IContentType.class); // org.eclipse.core.contenttype
addBundle(org.eclipse.equinox.app.IApplication.class); // org.eclipse.equinox.app

// org.apache.felix.scr + dependencies
Bundle scrBundle = FrameworkUtil.getBundle(org.apache.felix.scr.info.ScrInfo.class);
Collection<Bundle> scrAndDependencies = new HashSet<>();
collectDependencies(scrBundle, scrAndDependencies);
scrAndDependencies.forEach(i -> addBundle(i, null));

addBundle(org.eclipse.core.tests.harness.TestHarnessPlugin.class); // org.eclipse.core.tests.harness
addBundle(org.eclipse.test.performance.Performance.class); // org.eclipse.test.performance

Expand Down
Loading