diff --git a/.gitignore b/.gitignore index 9f7d5b947e..27753e1d9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # maven noise target/ target-*/ +target11/ # gradle noise .gradle diff --git a/test-framework/providers/bundle/pom.xml b/test-framework/providers/bundle/pom.xml index 8227a40b4e..98f8c11192 100644 --- a/test-framework/providers/bundle/pom.xml +++ b/test-framework/providers/bundle/pom.xml @@ -63,20 +63,10 @@ jersey-test-framework-provider-netty ${project.version} + + org.glassfish.jersey.test-framework.providers + jersey-test-framework-provider-jetty + ${project.version} + - - - Jetty11 - - [11,) - - - - org.glassfish.jersey.test-framework.providers - jersey-test-framework-provider-jetty - ${project.version} - - - - diff --git a/tests/e2e-client/pom.xml b/tests/e2e-client/pom.xml index 3ba0b6a22c..3c9152d52a 100644 --- a/tests/e2e-client/pom.xml +++ b/tests/e2e-client/pom.xml @@ -127,6 +127,11 @@ jersey-jdk-connector test + + org.glassfish.jersey.connectors + jersey-jetty-connector + test + org.glassfish.jersey.security oauth1-signature @@ -217,45 +222,6 @@ - - JettyExclude - - 1.8 - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - org/glassfish/jersey/tests/e2e/client/connector/HttpPatchTest.java - org/glassfish/jersey/tests/e2e/client/connector/RequestHeaderModificationsTest.java - org/glassfish/jersey/tests/e2e/client/connector/ssl/SslConnectorConfigurationTest.java - org/glassfish/jersey/tests/e2e/client/connector/ssl/SslConnectorHostnameVerifierTest.java - org/glassfish/jersey/tests/e2e/client/connector/ssl/SslHttpUrlConnectorTest.java - org/glassfish/jersey/tests/e2e/client/ShutdownHookMemoryLeakTest.java - org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java - - - - - - - - Jetty11 - - [11,) - - - - org.glassfish.jersey.connectors - jersey-jetty-connector - ${project.version} - test - - - diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ShutdownHookMemoryLeakTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ShutdownHookMemoryLeakTest.java index e0e6372c56..5a0b830dcf 100644 --- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ShutdownHookMemoryLeakTest.java +++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ShutdownHookMemoryLeakTest.java @@ -39,6 +39,7 @@ import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; +import org.glassfish.jersey.tests.e2e.client.connector.ProviderFiltering; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -72,12 +73,12 @@ public ShutdownHookMemoryLeakTest(final ConnectorProvider cp) { @Parameterized.Parameters public static List connectionProviders() { - return Arrays.asList(new ConnectorProvider[][] { + return Arrays.asList(ProviderFiltering.filterProviders(new ConnectorProvider[][] { {new GrizzlyConnectorProvider()}, {new JettyConnectorProvider()}, {new ApacheConnectorProvider()}, {new HttpUrlConnectorProvider()} - }); + })); } @Path(PATH) diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/HttpPatchTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/HttpPatchTest.java index 95a2c535a8..9c04cc5932 100644 --- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/HttpPatchTest.java +++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/HttpPatchTest.java @@ -58,7 +58,7 @@ public class HttpPatchTest extends JerseyTest { @Parameterized.Parameters(name = "{index}: {0}") public static List testData() { - return Arrays.asList(new Object[][]{ + return Arrays.asList(ProviderFiltering.filterProviders(new Object[][]{ // {HttpUrlConnectorProvider.class}, // cannot process PATCH without additional configuration {GrizzlyConnectorProvider.class}, {JettyConnectorProvider.class}, // unstable. @@ -66,7 +66,7 @@ public static List testData() { {GrizzlyConnectorProvider.class}, {NettyConnectorProvider.class}, {JdkConnectorProvider.class}, - }); + })); } private final ConnectorProvider connectorProvider; diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ProviderFiltering.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ProviderFiltering.java new file mode 100644 index 0000000000..db9f21fcf2 --- /dev/null +++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ProviderFiltering.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + + +package org.glassfish.jersey.tests.e2e.client.connector; + +import org.glassfish.jersey.internal.util.JdkVersion; +import org.glassfish.jersey.jetty.connector.JettyConnectorProvider; + +import java.util.LinkedList; +import java.util.List; + +public class ProviderFiltering { + public static T[][] filterProviders(T[][] tofilter) { + final List filtered = new LinkedList<>(); + final JdkVersion version = JdkVersion.getJdkVersion(); + final boolean isJdk8 = version.getMajor() == 1; + for (Object[] provider : tofilter) { + if (!isJdk8 + || (provider[0] != JettyConnectorProvider.class && !JettyConnectorProvider.class.isInstance(provider[0]))) { + filtered.add(provider); + } + } + return filtered.toArray( + (T[][]) java.lang.reflect.Array.newInstance(tofilter.getClass().getComponentType(), + filtered.size()) + ); + } +} diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/RequestHeaderModificationsTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/RequestHeaderModificationsTest.java index 48c631473a..ebacf5292d 100644 --- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/RequestHeaderModificationsTest.java +++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/RequestHeaderModificationsTest.java @@ -98,7 +98,7 @@ public class RequestHeaderModificationsTest extends JerseyTest { @Parameterized.Parameters(name = "{index}: {0} / modificationSupported= {1} / addHeader= {2}") public static List testData() { - return Arrays.asList(new Object[][] { + return Arrays.asList(ProviderFiltering.filterProviders(new Object[][] { {HttpUrlConnectorProvider.class, true, false}, {GrizzlyConnectorProvider.class, false, false}, // change to true when JERSEY-2341 fixed {JettyConnectorProvider.class, false, false}, // change to true when JERSEY-2341 fixed @@ -107,7 +107,7 @@ public static List testData() { {GrizzlyConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed {JettyConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed {ApacheConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed - }); + })); } private final ConnectorProvider connectorProvider; diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java index e0315f4e56..8b224857a5 100644 --- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java +++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -29,6 +29,7 @@ import org.glassfish.jersey.grizzly.connector.GrizzlyConnectorProvider; import org.glassfish.jersey.jetty.connector.JettyConnectorProvider; +import org.glassfish.jersey.tests.e2e.client.connector.ProviderFiltering; import org.junit.After; import org.junit.Before; import org.junit.runner.RunWith; @@ -56,12 +57,12 @@ public abstract class AbstractConnectorServerTest { */ @Parameterized.Parameters(name = "{index}: {0}") public static Iterable testData() { - return Arrays.asList(new Object[][] { + return Arrays.asList(ProviderFiltering.filterProviders(new Object[][] { {new HttpUrlConnectorProvider()}, {new GrizzlyConnectorProvider()}, {new JettyConnectorProvider()}, {new ApacheConnectorProvider()} - }); + })); } @Parameterized.Parameter(0) diff --git a/tests/e2e-entity/pom.xml b/tests/e2e-entity/pom.xml index e33c36547d..bf41db4e42 100644 --- a/tests/e2e-entity/pom.xml +++ b/tests/e2e-entity/pom.xml @@ -223,20 +223,6 @@ - - Jetty11 - - [11,) - - - - org.glassfish.jersey.connectors - jersey-jetty-connector - ${project.version} - test - - - diff --git a/tests/e2e/pom.xml b/tests/e2e/pom.xml index 22758ecf02..80e534e955 100644 --- a/tests/e2e/pom.xml +++ b/tests/e2e/pom.xml @@ -139,6 +139,12 @@ jersey-jdk-connector test + + org.glassfish.jersey.connectors + jersey-jetty-connector + ${project.version} + test + org.glassfish.jersey.security oauth1-signature @@ -211,37 +217,13 @@ org/glassfish/jersey/tests/e2e/container/Jersey2462Test.java - org/glassfish/jersey/tests/e2e/container/EscapedUriTest.java - org/glassfish/jersey/tests/e2e/container/GzipContentEncodingTest.java - org/glassfish/jersey/tests/e2e/container/HeadTest.java org/glassfish/jersey/tests/e2e/container/JettyEmptyHeaderParamTest.java - org/glassfish/jersey/tests/e2e/container/LeadingSlashesTest.java - org/glassfish/jersey/tests/e2e/container/MatrixParamTest.java - org/glassfish/jersey/tests/e2e/container/QueryParamTest.java - org/glassfish/jersey/tests/e2e/container/ResponseWriterMetadataTest.java - org/glassfish/jersey/tests/e2e/container/ResponseWriterOutputStreamTest.java - org/glassfish/jersey/tests/e2e/container/TrailingSlashTest.java - org/glassfish/jersey/tests/e2e/container/JerseyContainerTest.java - - Jetty11 - - [11,) - - - - org.glassfish.jersey.connectors - jersey-jetty-connector - ${project.version} - test - - - sonar diff --git a/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/container/HeadTest.java b/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/container/HeadTest.java index 40bdf7df63..0e14b3df50 100644 --- a/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/container/HeadTest.java +++ b/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/container/HeadTest.java @@ -18,7 +18,6 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; -import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; @@ -50,11 +49,12 @@ @RunWith(Parameterized.class) public class HeadTest extends JerseyContainerTest { - private static final List FACTORIES = Arrays.asList( + private static final List FACTORIES = listContainerFactories( new GrizzlyTestContainerFactory(), new InMemoryTestContainerFactory(), new SimpleTestContainerFactory(), - new JettyTestContainerFactory()); + new JettyTestContainerFactory() + ); @Parameterized.Parameters(name = "{0}") public static Collection parameters() throws Exception { diff --git a/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/container/JerseyContainerTest.java b/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/container/JerseyContainerTest.java index fe2b087310..3c1bd96be4 100644 --- a/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/container/JerseyContainerTest.java +++ b/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/container/JerseyContainerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,11 +16,12 @@ package org.glassfish.jersey.tests.e2e.container; -import java.util.Arrays; import java.util.Collection; +import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; +import org.glassfish.jersey.internal.util.JdkVersion; import org.glassfish.jersey.test.JerseyTest; import org.glassfish.jersey.test.grizzly.GrizzlyTestContainerFactory; import org.glassfish.jersey.test.inmemory.InMemoryTestContainerFactory; @@ -39,7 +40,7 @@ @RunWith(Parameterized.class) public abstract class JerseyContainerTest extends JerseyTest { - private static final List FACTORIES = Arrays.asList( + private static final List FACTORIES = listContainerFactories( new GrizzlyTestContainerFactory(), new InMemoryTestContainerFactory(), new SimpleTestContainerFactory(), @@ -61,4 +62,16 @@ public static Collection parameters() throws Exception { protected TestContainerFactory getTestContainerFactory() throws TestContainerException { return factory; } + + protected static List listContainerFactories(TestContainerFactory...factories) { + final JdkVersion version = JdkVersion.getJdkVersion(); + boolean isJDK8 = version.getMajor() == 1; + final List filtered = new LinkedList<>(); + for (TestContainerFactory factory : factories) { + if (!isJDK8 || !JettyTestContainerFactory.class.isInstance(factory)) { + filtered.add(factory); + } + } + return filtered; + } }