Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2015-07-23 23:11:16 +0000
committerJoakim Erdfelt2015-07-23 23:11:16 +0000
commit06cb0ca8975fd38019fa0f596f0ed9d493416fc7 (patch)
treefdeaa3fa2dbd8dc3c4402e1fdd9f0017bdf61e5c /apache-jstl/src/test/java
parent0476d4d28d6350616bb41525d0b6cbe1067d57aa (diff)
downloadorg.eclipse.jetty.project-06cb0ca8975fd38019fa0f596f0ed9d493416fc7.tar.gz
org.eclipse.jetty.project-06cb0ca8975fd38019fa0f596f0ed9d493416fc7.tar.xz
org.eclipse.jetty.project-06cb0ca8975fd38019fa0f596f0ed9d493416fc7.zip
Adding <c:catch> JSTL test cases
Diffstat (limited to 'apache-jstl/src/test/java')
-rw-r--r--apache-jstl/src/test/java/org/eclipse/jetty/jstl/JspConfig.java12
-rw-r--r--apache-jstl/src/test/java/org/eclipse/jetty/jstl/JstlTest.java41
2 files changed, 35 insertions, 18 deletions
diff --git a/apache-jstl/src/test/java/org/eclipse/jetty/jstl/JspConfig.java b/apache-jstl/src/test/java/org/eclipse/jetty/jstl/JspConfig.java
index 3ca87d679c..df145af94a 100644
--- a/apache-jstl/src/test/java/org/eclipse/jetty/jstl/JspConfig.java
+++ b/apache-jstl/src/test/java/org/eclipse/jetty/jstl/JspConfig.java
@@ -20,19 +20,7 @@ package org.eclipse.jetty.jstl;
import java.io.File;
import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.tomcat.InstanceManager;
-import org.apache.tomcat.SimpleInstanceManager;
-import org.eclipse.jetty.annotations.ServletContainerInitializersStarter;
-import org.eclipse.jetty.apache.jsp.JettyJasperInitializer;
-import org.eclipse.jetty.jsp.JettyJspServlet;
-import org.eclipse.jetty.plus.annotation.ContainerInitializer;
-import org.eclipse.jetty.servlet.DefaultServlet;
-import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.webapp.WebAppContext;
/**
diff --git a/apache-jstl/src/test/java/org/eclipse/jetty/jstl/JstlTest.java b/apache-jstl/src/test/java/org/eclipse/jetty/jstl/JstlTest.java
index 858701f67e..6221c1d694 100644
--- a/apache-jstl/src/test/java/org/eclipse/jetty/jstl/JstlTest.java
+++ b/apache-jstl/src/test/java/org/eclipse/jetty/jstl/JstlTest.java
@@ -25,19 +25,21 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
+import javax.servlet.jsp.JspException;
+
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.toolchain.test.FS;
+import org.eclipse.jetty.toolchain.test.JAR;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.SimpleRequest;
-import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.Configuration;
+import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-@Ignore
public class JstlTest
{
private static Server server;
@@ -54,6 +56,14 @@ public class JstlTest
// Setup WebAppContext
File testWebAppDir = MavenTestingUtils.getProjectDir("src/test/webapp");
+
+ // Prepare WebApp libs
+ File libDir = new File(testWebAppDir, "WEB-INF/lib");
+ FS.ensureDirExists(libDir);
+ File testTagLibDir = MavenTestingUtils.getProjectDir("src/test/taglibjar");
+ JAR.create(testTagLibDir,new File(libDir, "testtaglib.jar"));
+
+ // Configure WebAppContext
Configuration.ClassList classlist = Configuration.ClassList
.setServerDefault(server);
@@ -61,7 +71,6 @@ public class JstlTest
classlist.addBefore(
"org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
"org.eclipse.jetty.annotations.AnnotationConfiguration");
-
WebAppContext context = new WebAppContext();
context.setContextPath("/");
@@ -99,8 +108,28 @@ public class JstlTest
assertThat("Response should be JSP processed", resp, not(containsString("<c:url")));
assertThat("Response", resp, containsString("[c:url value] = /ref.jsp;jsessionid="));
assertThat("Response", resp, containsString("[c:url param] = ref.jsp;key=value;jsessionid="));
-
- System.err.println("Response:");
- System.err.println(resp);
+ }
+
+ @Test
+ public void testCatchBasic() throws IOException
+ {
+ SimpleRequest req = new SimpleRequest(baseUri);
+ String resp = req.getString("/catch-basic.jsp");
+ assertThat("Response should be JSP processed", resp, not(containsString("<c:catch")));
+ assertThat("Response", resp, containsString("[c:catch] exception : " + JspException.class.getName()));
+ assertThat("Response", resp, containsString("[c:catch] exception.message : In &lt;parseNumber&gt;"));
+ }
+
+ @Test
+ @Ignore
+ public void testCatchTaglib() throws IOException
+ {
+ SimpleRequest req = new SimpleRequest(baseUri);
+ String resp = req.getString("/catch-taglib.jsp");
+ System.out.println("resp = " + resp);
+ assertThat("Response should be JSP processed", resp, not(containsString("<c:catch")));
+ assertThat("Response should be JSP processed", resp, not(containsString("<jtest:errortest")));
+ assertThat("Response", resp, containsString("[jtest:errorhandler] exception : "));
+ assertThat("Response", resp, containsString("[jtest:errorhandler] exception.message : "));
}
}

Back to the top