Skip to content

Commit

Permalink
Fixes #11583 - Broken HTTP/3 tests (#11584)
Browse files Browse the repository at this point in the history
Initialized PEM directories for both client and server.
Added [lib] section that was missing due to #11263.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet authored Mar 27, 2024
1 parent ee82c2b commit e00a71a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ https://github.com/java-native-access/jna
[files]
maven://net.java.dev.jna/jna-jpms/${jna.version}|lib/http3/jna-jpms-${jna.version}.jar

[lib]
lib/http3/jna-jpms-${jna.version}.jar

[ini]
jna.version?=@jna.version@

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ maven://org.mortbay.jetty.quiche/jetty-quiche-native/${jetty-quiche-native.versi
[ini]
jetty-quiche-native.version?=@jetty-quiche-native.version@

[lib]
lib/http3/jetty-quiche-native-${jetty-quiche-native.version}.jar

[license]
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;

@ExtendWith(WorkDirExtension.class)
Expand All @@ -71,6 +72,7 @@ public class AbstractTest
public WorkDir workDir;

protected final HttpConfiguration httpConfig = new HttpConfiguration();
protected Path pemDir;
protected SslContextFactory.Server sslContextFactoryServer;
protected ServerQuicConfiguration serverQuicConfig;
protected Server server;
Expand Down Expand Up @@ -100,6 +102,12 @@ public static Collection<Transport> transportsWithPushSupport()
return transports;
}

@BeforeEach
public void prepare()
{
pemDir = workDir.getEmptyPathDir();
}

@AfterEach
public void dispose()
{
Expand All @@ -122,7 +130,8 @@ protected void startServer(Transport transport, HttpServlet servlet) throws Exce
protected void prepareServer(Transport transport, HttpServlet servlet) throws Exception
{
sslContextFactoryServer = newSslContextFactoryServer();
serverQuicConfig = new ServerQuicConfiguration(sslContextFactoryServer, workDir.getEmptyPathDir());
Path serverPemDirectory = Files.createDirectories(pemDir.resolve("server"));
serverQuicConfig = new ServerQuicConfiguration(sslContextFactoryServer, serverPemDirectory);
if (server == null)
server = newServer();
connector = newConnector(transport, server);
Expand Down Expand Up @@ -262,7 +271,8 @@ protected HttpClientTransport newHttpClientTransport(Transport transport) throws
clientConnector.setSelectors(1);
SslContextFactory.Client sslContextFactory = newSslContextFactoryClient();
clientConnector.setSslContextFactory(sslContextFactory);
HTTP3Client http3Client = new HTTP3Client(new ClientQuicConfiguration(sslContextFactory, null));
Path clientPemDirectory = Files.createDirectories(pemDir.resolve("client"));
HTTP3Client http3Client = new HTTP3Client(new ClientQuicConfiguration(sslContextFactory, clientPemDirectory));
yield new HttpClientTransportOverHTTP3(http3Client);
}
case FCGI -> new HttpClientTransportOverFCGI(1, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;

@ExtendWith(WorkDirExtension.class)
Expand All @@ -75,6 +76,7 @@ public class AbstractTest
public WorkDir workDir;

protected final HttpConfiguration httpConfig = new HttpConfiguration();
protected Path pemDir;
protected SslContextFactory.Server sslContextFactoryServer;
protected ServerQuicConfiguration serverQuicConfig;
protected Server server;
Expand Down Expand Up @@ -104,6 +106,12 @@ public static Collection<Transport> transportsWithPushSupport()
return transports;
}

@BeforeEach
public void prepare()
{
pemDir = workDir.getEmptyPathDir();
}

@AfterEach
public void dispose()
{
Expand Down Expand Up @@ -131,7 +139,8 @@ protected void prepareServer(Transport transport, HttpServlet servlet) throws Ex
protected void prepareServer(Transport transport, HttpServlet servlet, String path) throws Exception
{
sslContextFactoryServer = newSslContextFactoryServer();
serverQuicConfig = new ServerQuicConfiguration(sslContextFactoryServer, workDir.getEmptyPathDir());
Path serverPemDirectory = Files.createDirectories(pemDir.resolve("server"));
serverQuicConfig = new ServerQuicConfiguration(sslContextFactoryServer, serverPemDirectory);
if (server == null)
server = newServer();
connector = newConnector(transport, server);
Expand Down Expand Up @@ -268,7 +277,8 @@ protected HttpClientTransport newHttpClientTransport(Transport transport) throws
clientConnector.setSelectors(1);
SslContextFactory.Client sslContextFactory = newSslContextFactoryClient();
clientConnector.setSslContextFactory(sslContextFactory);
HTTP3Client http3Client = new HTTP3Client(new ClientQuicConfiguration(sslContextFactory, null));
Path clientPemDirectory = Files.createDirectories(pemDir.resolve("client"));
HTTP3Client http3Client = new HTTP3Client(new ClientQuicConfiguration(sslContextFactory, clientPemDirectory));
yield new HttpClientTransportOverHTTP3(http3Client);
}
case FCGI -> new HttpClientTransportOverFCGI(1, "");
Expand Down

0 comments on commit e00a71a

Please sign in to comment.