From a4c547d61fbe2cc60eac38f0c9624774c77f1081 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 7 Jan 2013 19:18:53 +1100 Subject: [PATCH] Make JspMatchingTest work with jsp 2.1 using maven command line build --- tests/test-integration/pom.xml | 12 ++---------- .../eclipse/jetty/test/jsp/JspMatchingTest.java | 14 ++++++++++---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/test-integration/pom.xml b/tests/test-integration/pom.xml index 8f968c068ec..b19c6668059 100644 --- a/tests/test-integration/pom.xml +++ b/tests/test-integration/pom.xml @@ -82,6 +82,8 @@ maven-surefire-plugin always + true + false @@ -112,16 +114,6 @@ jetty-monitor ${project.version} - - javax.servlet.jsp - jsp-api - 2.1 - - - javax.servlet - jstl - 1.2 - org.eclipse.jetty.toolchain jetty-test-helper diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/JspMatchingTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/JspMatchingTest.java index e465d0ff68f..0e8dbb99aa2 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/JspMatchingTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/jsp/JspMatchingTest.java @@ -25,6 +25,8 @@ import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URI; +import java.net.URL; +import java.net.URLClassLoader; import org.apache.jasper.servlet.JspServlet; import org.eclipse.jetty.security.HashLoginService; @@ -35,6 +37,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.IO; +import org.eclipse.jetty.util.Loader; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; @@ -66,7 +69,9 @@ public class JspMatchingTest context.setContextPath("/"); File webappBase = MavenTestingUtils.getTestResourceDir("docroots/jsp"); context.setResourceBase(webappBase.getAbsolutePath()); - context.setClassLoader(Thread.currentThread().getContextClassLoader()); + URLClassLoader contextLoader = new URLClassLoader(new URL[]{}, Server.class.getClassLoader()); + context.setClassLoader(contextLoader); + // add default servlet ServletHolder defaultServHolder = context.addServlet(DefaultServlet.class,"/"); @@ -74,7 +79,8 @@ public class JspMatchingTest // add jsp ServletHolder jsp = context.addServlet(JspServlet.class,"*.jsp"); - jsp.setInitParameter("classpath",context.getClassPath()); + context.setAttribute("org.apache.catalina.jsp_classpath", context.getClassPath()); + jsp.setInitParameter("com.sun.appserv.jsp.classpath", Loader.getClassPath(Server.class.getClassLoader())); // add context server.setHandler(context); @@ -101,8 +107,8 @@ public class JspMatchingTest try { conn = (HttpURLConnection)uri.toURL().openConnection(); - conn.setConnectTimeout(1000); - conn.setReadTimeout(1000); + conn.setConnectTimeout(5000); + conn.setReadTimeout(5000); Assert.assertThat(conn.getResponseCode(),is(200)); // make sure that jsp actually ran, and didn't just get passed onto