Skip to content

Commit

Permalink
Issue #6327 Remove DisabledOnJre or test where appropriate (#6386)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Bartel <janb@webtide.com>
  • Loading branch information
janbartel committed Jun 10, 2021
1 parent 103e1d9 commit 900c719
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 134 deletions.
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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));
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -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()}))
Expand Down
22 changes: 0 additions & 22 deletions jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java
Expand Up @@ -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;
Expand Down Expand Up @@ -176,7 +174,6 @@ public void getLocationOfClassClassDirectory()
}

@Test
@DisabledOnJre(JRE.JAVA_8)
public void testGetLocationJvmCoreJPMS()
{
// Class from JVM core
Expand All @@ -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));
}
}
Expand Up @@ -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;
Expand All @@ -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
{
Expand All @@ -94,7 +40,6 @@ public void testResourceModule()
}

@Test
@DisabledOnJre(JRE.JAVA_8)
public void testResourceAllModules()
throws Exception
{
Expand Down
Expand Up @@ -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;

Expand Down Expand Up @@ -124,7 +123,6 @@ public void testMatchAll()

@SuppressWarnings("restriction")
@Test
@DisabledOnJre(JRE.JAVA_8)
public void testIncludedLocations() throws Exception
{
// jar from JVM classloader
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Expand Up @@ -186,7 +186,6 @@ public void testSimpleWebAppWithJSP() throws Exception
}

@Test
@DisabledOnJre(JRE.JAVA_8)
public void testSimpleWebAppWithJSPOnModulePath() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 900c719

Please sign in to comment.