-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Issue #11280 update ee10 osgi embedded xml files and add test
- Loading branch information
Showing
7 changed files
with
161 additions
and
81 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
jetty-ee10/jetty-ee10-osgi/jetty-ee10-osgi-boot/jettyhome/etc/jetty-deploy.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...etty-ee10-osgi/test-jetty-ee10-osgi/src/test/config/etc/jetty-http-connector-listener.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd"> | ||
|
||
<!-- ============================================================= --> | ||
<!-- Configure the Jetty Server instance with an ID "Server" --> | ||
<!-- by adding an HTTP connector. --> | ||
<!-- This configuration must be used in conjunction with jetty.xml --> | ||
<!-- ============================================================= --> | ||
<Configure id="Server" class="org.eclipse.jetty.server.Server"> | ||
|
||
<!-- =========================================================== --> | ||
<!-- Add a listener to the default HTTP Connector to set a --> | ||
<!-- system property with the port number. Mostly useful for --> | ||
<!-- testing. --> | ||
<!-- =========================================================== --> | ||
<Ref id="httpConnector"> | ||
<Call name="addEventListener"> | ||
<Arg> | ||
<New class="org.eclipse.jetty.osgi.util.ServerConnectorListener"> | ||
<Set name="sysPropertyName">boot.http.port</Set> | ||
</New> | ||
</Arg> | ||
</Call> | ||
</Ref> | ||
|
||
</Configure> |
48 changes: 0 additions & 48 deletions
48
jetty-ee10/jetty-ee10-osgi/test-jetty-ee10-osgi/src/test/config/etc/jetty-http.xml
This file was deleted.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
.../src/test/java/org/eclipse/jetty/ee10/osgi/test/TestJettyOSGiBootWithBundleJettyHome.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.ee10.osgi.test; | ||
|
||
import java.util.ArrayList; | ||
import javax.inject.Inject; | ||
|
||
import org.eclipse.jetty.client.ContentResponse; | ||
import org.eclipse.jetty.client.HttpClient; | ||
import org.eclipse.jetty.http.HttpStatus; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.ops4j.pax.exam.Configuration; | ||
import org.ops4j.pax.exam.CoreOptions; | ||
import org.ops4j.pax.exam.Option; | ||
import org.ops4j.pax.exam.junit.PaxExam; | ||
import org.osgi.framework.BundleContext; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.ops4j.pax.exam.CoreOptions.mavenBundle; | ||
|
||
/** | ||
* Pax-Exam to make sure the jetty-ee10-osgi-boot can be started along with the | ||
* httpservice web-bundle. Then make sure we can deploy an OSGi service on the | ||
* top of this. | ||
*/ | ||
@RunWith(PaxExam.class) | ||
public class TestJettyOSGiBootWithBundleJettyHome | ||
{ | ||
@Inject | ||
BundleContext bundleContext = null; | ||
|
||
@Configuration | ||
public static Option[] configure() | ||
{ | ||
ArrayList<Option> options = new ArrayList<>(); | ||
|
||
options.addAll(TestOSGiUtil.configurePaxExamLogging()); | ||
|
||
options.add(CoreOptions.junitBundles()); | ||
options.addAll(TestOSGiUtil.configureJettyHomeAndPortViaBootBundle("jetty-http-connector-listener.xml")); | ||
options.add(CoreOptions.bootDelegationPackages("org.xml.sax", "org.xml.*", "org.w3c.*", "javax.xml.*")); | ||
options.add(CoreOptions.systemPackages("com.sun.org.apache.xalan.internal.res", "com.sun.org.apache.xml.internal.utils", | ||
"com.sun.org.apache.xml.internal.utils", "com.sun.org.apache.xpath.internal", | ||
"com.sun.org.apache.xpath.internal.jaxp", "com.sun.org.apache.xpath.internal.objects")); | ||
TestOSGiUtil.coreJettyDependencies(options); | ||
TestOSGiUtil.coreJspDependencies(options); | ||
options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-java-client").versionAsInProject().start()); | ||
options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-client").versionAsInProject().start()); | ||
options.add(CoreOptions.cleanCaches(true)); | ||
|
||
options.add(mavenBundle().groupId("org.eclipse.jetty.ee10.demos").artifactId("jetty-ee10-demo-jsp-webapp").classifier("webbundle").versionAsInProject()); | ||
return options.toArray(new Option[0]); | ||
} | ||
|
||
@Test | ||
public void testJspDump() throws Exception | ||
{ | ||
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG)) | ||
TestOSGiUtil.diagnoseBundles(bundleContext); | ||
|
||
HttpClient client = new HttpClient(); | ||
try | ||
{ | ||
client.start(); | ||
|
||
String port = System.getProperty("boot.http.port"); | ||
assertNotNull(port); | ||
ContentResponse response = client.GET("http://127.0.0.1:" + port + "/ee10-demo-jsp/jstl.jsp"); | ||
assertEquals(HttpStatus.OK_200, response.getStatus()); | ||
String content = response.getContentAsString(); | ||
assertTrue(content.contains("JSTL Example")); | ||
} | ||
finally | ||
{ | ||
client.stop(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters