From 1ffbf15fc1caa4182b45f152767ee7e5478c5e58 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Mon, 25 Sep 2017 18:36:42 -0400 Subject: [PATCH] @janbartel guided me to an analogue of WebAppClassLoaderTest.ordering. --- .../jetty/webapp/WebAppContextTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppContextTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppContextTest.java index f494adbe8f1..acfa5878e7d 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppContextTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/WebAppContextTest.java @@ -25,9 +25,11 @@ import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; import javax.servlet.GenericServlet; import javax.servlet.ServletContext; @@ -44,7 +46,9 @@ import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.server.handler.HotSwapHandler; import org.eclipse.jetty.servlet.ErrorPageErrorHandler; import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.resource.PathResource; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.ResourceCollection; import org.hamcrest.Matchers; @@ -378,4 +382,18 @@ public class WebAppContextTest server.stop(); } + + @Test + public void ordering() throws Exception + { + Path testWebappDir = MavenTestingUtils.getProjectDirPath("src/test/webapp"); + Resource webapp = new PathResource(testWebappDir); + WebAppContext context = new WebAppContext(); + context.setBaseResource(webapp); + context.setContextPath("/test"); + new WebInfConfiguration().preConfigure(context); + assertEquals(Arrays.asList("acme.jar", "alpha.jar", "omega.jar"), + context.getMetaData().getWebInfJars().stream().map(r -> r.getURI().toString().replaceFirst(".+/", "")).collect(Collectors.toList())); + } + }