Author: costin Date: Tue Mar 25 22:37:15 2008 New Revision: 641161 URL: http://svn.apache.org/viewvc?rev=641161&view=rev Log: Missed one file, check error response
Added: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/SimpleServlet.java (with props) Modified: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteNoConnectorTest.java Added: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/SimpleServlet.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/SimpleServlet.java?rev=641161&view=auto ============================================================================== --- tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/SimpleServlet.java (added) +++ tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/SimpleServlet.java Tue Mar 25 22:37:15 2008 @@ -0,0 +1,22 @@ +/* + */ +package org.apache.tomcat.lite; + +import java.io.IOException; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class SimpleServlet extends HttpServlet { + public void doGet(HttpServletRequest req, HttpServletResponse res) + throws IOException { + res.setHeader("Foo", "Bar"); + res.getWriter().write("Hello world"); + } + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws IOException { + res.setHeader("Foo", "Post"); + res.getWriter().write("Hello post world"); + } +} \ No newline at end of file Propchange: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/SimpleServlet.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteNoConnectorTest.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteNoConnectorTest.java?rev=641161&r1=641160&r2=641161&view=diff ============================================================================== --- tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteNoConnectorTest.java (original) +++ tomcat/sandbox/tomcat-lite/test/org/apache/tomcat/lite/TomcatLiteNoConnectorTest.java Tue Mar 25 22:37:15 2008 @@ -4,6 +4,12 @@ +import java.io.IOException; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import junit.framework.TestCase; import org.apache.tomcat.servlets.addon.ConfigurableServletContext; @@ -11,10 +17,12 @@ public class TomcatLiteNoConnectorTest extends TestCase { - TomcatLite lite = TomcatLite.getServletImpl(); + TomcatLite lite = TomcatLite.getServletImpl(); + ConfigurableServletContext ctx; + void initServer() throws Exception { - ConfigurableServletContext ctx = + ctx = (ConfigurableServletContext) lite.addServletContext(null, null, "/test1"); ctx.addServlet("test", new SimpleServlet()); @@ -63,6 +71,21 @@ // Headers are still in the response assertEquals(res.getHeader("Foo"), "Post"); assertEquals(res.getStatus(), 200); + } + + public void testException() throws IOException, Exception { + ctx.addServlet("testException", new HttpServlet() { + public void doGet(HttpServletRequest req, HttpServletResponse res) + throws IOException { + throw new NullPointerException(); + } + }); + ctx.addMapping("/testException", "testException"); + ByteChunk out = new ByteChunk(); + ServletRequestImpl req = + lite.createMessage("/test1/testException", out); + ServletResponseImpl res = lite.service(req); + assertEquals(res.getStatus(), 500); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]