From 17820898746827b22ad64f019ba42536bcd8bc54 Mon Sep 17 00:00:00 2001 From: kkolinko Date: Wed, 19 May 2010 03:44:51 +0000 Subject: [PATCH] re-add all-in-one testcase, in case if it matters for the failure that was observed by Gump git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@946011 13f79535-47bb-0310-9956-ffa450edef68 --- .../catalina/connector/TestCoyoteAdaptor.java | 32 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/test/org/apache/catalina/connector/TestCoyoteAdaptor.java b/test/org/apache/catalina/connector/TestCoyoteAdaptor.java index 0e2b24fcd..a044cc567 100644 --- a/test/org/apache/catalina/connector/TestCoyoteAdaptor.java +++ b/test/org/apache/catalina/connector/TestCoyoteAdaptor.java @@ -61,10 +61,9 @@ public class TestCoyoteAdaptor extends TomcatBaseTest { public void testPathParmsFooSessionBar() throws Exception { pathParamTest("/foo;jsessionid=1234/bar", "1234"); - } - public void pathParamTest(String path, String expected) throws Exception { + public void testPathParams() throws Exception { // Setup Tomcat instance Tomcat tomcat = getTomcatInstance(); @@ -74,9 +73,36 @@ public class TestCoyoteAdaptor extends TomcatBaseTest { Tomcat.addServlet(ctx, "servlet", new PathParamServlet()); ctx.addServletMapping("/", "servlet"); - + tomcat.start(); + testPath("/", "none"); + testPath("/;jsessionid=1234", "1234"); + testPath("/foo;jsessionid=1234", "1234"); + testPath("/foo;jsessionid=1234;dummy", "1234"); + testPath("/foo;jsessionid=1234;dummy=5678", "1234"); + testPath("/foo;jsessionid=1234;=5678", "1234"); + testPath("/foo;jsessionid=1234/bar", "1234"); + } + + private void pathParamTest(String path, String expected) throws Exception { + // Setup Tomcat instance + Tomcat tomcat = getTomcatInstance(); + + // Must have a real docBase - just use temp + Context ctx = + tomcat.addContext("/", System.getProperty("java.io.tmpdir")); + + Tomcat.addServlet(ctx, "servlet", new PathParamServlet()); + ctx.addServletMapping("/", "servlet"); + + tomcat.start(); + + ByteChunk res = getUrl("http://localhost:" + getPort() + path); + assertEquals(expected, res.toString()); + } + + private void testPath(String path, String expected) throws Exception { ByteChunk res = getUrl("http://localhost:" + getPort() + path); assertEquals(expected, res.toString()); } -- 2.11.0