From b14960d90b5ff3a54be6b349aebdd4ad4c373d00 Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 20 May 2010 09:48:43 +0000 Subject: [PATCH] REpurpose the duplicate pathPath test to test the redirect process git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@946583 13f79535-47bb-0310-9956-ffa450edef68 --- test/org/apache/catalina/connector/TestCoyoteAdapter.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/org/apache/catalina/connector/TestCoyoteAdapter.java b/test/org/apache/catalina/connector/TestCoyoteAdapter.java index 506df23a3..877fe847f 100644 --- a/test/org/apache/catalina/connector/TestCoyoteAdapter.java +++ b/test/org/apache/catalina/connector/TestCoyoteAdapter.java @@ -16,6 +16,7 @@ */ package org.apache.catalina.connector; +import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.logging.Level; @@ -65,13 +66,20 @@ public class TestCoyoteAdapter extends TomcatBaseTest { pathParamTest("/foo;jsessionid=1234/bar", "1234"); } - public void testPathParams() throws Exception { + public void testPathParamsRedirect() 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")); + File docBase = new File(System.getProperty("java.io.tmpdir")); + + // Create the folder that will trigger the redirect + File foo = new File(docBase, "foo"); + if (!foo.exists() && !foo.mkdirs()) { + fail("Unable to create foo directory in docBase"); + } + + Context ctx = tomcat.addContext("/", docBase.getAbsolutePath()); Tomcat.addServlet(ctx, "servlet", new PathParamServlet()); ctx.addServletMapping("/", "servlet"); -- 2.11.0