Skip to content

Commit 517f9a0

Browse files
FELIX-6700 Missing o.o.service.servlet.* export-package in felix jetty (#314)
1 parent f9f34ee commit 517f9a0

File tree

6 files changed

+225
-6
lines changed

6 files changed

+225
-6
lines changed

http/jetty/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,17 @@
281281
org.osgi.service.http.runtime,
282282
org.osgi.service.http.runtime.dto,
283283
org.osgi.service.http.whiteboard,
284-
!org.osgi.service.servlet.*,
284+
org.osgi.service.servlet.context,
285+
org.osgi.service.servlet.runtime,
286+
org.osgi.service.servlet.runtime.dto,
287+
org.osgi.service.servlet.whiteboard,
285288
org.apache.felix.http.jetty,
286289
org.apache.felix.http.javaxwrappers,
287290
org.apache.felix.http.jakartawrappers
288291
</Export-Package>
289292
<Private-Package>
290293
org.apache.felix.http.base.*,
291294
org.apache.felix.http.jetty.*,
292-
org.osgi.service.servlet.*
293295
</Private-Package>
294296
<Import-Package>
295297
org.osgi.service.cm;resolution:=optional;version="[1.3,2)",

http/jetty/src/test/java/org/apache/felix/http/jetty/it/AbstractJettyTestSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public static OptionalCompositeOption localMavenRepo() {
153153
* @param systemProperty the System property which contains the pathname of the test bundle
154154
* @return the provisioning option
155155
*/
156-
public static UrlProvisionOption testBundle(final String systemProperty) {
156+
protected UrlProvisionOption testBundle(final String systemProperty) {
157157
final String pathname = System.getProperty(systemProperty);
158158
final File file = new File(pathname);
159159
return bundle(file.toURI().toString());
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.felix.http.jetty.it;
18+
19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertNotNull;
21+
import static org.junit.Assert.assertTrue;
22+
import static org.ops4j.pax.exam.CoreOptions.bundle;
23+
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
24+
25+
import java.io.File;
26+
import java.io.IOException;
27+
import java.util.Optional;
28+
import java.util.stream.Stream;
29+
30+
import javax.inject.Inject;
31+
32+
import org.junit.Test;
33+
import org.junit.runner.RunWith;
34+
import org.ops4j.pax.exam.Option;
35+
import org.ops4j.pax.exam.junit.PaxExam;
36+
import org.ops4j.pax.exam.options.UrlProvisionOption;
37+
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
38+
import org.ops4j.pax.exam.spi.reactors.PerClass;
39+
import org.osgi.framework.Bundle;
40+
import org.osgi.framework.BundleContext;
41+
42+
/**
43+
*
44+
*/
45+
@RunWith(PaxExam.class)
46+
@ExamReactorStrategy(PerClass.class)
47+
public class LightClassifierIT extends AbstractJettyTestSupport {
48+
49+
@Inject
50+
protected BundleContext bundleContext;
51+
52+
@Override
53+
protected Option[] additionalOptions() throws IOException {
54+
String jettyVersion = System.getProperty("jetty.version", "11.0.20");
55+
return new Option[] {
56+
spifly(),
57+
58+
// Minimum additional jetty dependency bundles
59+
mavenBundle().groupId("org.slf4j").artifactId("slf4j-api").version("2.0.13"),
60+
mavenBundle().groupId("org.slf4j").artifactId("slf4j-simple").version("2.0.13"),
61+
mavenBundle().groupId("commons-io").artifactId("commons-io").version("2.16.1"),
62+
mavenBundle().groupId("commons-fileupload").artifactId("commons-fileupload").version("1.5"),
63+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-java-server").version(jettyVersion),
64+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-server").version(jettyVersion),
65+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-http").version(jettyVersion),
66+
mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("http2-common").version(jettyVersion),
67+
mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("http2-hpack").version(jettyVersion),
68+
mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("http2-server").version(jettyVersion),
69+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-io").version(jettyVersion),
70+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-jmx").version(jettyVersion),
71+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-security").version(jettyVersion),
72+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-server").version(jettyVersion),
73+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-servlet").version(jettyVersion),
74+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-util").version(jettyVersion),
75+
76+
// additional dependencies to verify FELIX-6700
77+
mavenBundle().groupId("org.owasp.encoder").artifactId("encoder").version("1.2.3"),
78+
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.inventory").version("2.0.0"),
79+
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.webconsole").version("5.0.2")
80+
};
81+
}
82+
83+
/**
84+
* Override to use the "light" classifier variant of the test bundle
85+
*/
86+
@Override
87+
protected UrlProvisionOption testBundle(String systemProperty) {
88+
String pathname = System.getProperty(systemProperty);
89+
pathname = pathname.replace(".jar", "-light.jar");
90+
final File file = new File(pathname);
91+
return bundle(file.toURI().toString());
92+
}
93+
94+
/**
95+
* Verify FELIX-6700 by checking that the webconsole bundle was resolved and active
96+
*/
97+
@Test
98+
public void testWebConsoleBundleIsActive() throws Exception {
99+
assertNotNull(bundleContext);
100+
Optional<Bundle> first = Stream.of(bundleContext.getBundles())
101+
.filter(b -> "org.apache.felix.webconsole".equals(b.getSymbolicName()))
102+
.findFirst();
103+
assertTrue(first.isPresent());
104+
assertEquals(Bundle.ACTIVE, first.get().getState());
105+
}
106+
107+
}

http/jetty12/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,17 @@
283283
org.osgi.service.http.runtime,
284284
org.osgi.service.http.runtime.dto,
285285
org.osgi.service.http.whiteboard,
286-
!org.osgi.service.servlet.*,
286+
org.osgi.service.servlet.context,
287+
org.osgi.service.servlet.runtime,
288+
org.osgi.service.servlet.runtime.dto,
289+
org.osgi.service.servlet.whiteboard,
287290
org.apache.felix.http.jetty,
288291
org.apache.felix.http.javaxwrappers,
289292
org.apache.felix.http.jakartawrappers
290293
</Export-Package>
291294
<Private-Package>
292295
org.apache.felix.http.base.*,
293296
org.apache.felix.http.jetty.*,
294-
org.osgi.service.servlet.*
295297
</Private-Package>
296298
<Import-Package>
297299
org.osgi.service.cm;resolution:=optional;version="[1.3,2)",

http/jetty12/src/test/java/org/apache/felix/http/jetty/it/AbstractJettyTestSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public static OptionalCompositeOption localMavenRepo() {
153153
* @param systemProperty the System property which contains the pathname of the test bundle
154154
* @return the provisioning option
155155
*/
156-
public static UrlProvisionOption testBundle(final String systemProperty) {
156+
protected UrlProvisionOption testBundle(final String systemProperty) {
157157
final String pathname = System.getProperty(systemProperty);
158158
final File file = new File(pathname);
159159
return bundle(file.toURI().toString());
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.felix.http.jetty.it;
18+
19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertNotNull;
21+
import static org.junit.Assert.assertTrue;
22+
import static org.ops4j.pax.exam.CoreOptions.bundle;
23+
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
24+
25+
import java.io.File;
26+
import java.io.IOException;
27+
import java.util.Optional;
28+
import java.util.stream.Stream;
29+
30+
import javax.inject.Inject;
31+
32+
import org.junit.Test;
33+
import org.junit.runner.RunWith;
34+
import org.ops4j.pax.exam.Option;
35+
import org.ops4j.pax.exam.junit.PaxExam;
36+
import org.ops4j.pax.exam.options.UrlProvisionOption;
37+
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
38+
import org.ops4j.pax.exam.spi.reactors.PerClass;
39+
import org.osgi.framework.Bundle;
40+
import org.osgi.framework.BundleContext;
41+
42+
/**
43+
*
44+
*/
45+
@RunWith(PaxExam.class)
46+
@ExamReactorStrategy(PerClass.class)
47+
public class LightClassifierIT extends AbstractJettyTestSupport {
48+
49+
@Inject
50+
protected BundleContext bundleContext;
51+
52+
@Override
53+
protected Option[] additionalOptions() throws IOException {
54+
String jettyVersion = System.getProperty("jetty.version", "12.0.8");
55+
return new Option[] {
56+
spifly(),
57+
58+
// Minimum additional jetty dependency bundles
59+
mavenBundle().groupId("org.slf4j").artifactId("slf4j-api").version("2.0.13"),
60+
mavenBundle().groupId("org.slf4j").artifactId("slf4j-simple").version("2.0.13"),
61+
mavenBundle().groupId("commons-io").artifactId("commons-io").version("2.16.1"),
62+
mavenBundle().groupId("commons-fileupload").artifactId("commons-fileupload").version("1.5"),
63+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-java-server").version(jettyVersion),
64+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-server").version(jettyVersion),
65+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-http").version(jettyVersion),
66+
mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("jetty-http2-common").version(jettyVersion),
67+
mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("jetty-http2-hpack").version(jettyVersion),
68+
mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("jetty-http2-server").version(jettyVersion),
69+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-io").version(jettyVersion),
70+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-jmx").version(jettyVersion),
71+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-security").version(jettyVersion),
72+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-server").version(jettyVersion),
73+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-session").version(jettyVersion),
74+
mavenBundle().groupId("org.eclipse.jetty.ee10").artifactId("jetty-ee10-servlet").version(jettyVersion),
75+
mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-util").version(jettyVersion),
76+
77+
// additional dependencies to verify FELIX-6700
78+
mavenBundle().groupId("org.owasp.encoder").artifactId("encoder").version("1.2.3"),
79+
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.inventory").version("2.0.0"),
80+
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.webconsole").version("5.0.2")
81+
};
82+
}
83+
84+
/**
85+
* Override to use the "light" classifier variant of the test bundle
86+
*/
87+
@Override
88+
protected UrlProvisionOption testBundle(String systemProperty) {
89+
String pathname = System.getProperty(systemProperty);
90+
pathname = pathname.replace(".jar", "-light.jar");
91+
final File file = new File(pathname);
92+
return bundle(file.toURI().toString());
93+
}
94+
95+
/**
96+
* Verify FELIX-6700 by checking that the webconsole bundle was resolved and active
97+
*/
98+
@Test
99+
public void testWebConsoleBundleIsActive() throws Exception {
100+
assertNotNull(bundleContext);
101+
Optional<Bundle> first = Stream.of(bundleContext.getBundles())
102+
.filter(b -> "org.apache.felix.webconsole".equals(b.getSymbolicName()))
103+
.findFirst();
104+
assertTrue(first.isPresent());
105+
assertEquals(Bundle.ACTIVE, first.get().getState());
106+
}
107+
108+
}

0 commit comments

Comments
 (0)