Skip to content

Commit

Permalink
Merge branch 'jetty-10.0.x' of github.com:eclipse/jetty.project into …
Browse files Browse the repository at this point in the history
…jetty-10.0.x
  • Loading branch information
janbartel committed Sep 22, 2020
2 parents 53eaa37 + b3f4795 commit 1294382
Show file tree
Hide file tree
Showing 12 changed files with 409 additions and 590 deletions.
6 changes: 6 additions & 0 deletions jetty-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@
<artifactId>jetty-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>jetty-http-tools</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.io.InputStream;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.net.URI;
import java.net.URL;
import java.nio.file.Path;
Expand All @@ -45,6 +44,7 @@
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
Expand Down Expand Up @@ -79,7 +79,7 @@ public void assertCanLoadClass(String clazz) throws ClassNotFoundException
assertThat("Can Load Class [" + clazz + "]", _loader.loadClass(clazz), notNullValue());
}

public void assertCanLoadResource(String res) throws ClassNotFoundException
public void assertCanLoadResource(String res)
{
assertThat("Can Load Resource [" + res + "]", _loader.getResource(res), notNullValue());
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public void testParentLoad() throws Exception
assertCantLoadClass("org.eclipse.jetty.webapp.Configuration");

Class<?> clazzA = _loader.loadClass("org.acme.webapp.ClassInJarA");
assertTrue(clazzA.getField("FROM_PARENT") != null);
assertNotNull(clazzA.getField("FROM_PARENT"));
}

@Test
Expand All @@ -131,21 +131,18 @@ public void testWebAppLoad() throws Exception

Class<?> clazzA = _loader.loadClass("org.acme.webapp.ClassInJarA");
assertThrows(NoSuchFieldException.class, () ->
{
clazzA.getField("FROM_PARENT");
});
clazzA.getField("FROM_PARENT"));
}

@Test
public void testClassFileTranslations() throws Exception
{
final List<Object> results = new ArrayList<Object>();
final List<Object> results = new ArrayList<>();

_loader.addTransformer(new ClassFileTransformer()
{
@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws IllegalClassFormatException
{
results.add(loader);
byte[] b = new byte[classfileBuffer.length];
Expand All @@ -160,7 +157,6 @@ public byte[] transform(ClassLoader loader, String className, Class<?> classBein
{
@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws IllegalClassFormatException
{
results.add(className);
byte[] b = new byte[classfileBuffer.length];
Expand Down Expand Up @@ -196,7 +192,6 @@ public void testNullClassFileTransformer() throws Exception
{
@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
throws IllegalClassFormatException
{
return null;
}
Expand Down Expand Up @@ -235,7 +230,6 @@ public void testExposedClass() throws Exception
assertCantLoadClass("org.eclipse.jetty.webapp.JarScanner");
}

@SuppressWarnings("deprecation")
@Test
public void testSystemServerClassDeprecated() throws Exception
{
Expand Down Expand Up @@ -377,7 +371,7 @@ public void testResources() throws Exception
}

@Test
public void ordering() throws Exception
public void testClashingResource() throws Exception
{
// The existence of a URLStreamHandler changes the behavior
assumeTrue(URLStreamHandlerUtil.getFactory() == null, "URLStreamHandler changes behavior, skip test");
Expand Down

This file was deleted.

Loading

0 comments on commit 1294382

Please sign in to comment.