This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push: new 712f21da4d Use the simple realm for testServlets 712f21da4d is described below commit 712f21da4de3e6ead857d479a6d6a017fc1fb0de Author: remm <r...@apache.org> AuthorDate: Tue Sep 24 15:14:45 2024 +0200 Use the simple realm for testServlets --- .../apache/catalina/manager/TestManagerWebapp.java | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java b/test/org/apache/catalina/manager/TestManagerWebapp.java index 70464f56c2..0efb515f01 100644 --- a/test/org/apache/catalina/manager/TestManagerWebapp.java +++ b/test/org/apache/catalina/manager/TestManagerWebapp.java @@ -60,20 +60,14 @@ public class TestManagerWebapp extends TomcatBaseTest { public void testServlets() throws Exception { Tomcat tomcat = getTomcatInstance(); tomcat.setAddDefaultWebXmlToWebapp(false); - - File configFile = new File(getTemporaryDirectory(), "tomcat-users-manager.xml"); - try (PrintWriter writer = new PrintWriter(configFile)) { - writer.write(CONFIG); - } - addDeleteOnTearDown(configFile); - - MemoryRealm memoryRealm = new MemoryRealm(); - memoryRealm.setCredentialHandler(new MessageDigestCredentialHandler()); - memoryRealm.setPathname(configFile.getAbsolutePath()); - tomcat.getEngine().setRealm(memoryRealm); + tomcat.addUser("admin", "sekr3t"); + tomcat.addRole("admin", "manager-gui"); + tomcat.addRole("admin", "manager-script"); + tomcat.addRole("admin", "manager-jmx"); + tomcat.addRole("admin", "manager-status"); // Add manager webapp - File appDir = new File(System.getProperty("tomcat.test.basedir"), "webapps/manager"); + File appDir = new File(getBuildDirectory(), "webapps/manager"); tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath()); tomcat.start(); @@ -195,6 +189,7 @@ public class TestManagerWebapp extends TomcatBaseTest { Assert.assertEquals(HttpServletResponse.SC_OK, client.getStatusCode()); Assert.assertTrue(client.getResponseBody().contains("/manager:running")); + tomcat.stop(); } @Test @@ -215,7 +210,7 @@ public class TestManagerWebapp extends TomcatBaseTest { tomcat.getEngine().setRealm(memoryRealm); // Add manager webapp - File appDir = new File(System.getProperty("tomcat.test.basedir"), "webapps/manager"); + File appDir = new File(getBuildDirectory(), "webapps/manager"); Context ctx = tomcat.addWebapp(null, "/manager", appDir.getAbsolutePath()); // Add host config otherwise there's no JMX deployer bean @@ -384,6 +379,7 @@ public class TestManagerWebapp extends TomcatBaseTest { client.processRequest(true); Assert.assertEquals(HttpServletResponse.SC_OK, client.getStatusCode()); + tomcat.stop(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org