Skip to content

Commit 00bf88d

Browse files
committed
Test Harness: Session Tests: List felix.scr dependencies explicitly
* We don't need the optional ones * We should not install org.eclipse.osgi again, as this is already set as the 'osgi.framework' in the config.ini It's easier to just list the few dependencies we really want explicitly.
1 parent 3f36b28 commit 00bf88d

File tree

3 files changed

+17
-41
lines changed

3 files changed

+17
-41
lines changed

runtime/tests/org.eclipse.core.tests.harness/META-INF/MANIFEST.MF

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Export-Package: org.eclipse.core.tests.harness;version="2.0",
88
org.eclipse.core.tests.harness.session,
99
org.eclipse.core.tests.session;version="2.0"
1010
Require-Bundle: org.junit,
11-
org.apache.felix.scr,
1211
org.eclipse.test.performance,
1312
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
1413
org.eclipse.jdt.junit.runtime,
@@ -24,6 +23,11 @@ Require-Bundle: org.junit,
2423
Bundle-ActivationPolicy: lazy
2524
Bundle-RequiredExecutionEnvironment: JavaSE-17
2625
Import-Package: javax.xml.parsers,
26+
org.apache.felix.scr.info,
27+
org.osgi.service.event,
28+
org.osgi.service.component,
29+
org.osgi.util.promise,
30+
org.osgi.util.function,
2731
net.bytebuddy,
2832
org.apiguardian.api,
2933
org.assertj.core.api,

runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/customization/CustomSessionConfigurationImpl.java

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.nio.file.Files;
2121
import java.nio.file.Path;
2222
import java.util.Collection;
23-
import java.util.HashSet;
2423
import java.util.LinkedHashSet;
2524
import java.util.Objects;
2625
import java.util.Optional;
@@ -37,8 +36,6 @@
3736
import org.osgi.framework.Constants;
3837
import org.osgi.framework.FrameworkUtil;
3938
import org.osgi.framework.Version;
40-
import org.osgi.framework.wiring.BundleWire;
41-
import org.osgi.framework.wiring.BundleWiring;
4239

4340
@SuppressWarnings("restriction")
4441
public class CustomSessionConfigurationImpl implements CustomSessionConfiguration {
@@ -61,18 +58,6 @@ public CustomSessionConfigurationImpl() {
6158
addMinimalBundleSet();
6259
}
6360

64-
private static void collectDependencies(Bundle bundle, Collection<Bundle> dependencyClosure) {
65-
if (!dependencyClosure.add(bundle)) {
66-
return;
67-
}
68-
BundleWiring wiring = bundle.adapt(BundleWiring.class);
69-
if (wiring != null) {
70-
for (BundleWire wire : wiring.getRequiredWires(null)) {
71-
collectDependencies(wire.getProviderWiring().getBundle(), dependencyClosure);
72-
}
73-
}
74-
}
75-
7661
@SuppressWarnings("deprecation")
7762
private void addMinimalBundleSet() {
7863
// Just use any class from the bundles we want to add as minimal bundle set
@@ -86,11 +71,12 @@ private void addMinimalBundleSet() {
8671
addBundle(org.eclipse.core.runtime.content.IContentType.class); // org.eclipse.core.contenttype
8772
addBundle(org.eclipse.equinox.app.IApplication.class); // org.eclipse.equinox.app
8873

89-
// org.apache.felix.scr + dependencies
90-
Bundle scrBundle = FrameworkUtil.getBundle(org.apache.felix.scr.info.ScrInfo.class);
91-
Collection<Bundle> scrAndDependencies = new HashSet<>();
92-
collectDependencies(scrBundle, scrAndDependencies);
93-
scrAndDependencies.forEach(this::addBundle);
74+
// org.apache.felix.scr + (non-optional) dependencies
75+
addBundle(org.apache.felix.scr.info.ScrInfo.class); // org.apache.felix.scr
76+
addBundle(org.osgi.service.event.EventAdmin.class); // org.osgi.service.event
77+
addBundle(org.osgi.service.component.ComponentConstants.class); // org.osgi.service.component
78+
addBundle(org.osgi.util.promise.Promise.class); // org.osgi.util.promise
79+
addBundle(org.osgi.util.function.Function.class); // org.osgi.util.function
9480

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

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

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.Arrays;
2727
import java.util.Collection;
2828
import java.util.HashMap;
29-
import java.util.HashSet;
3029
import java.util.List;
3130
import java.util.Map;
3231
import java.util.Optional;
@@ -46,8 +45,6 @@
4645
import org.osgi.framework.Constants;
4746
import org.osgi.framework.FrameworkUtil;
4847
import org.osgi.framework.Version;
49-
import org.osgi.framework.wiring.BundleWire;
50-
import org.osgi.framework.wiring.BundleWiring;
5148

5249
@SuppressWarnings("restriction")
5350
public class ConfigurationSessionTestSuite extends SessionTestSuite {
@@ -74,18 +71,6 @@ public ConfigurationSessionTestSuite(String pluginId, String name) {
7471
super(pluginId, name);
7572
}
7673

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-
8974
@SuppressWarnings("deprecation")
9075
public void addMinimalBundleSet() {
9176
// Just use any class from the bundles we want to add as minimal bundle set
@@ -99,11 +84,12 @@ public void addMinimalBundleSet() {
9984
addBundle(org.eclipse.core.runtime.content.IContentType.class); // org.eclipse.core.contenttype
10085
addBundle(org.eclipse.equinox.app.IApplication.class); // org.eclipse.equinox.app
10186

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));
87+
// org.apache.felix.scr + (non-optional) dependencies
88+
addBundle(org.apache.felix.scr.info.ScrInfo.class); // org.apache.felix.scr
89+
addBundle(org.osgi.service.event.EventAdmin.class); // org.osgi.service.event
90+
addBundle(org.osgi.service.component.ComponentConstants.class); // org.osgi.service.component
91+
addBundle(org.osgi.util.promise.Promise.class); // org.osgi.util.promise
92+
addBundle(org.osgi.util.function.Function.class); // org.osgi.util.function
10793

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

0 commit comments

Comments
 (0)