From c73ecae431f282c44b0865e4c83c7cda4b165596 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Tue, 6 Mar 2018 11:04:50 +1100 Subject: [PATCH] Jetty 9.4.x 2059 make osgi tests work jre9 (#2264) * Issue #2059 WIP: make osgi tests work with jdk9 Signed-off-by: Jan Bartel --- jetty-osgi/test-jetty-osgi/pom.xml | 32 +++- .../src/test/config/etc/jetty-http2-jdk9.xml | 26 +++ .../osgi/test/TestJettyOSGiBootHTTP2JDK9.java | 162 ++++++++++++++++++ pom.xml | 2 +- 4 files changed, 214 insertions(+), 8 deletions(-) create mode 100644 jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-http2-jdk9.xml create mode 100644 jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2JDK9.java diff --git a/jetty-osgi/test-jetty-osgi/pom.xml b/jetty-osgi/test-jetty-osgi/pom.xml index 24325dcbbe0..88310a81aad 100644 --- a/jetty-osgi/test-jetty-osgi/pom.xml +++ b/jetty-osgi/test-jetty-osgi/pom.xml @@ -481,7 +481,7 @@ jdk8 - [1.8,1.9) + [1.8,9) @@ -511,7 +511,7 @@ org.conscrypt conscrypt-openjdk-uber - 1.0.0.RC11 + ${conscrypt.version} test @@ -522,7 +522,7 @@ false - **/*JDK9* + **/TestJettyOSGiBootHTTP2JDK9* @@ -535,9 +535,27 @@ jdk9 - [1.9,) + [9,) + + org.eclipse.jetty + jetty-alpn-conscrypt-server + ${project.version} + test + + + org.eclipse.jetty + jetty-alpn-conscrypt-client + ${project.version} + test + + + org.conscrypt + conscrypt-openjdk-uber + 1.0.0.RC11 + test + org.eclipse.jetty jetty-alpn-java-server @@ -557,9 +575,9 @@ maven-surefire-plugin false - - **/*JDK9 - + + **/TestJettyOSGiBootHTTP2 + diff --git a/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-http2-jdk9.xml b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-http2-jdk9.xml new file mode 100644 index 00000000000..2de7f348d0a --- /dev/null +++ b/jetty-osgi/test-jetty-osgi/src/test/config/etc/jetty-http2-jdk9.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + true + + + diff --git a/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2JDK9.java b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2JDK9.java new file mode 100644 index 00000000000..ae8d0308535 --- /dev/null +++ b/jetty-osgi/test-jetty-osgi/src/test/java/org/eclipse/jetty/osgi/test/TestJettyOSGiBootHTTP2JDK9.java @@ -0,0 +1,162 @@ +// +// ======================================================================== +// Copyright (c) 1995-2018 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.osgi.test; + +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; +import static org.ops4j.pax.exam.CoreOptions.systemProperty; + +import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Executor; + +import javax.inject.Inject; + +import org.eclipse.jetty.client.HttpClient; +import org.eclipse.jetty.client.api.ContentResponse; +import org.eclipse.jetty.http2.client.HTTP2Client; +import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2; +import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.eclipse.jetty.util.thread.QueuedThreadPool; +import org.junit.Ignore; +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.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerClass; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +/** + * Test HTTP2 using java9 alpn. + */ +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerClass.class) +public class TestJettyOSGiBootHTTP2JDK9 +{ + private static final String LOG_LEVEL = "WARN"; + + + @Inject + private BundleContext bundleContext; + + @Configuration + public Option[] config() + { + ArrayList