This is an automated email from the ASF dual-hosted git repository. remm 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 8366de65c6 Use the simple realm for testServlets 8366de65c6 is described below commit 8366de65c69679a005aa99821c1b184834e6367d 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