From 900c71902c60204368ff283c6a00f60d1bac7569 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 10 Jun 2021 21:26:16 +1000 Subject: [PATCH] Issue #6327 Remove DisabledOnJre or test where appropriate (#6386) Signed-off-by: Jan Bartel --- .../client/util/SPNEGOAuthenticationTest.java | 5 -- .../jetty/server/HttpServerTestBase.java | 3 - .../ssl/SSLReadEOFAfterResponseTest.java | 3 - .../jetty/util/MultiReleaseJarFileTest.java | 2 - .../org/eclipse/jetty/util/TypeUtilTest.java | 22 -------- .../jetty/util/resource/JrtResourceTest.java | 55 ------------------- .../jetty/webapp/ClassMatcherTest.java | 41 -------------- .../tests/distribution/DistributionTests.java | 3 - 8 files changed, 134 deletions(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/util/SPNEGOAuthenticationTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/util/SPNEGOAuthenticationTest.java index 996c9236daca..618bc1b20b90 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/util/SPNEGOAuthenticationTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/util/SPNEGOAuthenticationTest.java @@ -49,7 +49,6 @@ import org.eclipse.jetty.util.security.Constraint; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.condition.DisabledOnJre; import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ArgumentsSource; @@ -60,10 +59,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; -// Apparently only JDK 11 is able to run these tests. -// See for example: https://bugs.openjdk.java.net/browse/JDK-8202439 -// where apparently the compiler gets the AES CPU instructions wrong. -@DisabledOnJre({JRE.JAVA_8, JRE.JAVA_9, JRE.JAVA_10}) public class SPNEGOAuthenticationTest extends AbstractHttpClientServerTest { private static final Logger LOG = LoggerFactory.getLogger(SPNEGOAuthenticationTest.class); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java index 118b818735a7..c3dfccacf87e 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java @@ -47,7 +47,6 @@ import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.DisabledIfSystemProperty; -import org.junit.jupiter.api.condition.DisabledOnJre; import org.junit.jupiter.api.condition.JRE; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1750,7 +1749,6 @@ public void testSuspendedPipeline() throws Exception } @Test - @DisabledOnJre({JRE.JAVA_8, JRE.JAVA_9, JRE.JAVA_10}) public void testShutdown() throws Exception { configureServer(new ReadExactHandler()); @@ -1791,7 +1789,6 @@ public void testShutdown() throws Exception } @Test - @DisabledOnJre({JRE.JAVA_8, JRE.JAVA_9, JRE.JAVA_10}) public void testChunkedShutdown() throws Exception { configureServer(new ReadExactHandler(4096)); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLReadEOFAfterResponseTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLReadEOFAfterResponseTest.java index 14de9220c805..28d6de30c8d0 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLReadEOFAfterResponseTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLReadEOFAfterResponseTest.java @@ -34,14 +34,11 @@ import org.eclipse.jetty.util.ssl.SslContextFactory; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnJre; import org.junit.jupiter.api.condition.JRE; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -// Only in JDK 11 is possible to use SSLSocket.shutdownOutput(). -@DisabledOnJre({JRE.JAVA_8, JRE.JAVA_9, JRE.JAVA_10}) public class SSLReadEOFAfterResponseTest { @Test diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiReleaseJarFileTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiReleaseJarFileTest.java index 2a52bc2251d9..8da1f62033a8 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiReleaseJarFileTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiReleaseJarFileTest.java @@ -22,7 +22,6 @@ import org.eclipse.jetty.util.MultiReleaseJarFile.VersionedJarEntry; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnJre; import org.junit.jupiter.api.condition.JRE; import static org.hamcrest.MatcherAssert.assertThat; @@ -117,7 +116,6 @@ public void test10() throws Exception } @Test - @DisabledOnJre(JRE.JAVA_8) public void testClassLoaderJava9() throws Exception { try (URLClassLoader loader = new URLClassLoader(new URL[]{example.toURI().toURL()})) diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java index 97fc5bc8de6b..1d6851747a7f 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java @@ -19,8 +19,6 @@ import org.eclipse.jetty.util.resource.Resource; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnJre; -import org.junit.jupiter.api.condition.EnabledOnJre; import org.junit.jupiter.api.condition.JRE; import static org.hamcrest.MatcherAssert.assertThat; @@ -176,7 +174,6 @@ public void getLocationOfClassClassDirectory() } @Test - @DisabledOnJre(JRE.JAVA_8) public void testGetLocationJvmCoreJPMS() { // Class from JVM core @@ -185,29 +182,10 @@ public void testGetLocationJvmCoreJPMS() } @Test - @DisabledOnJre(JRE.JAVA_8) public void testGetLocationJavaLangThreadDeathJPMS() { // Class from JVM core String expectedJavaBase = "/java.base"; assertThat(TypeUtil.getLocationOfClass(java.lang.ThreadDeath.class).toASCIIString(), containsString(expectedJavaBase)); } - - @Test - @EnabledOnJre(JRE.JAVA_8) - public void testGetLocationJvmCoreJava8RT() - { - // Class from JVM core - String expectedJavaBase = "/rt.jar"; - assertThat(TypeUtil.getLocationOfClass(String.class).toASCIIString(), containsString(expectedJavaBase)); - } - - @Test - @EnabledOnJre(JRE.JAVA_8) - public void testGetLocationJavaLangThreadDeathJava8RT() - { - // Class from JVM core - String expectedJavaBase = "/rt.jar"; - assertThat(TypeUtil.getLocationOfClass(java.lang.ThreadDeath.class).toASCIIString(), containsString(expectedJavaBase)); - } } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JrtResourceTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JrtResourceTest.java index beefe18eb3fc..600e75e319c7 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JrtResourceTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/JrtResourceTest.java @@ -18,9 +18,7 @@ import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.TypeUtil; import org.hamcrest.Matchers; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnJre; import org.junit.jupiter.api.condition.JRE; import static org.hamcrest.MatcherAssert.assertThat; @@ -31,58 +29,6 @@ public class JrtResourceTest { @Test - @DisabledOnJre(JRE.JAVA_8) - @Disabled("Not supported on Java 9+ Module API") - public void testResourceFromUriForString() - throws Exception - { - URI stringLoc = TypeUtil.getLocationOfClass(String.class); - Resource resource = Resource.newResource(stringLoc); - - assertThat(resource.exists(), is(true)); - assertThat(resource.isDirectory(), is(false)); - assertThat(IO.readBytes(resource.getInputStream()).length, Matchers.greaterThan(0)); - assertThat(IO.readBytes(resource.getInputStream()).length, is((int)resource.length())); - assertThat(resource.getWeakETag("-xxx"), startsWith("W/\"")); - assertThat(resource.getWeakETag("-xxx"), endsWith("-xxx\"")); - } - - @Test - @DisabledOnJre(JRE.JAVA_8) - @Disabled("Not supported on Java 9+ Module API") - public void testResourceFromStringForString() - throws Exception - { - URI stringLoc = TypeUtil.getLocationOfClass(String.class); - Resource resource = Resource.newResource(stringLoc.toASCIIString()); - - assertThat(resource.exists(), is(true)); - assertThat(resource.isDirectory(), is(false)); - assertThat(IO.readBytes(resource.getInputStream()).length, Matchers.greaterThan(0)); - assertThat(IO.readBytes(resource.getInputStream()).length, is((int)resource.length())); - assertThat(resource.getWeakETag("-xxx"), startsWith("W/\"")); - assertThat(resource.getWeakETag("-xxx"), endsWith("-xxx\"")); - } - - @Test - @DisabledOnJre(JRE.JAVA_8) - @Disabled("Not supported on Java 9+ Module API") - public void testResourceFromURLForString() - throws Exception - { - URI stringLoc = TypeUtil.getLocationOfClass(String.class); - Resource resource = Resource.newResource(stringLoc.toURL()); - - assertThat(resource.exists(), is(true)); - assertThat(resource.isDirectory(), is(false)); - assertThat(IO.readBytes(resource.getInputStream()).length, Matchers.greaterThan(0)); - assertThat(IO.readBytes(resource.getInputStream()).length, is((int)resource.length())); - assertThat(resource.getWeakETag("-xxx"), startsWith("W/\"")); - assertThat(resource.getWeakETag("-xxx"), endsWith("-xxx\"")); - } - - @Test - @DisabledOnJre(JRE.JAVA_8) public void testResourceModule() throws Exception { @@ -94,7 +40,6 @@ public void testResourceModule() } @Test - @DisabledOnJre(JRE.JAVA_8) public void testResourceAllModules() throws Exception { diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClassMatcherTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClassMatcherTest.java index 4ee2cdbcddd6..2b4afc9c6a43 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClassMatcherTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/ClassMatcherTest.java @@ -25,7 +25,6 @@ import org.hamcrest.Matchers; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnJre; import org.junit.jupiter.api.condition.EnabledOnJre; import org.junit.jupiter.api.condition.JRE; @@ -124,7 +123,6 @@ public void testMatchAll() @SuppressWarnings("restriction") @Test - @DisabledOnJre(JRE.JAVA_8) public void testIncludedLocations() throws Exception { // jar from JVM classloader @@ -160,7 +158,6 @@ public void testIncludedLocations() throws Exception @SuppressWarnings("restriction") @Test - @DisabledOnJre(JRE.JAVA_8) public void testIncludedLocationsOrModule() throws Exception { // jar from JVM classloader @@ -199,44 +196,6 @@ public void testIncludedLocationsOrModule() throws Exception @SuppressWarnings("restriction") @Test - @EnabledOnJre(JRE.JAVA_8) - public void testExcludeLocations() throws Exception - { - // jar from JVM classloader - URI locString = TypeUtil.getLocationOfClass(String.class); - // System.err.println(locString); - - // a jar from maven repo jar - URI locJunit = TypeUtil.getLocationOfClass(Test.class); - // System.err.println(locJunit); - - // class file - URI locTest = TypeUtil.getLocationOfClass(ClassMatcherTest.class); - // System.err.println(locTest); - - ClassMatcher pattern = new ClassMatcher(); - - // include everything - pattern.include("."); - - assertThat(pattern.match(String.class), Matchers.is(true)); - assertThat(pattern.match(Test.class), Matchers.is(true)); - assertThat(pattern.match(ClassMatcherTest.class), Matchers.is(true)); - - // Add directory for both JVM classes - pattern.exclude(locString.toString()); - - // Add jar for individual class and classes directory - pattern.exclude(locJunit.toString(), locTest.toString()); - - assertThat(pattern.match(String.class), Matchers.is(false)); - assertThat(pattern.match(Test.class), Matchers.is(false)); - assertThat(pattern.match(ClassMatcherTest.class), Matchers.is(false)); - } - - @SuppressWarnings("restriction") - @Test - @DisabledOnJre(JRE.JAVA_8) public void testExcludeLocationsOrModule() throws Exception { // jar from JVM classloader diff --git a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java index 97d940c3ea6e..7de00f6112c2 100644 --- a/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java +++ b/tests/test-distribution/src/test/java/org/eclipse/jetty/tests/distribution/DistributionTests.java @@ -186,7 +186,6 @@ public void testSimpleWebAppWithJSP() throws Exception } @Test - @DisabledOnJre(JRE.JAVA_8) public void testSimpleWebAppWithJSPOnModulePath() throws Exception { String jettyVersion = System.getProperty("jettyVersion"); @@ -226,14 +225,12 @@ public void testSimpleWebAppWithJSPOnModulePath() throws Exception } @Test - @DisabledOnJre(JRE.JAVA_8) public void testSimpleWebAppWithJSPOverH2C() throws Exception { testSimpleWebAppWithJSPOverHTTP2(false); } @Test - @DisabledOnJre(JRE.JAVA_8) public void testSimpleWebAppWithJSPOverH2() throws Exception { testSimpleWebAppWithJSPOverHTTP2(true);