Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x
This commit is contained in:
commit
1e9c736692
|
@ -122,6 +122,39 @@
|
|||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>run-h2spec-in-docker</id>
|
||||
<activation>
|
||||
<file>
|
||||
<exists>/var/run/docker.sock</exists>
|
||||
</file>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>h2spec-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>org.eclipse.jetty.http2.server.H2SpecServer</mainClass>
|
||||
<skip>${skipTests}</skip>
|
||||
<junitPackage>org.eclipse.jetty.h2spec</junitPackage>
|
||||
<excludeSpecs>
|
||||
<excludeSpec>3.5 - Sends invalid connection preface</excludeSpec>
|
||||
</excludeSpecs>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>h2spec</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>h2spec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -38,8 +38,8 @@ import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
|||
import org.eclipse.jetty.server.handler.ErrorHandler;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.ajax.JSON;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
@ -57,12 +57,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
public class ErrorHandlerTest
|
||||
{
|
||||
static StacklessLogging stacklessLogging;
|
||||
static Server server;
|
||||
static LocalConnector connector;
|
||||
StacklessLogging stacklessLogging;
|
||||
Server server;
|
||||
LocalConnector connector;
|
||||
|
||||
@BeforeAll
|
||||
public static void before() throws Exception
|
||||
@BeforeEach
|
||||
public void before() throws Exception
|
||||
{
|
||||
stacklessLogging = new StacklessLogging(HttpChannel.class);
|
||||
server = new Server();
|
||||
|
@ -133,8 +133,8 @@ public class ErrorHandlerTest
|
|||
server.start();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void after() throws Exception
|
||||
@AfterEach
|
||||
public void after() throws Exception
|
||||
{
|
||||
server.stop();
|
||||
stacklessLogging.close();
|
||||
|
@ -182,11 +182,21 @@ public class ErrorHandlerTest
|
|||
"\r\n");
|
||||
HttpTester.Response response = HttpTester.parseResponse(rawResponse);
|
||||
|
||||
dump(response);
|
||||
|
||||
assertThat("Response status code", response.getStatus(), is(404));
|
||||
assertThat("Response Content-Length", response.getField(HttpHeader.CONTENT_LENGTH).getIntValue(), is(0));
|
||||
assertThat("Response Content-Type", response.getField(HttpHeader.CONTENT_TYPE), is(nullValue()));
|
||||
}
|
||||
|
||||
private void dump(HttpTester.Response response)
|
||||
{
|
||||
System.out.println("-------------");
|
||||
System.out.println(response);
|
||||
System.out.println(response.getContent());
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test404AllAccept() throws Exception
|
||||
{
|
||||
|
@ -290,6 +300,8 @@ public class ErrorHandlerTest
|
|||
|
||||
HttpTester.Response response = HttpTester.parseResponse(rawResponse);
|
||||
|
||||
// System.out.println("response: " + response);
|
||||
|
||||
assertThat("Response status code", response.getStatus(), is(404));
|
||||
assertThat("Response Content-Length", response.getField(HttpHeader.CONTENT_LENGTH).getIntValue(), greaterThan(0));
|
||||
assertThat("Response Content-Type", response.get(HttpHeader.CONTENT_TYPE), containsString("text/html;charset=ISO-8859-1"));
|
||||
|
@ -453,6 +465,8 @@ public class ErrorHandlerTest
|
|||
|
||||
HttpTester.Response response = HttpTester.parseResponse(rawResponse);
|
||||
|
||||
System.out.println("response: " + response);
|
||||
|
||||
assertThat("Response status code", response.getStatus(), is(500));
|
||||
assertThat("Response Content-Length", response.getField(HttpHeader.CONTENT_LENGTH).getIntValue(), greaterThan(0));
|
||||
assertThat("Response Content-Type", response.get(HttpHeader.CONTENT_TYPE), containsString("text/html;charset=UTF-8"));
|
||||
|
|
|
@ -66,6 +66,8 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
|
|||
import org.hamcrest.Matchers;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledOnOs;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
@ -213,6 +215,7 @@ public class SniSslConnectionFactoryTest
|
|||
}
|
||||
|
||||
@Test
|
||||
@DisabledOnOs(OS.WINDOWS)
|
||||
public void testWrongSNIRejectedConnection() throws Exception
|
||||
{
|
||||
start(ssl ->
|
||||
|
@ -252,6 +255,7 @@ public class SniSslConnectionFactoryTest
|
|||
}
|
||||
|
||||
@Test
|
||||
@DisabledOnOs(OS.WINDOWS)
|
||||
public void testWrongSNIRejectedFunction() throws Exception
|
||||
{
|
||||
start((ssl, customizer) ->
|
||||
|
@ -278,6 +282,7 @@ public class SniSslConnectionFactoryTest
|
|||
}
|
||||
|
||||
@Test
|
||||
@DisabledOnOs(OS.WINDOWS)
|
||||
public void testWrongSNIRejectedConnectionWithNonSNIKeystore() throws Exception
|
||||
{
|
||||
start(ssl ->
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# Jetty Logging using jetty-slf4j-impl
|
||||
#org.eclipse.jetty.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.server.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.servlet.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.server.ConnectionLimit.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.server.AcceptRateLimit.LEVEL=DEBUG
|
||||
|
|
|
@ -189,7 +189,7 @@ public class FileSystemResourceTest
|
|||
final URI alias = ritem.getAlias();
|
||||
if (alias == null)
|
||||
{
|
||||
return false;
|
||||
return resource.getAlias() == null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package org.eclipse.jetty.util.ssl;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
@ -233,7 +234,7 @@ public class SslContextFactoryTest
|
|||
cf.setTrustStorePath("/foo");
|
||||
cf.start();
|
||||
});
|
||||
assertThat(x.getMessage(), equalTo("/foo is not a valid keystore"));
|
||||
assertThat(x.getMessage(), containsString(File.separator + "foo is not a valid keystore"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -387,13 +387,13 @@ public class WebAppContextTest
|
|||
extLibs = extLibs.toAbsolutePath();
|
||||
|
||||
// Absolute reference with trailing slash and glob
|
||||
references.add(Arguments.of(extLibs.toString() + File.separator + "*"));
|
||||
references.add(Arguments.of("absolute extLibs with glob", extLibs.toString() + File.separator + "*"));
|
||||
|
||||
// Establish a relative extraClassPath reference
|
||||
String relativeExtLibsDir = MavenTestingUtils.getBasePath().relativize(extLibs).toString();
|
||||
|
||||
// This will be in the String form similar to "src/test/resources/ext/*" (with trailing slash and glob)
|
||||
references.add(Arguments.of(relativeExtLibsDir + File.separator + "*"));
|
||||
references.add(Arguments.of("relative extLibs with glob", relativeExtLibsDir + File.separator + "*"));
|
||||
|
||||
return references.stream();
|
||||
}
|
||||
|
@ -401,9 +401,9 @@ public class WebAppContextTest
|
|||
/**
|
||||
* Test using WebAppContext.setExtraClassPath(String) with a reference to a glob
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@ParameterizedTest(name = "{0}")
|
||||
@MethodSource("extraClasspathGlob")
|
||||
public void testExtraClasspathGlob(String extraClasspathGlobReference) throws Exception
|
||||
public void testExtraClasspathGlob(String description, String extraClasspathGlobReference) throws Exception
|
||||
{
|
||||
Server server = newServer();
|
||||
|
||||
|
@ -434,7 +434,7 @@ public class WebAppContextTest
|
|||
{
|
||||
actualPaths.add(Paths.get(url.toURI()));
|
||||
}
|
||||
assertThat("WebAppClassLoader.urls.length", actualPaths.size(), is(expectedPaths.size()));
|
||||
assertThat("[" + description + "] WebAppClassLoader.urls.length", actualPaths.size(), is(expectedPaths.size()));
|
||||
for (Path expectedPath : expectedPaths)
|
||||
{
|
||||
boolean found = false;
|
||||
|
@ -445,7 +445,7 @@ public class WebAppContextTest
|
|||
found = true;
|
||||
}
|
||||
}
|
||||
assertTrue(found, "Not able to find expected jar in WebAppClassLoader: " + expectedPath);
|
||||
assertTrue(found, "[" + description + "] Not able to find expected jar in WebAppClassLoader: " + expectedPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,9 @@ import org.eclipse.jetty.websocket.api.WebSocketListener;
|
|||
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.DisabledOnJre;
|
||||
import org.junit.jupiter.api.condition.DisabledOnOs;
|
||||
import org.junit.jupiter.api.condition.JRE;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
|
@ -276,6 +278,7 @@ public class DistributionTests extends AbstractJettyHomeTest
|
|||
}
|
||||
|
||||
@Test
|
||||
@DisabledOnOs(OS.WINDOWS) // jnr not supported on windows
|
||||
public void testUnixSocket() throws Exception
|
||||
{
|
||||
Path tmpSockFile;
|
||||
|
|
Loading…
Reference in New Issue