Author: markt Date: Mon Nov 3 12:39:01 2014 New Revision: 1636337 URL: http://svn.apache.org/r1636337 Log: Reduce boilerplate code.
Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestCompiler.java tomcat/trunk/test/org/apache/jasper/compiler/TestGenerator.java tomcat/trunk/test/org/apache/jasper/compiler/TestJspDocumentParser.java tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java tomcat/trunk/test/org/apache/jasper/compiler/TestNodeIntegration.java tomcat/trunk/test/org/apache/jasper/compiler/TestParser.java tomcat/trunk/test/org/apache/jasper/compiler/TestParserNoStrictWhitespace.java tomcat/trunk/test/org/apache/jasper/compiler/TestScriptingVariabler.java tomcat/trunk/test/org/apache/jasper/compiler/TestTagLibraryInfoImpl.java tomcat/trunk/test/org/apache/jasper/compiler/TestTagPluginManager.java tomcat/trunk/test/org/apache/jasper/compiler/TestValidator.java Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestCompiler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestCompiler.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestCompiler.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestCompiler.java Mon Nov 3 12:39:01 2014 @@ -36,11 +36,7 @@ public class TestCompiler extends Tomcat @Test public void testBug49726a() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); Map<String,List<String>> headers = new HashMap<>(); @@ -58,11 +54,7 @@ public class TestCompiler extends Tomcat @Test public void testBug49726b() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); Map<String,List<String>> headers = new HashMap<>(); @@ -80,11 +72,7 @@ public class TestCompiler extends Tomcat @Test public void testBug53257a() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); // foo;bar.jsp ByteChunk res = getUrl("http://localhost:" + getPort() + @@ -97,11 +85,7 @@ public class TestCompiler extends Tomcat @Test public void testBug53257b() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug53257/foo&bar.jsp"); @@ -113,11 +97,7 @@ public class TestCompiler extends Tomcat @Test public void testBug53257c() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); // foo#bar.jsp ByteChunk res = getUrl("http://localhost:" + getPort() + @@ -130,11 +110,7 @@ public class TestCompiler extends Tomcat @Test public void testBug53257d() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); // foo%bar.jsp ByteChunk res = getUrl("http://localhost:" + getPort() + @@ -147,11 +123,7 @@ public class TestCompiler extends Tomcat @Test public void testBug53257e() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug53257/foo+bar.jsp"); @@ -163,11 +135,7 @@ public class TestCompiler extends Tomcat @Test public void testBug53257f() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug53257/foo%20bar.jsp"); @@ -179,11 +147,7 @@ public class TestCompiler extends Tomcat @Test public void testBug53257g() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug53257/foo%20bar/foobar.jsp"); @@ -195,11 +159,7 @@ public class TestCompiler extends Tomcat @Test public void testBug53257z() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); // Check that URL decoding is not done twice ByteChunk res = new ByteChunk(); @@ -223,11 +183,7 @@ public class TestCompiler extends Tomcat @Test public void testBug55262() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug55262.jsp"); Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestGenerator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestGenerator.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestGenerator.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestGenerator.java Mon Nov 3 12:39:01 2014 @@ -17,7 +17,6 @@ package org.apache.jasper.compiler; -import java.io.File; import java.io.IOException; import java.util.Date; import java.util.HashMap; @@ -38,25 +37,14 @@ import org.junit.Assert; import org.junit.Test; import org.apache.catalina.LifecycleException; -import org.apache.catalina.WebResourceRoot; -import org.apache.catalina.core.StandardContext; -import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; -import org.apache.catalina.webresources.StandardRoot; import org.apache.tomcat.util.buf.ByteChunk; public class TestGenerator extends TomcatBaseTest { @Test public void testBug45015a() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45015a.jsp"); @@ -78,14 +66,7 @@ public class TestGenerator extends Tomca @Test public void testBug45015b() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); int rc = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45015b.jsp", new ByteChunk(), null); @@ -95,14 +76,7 @@ public class TestGenerator extends Tomca @Test public void testBug45015c() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); int rc = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45015c.jsp", new ByteChunk(), null); @@ -112,22 +86,7 @@ public class TestGenerator extends Tomca @Test public void testBug48701Fail() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - StandardContext ctxt = (StandardContext) tomcat.addWebapp(null, - "/test", appDir.getAbsolutePath()); - - // This test needs the JSTL libraries - File lib = new File("webapps/examples/WEB-INF/lib"); - ctxt.setResources(new StandardRoot(ctxt)); - ctxt.getResources().createWebResourceSet( - WebResourceRoot.ResourceSetType.POST, "/WEB-INF/lib", - lib.getAbsolutePath(), null, "/"); - - tomcat.start(); + getTomcatInstanceTestWebapp(true, true); int rc = getUrl("http://localhost:" + getPort() + "/test/bug48nnn/bug48701-fail.jsp", new ByteChunk(), null); @@ -156,14 +115,7 @@ public class TestGenerator extends Tomca } private void testBug48701(String jsp) throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/" + jsp); @@ -231,11 +183,7 @@ public class TestGenerator extends Tomca "<p style=\"color:red\">04-Red</p>", "<p>05-Not Red</p>"}; - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); Map<String,List<String>> headers = new HashMap<>(); @@ -262,13 +210,7 @@ public class TestGenerator extends Tomca @Test public void testBug56529() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk bc = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + @@ -321,14 +263,7 @@ public class TestGenerator extends Tomca @Test public void testBug56581() throws LifecycleException { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); try { Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestJspDocumentParser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestJspDocumentParser.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestJspDocumentParser.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestJspDocumentParser.java Mon Nov 3 12:39:01 2014 @@ -17,7 +17,6 @@ package org.apache.jasper.compiler; -import java.io.File; import java.io.IOException; import javax.servlet.http.HttpServletResponse; @@ -27,7 +26,6 @@ import javax.xml.parsers.DocumentBuilder import org.junit.Assert; import org.junit.Test; -import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; import org.w3c.dom.Document; @@ -39,14 +37,7 @@ public class TestJspDocumentParser exten @Test public void testBug47977() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); int rc = getUrl("http://localhost:" + getPort() + "/test/bug47977.jspx", new ByteChunk(), null); @@ -56,14 +47,7 @@ public class TestJspDocumentParser exten @Test public void testBug48827() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); Exception e = null; try { @@ -78,13 +62,7 @@ public class TestJspDocumentParser exten @Test public void testBug54801() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk bc = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + @@ -99,13 +77,7 @@ public class TestJspDocumentParser exten @Test public void testBug54821() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk bc = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + @@ -120,13 +92,7 @@ public class TestJspDocumentParser exten @Test public void testSchemaValidation() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); String path = "http://localhost:" + getPort() + "/test/valid.jspx"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestJspReader.java Mon Nov 3 12:39:01 2014 @@ -16,12 +16,9 @@ */ package org.apache.jasper.compiler; -import java.io.File; - import org.junit.Assert; import org.junit.Test; -import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; @@ -29,16 +26,10 @@ public class TestJspReader extends Tomca @Test public void testBug53986() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - tomcat.addWebapp(null, "", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + - "/bug5nnnn/bug53986.jsp"); + "/test/bug5nnnn/bug53986.jsp"); Assert.assertTrue(res.toString().contains("OK")); } } Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestNodeIntegration.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestNodeIntegration.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestNodeIntegration.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestNodeIntegration.java Mon Nov 3 12:39:01 2014 @@ -16,12 +16,9 @@ */ package org.apache.jasper.compiler; -import java.io.File; - import org.junit.Assert; import org.junit.Test; -import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; @@ -29,21 +26,14 @@ public class TestNodeIntegration extends @Test public void testJspAttributeIsLiteral() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + - "/bug5nnnn/bug55642a.jsp"); + "/test/bug5nnnn/bug55642a.jsp"); String result = res.toString(); Assert.assertTrue( - result.indexOf("/bug5nnnn/bug55642b.jsp?foo=bar&a=1&b=2") > 0); + result.indexOf("/test/bug5nnnn/bug55642b.jsp?foo=bar&a=1&b=2") > 0); } } Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestParser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestParser.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestParser.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestParser.java Mon Nov 3 12:39:01 2014 @@ -16,7 +16,6 @@ */ package org.apache.jasper.compiler; -import java.io.File; import java.util.HashMap; import java.util.List; @@ -26,11 +25,7 @@ import static org.junit.Assert.assertTru import org.junit.Assert; import org.junit.Test; -import org.apache.catalina.WebResourceRoot; -import org.apache.catalina.core.StandardContext; -import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; -import org.apache.catalina.webresources.StandardRoot; import org.apache.tomcat.util.buf.ByteChunk; /** @@ -41,14 +36,7 @@ public class TestParser extends TomcatBa @Test public void testBug48627() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug48nnn/bug48627.jsp"); @@ -62,14 +50,7 @@ public class TestParser extends TomcatBa @Test public void testBug48668a() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug48nnn/bug48668a.jsp"); @@ -108,13 +89,7 @@ public class TestParser extends TomcatBa @Test public void testBug48668b() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug48nnn/bug48668b.jsp"); @@ -125,13 +100,7 @@ public class TestParser extends TomcatBa @Test public void testBug49297NoSpaceStrict() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); int sc = getUrl("http://localhost:" + getPort() + "/test/bug49nnn/bug49297NoSpace.jsp", new ByteChunk(), @@ -142,13 +111,7 @@ public class TestParser extends TomcatBa @Test public void testBug49297DuplicateAttr() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); int sc = getUrl("http://localhost:" + getPort() + "/test/bug49nnn/bug49297DuplicateAttr.jsp", new ByteChunk(), @@ -159,14 +122,7 @@ public class TestParser extends TomcatBa @Test public void testBug49297MultipleImport1() throws Exception { - - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); int sc = getUrl("http://localhost:" + getPort() + @@ -179,14 +135,7 @@ public class TestParser extends TomcatBa @Test public void testBug49297MultipleImport2() throws Exception { - - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); int sc = getUrl("http://localhost:" + getPort() + @@ -199,14 +148,7 @@ public class TestParser extends TomcatBa @Test public void testBug49297MultiplePageEncoding1() throws Exception { - - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); int sc = getUrl("http://localhost:" + getPort() + @@ -218,14 +160,7 @@ public class TestParser extends TomcatBa @Test public void testBug49297MultiplePageEncoding2() throws Exception { - - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); int sc = getUrl("http://localhost:" + getPort() + @@ -237,14 +172,7 @@ public class TestParser extends TomcatBa @Test public void testBug49297MultiplePageEncoding3() throws Exception { - - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); int sc = getUrl("http://localhost:" + getPort() + @@ -256,14 +184,7 @@ public class TestParser extends TomcatBa @Test public void testBug49297MultiplePageEncoding4() throws Exception { - - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); int sc = getUrl("http://localhost:" + getPort() + @@ -275,14 +196,7 @@ public class TestParser extends TomcatBa @Test public void testBug49297Tag() throws Exception { - - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); int sc = getUrl("http://localhost:" + getPort() + @@ -295,14 +209,7 @@ public class TestParser extends TomcatBa @Test public void testBug52335() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug52335.jsp"); @@ -317,13 +224,7 @@ public class TestParser extends TomcatBa @Test public void testBug55198() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug55198.jsp"); @@ -349,21 +250,7 @@ public class TestParser extends TomcatBa @Test public void testBug56265() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - StandardContext ctxt = (StandardContext) tomcat.addWebapp(null, - "/test", appDir.getAbsolutePath()); - - // This test needs the JSTL libraries - File lib = new File("webapps/examples/WEB-INF/lib"); - ctxt.setResources(new StandardRoot(ctxt)); - ctxt.getResources().createWebResourceSet( - WebResourceRoot.ResourceSetType.POST, "/WEB-INF/lib", - lib.getAbsolutePath(), null, "/"); - - tomcat.start(); + getTomcatInstanceTestWebapp(true, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug56265.jsp"); @@ -382,21 +269,7 @@ public class TestParser extends TomcatBa @Test public void testBug56334And56561() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - StandardContext ctxt = (StandardContext) tomcat.addWebapp(null, - "/test", appDir.getAbsolutePath()); - - // This test needs the JSTL libraries - File lib = new File("webapps/examples/WEB-INF/lib"); - ctxt.setResources(new StandardRoot(ctxt)); - ctxt.getResources().createWebResourceSet( - WebResourceRoot.ResourceSetType.POST, "/WEB-INF/lib", - lib.getAbsolutePath(), null, "/"); - - tomcat.start(); + getTomcatInstanceTestWebapp(true, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug56334and56561.jspx"); Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestParserNoStrictWhitespace.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestParserNoStrictWhitespace.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestParserNoStrictWhitespace.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestParserNoStrictWhitespace.java Mon Nov 3 12:39:01 2014 @@ -17,7 +17,6 @@ package org.apache.jasper.compiler; -import java.io.File; import java.util.HashMap; import java.util.List; @@ -26,7 +25,6 @@ import static org.junit.Assert.assertTru import org.junit.Test; -import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; @@ -46,14 +44,7 @@ public class TestParserNoStrictWhitespac @Test public void testBug48627() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug48nnn/bug48627.jsp"); @@ -67,14 +58,7 @@ public class TestParserNoStrictWhitespac @Test public void testBug48668a() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug48nnn/bug48668a.jsp"); @@ -113,13 +97,7 @@ public class TestParserNoStrictWhitespac @Test public void testBug48668b() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug48nnn/bug48668b.jsp"); @@ -130,14 +108,7 @@ public class TestParserNoStrictWhitespac @Test public void testBug49297NoSpaceNotStrict() throws Exception { - - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); int sc = getUrl("http://localhost:" + getPort() + @@ -151,13 +122,7 @@ public class TestParserNoStrictWhitespac @Test public void testBug49297DuplicateAttr() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); int sc = getUrl("http://localhost:" + getPort() + "/test/bug49nnn/bug49297DuplicateAttr.jsp", new ByteChunk(), Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestScriptingVariabler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestScriptingVariabler.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestScriptingVariabler.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestScriptingVariabler.java Mon Nov 3 12:39:01 2014 @@ -17,7 +17,6 @@ package org.apache.jasper.compiler; -import java.io.File; import java.io.IOException; import javax.servlet.jsp.tagext.TagData; @@ -29,21 +28,13 @@ import static org.junit.Assert.assertNul import org.junit.Test; -import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; public class TestScriptingVariabler extends TomcatBaseTest { @Test public void testBug42390() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); Exception e = null; try { @@ -79,14 +70,7 @@ public class TestScriptingVariabler exte @Test public void testBug48616() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); Exception e = null; try { @@ -101,14 +85,7 @@ public class TestScriptingVariabler exte @Test public void testBug48616b() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); Exception e = null; try { Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestTagLibraryInfoImpl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestTagLibraryInfoImpl.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestTagLibraryInfoImpl.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestTagLibraryInfoImpl.java Mon Nov 3 12:39:01 2014 @@ -16,14 +16,11 @@ */ package org.apache.jasper.compiler; -import java.io.File; - import javax.servlet.http.HttpServletResponse; import org.junit.Assert; import org.junit.Test; -import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tomcat.util.buf.ByteChunk; @@ -34,12 +31,7 @@ public class TestTagLibraryInfoImpl exte @Test public void testRelativeTldLocation() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = new File("test/webapp"); - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); ByteChunk res = new ByteChunk(); Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestTagPluginManager.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestTagPluginManager.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestTagPluginManager.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestTagPluginManager.java Mon Nov 3 12:39:01 2014 @@ -16,8 +16,6 @@ */ package org.apache.jasper.compiler; -import java.io.File; - import javax.servlet.ServletContext; import javax.servlet.jsp.tagext.TagFileInfo; import javax.servlet.jsp.tagext.TagInfo; @@ -39,13 +37,11 @@ public class TestTagPluginManager extend @Test public void testBug54240() throws Exception { - Tomcat tomcat = getTomcatInstance(); + Tomcat tomcat = getTomcatInstanceTestWebapp(false, true); + - File appDir = new File("test/webapp"); - Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - tomcat.start(); - ServletContext context = ctx.getServletContext(); + ServletContext context = ((Context) tomcat.getHost().findChildren()[0]).getServletContext(); TagPluginManager manager = new TagPluginManager(context); Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestValidator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestValidator.java?rev=1636337&r1=1636336&r2=1636337&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestValidator.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestValidator.java Mon Nov 3 12:39:01 2014 @@ -37,14 +37,7 @@ public class TestValidator extends Tomca @Test public void testBug47331() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - File appDir = - new File("test/webapp"); - // app dir is relative to server home - tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); - - tomcat.start(); + getTomcatInstanceTestWebapp(false, true); int rc = getUrl("http://localhost:" + getPort() + "/test/bug47331.jsp", new ByteChunk(), null); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org