Skip to content

Commit

Permalink
Merge pull request #8893 from eclipse/jetty-12.0.x-ee9-StatisticsServ…
Browse files Browse the repository at this point in the history
…letTest

Re-enable and fix StatisticsServletTest for ee9
  • Loading branch information
lachlan-roberts authored Nov 16, 2022
2 parents 557490e + eff404c commit 4a4ea5b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2381,14 +2381,7 @@ public class CoreContextHandler extends org.eclipse.jetty.server.handler.Context
{
CoreContextHandler()
{
super.setHandler(new Handler.Abstract()
{
@Override
public org.eclipse.jetty.server.Request.Processor handle(org.eclipse.jetty.server.Request request) throws Exception
{
return CoreContextHandler.this;
}
});
super.setHandler(new CoreToNestedHandler());
addBean(ContextHandler.this, true);
}

Expand Down Expand Up @@ -2522,5 +2515,14 @@ public APIContext getAPIContext()
return _apiContext;
}
}

private class CoreToNestedHandler extends Abstract
{
@Override
public org.eclipse.jetty.server.Request.Processor handle(org.eclipse.jetty.server.Request request) throws Exception
{
return CoreContextHandler.this;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.ee9.nested.ContextHandler;
import org.eclipse.jetty.ee9.nested.SessionHandler;
import org.eclipse.jetty.ee9.nested.StatisticsHandler;
import org.eclipse.jetty.http.HttpHeader;
Expand All @@ -41,7 +40,6 @@
import org.eclipse.jetty.util.ajax.JSON;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
Expand All @@ -57,7 +55,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@Disabled // TODO
public class StatisticsServletTest
{
private Server _server;
Expand All @@ -82,12 +79,9 @@ public void destroyServer()

private void addStatisticsHandler()
{
StatisticsHandler statsHandler = new StatisticsHandler();
ContextHandler contextHandler = new ContextHandler();
contextHandler.setHandler(statsHandler);
_server.setHandler(contextHandler);
ServletContextHandler statsContext = new ServletContextHandler(_server, "/");
statsHandler.setHandler(statsContext);
StatisticsHandler statsHandler = new StatisticsHandler();
statsContext.insertHandler(statsHandler);
statsContext.addServlet(new ServletHolder(new TestServlet()), "/test1");
ServletHolder servletHolder = new ServletHolder(new StatisticsServlet());
servletHolder.setInitParameter("restrictToLocalhost", "false");
Expand Down

0 comments on commit 4a4ea5b

Please sign in to comment.