This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new e8611a122c Fix tests when running with custom tomcat.output e8611a122c is described below commit e8611a122c5ff3693d9a6b9e94f436c8590cd19f Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Mar 15 12:05:05 2023 +0000 Fix tests when running with custom tomcat.output --- .../catalina/valves/rewrite/TestRewriteValve.java | 36 +++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/test/org/apache/catalina/valves/rewrite/TestRewriteValve.java b/test/org/apache/catalina/valves/rewrite/TestRewriteValve.java index 3cdaf134af..6a85de082d 100644 --- a/test/org/apache/catalina/valves/rewrite/TestRewriteValve.java +++ b/test/org/apache/catalina/valves/rewrite/TestRewriteValve.java @@ -16,6 +16,7 @@ */ package org.apache.catalina.valves.rewrite; +import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.net.HttpURLConnection; @@ -147,88 +148,95 @@ public class TestRewriteValve extends TomcatBaseTest { "RewriteRule ^(.*) ${lc:$1}", "/c/a%2520aa", "/c/a%20aa"); } + + private static String getTestConfDirectory() { + File f = new File("test/conf"); + return f.getAbsolutePath() + File.separator; + } + + @Test public void testRewriteMap12() throws Exception { - doTestRewrite("RewriteMap mapb txt:../../../test/conf/TesterRewriteMapB.txt\n" + + doTestRewrite("RewriteMap mapb txt:" + getTestConfDirectory() + "TesterRewriteMapB.txt\n" + "RewriteRule /b/(.*).html$ /c/${mapb:$1}", "/b/a.html", "/c/aa"); } @Test public void testRewriteMap13() throws Exception { - doTestRewrite("RewriteMap mapb txt:../../../test/conf/TesterRewriteMapB.txt\n" + + doTestRewrite("RewriteMap mapb txt:" + getTestConfDirectory() + "TesterRewriteMapB.txt\n" + "RewriteRule /b/(.*).html$ /c/${mapb:$1|dd}", "/b/x.html", "/c/dd"); } // BZ 62667 @Test public void testRewriteMap14() throws Exception { - doTestRewrite("RewriteMap mapb txt:../../../test/conf/TesterRewriteMapB.txt\n" + + doTestRewrite("RewriteMap mapb txt:" + getTestConfDirectory() + "TesterRewriteMapB.txt\n" + "RewriteRule /b/(.*).html$ /c/${mapb:$1|d$1d}", "/b/x.html", "/c/dxd"); } @Test public void testRewriteMap15() throws Exception { - doTestRewrite("RewriteMap mapb txt:../../../test/conf/TesterRewriteMapB.txt\n" + + doTestRewrite("RewriteMap mapb txt:" + getTestConfDirectory() + "TesterRewriteMapB.txt\n" + "RewriteRule /b/(.*).html$ /c/${mapb:a$1|dd}", "/b/a.html", "/c/aaaa"); } @Test public void testRewriteMap16() throws Exception { - doTestRewrite("RewriteMap mapb txt:../../../test/conf/TesterRewriteMapB.txt\n" + + doTestRewrite("RewriteMap mapb txt:" + getTestConfDirectory() + "TesterRewriteMapB.txt\n" + "RewriteRule /b/.* /c/${mapb:a}", "/b/a.html", "/c/aa"); } @Test public void testRewriteMap17() throws Exception { - doTestRewrite("RewriteMap mapb txt:../../../test/conf/TesterRewriteMapB.txt\n" + + doTestRewrite("RewriteMap mapb txt:" + getTestConfDirectory() + "TesterRewriteMapB.txt\n" + "RewriteRule /b/.* /c/${mapb:${mapb:a}}", "/b/a.html", "/c/aaaa"); } @Test public void testRewriteMap18() throws Exception { - doTestRewrite("RewriteMap mapb txt:../../../test/conf/TesterRewriteMapB.txt\n" + + doTestRewrite("RewriteMap mapb txt:" + getTestConfDirectory() + "TesterRewriteMapB.txt\n" + "RewriteRule /b/.* /c/${mapb:${mapb:a}}", "/b/a.html", "/c/aaaa"); } @Test(expected = IllegalArgumentException.class) public void testRewriteMap19() throws Exception { - doTestRewrite("RewriteMap mapb txt:../../../test/conf/TesterRewriteMapB.txt first\n" + + doTestRewrite("RewriteMap mapb txt:" + getTestConfDirectory() + "TesterRewriteMapB.txt first\n" + "RewriteRule /b/(.*).html$ /c/${mapb:$1}", "/b/aa.html", "/c/aaaa"); } @Test(expected = IllegalArgumentException.class) public void testRewriteMap20() throws Exception { - doTestRewrite("RewriteMap mapb txt:../../../test/conf/TesterRewriteMapB.txt first second\n" + + doTestRewrite("RewriteMap mapb txt:" + getTestConfDirectory() + "TesterRewriteMapB.txt first second\n" + "RewriteRule /b/(.*).html$ /c/${mapb:$1}", "/b/aa.html", "/c/aaaa"); } @Test public void testRewriteMap21() throws Exception { - doTestRewrite("RewriteMap mapb rnd:../../../test/conf/TesterRewriteMapC.txt\n" + + doTestRewrite("RewriteMap mapb rnd:" + getTestConfDirectory() + "TesterRewriteMapC.txt\n" + "RewriteRule /b/(.*).html$ /c/${mapb:$1}", "/b/a.html", "/c/aa"); } //This test should succeed 50% of the runs as it depends on a random choice public void testRewriteMap22() throws Exception { - doTestRewrite("RewriteMap mapb rnd:../../../test/conf/TesterRewriteMapC.txt\n" + + doTestRewrite("RewriteMap mapb rnd:" + getTestConfDirectory() + "TesterRewriteMapC.txt\n" + "RewriteRule /b/(.*).html$ /c/${mapb:$1}", "/b/b.html", "/c/bb"); } @Test public void testRewriteMap23() throws Exception { - doTestRewrite("RewriteMap mapb rnd:../../../test/conf/TesterRewriteMapC.txt\n" + + doTestRewrite("RewriteMap mapb rnd:" + getTestConfDirectory() + "TesterRewriteMapC.txt\n" + "RewriteRule /b/(.*).html$ /c/${mapb:$1}", "/b/aa.html", "/c/aaaa"); } @Test(expected = IllegalArgumentException.class) public void testRewriteMap24() throws Exception { - doTestRewrite("RewriteMap mapb rnd:../../../test/conf/TesterRewriteMapC.txt first\n" + + doTestRewrite("RewriteMap mapb rnd:" + getTestConfDirectory() + "TesterRewriteMapC.txt first\n" + "RewriteRule /b/(.*).html$ /c/${mapb:$1}", "/b/aa.html", "/c/aaaa"); } @Test(expected = IllegalArgumentException.class) public void testRewriteMap25() throws Exception { - doTestRewrite("RewriteMap mapb rnd:../../../test/conf/TesterRewriteMapC.txt first second\n" + + doTestRewrite("RewriteMap mapb rnd:" + getTestConfDirectory() + "TesterRewriteMapC.txt first second\n" + "RewriteRule /b/(.*).html$ /c/${mapb:$1}", "/b/aa.html", "/c/aaaa"); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org