Fixing windows build/test issues.
This commit is contained in:
parent
91f4516ec2
commit
97f795160c
|
@ -38,8 +38,8 @@ import org.eclipse.jetty.server.handler.ErrorHandler;
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.ajax.JSON;
|
import org.eclipse.jetty.util.ajax.JSON;
|
||||||
import org.eclipse.jetty.util.log.StacklessLogging;
|
import org.eclipse.jetty.util.log.StacklessLogging;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.ValueSource;
|
import org.junit.jupiter.params.provider.ValueSource;
|
||||||
|
@ -57,12 +57,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
public class ErrorHandlerTest
|
public class ErrorHandlerTest
|
||||||
{
|
{
|
||||||
static StacklessLogging stacklessLogging;
|
StacklessLogging stacklessLogging;
|
||||||
static Server server;
|
Server server;
|
||||||
static LocalConnector connector;
|
LocalConnector connector;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeEach
|
||||||
public static void before() throws Exception
|
public void before() throws Exception
|
||||||
{
|
{
|
||||||
stacklessLogging = new StacklessLogging(HttpChannel.class);
|
stacklessLogging = new StacklessLogging(HttpChannel.class);
|
||||||
server = new Server();
|
server = new Server();
|
||||||
|
@ -134,8 +134,8 @@ public class ErrorHandlerTest
|
||||||
server.start();
|
server.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterEach
|
||||||
public static void after() throws Exception
|
public void after() throws Exception
|
||||||
{
|
{
|
||||||
server.stop();
|
server.stop();
|
||||||
stacklessLogging.close();
|
stacklessLogging.close();
|
||||||
|
@ -183,11 +183,21 @@ public class ErrorHandlerTest
|
||||||
"\r\n");
|
"\r\n");
|
||||||
HttpTester.Response response = HttpTester.parseResponse(rawResponse);
|
HttpTester.Response response = HttpTester.parseResponse(rawResponse);
|
||||||
|
|
||||||
|
dump(response);
|
||||||
|
|
||||||
assertThat("Response status code", response.getStatus(), is(404));
|
assertThat("Response status code", response.getStatus(), is(404));
|
||||||
assertThat("Response Content-Length", response.getField(HttpHeader.CONTENT_LENGTH).getIntValue(), is(0));
|
assertThat("Response Content-Length", response.getField(HttpHeader.CONTENT_LENGTH).getIntValue(), is(0));
|
||||||
assertThat("Response Content-Type", response.getField(HttpHeader.CONTENT_TYPE), is(nullValue()));
|
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
|
@Test
|
||||||
public void test404AllAccept() throws Exception
|
public void test404AllAccept() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -291,6 +301,8 @@ public class ErrorHandlerTest
|
||||||
|
|
||||||
HttpTester.Response response = HttpTester.parseResponse(rawResponse);
|
HttpTester.Response response = HttpTester.parseResponse(rawResponse);
|
||||||
|
|
||||||
|
// System.out.println("response: " + response);
|
||||||
|
|
||||||
assertThat("Response status code", response.getStatus(), is(404));
|
assertThat("Response status code", response.getStatus(), is(404));
|
||||||
assertThat("Response Content-Length", response.getField(HttpHeader.CONTENT_LENGTH).getIntValue(), greaterThan(0));
|
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"));
|
assertThat("Response Content-Type", response.get(HttpHeader.CONTENT_TYPE), containsString("text/html;charset=ISO-8859-1"));
|
||||||
|
@ -454,6 +466,8 @@ public class ErrorHandlerTest
|
||||||
|
|
||||||
HttpTester.Response response = HttpTester.parseResponse(rawResponse);
|
HttpTester.Response response = HttpTester.parseResponse(rawResponse);
|
||||||
|
|
||||||
|
System.out.println("response: " + response);
|
||||||
|
|
||||||
assertThat("Response status code", response.getStatus(), is(500));
|
assertThat("Response status code", response.getStatus(), is(500));
|
||||||
assertThat("Response Content-Length", response.getField(HttpHeader.CONTENT_LENGTH).getIntValue(), greaterThan(0));
|
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"));
|
assertThat("Response Content-Type", response.get(HttpHeader.CONTENT_TYPE), containsString("text/html;charset=UTF-8"));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
||||||
#org.eclipse.jetty.LEVEL=DEBUG
|
#org.eclipse.jetty.LEVEL=DEBUG
|
||||||
#org.eclipse.jetty.server.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.ConnectionLimit.LEVEL=DEBUG
|
||||||
#org.eclipse.jetty.server.AcceptRateLimit.LEVEL=DEBUG
|
#org.eclipse.jetty.server.AcceptRateLimit.LEVEL=DEBUG
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class FileSystemResourceTest
|
||||||
final URI alias = ritem.getAlias();
|
final URI alias = ritem.getAlias();
|
||||||
if (alias == null)
|
if (alias == null)
|
||||||
{
|
{
|
||||||
return ritem == null;
|
return resource.getAlias() == null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.util.ssl;
|
package org.eclipse.jetty.util.ssl;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -260,7 +261,7 @@ public class SslContextFactoryTest
|
||||||
cf.setTrustStorePath("/foo");
|
cf.setTrustStorePath("/foo");
|
||||||
cf.start();
|
cf.start();
|
||||||
});
|
});
|
||||||
assertThat(x.getMessage(), equalTo("/foo is not a valid keystore"));
|
assertThat(x.getMessage(), containsString(File.separator + "foo is not a valid keystore"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -327,13 +327,13 @@ public class WebAppContextTest
|
||||||
extLibs = extLibs.toAbsolutePath();
|
extLibs = extLibs.toAbsolutePath();
|
||||||
|
|
||||||
// Absolute reference with trailing slash and glob
|
// 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
|
// Establish a relative extraClassPath reference
|
||||||
String relativeExtLibsDir = MavenTestingUtils.getBasePath().relativize(extLibs).toString();
|
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)
|
// 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();
|
return references.stream();
|
||||||
}
|
}
|
||||||
|
@ -341,9 +341,9 @@ public class WebAppContextTest
|
||||||
/**
|
/**
|
||||||
* Test using WebAppContext.setExtraClassPath(String) with a reference to a glob
|
* Test using WebAppContext.setExtraClassPath(String) with a reference to a glob
|
||||||
*/
|
*/
|
||||||
@ParameterizedTest
|
@ParameterizedTest(name = "{0}")
|
||||||
@MethodSource("extraClasspathGlob")
|
@MethodSource("extraClasspathGlob")
|
||||||
public void testExtraClasspathGlob(String extraClasspathGlobReference) throws Exception
|
public void testExtraClasspathGlob(String description, String extraClasspathGlobReference) throws Exception
|
||||||
{
|
{
|
||||||
Server server = newServer();
|
Server server = newServer();
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ public class WebAppContextTest
|
||||||
{
|
{
|
||||||
actualPaths.add(Paths.get(url.toURI()));
|
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)
|
for (Path expectedPath : expectedPaths)
|
||||||
{
|
{
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
@ -385,7 +385,7 @@ public class WebAppContextTest
|
||||||
found = true;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue